From: Janne Koschinski Date: Thu, 21 Dec 2017 20:57:03 +0000 (+0100) Subject: Disable the highlights page when not connected X-Git-Tag: travis-deploy-test~159 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=e7ca039bcfdef8e22946b4402643ce107e89709c Disable the highlights page when not connected --- diff --git a/src/qtui/settingspages/corehighlightsettingspage.cpp b/src/qtui/settingspages/corehighlightsettingspage.cpp index fba21eb2..d4be7cf6 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.cpp +++ b/src/qtui/settingspages/corehighlightsettingspage.cpp @@ -37,6 +37,9 @@ CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent) ui.highlightNicksComboBox->addItem(tr("Current Nick"), QVariant(HighlightRuleManager::CurrentNick)); ui.highlightNicksComboBox->addItem(tr("None"), QVariant(HighlightRuleManager::NoNick)); + coreConnectionStateChanged(Client::isConnected()); // need a core connection! + connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool))); + connect(ui.highlightAdd, SIGNAL(clicked(bool)), this, SLOT(addNewHighlightRow())); connect(ui.highlightRemove, SIGNAL(clicked(bool)), this, SLOT(removeSelectedHighlightRows())); @@ -76,6 +79,16 @@ CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent) connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); } +void CoreHighlightSettingsPage::coreConnectionStateChanged(bool state) +{ + setEnabled(state); + if (state) { + load(); + } else { + revert(); + } +} + void CoreHighlightSettingsPage::setupRuleTable(QTableWidget *table) const { table->verticalHeader()->hide(); diff --git a/src/qtui/settingspages/corehighlightsettingspage.h b/src/qtui/settingspages/corehighlightsettingspage.h index 722bf00a..fe0113f6 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.h +++ b/src/qtui/settingspages/corehighlightsettingspage.h @@ -45,6 +45,7 @@ public slots: void clientConnected(); private slots: + void coreConnectionStateChanged(bool state); void widgetHasChanged(); void addNewHighlightRow(bool enable = true, const QString &name = tr("highlight rule"), bool regex = false, bool cs = false, const QString &sender = "", const QString &chanName = "",