+
+void CoreHighlightSettingsPage::on_coreUnsupportedDetails_clicked()
+{
+ // Re-use translations of "Local Highlights" as this is a word-for-word reference, forcing all
+ // spaces to non-breaking
+ const QString localHighlightsName = tr("Local Highlights").replace(" ", " ");
+
+ const QString remoteHighlightsMsgText =
+ QString("<p><b>%1</b></p></br><p>%2</p></br><p>%3</p>"
+ ).arg(tr("Your Quassel core is too old to support remote highlights"),
+ tr("You need a Quassel core v0.13.0 or newer to configure remote "
+ "highlights."),
+ tr("You can still configure highlights for this device only in "
+ "<i>%1</i>.").arg(localHighlightsName));
+
+ QMessageBox::warning(this,
+ tr("Remote Highlights unsupported"),
+ remoteHighlightsMsgText);
+}
+
+void CoreHighlightSettingsPage::importRules() {
+ NotificationSettings notificationSettings;
+
+ const auto localHighlightList = notificationSettings.highlightList();
+
+ // Re-use translations of "Local Highlights" as this is a word-for-word reference, forcing all
+ // spaces to non-breaking
+ const QString localHighlightsName = tr("Local Highlights").replace(" ", " ");
+
+ if (localHighlightList.count() == 0) {
+ // No highlight rules exist to import, do nothing
+ QMessageBox::information(this,
+ tr("No local highlights"),
+ tr("No highlight rules in <i>%1</i>."
+ ).arg(localHighlightsName));
+ return;
+ }
+
+ int ret = QMessageBox::question(this,
+ tr("Import local highlights?"),
+ tr("Import all highlight rules from <i>%1</i>?"
+ ).arg(localHighlightsName),
+ QMessageBox::Yes|QMessageBox::No,
+ QMessageBox::No);
+
+ if (ret == QMessageBox::No) {
+ // Only two options, Yes or No, just return if No
+ return;
+ }
+
+ auto clonedManager = HighlightRuleManager();
+ clonedManager.fromVariantMap(Client::highlightRuleManager()->toVariantMap());
+
+ for (const auto &variant : notificationSettings.highlightList()) {
+ auto highlightRule = variant.toMap();
+
+ clonedManager.addHighlightRule(
+ highlightRule["Name"].toString(),
+ highlightRule["RegEx"].toBool(),
+ highlightRule["CS"].toBool(),
+ highlightRule["Enable"].toBool(),
+ false,
+ "",
+ highlightRule["Channel"].toString()
+ );
+ }
+
+ Client::highlightRuleManager()->requestUpdate(clonedManager.toVariantMap());
+ setChangedState(false);
+ load();
+
+ // Give a heads-up that all succeeded
+ QMessageBox::information(this,
+ tr("Imported local highlights"),
+ tr("%1 highlight rules successfully imported."
+ ).arg(QString::number(localHighlightList.count())));
+}
+
+bool CoreHighlightSettingsPage::isSelectable() const {
+ return Client::isConnected();
+ // We check for Quassel::Feature::CoreSideHighlights when loading this page, allowing us to show
+ // a friendly error message.
+}