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

List:       kde-commits
Subject:    kdepim/kresources/opengroupware
From:       Cornelius Schumacher <schumacher () kde ! org>
Date:       2004-11-01 1:09:37
Message-ID: 20041101010937.DFB1216C1E () office ! kde ! org
[Download RAW message or body]

CVS commit by cschumac: 

Remeber active state across folder list updates.


  M +22 -4     folderlister.cpp   1.7
  M +1 -0      folderlister.h   1.6


--- kdepim/kresources/opengroupware/folderlister.cpp  #1.6:1.7
@@ -62,4 +62,13 @@ QStringList FolderLister::activeFolderId
 }
 
+bool FolderLister::isActive( const QString &id ) const
+{
+  FolderLister::Entry::List::ConstIterator it;
+  for( it = mFolders.begin(); it != mFolders.end(); ++it ) {
+    if ( (*it).id == id ) return (*it).active;
+  }
+  return false;  
+}
+
 void FolderLister::readConfig( const KConfig *config )
 {
@@ -140,9 +149,10 @@ void FolderLister::slotListJobResult( KI
     kdDebug(7000) << " Doc: " << doc.toString() << endl;
 
-    mFolders.clear();
+    bool firstRetrieve = mFolders.isEmpty();
+
+    Entry::List newFolders;
 
     // Personal calendar/addressbook
     Entry personal;
-    personal.active = true;
     KURL url = mUrl;
     url.setUser( QString::null );
@@ -156,5 +166,10 @@ void FolderLister::slotListJobResult( KI
       personal.id = url.url();
     }
-    mFolders.append( personal );
+    if ( firstRetrieve ) {
+      personal.active = true;
+    } else {
+      personal.active = isActive( personal.id );
+    }
+    newFolders.append( personal );
 
     QDomElement docElement = doc.documentElement();
@@ -196,6 +211,7 @@ void FolderLister::slotListJobResult( KI
         entry.id = href;
         entry.name = displayName;
+        entry.active = isActive( entry.id );
         
-        mFolders.append( entry );
+        newFolders.append( entry );
       
         kdDebug() << "FOLDER: " << displayName << endl;
@@ -203,4 +219,6 @@ void FolderLister::slotListJobResult( KI
     }
 
+    mFolders = newFolders;
+
     emit foldersRead();
   }

--- kdepim/kresources/opengroupware/folderlister.h  #1.5:1.6
@@ -63,4 +63,5 @@ class FolderLister : public QObject
 
     QStringList activeFolderIds() const;
+    bool isActive( const QString &id ) const;
 
     void setWriteDestinationId( const QString & );


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

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