[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-05-08 14:09:28
Message-ID: 20100508140928.B2466AC8B0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1124271 by tokoe:
Allow the user to select which address book content shall be
included in the middle pane via checkboxes. Now it is possible
to search over all contacts again
BUG: 226383
M +1 -1 CMakeLists.txt
M +53 -24 mainwidget.cpp
M +2 -0 mainwidget.h
--- trunk/KDE/kdepim/kaddressbook/CMakeLists.txt #1124270:1124271
@@ -64,7 +64,7 @@
kde4_add_kcfg_files(kaddressbook_LIB_SRCS settings.kcfgc)
kde4_add_library(kaddressbookprivate SHARED ${kaddressbook_LIB_SRCS})
-target_link_libraries(kaddressbookprivate kdepim ${KDE4_KDEUI_LIBS} \
${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_KABC_LIBS} ${KDEPIMLIBS_AKONADI_CONTACT_LIBS} \
${KDEPIMLIBS_KLDAP_LIBS} ${KDE4_KUTILS_LIBS} ) \
+target_link_libraries(kaddressbookprivate kdepim akonadi_next ${KDE4_KDEUI_LIBS} \
${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_KABC_LIBS} ${KDEPIMLIBS_AKONADI_CONTACT_LIBS} \
${KDEPIMLIBS_KLDAP_LIBS} ${KDE4_KUTILS_LIBS} )
if(QGPGME_FOUND)
target_link_libraries(kaddressbookprivate ${QGPGME_LIBRARIES})
--- trunk/KDE/kdepim/kaddressbook/mainwidget.cpp #1124270:1124271
@@ -19,17 +19,19 @@
*/
#include "mainwidget.h"
-#include <QPrinter>
-#include <QPrintDialog>
-#include <QtGui/QAction>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QHeaderView>
-#include <QtGui/QListView>
-#include <QtGui/QSortFilterProxyModel>
-#include <QtGui/QSplitter>
-#include <QtGui/QStackedWidget>
+#include "contactswitcher.h"
+#include "globalcontactmodel.h"
+#include "kdescendantsproxymodel_p.h"
+#include "modelcolumnmanager.h"
+#include "printing/printingwizard.h"
+#include "quicksearchwidget.h"
+#include "settings.h"
+#include "standardcontactactionmanager.h"
+#include "xxportmanager.h"
+#include <akonadi/akonadi_next/collectionselectionproxymodel.h>
+#include <akonadi/akonadi_next/entitymodelstatesaver.h>
#include <akonadi/collectionfilterproxymodel.h>
#include <akonadi/collectionmodel.h>
#include <akonadi/contact/contactdefaultactions.h>
@@ -50,7 +52,6 @@
#include <kactioncollection.h>
#include <kabc/addressee.h>
#include <kabc/contactgroup.h>
-#include "kdescendantsproxymodel_p.h"
#include <kicon.h>
#include <klineedit.h>
#include <klocale.h>
@@ -61,16 +62,16 @@
#include <kxmlguiwindow.h>
#include <libkdepim/uistatesaver.h>
-#include "contactswitcher.h"
-#include "globalcontactmodel.h"
-#include "modelcolumnmanager.h"
-#include "quicksearchwidget.h"
-#include "settings.h"
-#include "standardcontactactionmanager.h"
-#include "xxportmanager.h"
+#include <QtGui/QAction>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QHeaderView>
+#include <QtGui/QListView>
+#include <QtGui/QPrinter>
+#include <QtGui/QPrintDialog>
+#include <QtGui/QSortFilterProxyModel>
+#include <QtGui/QSplitter>
+#include <QtGui/QStackedWidget>
-#include "printing/printingwizard.h"
-
MainWidget::MainWidget( KXMLGUIClient *guiClient, QWidget *parent )
: QWidget( parent ), mAllContactsModel( 0 )
{
@@ -94,8 +95,13 @@
* | mAllContactsModel
* | ^
* | |
- * mCollectionView -> selectionProxyModel descendantsModel
- * ^ ^ ^
+ * mCollectionView selectionProxyModel descendantsModel
+ * ^ ^ ^ ^
+ * | | | |
+ * | selectionModel | |
+ * | | | |
+ * proxyModel ---------' | |
+ * ^ | |
* | | |
* mCollectionTree | |
* ^ | |
@@ -106,9 +112,12 @@
*
* GlobalContactModel::instance(): The global contact model (contains \
collections and items)
* mCollectionTree: Filters out all items
+ * proxyModel: Allows the user to select collections by \
checkboxes + * selectionModel: Represents the selected \
collections that have been selected in + * \
proxyModel
* mCollectionView: Shows the collections (address books) in a \
view
* selectionProxyModel: Filters out all collections and items that \
are no children
- * of the collection currently selected in \
mCollectionView + * of the collections currently \
selected in selectionModel
* mItemTree: Filters out all collections
* mContactsFilterModel: Filters the contacts by the content of \
mQuickSearchWidget
* mItemView: Shows the items (contacts and contact groups) \
in a view @@ -122,9 +131,20 @@
mCollectionTree->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() );
mCollectionTree->setHeaderGroup( Akonadi::EntityTreeModel::CollectionTreeHeaders \
);
+ Akonadi::CollectionSelectionProxyModel *proxyModel = new \
Akonadi::CollectionSelectionProxyModel( this ); + proxyModel->setDynamicSortFilter( \
true ); + proxyModel->setSortCaseSensitivity( Qt::CaseInsensitive );
+
+ mCollectionSelectionStateSaver = new Akonadi::EntityModelStateSaver( proxyModel, \
this ); + mCollectionSelectionStateSaver->addRole( Qt::CheckStateRole, "CheckState" \
); +
+ QItemSelectionModel* selectionModel = new QItemSelectionModel( proxyModel );
+ proxyModel->setSelectionModel( selectionModel );
+ proxyModel->setSourceModel( mCollectionTree );
+
mXXPortManager->setItemModel( allContactsModel() );
- mCollectionView->setModel( mCollectionTree );
+ mCollectionView->setModel( proxyModel );
mCollectionView->setXmlGuiClient( guiClient );
mCollectionView->header()->setDefaultAlignment( Qt::AlignCenter );
mCollectionView->header()->setSortIndicatorShown( false );
@@ -132,7 +152,7 @@
connect( mCollectionView, SIGNAL( currentChanged( const Akonadi::Collection& ) ),
mXXPortManager, SLOT( setDefaultAddressBook( const Akonadi::Collection& ) \
) );
- KSelectionProxyModel *selectionProxyModel = new KSelectionProxyModel( \
mCollectionView->selectionModel(), + KSelectionProxyModel *selectionProxyModel = new \
KSelectionProxyModel( selectionModel,
\
this ); selectionProxyModel->setSourceModel( GlobalContactModel::instance()->model() \
); selectionProxyModel->setFilterBehavior( \
KSelectionProxyModel::ChildrenOfExactSelection ); @@ -205,6 +225,10 @@
restorer->restoreState( group );
}
{
+ const KConfigGroup group( Settings::self()->config(), "CollectionSelection" );
+ mCollectionSelectionStateSaver->restoreConfig( group );
+ }
+ {
const KConfigGroup group( Settings::self()->config(), "ItemViewState" );
Akonadi::EntityTreeViewStateSaver *restorer = new \
Akonadi::EntityTreeViewStateSaver( mItemView ); restorer->restoreState( group );
@@ -224,6 +248,11 @@
group.sync();
}
{
+ KConfigGroup group( Settings::self()->config(), "CollectionSelection" );
+ mCollectionSelectionStateSaver->saveConfig( group );
+ group.sync();
+ }
+ {
KConfigGroup group( Settings::self()->config(), "ItemViewState" );
Akonadi::EntityTreeViewStateSaver saver( mItemView );
saver.saveState( group );
--- trunk/KDE/kdepim/kaddressbook/mainwidget.h #1124270:1124271
@@ -31,6 +31,7 @@
class ContactViewer;
class ContactsFilterModel;
class EntityMimeTypeFilterModel;
+class EntityModelStateSaver;
class EntityTreeView;
class Item;
class ItemView;
@@ -106,6 +107,7 @@
Akonadi::ContactGroupViewer *mContactGroupDetails;
QWidget *mEmptyDetails;
Akonadi::StandardContactActionManager *mActionManager;
+ Akonadi::EntityModelStateSaver *mCollectionSelectionStateSaver;
XXPortManager *mXXPortManager;
ModelColumnManager *mModelColumnManager;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic