[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-08-10 12:20:15
Message-ID: 20100810122015.E8150AC7E8 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1161594 by tokoe:

Use the default action implementations from the StandardContactActionManager


 M  +8 -45     mainwidget.cpp  
 M  +0 -4      mainwidget.h  


--- trunk/KDE/kdepim/kaddressbook/mainwidget.cpp #1161593:1161594
@@ -183,10 +183,15 @@
 
   mXXPortManager->setSelectionModel( mItemView->selectionModel() );
 
+  mActionManager = new Akonadi::StandardContactActionManager( \
guiClient->actionCollection(), this ); +  \
mActionManager->setCollectionSelectionModel( mCollectionView->selectionModel() ); +  \
mActionManager->setItemSelectionModel( mItemView->selectionModel() ); +  \
mActionManager->createAllActions(); +
   connect( mItemView, SIGNAL( currentChanged( const Akonadi::Item& ) ),
            this, SLOT( itemSelected( const Akonadi::Item& ) ) );
   connect( mItemView, SIGNAL( doubleClicked( const Akonadi::Item& ) ),
-           this, SLOT( editItem( const Akonadi::Item& ) ) );
+           mActionManager->action( Akonadi::StandardContactActionManager::EditItem \
), SLOT( trigger() ) );  connect( mItemView->selectionModel(), SIGNAL( \
                currentChanged( const QModelIndex&, const QModelIndex& ) ),
            this, SLOT( itemSelectionChanged( const QModelIndex&, const QModelIndex& \
) ) );  
@@ -197,19 +202,6 @@
 
   Akonadi::Control::widgetNeedsAkonadi( this );
 
-  mActionManager = new Akonadi::StandardContactActionManager( \
                guiClient->actionCollection(), this );
-  mActionManager->setCollectionSelectionModel( mCollectionView->selectionModel() );
-  mActionManager->setItemSelectionModel( mItemView->selectionModel() );
-
-  mActionManager->createAllActions();
-
-  connect( mActionManager->action( \
                Akonadi::StandardContactActionManager::CreateContact ), SIGNAL( \
                triggered( bool ) ),
-           this, SLOT( newContact() ) );
-  connect( mActionManager->action( \
Akonadi::StandardContactActionManager::CreateContactGroup ), SIGNAL( triggered( bool \
                ) ),
-           this, SLOT( newGroup() ) );
-  connect( mActionManager, SIGNAL( editItem( const Akonadi::Item& ) ),
-           this, SLOT( editItem( const Akonadi::Item& ) ) );
-
   mModelColumnManager = new ModelColumnManager( \
GlobalContactModel::instance()->model(), this );  mModelColumnManager->setWidget( \
mItemView->header() );  mModelColumnManager->load();
@@ -520,29 +512,14 @@
 
 void MainWidget::newContact()
 {
-  Akonadi::ContactEditorDialog dlg( Akonadi::ContactEditorDialog::CreateMode, this \
                );
-  dlg.setDefaultAddressBook( currentAddressBook() );
-
-  dlg.exec();
+  mActionManager->action( Akonadi::StandardContactActionManager::CreateContact \
)->trigger();  }
 
 void MainWidget::newGroup()
 {
-  Akonadi::ContactGroupEditorDialog dlg( \
                Akonadi::ContactGroupEditorDialog::CreateMode, this );
-  dlg.setDefaultAddressBook( currentAddressBook() );
-
-  dlg.exec();
+  mActionManager->action( Akonadi::StandardContactActionManager::CreateContactGroup \
)->trigger();  }
 
-void MainWidget::editItem( const Akonadi::Item &reference )
-{
-  if ( Akonadi::MimeTypeChecker::isWantedItem( reference, \
                KABC::Addressee::mimeType() ) ) {
-    editContact( reference );
-  } else if ( Akonadi::MimeTypeChecker::isWantedItem( reference, \
                KABC::ContactGroup::mimeType() ) ) {
-    editGroup( reference );
-  }
-}
-
 /**
  * Depending on the mime type of the selected item, this method
  * brings up the right view on the detail view stack and sets the
@@ -608,20 +585,6 @@
   Settings::self()->setUseSimpleMode( on );
 }
 
-void MainWidget::editContact( const Akonadi::Item &contact )
-{
-  Akonadi::ContactEditorDialog dlg( Akonadi::ContactEditorDialog::EditMode, this );
-  dlg.setContact( contact );
-  dlg.exec();
-}
-
-void MainWidget::editGroup( const Akonadi::Item &group )
-{
-  Akonadi::ContactGroupEditorDialog dlg( \
                Akonadi::ContactGroupEditorDialog::EditMode, this );
-  dlg.setContactGroup( group );
-  dlg.exec();
-}
-
 Akonadi::Collection MainWidget::currentAddressBook() const
 {
   if ( mCollectionView->selectionModel() && \
                mCollectionView->selectionModel()->hasSelection() ) {
--- trunk/KDE/kdepim/kaddressbook/mainwidget.h #1161593:1161594
@@ -65,7 +65,6 @@
   private Q_SLOTS:
     void delayedInit();
 
-    void editItem( const Akonadi::Item &item );
     void itemSelected( const Akonadi::Item &item );
     void itemSelectionChanged( const QModelIndex&, const QModelIndex& );
     void selectFirstItem();
@@ -83,9 +82,6 @@
     void setupGui();
     void setupActions( KActionCollection* );
 
-    void editContact( const Akonadi::Item& );
-    void editGroup( const Akonadi::Item& );
-
     QAbstractItemModel* allContactsModel();
 
     /**


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

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