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

List:       kde-commits
Subject:    KDE/kdepim/libakonadi
From:       Volker Krause <volker.krause () rwth-aachen ! de>
Date:       2006-02-04 14:48:29
Message-ID: 1139064509.068983.26372.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 505657 by vkrause:

Make collection type an enum as suggested by Till.


 M  +4 -3      collection.cpp  
 M  +13 -2     collection.h  
 M  +1 -1      collectionmodel.cpp  
 M  +2 -5      tests/collectionbrowser.cpp  


--- trunk/KDE/kdepim/libakonadi/collection.cpp #505656:505657
@@ -30,7 +30,7 @@
     DataReference ref;
     DataReference parent;
     QString name;
-    QString type;
+    Type type;
     QStringList contentTypes;
     QString query;
 };
@@ -39,6 +39,7 @@
   d( new Collection::CollectionPrivate() )
 {
   d->ref = ref;
+  d->type = Unknown;
 }
 
 PIM::Collection::~ Collection( )
@@ -62,12 +63,12 @@
   d->name = name;
 }
 
-QString PIM::Collection::type( ) const
+Collection::Type PIM::Collection::type() const
 {
   return d->type;
 }
 
-void PIM::Collection::setType( const QString & type )
+void PIM::Collection::setType( Type type )
 {
   d->type = type;
 }
--- trunk/KDE/kdepim/libakonadi/collection.h #505656:505657
@@ -34,6 +34,17 @@
 {
   public:
     /**
+      Collection types.
+    */
+    enum Type {
+      Folder, /**< 'Real' folder on eg. an IMAP server. */
+      Virtual, /**< Virtual collection (aka search folder). */
+      Resource, /**< Resource or account. */
+      Category, /**< Category. */
+      Unknown /**< Unknown collection type. */
+    };
+
+    /**
       Create a new collection.
 
       @param ref The data reference of this collection.
@@ -64,12 +75,12 @@
       Returns the type of this collection (e.g. virtual folder, folder on an
       IMAP server, etc.).
     */
-    QString type() const;
+    Type type() const;
 
     /**
       Sets the type of this collection.
     */
-    void setType( const QString &type );
+    void setType( Type type );
 
     /**
       Returns a list of possible content mimetypes,
--- trunk/KDE/kdepim/libakonadi/collectionmodel.cpp #505656:505657
@@ -93,7 +93,7 @@
     return col->name();
   }
   if ( role == Qt::DecorationRole ) {
-    if ( col->type() == "akonadi/resource" )
+    if ( col->type() == Collection::Resource )
       return SmallIcon( "server" );
     QStringList content = col->contentTypes();
     if ( content.size() == 1 ) {
--- trunk/KDE/kdepim/libakonadi/tests/collectionbrowser.cpp #505656:505657
@@ -62,11 +62,8 @@
     }
     col->setContentTypes( content );
     global_collection_map.insert( ref, col );
-    if ( parent.persistanceID().isNull() ) {
-      col->setType( "akonadi/resource" );
-    } else {
-      col->setType( "akonadi/collection" );
-    }
+    if ( parent.isNull() )
+      col->setType( Collection::Resource );
     createCollections( ref, rec - ( rand() % 3 ) - 1 );
   }
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

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