2 This file is part of KAddressBook.
4 Copyright (c) 2007 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include "kaddressbook_export.h"
25 #include <AkonadiCore/Item>
28 namespace GrantleeTheme
30 class GrantleeThemeManager
;
36 class ContactGroupViewer
;
38 class ContactsFilterProxyModel
;
39 class EntityMimeTypeFilterModel
;
42 class StandardContactActionManager
;
43 class EntityTreeModel
;
46 namespace KAddressBookGrantlee
48 class GrantleeContactFormatter
;
49 class GrantleeContactGroupFormatter
;
52 class ContactSwitcher
;
53 class KActionCollection
;
55 class ModelColumnManager
;
56 class QAbstractItemModel
;
57 class QItemSelectionModel
;
61 class QuickSearchWidget
;
64 class CategorySelectWidget
;
65 class CategoryFilterProxyModel
;
67 class KADDRESSBOOK_EXPORT MainWidget
: public QWidget
72 explicit MainWidget(KXMLGUIClient
*guiClient
, QWidget
*parent
= Q_NULLPTR
);
75 XXPortManager
*importManager() const;
76 void updateQuickSearchText();
85 void slotSearchDuplicateContacts();
87 void handleCommandLine(const QStringList
&arguments
);
92 void itemSelected(const Akonadi::Item
&item
);
93 void itemSelectionChanged(const QModelIndex
&, const QModelIndex
&);
94 void selectFirstItem();
96 void setViewMode(QAction
*action
);
97 void setQRCodeShow(bool on
);
102 void slotGrantleeThemeSelected();
103 void slotGrantleeThemesUpdated();
104 void slotCheckNewCalendar(const QModelIndex
&parent
, int begin
, int end
);
107 void slotSendMailsError(const QString
&error
);
109 void slotSendMails(const QStringList
&emails
);
111 void slotDebugBaloo();
112 void slotSendVcards();
113 void slotSendVcardsError(const QString
&error
);
114 void slotServerSideSubscription();
115 void slotCurrentCollectionChanged(const Akonadi::Collection
&col
);
116 void slotCheckGravatar();
118 const Akonadi::Item::List
collectSelectedAllContactsItem(QItemSelectionModel
*model
);
119 void initGrantleeThemeName();
121 void setupActions(KActionCollection
*);
123 void setViewMode(int mode
);
124 void saveSplitterStates() const;
125 void restoreSplitterStates();
127 QAbstractItemModel
*allContactsModel();
130 * Returns the address book collection that is currently
131 * selected by the user or an invalid collection if no
132 * address book is selected.
134 Akonadi::Collection
currentAddressBook() const;
136 Akonadi::EntityMimeTypeFilterModel
*mCollectionTree
;
137 Akonadi::EntityMimeTypeFilterModel
*mItemTree
;
138 Akonadi::EntityMimeTypeFilterModel
*mAllContactsModel
;
139 Akonadi::ContactsFilterProxyModel
*mContactsFilterModel
;
140 CategoryFilterProxyModel
*mCategoryFilterModel
;
142 QuickSearchWidget
*mQuickSearchWidget
;
143 Akonadi::EntityTreeView
*mCollectionView
;
144 Akonadi::EntityTreeView
*mItemView
;
145 CategorySelectWidget
*mCategorySelectWidget
;
147 QWidget
*mDetailsPane
;
148 QStackedWidget
*mDetailsViewStack
;
149 ContactSwitcher
*mContactSwitcher
;
151 QSplitter
*mMainWidgetSplitter1
;
152 QSplitter
*mMainWidgetSplitter2
;
153 Akonadi::ContactViewer
*mContactDetails
;
154 Akonadi::ContactGroupViewer
*mContactGroupDetails
;
155 QWidget
*mEmptyDetails
;
156 Akonadi::StandardContactActionManager
*mActionManager
;
157 QItemSelectionModel
*mCollectionSelectionModel
;
159 QActionGroup
*mViewModeGroup
;
161 XXPortManager
*mXXPortManager
;
162 ModelColumnManager
*mModelColumnManager
;
163 KXMLGUIClient
*mXmlGuiClient
;
164 KAddressBookGrantlee::GrantleeContactFormatter
*mFormatter
;
165 KAddressBookGrantlee::GrantleeContactGroupFormatter
*mGroupFormatter
;
166 GrantleeTheme::GrantleeThemeManager
*mGrantleeThemeManager
;
167 Akonadi::EntityTreeModel
*entityTreeModel() const;
168 QAction
*mQuickSearchAction
;
169 QAction
*mServerSideSubscription
;