[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Wed Sep 15 19:30:33 CEST 2004


CVS commit by arwalker: 

Handle resize() failures.
Fix i18n problems.
Prevent potential crash by delaying initial update.


  M +24 -13    ksteventmonitorentry.cpp   1.25
  M +3 -0      ksteventmonitorentry.h   1.16


--- kdeextragear-2/kst/kst/ksteventmonitorentry.cpp  #1.24:1.25
@@ -87,5 +87,9 @@ EventMonitorEntry::EventMonitorEntry(QDo
   commonConstructor( strTag );
 
-  update();
+  //
+  // wait for the initial upadte, as we don't want to trigger elog entries
+  //  until we are sure the document is open...
+  //
+  QTimer::singleShot( 500, this, SLOT(slotUpdate()) );
 }
 
@@ -133,4 +137,8 @@ EventMonitorEntry::~EventMonitorEntry() 
 }
 
+void EventMonitorEntry::slotUpdate() {
+  update();
+}
+
 KstObject::UpdateType EventMonitorEntry::update(int updateCounter) {
   KstObject::UpdateType retVal = NO_CHANGE;
@@ -174,13 +182,16 @@ KstObject::UpdateType EventMonitorEntry:
 
     if (xv && yv) {
-      bool rc = xv->resize(ns);
-      rc = yv->resize(ns) && rc;
-      if (!rc) {
-        // FIXME: handle error
-        return retVal;
-      }
+      bool rc;
+
+      rc = xv->resize(ns);
+      if (rc) {
       pdRawValuesX = xv->value();
+      }
+
+      rc = yv->resize(ns);
+      if (rc) {
       pdRawValuesY = yv->value();
     }
+    }
 
     ctx.sampleCount = ns;
@@ -252,12 +263,12 @@ void EventMonitorEntry::logImmediately( 
       iIndex = *(_indexArray.at(i));
       if( i == 0 ) {
-        strRange += i18n("%1").arg( iIndex );
+        strRange.setNum( iIndex );
       } else if( !bRange && iIndex == iIndexOld+1 ) {
         bRange = true;
       } else if( bRange && iIndex != iIndexOld+1 ) {
-        strRange += i18n("-%1,%2").arg( iIndexOld ).arg( iIndex );
+        strRange = i18n("%1-%2,%3").arg( strRange ).arg( iIndexOld ).arg( iIndex );
         bRange = false;
       } else if( iIndex != iIndexOld+1 ) {
-        strRange += i18n(",%1").arg( iIndex );
+        strRange = i18n("%1,%2").arg( strRange ).arg( iIndex );
       }
       iIndexOld = iIndex;
@@ -265,8 +276,8 @@ void EventMonitorEntry::logImmediately( 
 
     if( bRange ) {
-      strRange += i18n("-%1").arg( iIndex );
+      strRange = i18n("%1-%2").arg( strRange ).arg( iIndex );
     }
 
-    if( _strDescription.isEmpty( ) ) {
+    if( _strDescription.isEmpty() ) {
       str = i18n("Event Monitor: %1: %2").arg( _strEvent ).arg( strRange );
     } else {

--- kdeextragear-2/kst/kst/ksteventmonitorentry.h  #1.15:1.16
@@ -67,4 +67,7 @@ class EventMonitorEntry : public KstData
     void logImmediately();
 
+  public slots:
+    void  slotUpdate();
+      
   private:
     void commonConstructor(const QString &in_tag);





More information about the Kst mailing list