QTfrontend/ui/widget/SmartLineEdit.cpp
changeset 6149 0b92341adb6a
parent 6147 b4d7d8d62feb
child 6150 1d98752c1fba
--- a/QTfrontend/ui/widget/SmartLineEdit.cpp	Tue Oct 18 09:09:49 2011 -0400
+++ b/QTfrontend/ui/widget/SmartLineEdit.cpp	Tue Oct 18 15:34:40 2011 +0200
@@ -29,11 +29,13 @@
     m_cmds  = new QStringList();
     m_nicks = new QStringList();
 
-    reset();
+    resetAutoCompletionStatus();
 
-    // reset when cursor is moved or content is changed
-    connect(this, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(reset()));
-    connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(reset()));
+    // reset autocompletion status when cursor is moved or content is changed
+    connect(this, SIGNAL(cursorPositionChanged(int, int)),
+            this, SLOT(resetAutoCompletionStatus()));
+    connect(this, SIGNAL(textChanged(const QString&)),
+            this, SLOT(resetAutoCompletionStatus()));
 }
 
 
@@ -79,6 +81,18 @@
     m_mutex.unlock();
 }
 
+void SmartLineEdit::forgetEverything()
+{
+    m_mutex.lock();
+
+    m_cmds->clear();
+    m_nicks->clear();
+
+    m_mutex.unlock();
+
+    resetAutoCompletionStatus();
+}
+
 bool SmartLineEdit::event(QEvent * event)
 {
     // we only want special treatment for key press events
@@ -237,7 +251,7 @@
     }
 }
 
-void SmartLineEdit::reset()
+void SmartLineEdit::resetAutoCompletionStatus()
 {
     m_beforeMatch = "";
     m_hasJustMatched = false;