From f8d2d34a4ac0b9514b6eecac66ba6b54520fa550 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 12 Nov 2015 13:13:16 +0100 Subject: Add enable management of alias --- dicealias.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'dicealias.cpp') diff --git a/dicealias.cpp b/dicealias.cpp index f9c366c..e7faa2f 100644 --- a/dicealias.cpp +++ b/dicealias.cpp @@ -22,8 +22,8 @@ #include "dicealias.h" #include -DiceAlias::DiceAlias(QString cmd, QString key, bool isReplace) - : m_command(cmd),m_value(key) +DiceAlias::DiceAlias(QString cmd, QString key, bool isReplace, bool isEnable) + : m_command(cmd),m_value(key),m_isEnable(isEnable) { if(isReplace) { @@ -42,6 +42,8 @@ DiceAlias::~DiceAlias() bool DiceAlias::resolved(QString & str) { + if(!m_isEnable) + return false; if((m_type == REPLACE)&&(str.contains(m_command))) { str.replace(m_command,m_value); @@ -97,3 +99,11 @@ void DiceAlias::setReplace(bool b) m_type = REGEXP; } } +bool DiceAlias::isEnable() const +{ + return m_isEnable; +} +void DiceAlias::setEnable(bool b) +{ + m_isEnable = b; +} -- cgit v1.2.3-70-g09d2