[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/korganizer
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2005-03-23 20:05:40
Message-ID: 20050323200540.61F443CF () office ! kde ! org
[Download RAW message or body]

CVS commit by tokoe: 

We have to delay/separate the setNewPercentage call, because it triggers the
deletion of the TodoViewItem (which is also delayed), but under special circumstances
also shows a dialog (from the filter thingy). So the item gets deleted, but the
dialog is still shown. And when the dialog is closed, the setNewPercentage()
method context isn't valid anymore (because the item which called this method was deleted).

BUGS:101146


  M +16 -0     kotodoview.cpp   1.197
  M +4 -0      kotodoview.h   1.83
  M +1 -1      kotodoviewitem.cpp   1.51


--- kdepim/korganizer/kotodoview.cpp  #1.196:1.197
@@ -1012,4 +1012,20 @@ void KOTodoView::itemStateChanged( QList
 }
 
+void KOTodoView::setNewPercentageDelayed( KOTodoViewItem *item, int percentage )
+{
+  mPercentChangedMap.append( qMakePair( item, percentage ) );
+
+  QTimer::singleShot( 0, this, SLOT( progressDelayedNewPercentage() ) );
+}
+
+void KOTodoView::progressDelayedNewPercentage()
+{
+  QValueList< QPair< KOTodoViewItem *, int> >::Iterator it;
+  for ( it = mPercentChangedMap.begin(); it != mPercentChangedMap.end(); ++it )
+    setNewPercentage( (*it).first, (*it).second );
+
+  mPercentChangedMap.clear();
+}
+
 void KOTodoView::saveLayout(KConfig *config, const QString &group) const
 {

--- kdepim/korganizer/kotodoview.h  #1.82:1.83
@@ -172,4 +172,7 @@ class KOTodoView : public KOrg::BaseView
     void itemStateChanged( QListViewItem * );
 
+    void setNewPercentageDelayed( KOTodoViewItem *item, int percentage );
+    void progressDelayedNewPercentage();
+
   signals:
     void unSubTodoSignal();
@@ -218,4 +221,5 @@ class KOTodoView : public KOrg::BaseView
     QMap<Todo *,KOTodoViewItem *> mTodoMap;
     QPtrList<KOTodoViewItem> mItemsToDelete;
+    QValueList< QPair<KOTodoViewItem *, int> > mPercentChangedMap;
 
     DocPrefs *mDocPrefs;

--- kdepim/korganizer/kotodoviewitem.cpp  #1.50:1.51
@@ -173,5 +173,5 @@ void KOTodoViewItem::stateChange( bool s
   
   kdDebug(5850) << "State changed, modified " << state << endl;
-  mTodoView->setNewPercentage( this, state ? 100 : 0 );
+  mTodoView->setNewPercentageDelayed( this, state ? 100 : 0 );
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic