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

List:       kde-commits
Subject:    kroupware_branch: kdepim/korganizer
From:       Bo Thorsen <bo () sonofthor ! dk>
Date:       2003-07-03 9:28:17
[Download RAW message or body]

CVS commit by thorsen: 

Fix kroupware issue #291: If sync changes the list of tasks, we can't rely on the popup menu


  M +2 -0      calendarview.h   1.79.2.12
  M +6 -2      kogroupware.cpp   1.1.2.28
  M +6 -1      kotodoview.cpp   1.95.2.12
  M +3 -0      kotodoview.h   1.44.2.6


--- kdepim/korganizer/calendarview.h  #1.79.2.11:1.79.2.12
@@ -93,4 +93,6 @@ class CalendarView : public KOrg::Calend
     Incidence *currentSelection();
 
+    KOTodoView *todoList() { return mTodoList; }
+
   signals:
 

--- kdepim/korganizer/kogroupware.cpp  #1.1.2.27:1.1.2.28
@@ -30,4 +30,5 @@
 #include "koeventeditor.h"
 #include "kotodoeditor.h"
+#include "kotodoview.h"
 
 #include <libkcal/incidencebase.h>
@@ -1023,7 +1024,10 @@ void KOGroupware::slotSyncRunning( const
   if( type == "Event" || type == "Calendar" )
     mCanEditEvents = !running;
-  else if( type == "Task" || type == "Todo" )
+  else if( type == "Task" || type == "Todo" ) {
     mCanEditTodos = !running;
-  else if( type == "Note" ) {
+    if( running && mView && mView->todoList() )
+      // Invalidate category selection menu
+      mView->todoList()->setCategorySelectionValidity( false );
+  } else if( type == "Note" ) {
     emit notesSync(running);
   }

--- kdepim/korganizer/kotodoview.cpp  #1.95.2.11:1.95.2.12
@@ -247,5 +247,5 @@ void KOTodoListView::contentsMouseDouble
 
 KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
-  KOrg::BaseView(calendar,parent,name)
+  KOrg::BaseView(calendar,parent,name), mCategorySelectionIsValid( false )
 {
   QBoxLayout *topLayout = new QVBoxLayout(this);
@@ -598,4 +598,7 @@ void KOTodoView::setNewPercentage(int in
 QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
 {
+  // Make the menu work
+  mCategorySelectionIsValid = true;
+
   QPopupMenu* tempMenu = new QPopupMenu (this);
   QStringList checkedCategories = todoItem->todo()->categories ();
@@ -617,4 +620,6 @@ QPopupMenu * KOTodoView::getCategoryPopu
 void KOTodoView::changedCategories(int index)
 {
+  if( !mCategorySelectionIsValid )
+    return;
   if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
     QStringList categories = mActiveItem->todo()->categories ();

--- kdepim/korganizer/kotodoview.h  #1.44.2.5:1.44.2.6
@@ -147,4 +147,6 @@ class KOTodoView : public KOrg::BaseView
     void modified(bool);
 
+    void setCategorySelectionValidity( bool b ) { mCategorySelectionIsValid = b; }
+
   signals:
     void newTodoSignal();
@@ -195,4 +197,5 @@ class KOTodoView : public KOrg::BaseView
     DocPrefs *mDocPrefs;
     QString mCurrentDoc;
+    bool mCategorySelectionIsValid;
 };
 


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

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