X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fchannellistdlg.cpp;h=d6dde67d1b482c94c28456f91a2a307ae61a8b90;hb=efe1292ee3dffb7fe2f8cee2c4c2767cd53efb34;hp=f8b70284a40b12605c8a68e298fe4d6dfef2f6ba;hpb=8e93326fd70af3c0accc599770796619ef3cee6e;p=quassel.git diff --git a/src/qtui/channellistdlg.cpp b/src/qtui/channellistdlg.cpp index f8b70284..d6dde67d 100644 --- a/src/qtui/channellistdlg.cpp +++ b/src/qtui/channellistdlg.cpp @@ -49,6 +49,8 @@ ChannelListDlg::ChannelListDlg(QWidget *parent) 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); @@ -70,6 +72,9 @@ ChannelListDlg::ChannelListDlg(QWidget *parent) enableQuery(true); showFilterLine(false); showErrors(false); + + // Set initial input focus + updateInputFocus(); } @@ -113,6 +118,8 @@ void ChannelListDlg::receiveChannelList(const NetworkId &netId, const QStringLis showFilterLine(!channelList.isEmpty()); _ircListModel.setChannelList(channelList); enableQuery(_listFinished); + // Reset input focus since UI changed + updateInputFocus(); } @@ -157,6 +164,18 @@ void ChannelListDlg::setAdvancedMode(bool advanced) } +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) {