X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=3ada47fddc0603d1c2c248c3b7d97305ea6e8f9e;hb=6fd69e84e6c395a108e6b2620c6428907b7d7efd;hp=99aaff3e1e48c2e1cb402530005c17379928409a;hpb=37110ceaa070167b4f40ed449ac9ea130503a792;p=quassel.git diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 99aaff3e..3ada47fd 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -206,12 +206,17 @@ 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))); connect(Client::instance(), SIGNAL(dbUpgradeInProgress(bool)), SLOT(showMigrationWarning(bool))); + connect(Client::instance(), SIGNAL(exitRequested(QString)), SLOT(onExitRequested(QString))); connect(Client::coreConnection(), SIGNAL(startCoreSetup(QVariantList, QVariantList)), SLOT(showCoreConfigWizard(QVariantList, QVariantList))); connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(handleCoreConnectionError(QString))); @@ -854,6 +859,19 @@ void MainWin::showMigrationWarning(bool show) } +void MainWin::onExitRequested(const QString &reason) +{ + if (!reason.isEmpty()) { + QMessageBox box(QMessageBox::Critical, + tr("Fatal error"), + "" + tr("Quassel encountered a fatal error and is terminated.") + "", + QMessageBox::Ok, this); + box.setInformativeText("

" + tr("Reason:") + " " + reason + ""); + box.exec(); + } +} + + void MainWin::changeActiveBufferView(bool backwards) { if (_activeBufferViewIndex >= 0 && _activeBufferViewIndex < _bufferViews.count()) { @@ -1469,7 +1487,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 +1495,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(); }