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

List:       kde-commits
Subject:    KDE/kdepim/kaddressbook
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2010-06-20 10:28:02
Message-ID: 20100620102802.7DC93AC8D9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1140326 by tokoe:

Disable address book related actions when all address books
have been removed


 M  +8 -6      standardcontactactionmanager.cpp  


--- trunk/KDE/kdepim/kaddressbook/standardcontactactionmanager.cpp #1140325:1140326
@@ -135,23 +135,25 @@
         }
       }
 
+      bool enableAddressBookActions = false;
       if ( mCollectionSelectionModel ) {
         if ( mCollectionSelectionModel->selectedRows().count() == 1 ) {
           const QModelIndex index = \
mCollectionSelectionModel->selectedRows().first();  if ( index.isValid() ) {
             const Collection collection = index.data( \
EntityTreeModel::CollectionRole ).value<Collection>();  if ( collection.isValid() ) {
-              // action is only enabled if the collection is a resource collection
-              bool isEnabled = (collection.parentCollection() == \
                Collection::root());
-              if ( mActions.contains( \
                StandardContactActionManager::DeleteAddressBook ) )
-                mActions[ StandardContactActionManager::DeleteAddressBook \
                ]->setEnabled( isEnabled );
-              if ( mActions.contains( \
                StandardContactActionManager::ConfigureAddressBook ) )
-                mActions[ StandardContactActionManager::ConfigureAddressBook \
]->setEnabled( isEnabled ); +              // actions are only enabled if the \
collection is a resource collection +              enableAddressBookActions = \
(collection.parentCollection() == Collection::root());  }
           }
         }
       }
 
+      if ( mActions.contains( StandardContactActionManager::DeleteAddressBook ) )
+        mActions[ StandardContactActionManager::DeleteAddressBook ]->setEnabled( \
enableAddressBookActions ); +      if ( mActions.contains( \
StandardContactActionManager::ConfigureAddressBook ) ) +        mActions[ \
StandardContactActionManager::ConfigureAddressBook ]->setEnabled( \
enableAddressBookActions ); +
       if ( mActions.contains( StandardContactActionManager::CreateContact ) )
         mActions[ StandardContactActionManager::CreateContact ]->setEnabled( \
                hasWritableCollection( KABC::Addressee::mimeType() ) );
       if ( mActions.contains( StandardContactActionManager::CreateContactGroup ) )


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

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