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);
enableQuery(true);
showFilterLine(false);
showErrors(false);
+
+ // Set initial input focus
+ updateInputFocus();
}
void ChannelListDlg::requestSearch()
{
+ if (!_netId.isValid()) {
+ // No valid network set yet
+ return;
+ }
+
_listFinished = false;
enableQuery(false);
showErrors(false);
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) {