emit showIgnoreList(ignoreRule);
}
- void displayChannelList(NetworkId networkId) {
- emit showChannelList(networkId);
+ /**
+ * Request to show the channel list dialog for the network, optionally searching by channel name
+ *
+ * @see Client::showChannelList()
+ *
+ * @param networkId Network ID for associated network
+ * @param channelFilters Partial channel name to search for, or empty to show all
+ */
+ void displayChannelList(NetworkId networkId, const QString &channelFilters = {})
+ {
+ emit showChannelList(networkId, channelFilters);
}
signals:
void requestNetworkStates();
void showConfigWizard(const QVariantMap &coredata);
- void showChannelList(NetworkId networkId);
+
+ /**
+ * Request to show the channel list dialog for the network, optionally searching by channel name
+ *
+ * @see MainWin::showChannelList()
+ *
+ * @param networkId Network ID for associated network
+ * @param channelFilters Partial channel name to search for, or empty to show all
+ */
+ void showChannelList(NetworkId networkId, const QString &channelFilters = {});
void showIgnoreList(QString ignoreRule);
void connected();
void ClientUserInputHandler::handleList(const BufferInfo &bufferInfo, const QString &text)
{
- Q_UNUSED(text)
- Client::instance()->displayChannelList(bufferInfo.networkId());
+ // Pass along any potential search parameters
+ Client::instance()->displayChannelList(bufferInfo.networkId(), text);
}
}
+void ChannelListDlg::setChannelFilters(const QString &channelFilters)
+{
+ // Enable advanced mode if searching
+ setAdvancedMode(!channelFilters.isEmpty());
+ // Set channel search text after setting advanced mode so it's not cleared
+ ui.channelNameLineEdit->setText(channelFilters.trimmed());
+}
+
+
void ChannelListDlg::requestSearch()
{
_listFinished = false;
void setNetwork(NetworkId netId);
+ /**
+ * Set the channel search string, enabling advanced mode if needed
+ *
+ * Sets the channel name search text to the specified string, enabling advanced mode. If search
+ * string is empty, advanced mode will be automatically hidden.
+ *
+ * @param channelFilters Partial channel name to search for, or empty to not filter by name
+ */
+ void setChannelFilters(const QString &channelFilters);
+
protected slots:
void requestSearch();
void receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList<IrcListHelper::ChannelDescription> &channelList);
connect(Client::instance(), SIGNAL(networkRemoved(NetworkId)), SLOT(clientNetworkRemoved(NetworkId)));
connect(Client::messageModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
SLOT(messagesInserted(const QModelIndex &, int, int)));
- connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showChannelList(NetworkId)), SLOT(showChannelList(NetworkId)));
- connect(Client::instance(), SIGNAL(showChannelList(NetworkId)), SLOT(showChannelList(NetworkId)));
+ connect(GraphicalUi::contextMenuActionProvider(),
+ SIGNAL(showChannelList(NetworkId, const QString &)),
+ SLOT(showChannelList(NetworkId, const QString &)));
+ connect(Client::instance(),
+ SIGNAL(showChannelList(NetworkId, const QString &)),
+ SLOT(showChannelList(NetworkId, const 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)));
}
-void MainWin::showChannelList(NetworkId netId)
+void MainWin::showChannelList(NetworkId netId, const QString &channelFilters)
{
ChannelListDlg *channelListDlg = new ChannelListDlg();
QAction *action = qobject_cast<QAction *>(sender());
if (action)
netId = action->data().value<NetworkId>();
+ if (!netId.isValid()) {
+ // We still haven't found a valid network, probably no network selected, e.g. "/list"
+ // on the client homescreen when no networks are connected.
+ QMessageBox box(QMessageBox::Information, tr("No network selected"),
+ QString("<b>%1</b>").arg(tr("No network selected")),
+ QMessageBox::Ok, this);
+ box.setInformativeText(tr("Select a network before trying to view the channel list."));
+ box.exec();
+ return;
+ }
}
+
channelListDlg->setAttribute(Qt::WA_DeleteOnClose);
channelListDlg->setNetwork(netId);
+ if (!channelFilters.isEmpty()) {
+ channelListDlg->setChannelFilters(channelFilters);
+ }
channelListDlg->show();
}
void currentBufferChanged(BufferId);
void messagesInserted(const QModelIndex &parent, int start, int end);
void showAboutDlg();
- void showChannelList(NetworkId netId = NetworkId());
+
+ /**
+ * 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
+ */
+ void showChannelList(NetworkId netId = {}, const QString &channelFilters = {});
void showNetworkConfig(NetworkId netId = NetworkId());
void showCoreConnectionDlg();
void showCoreConfigWizard(const QVariantList &, const QVariantList &);
}
case ShowChannelList:
if (networkId.isValid())
- emit showChannelList(networkId);
+ emit showChannelList(networkId, {});
break;
case ShowNetworkConfig:
if (networkId.isValid())
virtual void actionTriggered(QAction *);
signals:
- void showChannelList(NetworkId);
+ /**
+ * Request to show the channel list dialog for the network, optionally searching by channel name
+ *
+ * @see MainWin::showChannelList()
+ *
+ * @param networkId Network ID for associated network
+ * @param channelFilters Partial channel name to search for, or empty to show all
+ */
+ void showChannelList(NetworkId, const QString &);
void showNetworkConfig(NetworkId);
void showIgnoreList(QString);