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>
26 #include <QItemSelection>
29 namespace GrantleeTheme
37 class ContactGroupViewer
;
39 class ContactsFilterProxyModel
;
40 class EntityMimeTypeFilterModel
;
43 class StandardContactActionManager
;
44 class EntityTreeModel
;
47 namespace KAddressBookGrantlee
49 class GrantleeContactFormatter
;
50 class GrantleeContactGroupFormatter
;
53 class ContactSwitcher
;
54 class KActionCollection
;
56 class ModelColumnManager
;
57 class QAbstractItemModel
;
58 class QItemSelectionModel
;
62 class QuickSearchWidget
;
65 class CategorySelectWidget
;
66 class CategoryFilterProxyModel
;
68 class KADDRESSBOOK_EXPORT MainWidget
: public QWidget
73 explicit MainWidget(KXMLGUIClient
*guiClient
, QWidget
*parent
= Q_NULLPTR
);
76 XXPortManager
*importManager() const;
77 void updateQuickSearchText();
86 void slotSearchDuplicateContacts();
88 void handleCommandLine(const QStringList
&arguments
);
93 void itemSelected(const Akonadi::Item
&item
);
94 void itemSelectionChanged(const QModelIndex
&, const QModelIndex
&);
95 void selectFirstItem();
97 void setViewMode(QAction
*action
);
98 void setQRCodeShow(bool on
);
103 void slotGrantleeThemeSelected();
104 void slotGrantleeThemesUpdated();
105 void slotCheckNewCalendar(const QModelIndex
&parent
, int begin
, int end
);
108 void slotSendMailsError(const QString
&error
);
110 void slotSendMails(const QStringList
&emails
);
112 void slotDebugBaloo();
113 void slotSendVcards();
114 void slotSendVcardsError(const QString
&error
);
115 void slotServerSideSubscription();
116 void slotCurrentCollectionChanged(const Akonadi::Collection
&col
);
117 void slotCheckGravatar();
118 void slotModifyContactFinished(KJob
*job
);
119 void slotSelectionChanged();
121 const Akonadi::Item::List
collectSelectedAllContactsItem(QItemSelectionModel
*model
);
122 void initGrantleeThemeName();
124 void setupActions(KActionCollection
*);
126 void setViewMode(int mode
);
127 void saveSplitterStates() const;
128 void restoreSplitterStates();
130 QAbstractItemModel
*allContactsModel();
133 * Returns the address book collection that is currently
134 * selected by the user or an invalid collection if no
135 * address book is selected.
137 Akonadi::Collection
currentAddressBook() const;
139 Akonadi::EntityMimeTypeFilterModel
*mCollectionTree
;
140 Akonadi::EntityMimeTypeFilterModel
*mItemTree
;
141 Akonadi::EntityMimeTypeFilterModel
*mAllContactsModel
;
142 Akonadi::ContactsFilterProxyModel
*mContactsFilterModel
;
143 CategoryFilterProxyModel
*mCategoryFilterModel
;
145 QuickSearchWidget
*mQuickSearchWidget
;
146 Akonadi::EntityTreeView
*mCollectionView
;
147 Akonadi::EntityTreeView
*mItemView
;
148 CategorySelectWidget
*mCategorySelectWidget
;
150 QWidget
*mDetailsPane
;
151 QStackedWidget
*mDetailsViewStack
;
152 ContactSwitcher
*mContactSwitcher
;
154 QSplitter
*mMainWidgetSplitter1
;
155 QSplitter
*mMainWidgetSplitter2
;
156 Akonadi::ContactViewer
*mContactDetails
;
157 Akonadi::ContactGroupViewer
*mContactGroupDetails
;
158 QWidget
*mEmptyDetails
;
159 Akonadi::StandardContactActionManager
*mActionManager
;
160 QItemSelectionModel
*mCollectionSelectionModel
;
162 QActionGroup
*mViewModeGroup
;
164 XXPortManager
*mXXPortManager
;
165 ModelColumnManager
*mModelColumnManager
;
166 KXMLGUIClient
*mXmlGuiClient
;
167 KAddressBookGrantlee::GrantleeContactFormatter
*mFormatter
;
168 KAddressBookGrantlee::GrantleeContactGroupFormatter
*mGroupFormatter
;
169 GrantleeTheme::ThemeManager
*mGrantleeThemeManager
;
170 Akonadi::EntityTreeModel
*entityTreeModel() const;
171 QAction
*mQuickSearchAction
;
172 QAction
*mServerSideSubscription
;
173 QAction
*mSearchGravatarAction
;
174 QAction
*mSendVcardAction
;
175 QAction
*mSendEmailAction
;