Set Channel List input focus to reasonable defaults. When advanced
channel search is visible, focus it. Otherwise, focus the channel
list filter box.
Sort channel list by name in ascending order by default. Sort order
can be changed afterwards as before.
ui.channelListView->setTabKeyNavigation(false);
ui.channelListView->setModel(&_sortFilter);
ui.channelListView->setSortingEnabled(true);
ui.channelListView->setTabKeyNavigation(false);
ui.channelListView->setModel(&_sortFilter);
ui.channelListView->setSortingEnabled(true);
+ // Sort A-Z by default
+ ui.channelListView->sortByColumn(0, Qt::AscendingOrder);
ui.channelListView->verticalHeader()->hide();
ui.channelListView->horizontalHeader()->setStretchLastSection(true);
ui.channelListView->verticalHeader()->hide();
ui.channelListView->horizontalHeader()->setStretchLastSection(true);
enableQuery(true);
showFilterLine(false);
showErrors(false);
enableQuery(true);
showFilterLine(false);
showErrors(false);
+
+ // Set initial input focus
+ updateInputFocus();
showFilterLine(!channelList.isEmpty());
_ircListModel.setChannelList(channelList);
enableQuery(_listFinished);
showFilterLine(!channelList.isEmpty());
_ircListModel.setChannelList(channelList);
enableQuery(_listFinished);
+ // Reset input focus since UI changed
+ updateInputFocus();
+void ChannelListDlg::updateInputFocus()
+{
+ // Update keyboard focus to match what options are available. Prioritize the channel name
+ // editor as one likely won't need to filter when already limiting the list.
+ if (ui.channelNameLineEdit->isVisible()) {
+ ui.channelNameLineEdit->setFocus();
+ } else if (ui.filterLineEdit->isVisible()) {
+ ui.filterLineEdit->setFocus();
+ }
+}
+
+
void ChannelListDlg::showErrors(bool show)
{
if (!show) {
void ChannelListDlg::showErrors(bool show)
{
if (!show) {
void enableQuery(bool enable);
void setAdvancedMode(bool advanced);
void enableQuery(bool enable);
void setAdvancedMode(bool advanced);
+ /**
+ * Update the focus of input widgets according to dialog state
+ */
+ void updateInputFocus();
+
Ui::ChannelListDlg ui;
bool _listFinished;
Ui::ChannelListDlg ui;
bool _listFinished;