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

List:       kde-commits
Subject:    KDE/kdepimlibs/akonadi
From:       Kevin Ottens <ervin () kde ! org>
Date:       2009-07-20 17:47:57
Message-ID: 1248112077.478351.13262.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1000000 by ervin:

Allow to also attach a selection model for the favorite collections.
Still need to be synchronized with the collections selection model.


 M  +13 -4     standardactionmanager.cpp  
 M  +7 -0      standardactionmanager.h  


--- trunk/KDE/kdepimlibs/akonadi/standardactionmanager.cpp #999999:1000000
@@ -100,7 +100,8 @@
       q( parent ),
       collectionSelectionModel( 0 ),
       itemSelectionModel( 0 ),
-      favoritesModel( 0 )
+      favoritesModel( 0 ),
+      favoriteSelectionModel( 0 )
     {
       actions.fill( 0, StandardActionManager::LastType );
 
@@ -175,9 +176,9 @@
         enableAction( AddToFavoriteCollections, (favoritesModel!=0) && \
                (selectedIndex.model()!=reinterpret_cast<QAbstractItemModel*>(favoritesModel))
                
                                              && singleColSelected && (col != \
                Collection::root()) );
         //FIXME: better check if the collection is in the model, todo once \
                FavoriteCollectionsModel is in kdepimlibs/akonadi
-        enableAction( RemoveFromFavoriteCollections, (favoritesModel!=0) && \
(selectedIndex.model()!=reinterpret_cast<QAbstractItemModel*>(favoritesModel)) +      \
enableAction( RemoveFromFavoriteCollections, (favoriteSelectionModel!=0) && \
                (selectedIndex.model()!=reinterpret_cast<QAbstractItemModel*>(favoritesModel))
                
                                                   && singleColSelected && (col != \
                Collection::root()) );
-        enableAction( RenameFavoriteCollection, (favoritesModel!=0) && \
(selectedIndex.model()!=reinterpret_cast<QAbstractItemModel*>(favoritesModel)) +      \
enableAction( RenameFavoriteCollection, (favoriteSelectionModel!=0) && \
                (selectedIndex.model()!=reinterpret_cast<QAbstractItemModel*>(favoritesModel))
                
                                              && singleColSelected && (col != \
                Collection::root()) );
         enableAction( CopyCollectionToMenu, multiColSelected && (col != \
Collection::root()) );  } else {
@@ -525,6 +526,7 @@
     QWidget *parentWidget;
     QItemSelectionModel *collectionSelectionModel;
     QItemSelectionModel *itemSelectionModel;
+    QItemSelectionModel *favoriteSelectionModel;
     FavoriteCollectionsModel *favoritesModel;
     QVector<KAction*> actions;
     AgentManager *agentManager;
@@ -562,11 +564,18 @@
            SLOT(updateActions()) );
 }
 
-void Akonadi::StandardActionManager::setFavoriteCollectionsModel( \
FavoriteCollectionsModel *favoritesModel ) +void \
StandardActionManager::setFavoriteCollectionsModel( FavoriteCollectionsModel \
*favoritesModel )  {
   d->favoritesModel = favoritesModel;
 }
 
+void StandardActionManager::setFavoriteSelectionModel( QItemSelectionModel \
*selectionModel ) +{
+  d->favoriteSelectionModel = selectionModel;
+  connect( selectionModel, SIGNAL(selectionChanged( const QItemSelection&, const \
QItemSelection& )), +           SLOT(updateActions()) );
+}
+
 KAction* StandardActionManager::createAction( Type type )
 {
   Q_ASSERT( type >= 0 && type < LastType );
--- trunk/KDE/kdepimlibs/akonadi/standardactionmanager.h #999999:1000000
@@ -147,6 +147,13 @@
     void setFavoriteCollectionsModel( FavoriteCollectionsModel *favoritesModel );
 
     /**
+     * Sets the favorite collection selection model based on which the favorite
+     * collection related actions should operate. If none is set, all favorite \
modifications +     * actions will be disabled.
+     */
+    void setFavoriteSelectionModel( QItemSelectionModel *selectionModel );
+
+    /**
      * Creates the action of the given type and adds it to the action collection
      * specified in the constructor if it does not exist yet. The action is
      * connected to its default implementation provided by this class.


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

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