Use qtpaths directly
[kdepim.git] / kaddressbook / mainwidget.h
blob32924be591c794e752fd977008ccb8df8659a3c8
1 /*
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.
21 #ifndef MAINWIDGET_H
22 #define MAINWIDGET_H
24 #include "kaddressbook_export.h"
25 #include <AkonadiCore/Item>
26 #include <QItemSelection>
27 #include <QWidget>
29 namespace GrantleeTheme
31 class ThemeManager;
33 class QAction;
34 namespace Akonadi
36 class Collection;
37 class ContactGroupViewer;
38 class ContactViewer;
39 class ContactsFilterProxyModel;
40 class EntityMimeTypeFilterModel;
41 class EntityTreeView;
42 class Item;
43 class StandardContactActionManager;
44 class EntityTreeModel;
47 namespace KAddressBookGrantlee
49 class GrantleeContactFormatter;
50 class GrantleeContactGroupFormatter;
53 class ContactSwitcher;
54 class KActionCollection;
55 class KXMLGUIClient;
56 class ModelColumnManager;
57 class QAbstractItemModel;
58 class QItemSelectionModel;
59 class QModelIndex;
60 class QSplitter;
61 class QStackedWidget;
62 class QuickSearchWidget;
63 class XXPortManager;
64 class QActionGroup;
65 class CategorySelectWidget;
66 class CategoryFilterProxyModel;
68 class KADDRESSBOOK_EXPORT MainWidget : public QWidget
70 Q_OBJECT
72 public:
73 explicit MainWidget(KXMLGUIClient *guiClient, QWidget *parent = Q_NULLPTR);
74 ~MainWidget();
76 XXPortManager *importManager() const;
77 void updateQuickSearchText();
79 public Q_SLOTS:
80 void newContact();
81 void newGroup();
82 void print();
83 void printPreview();
84 void configure();
85 void mergeContacts();
86 void slotSearchDuplicateContacts();
88 void handleCommandLine(const QStringList &arguments);
90 private Q_SLOTS:
91 void delayedInit();
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);
100 void restoreState();
101 void saveState();
103 void slotGrantleeThemeSelected();
104 void slotGrantleeThemesUpdated();
105 void slotCheckNewCalendar(const QModelIndex &parent, int begin, int end);
107 void slotSendMail();
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();
120 private:
121 const Akonadi::Item::List collectSelectedAllContactsItem(QItemSelectionModel *model);
122 void initGrantleeThemeName();
123 void setupGui();
124 void setupActions(KActionCollection *);
125 bool showQRCodes();
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;
178 #endif