[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Fri Apr 8 07:16:33 CEST 2005


CVS commit by staikos: 

send a log cleared event when the log is cleared (needed by JS)


  M +2 -0      kstdebug.cpp   1.22
  M +1 -0      kstdebugdialog_i.cpp   1.15
  M +10 -1     kstdoc.cpp   1.161
  M +1 -0      kstdoc.h   1.42
  M +1 -1      logevents.h   1.2


--- kdeextragear-2/kst/kst/logevents.h  #1.1:1.2
@@ -24,5 +24,5 @@
 class LogEvent : public QEvent {
   public:
-    enum LogEventType { Unknown = 0, LogAdded };
+    enum LogEventType { Unknown = 0, LogAdded, LogCleared };
 
     LogEvent(LogEventType et) : QEvent(QEvent::Type(KstEventTypeLog)), _eventType(et) {}

--- kdeextragear-2/kst/kst/kstdebug.cpp  #1.21:1.22
@@ -105,4 +105,6 @@ void KstDebug::clear() {
   QMutexLocker ml(&_lock);
   _messages.clear(); 
+  LogEvent *e = new LogEvent(LogEvent::LogCleared);
+  QApplication::postEvent(_handler, e);
 }
 

--- kdeextragear-2/kst/kst/kstdebugdialog_i.cpp  #1.14:1.15
@@ -58,4 +58,5 @@ KstDebugDialogI::KstDebugDialogI(QWidget
 
   connect(KstApp::inst()->document(), SIGNAL(logAdded(const KstDebug::LogMessage&)), _log, SLOT(logAdded(const KstDebug::LogMessage&)));
+  connect(KstApp::inst()->document(), SIGNAL(logCleared()), _log, SLOT(clear()));
   connect(_email, SIGNAL(clicked()), this, SLOT(email()));
   connect(_clear, SIGNAL(clicked()), this, SLOT(clear()));

--- kdeextragear-2/kst/kst/kstdoc.cpp  #1.160:1.161
@@ -923,5 +923,14 @@ bool KstDoc::event(QEvent *e) {
     LogEvent *le = dynamic_cast<LogEvent*>(e);
     if (le) {
+      switch (le->_eventType) {
+        case LogEvent::LogAdded:
       emit logAdded(le->_msg);
+          break;
+        case LogEvent::LogCleared:
+          emit logCleared();
+          break;
+        default:
+          break;
+      }
     }
     return true;

--- kdeextragear-2/kst/kst/kstdoc.h  #1.41:1.42
@@ -109,4 +109,5 @@ signals:
   void updateDialogs();
   void logAdded(const KstDebug::LogMessage& msg);
+  void logCleared();
 };
 




More information about the Kst mailing list