From: genius3000 Date: Wed, 23 Nov 2016 09:04:46 +0000 (-0700) Subject: Add a Configure menu item to Networks in the buffer list X-Git-Tag: travis-deploy-test~100 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=e04ec81f1b7a29542135286854040d353e1e1474 Add a Configure menu item to Networks in the buffer list Add 'Configure' above 'Disconnect' in the right-click menu from a network in the buffer list. Clicking 'Configure' will open the Configure Networks dialog to the selected network. Fixes #607 --- diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 1db5f89b..14644fb7 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -204,6 +204,7 @@ void MainWin::init() 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(showNetworkConfig(NetworkId)), SLOT(showNetworkConfig(NetworkId))); connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString))); connect(Client::instance(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString))); @@ -1414,6 +1415,15 @@ void MainWin::showChannelList(NetworkId netId) } +void MainWin::showNetworkConfig(NetworkId netId) +{ + SettingsPageDlg dlg(new NetworksSettingsPage(this), this); + if (netId.isValid()) + qobject_cast(dlg.currentPage())->bufferList_Open(netId); + dlg.exec(); +} + + void MainWin::showIgnoreList(QString newRule) { SettingsPageDlg dlg(new IgnoreListSettingsPage(this), this); diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index d27b892e..431a3082 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -119,6 +119,7 @@ private slots: void messagesInserted(const QModelIndex &parent, int start, int end); void showAboutDlg(); void showChannelList(NetworkId netId = NetworkId()); + void showNetworkConfig(NetworkId netId = NetworkId()); void showCoreConnectionDlg(); void showCoreConfigWizard(const QVariantList &, const QVariantList &); void showCoreInfoDlg(); diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index bcc88110..f0aeac16 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -567,6 +567,14 @@ QListWidgetItem *NetworksSettingsPage::insertNetwork(const NetworkInfo &info) } +// Called when selecting 'Configure' from the buffer list +void NetworksSettingsPage::bufferList_Open(NetworkId netId) +{ + QListWidgetItem *item = networkItem(netId); + ui.networkList->setCurrentItem(item, QItemSelectionModel::SelectCurrent); +} + + void NetworksSettingsPage::displayNetwork(NetworkId id) { _ignoreWidgetChanges = true; diff --git a/src/qtui/settingspages/networkssettingspage.h b/src/qtui/settingspages/networkssettingspage.h index 52d42778..3ce01907 100644 --- a/src/qtui/settingspages/networkssettingspage.h +++ b/src/qtui/settingspages/networkssettingspage.h @@ -47,6 +47,7 @@ public: public slots: void save(); void load(); + void bufferList_Open(NetworkId); private slots: void widgetHasChanged(); diff --git a/src/uisupport/contextmenuactionprovider.cpp b/src/uisupport/contextmenuactionprovider.cpp index 608a6119..8a0ca825 100644 --- a/src/uisupport/contextmenuactionprovider.cpp +++ b/src/uisupport/contextmenuactionprovider.cpp @@ -90,6 +90,7 @@ ContextMenuActionProvider::ContextMenuActionProvider(QObject *parent) : NetworkM registerAction(HideBufferTemporarily, tr("Hide Chat(s) Temporarily")); registerAction(HideBufferPermanently, tr("Hide Chat(s) Permanently")); registerAction(ShowChannelList, tr("Show Channel List")); + registerAction(ShowNetworkConfig, tr("Configure")); registerAction(ShowIgnoreList, tr("Show Ignore List")); QMenu *hideEventsMenu = new QMenu(); @@ -285,6 +286,8 @@ void ContextMenuActionProvider::addNetworkItemActions(QMenu *menu, const QModelI if (!network) return; + addAction(ShowNetworkConfig, menu, index); + menu->addSeparator(); addAction(NetworkConnect, menu, network->connectionState() == Network::Disconnected); addAction(NetworkDisconnect, menu, network->connectionState() != Network::Disconnected); menu->addSeparator(); diff --git a/src/uisupport/networkmodelcontroller.cpp b/src/uisupport/networkmodelcontroller.cpp index 16243efe..10807d91 100644 --- a/src/uisupport/networkmodelcontroller.cpp +++ b/src/uisupport/networkmodelcontroller.cpp @@ -414,6 +414,10 @@ void NetworkModelController::handleGeneralAction(ActionType type, QAction *actio if (networkId.isValid()) emit showChannelList(networkId); break; + case ShowNetworkConfig: + if (networkId.isValid()) + emit showNetworkConfig(networkId); + break; case ShowIgnoreList: if (networkId.isValid()) emit showIgnoreList(QString()); diff --git a/src/uisupport/networkmodelcontroller.h b/src/uisupport/networkmodelcontroller.h index 0885a4a0..73ceabbc 100644 --- a/src/uisupport/networkmodelcontroller.h +++ b/src/uisupport/networkmodelcontroller.h @@ -75,6 +75,7 @@ public: JoinChannel = 0x1000, ShowChannelList = 0x2000, ShowIgnoreList = 0x3000, + ShowNetworkConfig = 0x4000, // Nick actions NickMask = 0xff0000, @@ -154,6 +155,7 @@ protected slots: signals: void showChannelList(NetworkId); + void showNetworkConfig(NetworkId); void showIgnoreList(QString); protected: