summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-01-16 16:52:29 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-01-16 16:52:29 (GMT)
commit1d3d73e81fa08a588036bbd1b9c896f9eefd7644 (patch)
treea6faf8a8ee740286f7ab8608f616282432b066af
parent89a81d282b802f94df4d990389ea6fc892a871a9 (diff)
downloadswift-1d3d73e81fa08a588036bbd1b9c896f9eefd7644.zip
swift-1d3d73e81fa08a588036bbd1b9c896f9eefd7644.tar.bz2
Started natural language display of rule as text.
Change-Id: Iaf973f96652175b6167e369cd74c1223697070a4
-rw-r--r--Swift/QtUI/QtHighlightEditor.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index 75756b2..18101d5 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -89,7 +89,22 @@ void QtHighlightEditor::show()
std::string formatNaturalDescription(const HighlightRule& rule)
{
- return "(null)";
+ //This rule will match messages either in chats or in rooms if the sender
+ // is called 'Admin', and the message contains 'Urgent' (not case sensitive)
+ // as a part of any word.
+
+ std::string text = "This rule will match messages ";
+ if (rule.getMatchChat() && rule.getMatchMUC()) {
+ text += "either in chats or in rooms";
+ } else if (rule.getMatchChat()) {
+ text += "in chats only";
+ } else if (rule.getMatchMUC()) {
+ text += "in rooms only";
+ } else {
+ return "This rule has not been marked as a chat or room rule!";
+ }
+
+ return text;
}
void QtHighlightEditor::setHighlightManager(HighlightManager* highlightManager)
@@ -188,7 +203,8 @@ void QtHighlightEditor::onCurrentRowChanged(int currentRow)
void QtHighlightEditor::onApplyButtonClick()
{
- close();
+ ui_.textEdit_2->setText(P2QSTRING(formatNaturalDescription(ruleFromDialog())));
+// close();
}
void QtHighlightEditor::onCancelButtonClick()