[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/akonadi/clients/akonadiconsole
From: Volker Krause <vkrause () kde ! org>
Date: 2008-10-05 20:49:27
Message-ID: 1223239767.882957.25805.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 868256 by vkrause:
Changing the model also changes the selection model, so update the
action manager accordingly.
M +11 -11 browserwidget.cpp
M +3 -4 browserwidget.h
M +0 -6 mainwidget.cpp
--- trunk/KDE/kdepim/akonadi/clients/akonadiconsole/browserwidget.cpp #868255:868256
@@ -33,6 +33,7 @@
#include <akonadi/itemmodifyjob.h>
#include <akonadi/collectionfilterproxymodel.h>
#include <akonadi/collectionpropertiesdialog.h>
+#include <akonadi/standardactionmanager.h>
#include <kcal/kcalmodel.h>
#include <kabc/kabcmodel.h>
@@ -66,8 +67,10 @@
QWidget( parent ),
mItemModel( 0 ),
mCurrentCollection( 0 ),
- mNepomukModel( 0 )
+ mNepomukModel( 0 ),
+ mStdActionManager( 0 )
{
+ Q_ASSERT( xmlGuiWindow );
QVBoxLayout *layout = new QVBoxLayout( this );
QSplitter *splitter = new QSplitter( Qt::Horizontal, this );
@@ -119,6 +122,11 @@
CollectionPropertiesDialog::registerPage( new CollectionInternalsPageFactory() );
Control::widgetNeedsAkonadi( this );
+
+ mStdActionManager = new StandardActionManager( xmlGuiWindow->actionCollection(), xmlGuiWindow );
+ mStdActionManager->setCollectionSelectionModel( mCollectionView->selectionModel() );
+ mStdActionManager->setItemSelectionModel( itemUi.itemView->selectionModel() );
+ mStdActionManager->createAllActions();
}
void BrowserWidget::collectionActivated(const QModelIndex & index)
@@ -238,6 +246,8 @@
itemUi.itemView->setModel( mItemModel );
if ( mCurrentCollection > 0 )
mItemModel->setCollection( Collection( mCurrentCollection ) );
+ if ( mStdActionManager )
+ mStdActionManager->setItemSelectionModel( itemUi.itemView->selectionModel() );
}
void BrowserWidget::save()
@@ -267,16 +277,6 @@
connect( store, SIGNAL(result(KJob*)), SLOT(saveResult(KJob*)) );
}
-QItemSelectionModel * BrowserWidget::collectionSelectionModel() const
-{
- return mCollectionView->selectionModel();
-}
-
-QItemSelectionModel * BrowserWidget::itemSelectionModel() const
-{
- return itemUi.itemView->selectionModel();
-}
-
void BrowserWidget::saveResult(KJob * job)
{
if ( job->error() ) {
--- trunk/KDE/kdepim/akonadi/clients/akonadiconsole/browserwidget.h #868255:868256
@@ -40,6 +40,7 @@
class CollectionModel;
class ItemModel;
class Job;
+class StandardActionManager;
}
class BrowserWidget: public QWidget
@@ -47,11 +48,8 @@
Q_OBJECT
public:
- explicit BrowserWidget( KXmlGuiWindow *xmlGuiWindow = 0, QWidget *parent = 0 );
+ explicit BrowserWidget( KXmlGuiWindow *xmlGuiWindow, QWidget *parent = 0 );
- QItemSelectionModel *collectionSelectionModel() const;
- QItemSelectionModel *itemSelectionModel() const;
-
private slots:
void collectionActivated( const QModelIndex &index );
void itemActivated( const QModelIndex &index );
@@ -72,6 +70,7 @@
Akonadi::Item mCurrentItem;
QStandardItemModel *mAttrModel;
QStandardItemModel *mNepomukModel;
+ Akonadi::StandardActionManager *mStdActionManager;
};
#endif
--- trunk/KDE/kdepim/akonadi/clients/akonadiconsole/mainwidget.cpp #868255:868256
@@ -28,7 +28,6 @@
#include <akonadi/agentinstancewidget.h>
#include <akonadi/agentfilterproxymodel.h>
-#include <akonadi/standardactionmanager.h>
#include <akonadi/searchcreatejob.h>
#include <KAction>
@@ -55,11 +54,6 @@
tabWidget->addTab( browser, "Browser" );
tabWidget->addTab( new DebugWidget( tabWidget ), "Debugger" );
- Akonadi::StandardActionManager *actMgr = new Akonadi::StandardActionManager( parent->actionCollection(), this );
- actMgr->setCollectionSelectionModel( browser->collectionSelectionModel() );
- actMgr->setItemSelectionModel( browser->itemSelectionModel() );
- actMgr->createAllActions();
-
KAction *action = parent->actionCollection()->addAction( "akonadiconsole_search" );
action->setText( "Create Search" );
connect( action, SIGNAL( triggered() ), this, SLOT( createSearch() ) );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic