From e2992ab2c52a12e0123bd4d8bbd70fa9437748fd Mon Sep 17 00:00:00 2001
From: Richard Maudsley <richard.maudsley@isode.com>
Date: Fri, 17 Jan 2014 15:20:29 +0000
Subject: Description is now updated as dialog options are changed.

Change-Id: I3210bebc9a1db6774504742fdd108984b06e135b

diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index e636b57..f933e3f 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -29,26 +29,6 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare
 {
 	ui_.setupUi(this);
 
-	//itemModel_ = new QtHighlightRulesItemModel(this);
-	//ui_.treeView->setModel(itemModel_);
-	//ui_.ruleWidget->setModel(itemModel_);
-//
-	//for (int i = 0; i < QtHighlightRulesItemModel::NumberOfColumns; ++i) {
-		//switch (i) {
-			//case QtHighlightRulesItemModel::ApplyTo:
-			//case QtHighlightRulesItemModel::Sender:
-			//case QtHighlightRulesItemModel::Keyword:
-			//case QtHighlightRulesItemModel::Action:
-				//ui_.treeView->showColumn(i);
-				//break;
-			//default:
-				//ui_.treeView->hideColumn(i);
-				//break;
-		//}
-	//}
-//
-	//setHighlightManager(NULL); // setup buttons for empty rules list
-//
 	connect(ui_.listWidget, SIGNAL(currentRowChanged(int)), SLOT(onCurrentRowChanged(int)));
 
 	connect(ui_.newButton, SIGNAL(clicked()), SLOT(onNewButtonClicked()));
@@ -68,10 +48,28 @@ QtHighlightEditor::QtHighlightEditor(QtSettingsProvider* settings, QWidget* pare
 	connect(ui_.defaultSoundRadio, SIGNAL(clicked()), SLOT(soundOtherSelect()));
 	connect(ui_.customSoundRadio, SIGNAL(clicked()), SLOT(soundCustomSelect()));
 
+	/* replace the static lineedit control with the roster autocompleter */
 	ui_.dummySenderName->setVisible(false);
 	jid_ = new QtSuggestingJIDInput(this, settings);
 	ui_.senderName->addWidget(jid_);
 
+	/* we need to be notified if any of the state changes so that we can update our textual rule description */
+	connect(ui_.chatCheck, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.roomCheck, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.senderCheck, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(jid_, SIGNAL(textChanged(const QString&)), SLOT(updateRuleDescription()));
+	connect(ui_.keywordCheck, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.keyword, SIGNAL(textChanged(const QString&)), SLOT(updateRuleDescription()));
+	connect(ui_.nickIsKeyword, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.matchWholeWords, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.matchCase, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.noColorRadio, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.defaultColorRadio, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.customColorRadio, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.noSoundRadio, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.defaultSoundRadio, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+	connect(ui_.customSoundRadio, SIGNAL(clicked()), SLOT(updateRuleDescription()));
+
 	setWindowTitle(tr("Highlight Rules"));
 }
 
-- 
cgit v0.10.2-6-g49f6