X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=80879a24e3750a120fb7c692fb7662b0cc344eb3;hb=cefad53d40b08c4271a2150533b747c3ca64b735;hp=fe1a0d0639d8bed4e27e1de3896b7d5cbcb8b415;hpb=da1a6f40b28d65e5b6a5a03e62f9b2604c3f00a7;p=quassel.git diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index fe1a0d06..80879a24 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -206,8 +206,12 @@ void MainWin::init() 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,QString,bool)), + SLOT(showChannelList(NetworkId,QString,bool))); + connect(Client::instance(), + 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))); @@ -1469,7 +1473,7 @@ void MainWin::showCoreConfigWizard(const QVariantList &backends, const QVariantL } -void MainWin::showChannelList(NetworkId netId) +void MainWin::showChannelList(NetworkId netId, const QString &channelFilters, bool listImmediately) { ChannelListDlg *channelListDlg = new ChannelListDlg(); @@ -1477,10 +1481,27 @@ void MainWin::showChannelList(NetworkId netId) QAction *action = qobject_cast(sender()); if (action) netId = action->data().value(); + 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("%1").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); + } + if (listImmediately) { + channelListDlg->requestSearch(); + } channelListDlg->show(); } @@ -1974,7 +1995,7 @@ void MainWin::on_actionDebugMessageModel_triggered() void MainWin::on_actionDebugLog_triggered() { - DebugLogWidget *logWidget = new DebugLogWidget(0); + DebugLogWidget *logWidget = new DebugLogWidget(nullptr); // will be deleted on close logWidget->show(); }