client: /list automatically requests channel list
authorShane Synan <digitalcircuit36939@gmail.com>
Fri, 22 Jun 2018 01:56:14 +0000 (20:56 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 12 Jul 2018 22:36:39 +0000 (00:36 +0200)
When using "/list" or "/list <params" to open Channel List dialog,
automatically request the channel list.  This mimics the behavior
before the UI interception and minimizes effort needed to use the
dialog.

src/client/client.h
src/client/clientuserinputhandler.cpp
src/qtui/channellistdlg.cpp
src/qtui/channellistdlg.h
src/qtui/mainwin.cpp
src/qtui/mainwin.h
src/uisupport/networkmodelcontroller.cpp
src/uisupport/networkmodelcontroller.h

index 29ee342..45880cf 100644 (file)
@@ -172,12 +172,14 @@ public:
      *
      * @see Client::showChannelList()
      *
      *
      * @see Client::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 displayChannelList(NetworkId networkId, const QString &channelFilters = {})
+    void displayChannelList(NetworkId networkId, const QString &channelFilters = {},
+                            bool listImmediately = false)
     {
     {
-        emit showChannelList(networkId, channelFilters);
+        emit showChannelList(networkId, channelFilters, listImmediately);
     }
 
 signals:
     }
 
 signals:
@@ -190,10 +192,13 @@ signals:
      *
      * @see MainWin::showChannelList()
      *
      *
      * @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 networkId, const QString &channelFilters = {});
+    void showChannelList(NetworkId networkId, const QString &channelFilters = {},
+                         bool listImmediately = false);
+
     void showIgnoreList(QString ignoreRule);
 
     void connected();
     void showIgnoreList(QString ignoreRule);
 
     void connected();
index 1be2692..6baf952 100644 (file)
@@ -142,8 +142,8 @@ void ClientUserInputHandler::handleIgnore(const BufferInfo &bufferInfo, const QS
 
 void ClientUserInputHandler::handleList(const BufferInfo &bufferInfo, const QString &text)
 {
 
 void ClientUserInputHandler::handleList(const BufferInfo &bufferInfo, const QString &text)
 {
-    // Pass along any potential search parameters
-    Client::instance()->displayChannelList(bufferInfo.networkId(), text);
+    // Pass along any potential search parameters, list channels immediately
+    Client::instance()->displayChannelList(bufferInfo.networkId(), text, true);
 }
 
 
 }
 
 
index d6dde67..d575dc7 100644 (file)
@@ -100,6 +100,11 @@ void ChannelListDlg::setChannelFilters(const QString &channelFilters)
 
 void ChannelListDlg::requestSearch()
 {
 
 void ChannelListDlg::requestSearch()
 {
+    if (!_netId.isValid()) {
+        // No valid network set yet
+        return;
+    }
+
     _listFinished = false;
     enableQuery(false);
     showErrors(false);
     _listFinished = false;
     enableQuery(false);
     showErrors(false);
index fbdb38f..aa0708d 100644 (file)
@@ -50,8 +50,13 @@ public:
      */
     void setChannelFilters(const QString &channelFilters);
 
      */
     void setChannelFilters(const QString &channelFilters);
 
-protected slots:
+public slots:
+    /**
+     * Request a channel listing using any parameters set in the UI
+     */
     void requestSearch();
     void requestSearch();
+
+protected slots:
     void receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList<IrcListHelper::ChannelDescription> &channelList);
     void reportFinishedList();
     void joinChannel(const QModelIndex &);
     void receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList<IrcListHelper::ChannelDescription> &channelList);
     void reportFinishedList();
     void joinChannel(const QModelIndex &);
index fd25883..80879a2 100644 (file)
@@ -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(),
     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(),
     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)));
     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();
 
 {
     ChannelListDlg *channelListDlg = new ChannelListDlg();
 
@@ -1499,6 +1499,9 @@ void MainWin::showChannelList(NetworkId netId, const QString &channelFilters)
     if (!channelFilters.isEmpty()) {
         channelListDlg->setChannelFilters(channelFilters);
     }
     if (!channelFilters.isEmpty()) {
         channelListDlg->setChannelFilters(channelFilters);
     }
+    if (listImmediately) {
+        channelListDlg->requestSearch();
+    }
     channelListDlg->show();
 }
 
     channelListDlg->show();
 }
 
index deb2500..476db51 100644 (file)
@@ -125,10 +125,13 @@ private slots:
     /**
      * Show the channel list dialog for the network, optionally searching by channel name
      *
     /**
      * 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 &);
     void showNetworkConfig(NetworkId netId = NetworkId());
     void showCoreConnectionDlg();
     void showCoreConfigWizard(const QVariantList &, const QVariantList &);
index bb6482c..e75d4f8 100644 (file)
@@ -412,8 +412,10 @@ void NetworkModelController::handleGeneralAction(ActionType type, QAction *actio
         break;
     }
     case ShowChannelList:
         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())
         break;
     case ShowNetworkConfig:
         if (networkId.isValid())
index 5ffe127..4b85957 100644 (file)
@@ -159,10 +159,11 @@ signals:
      *
      * @see MainWin::showChannelList()
      *
      *
      * @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);
 
     void showNetworkConfig(NetworkId);
     void showIgnoreList(QString);