From 70955828d6ffab8c39435fe48a923d0c7dbbb678 Mon Sep 17 00:00:00 2001 From: Shane Synan Date: Thu, 21 Jun 2018 20:56:14 -0500 Subject: [PATCH] client: /list automatically requests channel list When using "/list" or "/list displayChannelList(bufferInfo.networkId(), text); + // Pass along any potential search parameters, list channels immediately + Client::instance()->displayChannelList(bufferInfo.networkId(), text, true); } diff --git a/src/qtui/channellistdlg.cpp b/src/qtui/channellistdlg.cpp index d6dde67d..d575dc7b 100644 --- a/src/qtui/channellistdlg.cpp +++ b/src/qtui/channellistdlg.cpp @@ -100,6 +100,11 @@ void ChannelListDlg::setChannelFilters(const QString &channelFilters) void ChannelListDlg::requestSearch() { + if (!_netId.isValid()) { + // No valid network set yet + return; + } + _listFinished = false; enableQuery(false); showErrors(false); diff --git a/src/qtui/channellistdlg.h b/src/qtui/channellistdlg.h index fbdb38fe..aa0708d5 100644 --- a/src/qtui/channellistdlg.h +++ b/src/qtui/channellistdlg.h @@ -50,8 +50,13 @@ public: */ void setChannelFilters(const QString &channelFilters); -protected slots: +public slots: + /** + * Request a channel listing using any parameters set in the UI + */ void requestSearch(); + +protected slots: void receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList &channelList); void reportFinishedList(); void joinChannel(const QModelIndex &); diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index fd258838..80879a24 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -207,11 +207,11 @@ void MainWin::init() connect(Client::messageModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), SLOT(messagesInserted(const QModelIndex &, int, int))); connect(GraphicalUi::contextMenuActionProvider(), - SIGNAL(showChannelList(NetworkId, const QString &)), - SLOT(showChannelList(NetworkId, const QString &))); + SIGNAL(showChannelList(NetworkId,QString,bool)), + SLOT(showChannelList(NetworkId,QString,bool))); connect(Client::instance(), - SIGNAL(showChannelList(NetworkId, const QString &)), - SLOT(showChannelList(NetworkId, const QString &))); + SIGNAL(showChannelList(NetworkId,QString,bool)), + SLOT(showChannelList(NetworkId,QString,bool))); connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showNetworkConfig(NetworkId)), SLOT(showNetworkConfig(NetworkId))); connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString))); connect(Client::instance(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString))); @@ -1473,7 +1473,7 @@ void MainWin::showCoreConfigWizard(const QVariantList &backends, const QVariantL } -void MainWin::showChannelList(NetworkId netId, const QString &channelFilters) +void MainWin::showChannelList(NetworkId netId, const QString &channelFilters, bool listImmediately) { ChannelListDlg *channelListDlg = new ChannelListDlg(); @@ -1499,6 +1499,9 @@ void MainWin::showChannelList(NetworkId netId, const QString &channelFilters) if (!channelFilters.isEmpty()) { channelListDlg->setChannelFilters(channelFilters); } + if (listImmediately) { + channelListDlg->requestSearch(); + } channelListDlg->show(); } diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index deb25002..476db511 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -125,10 +125,13 @@ private slots: /** * Show the channel list dialog for the network, optionally searching by channel name * - * @param networkId Network ID for associated network - * @param channelFilters Partial channel name to search for, or empty to show all + * @param networkId Network ID for associated network + * @param channelFilters Partial channel name to search for, or empty to show all + * @param listImmediately If true, immediately list channels, otherwise just show dialog */ - void showChannelList(NetworkId netId = {}, const QString &channelFilters = {}); + void showChannelList(NetworkId netId = {}, const QString &channelFilters = {}, + bool listImmediately = false); + void showNetworkConfig(NetworkId netId = NetworkId()); void showCoreConnectionDlg(); void showCoreConfigWizard(const QVariantList &, const QVariantList &); diff --git a/src/uisupport/networkmodelcontroller.cpp b/src/uisupport/networkmodelcontroller.cpp index bb6482c0..e75d4f89 100644 --- a/src/uisupport/networkmodelcontroller.cpp +++ b/src/uisupport/networkmodelcontroller.cpp @@ -412,8 +412,10 @@ void NetworkModelController::handleGeneralAction(ActionType type, QAction *actio break; } case ShowChannelList: - if (networkId.isValid()) - emit showChannelList(networkId, {}); + if (networkId.isValid()) { + // Don't immediately list channels, allowing customization of filter first + emit showChannelList(networkId, {}, false); + } break; case ShowNetworkConfig: if (networkId.isValid()) diff --git a/src/uisupport/networkmodelcontroller.h b/src/uisupport/networkmodelcontroller.h index 5ffe1272..4b859574 100644 --- a/src/uisupport/networkmodelcontroller.h +++ b/src/uisupport/networkmodelcontroller.h @@ -159,10 +159,11 @@ signals: * * @see MainWin::showChannelList() * - * @param networkId Network ID for associated network - * @param channelFilters Partial channel name to search for, or empty to show all + * @param networkId Network ID for associated network + * @param channelFilters Partial channel name to search for, or empty to show all + * @param listImmediately If true, immediately list channels, otherwise just show dialog */ - void showChannelList(NetworkId, const QString &); + void showChannelList(NetworkId, const QString &, bool); void showNetworkConfig(NetworkId); void showIgnoreList(QString); -- 2.20.1