french -> French
[kdepim.git] / kaddressbook / mainwidget.h
blobfe3171d116c6cafb98d56a89c7e50e0e954f950a
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"
26 #include <QWidget>
28 namespace GrantleeTheme {
29 class GrantleeThemeManager;
32 namespace Akonadi {
33 class Collection;
34 class ContactGroupViewer;
35 class ContactViewer;
36 class ContactsFilterProxyModel;
37 class EntityMimeTypeFilterModel;
38 class EntityTreeView;
39 class Item;
40 class ItemView;
41 class StandardContactActionManager;
44 namespace KAddressBookGrantlee {
45 class GrantleeContactFormatter;
46 class GrantleeContactGroupFormatter;
49 class ContactSwitcher;
50 class KActionCollection;
51 class KXMLGUIClient;
52 class ModelColumnManager;
53 class QAbstractItemModel;
54 class QItemSelectionModel;
55 class QModelIndex;
56 class QSplitter;
57 class QStackedWidget;
58 class QuickSearchWidget;
59 class XXPortManager;
60 class QActionGroup;
62 class KADDRESSBOOK_EXPORT MainWidget : public QWidget
64 Q_OBJECT
66 public:
67 explicit MainWidget( KXMLGUIClient *guiClient, QWidget *parent = 0 );
68 ~MainWidget();
70 XXPortManager *importManager() const;
72 public Q_SLOTS:
73 void newContact();
74 void newGroup();
75 void print();
76 void printPreview();
77 void configure();
78 void mergeContacts();
79 void slotSearchDuplicateContacts();
81 bool handleCommandLine();
83 private Q_SLOTS:
84 void delayedInit();
86 void itemSelected( const Akonadi::Item &item );
87 void itemSelectionChanged( const QModelIndex &, const QModelIndex & );
88 void selectFirstItem();
90 void setViewMode( QAction *action );
91 void setQRCodeShow( bool on );
93 void restoreState();
94 void saveState();
96 void slotGrantleeThemeSelected();
97 void slotGrantleeThemesUpdated();
98 void slotDebugNepomuk();
100 private:
101 void initGrantleeThemeName();
102 void setupGui();
103 void setupActions( KActionCollection * );
104 bool showQRCodes();
105 void setViewMode( int mode );
106 void saveSplitterStates() const;
107 void restoreSplitterStates();
109 QAbstractItemModel *allContactsModel();
112 * Returns the address book collection that is currently
113 * selected by the user or an invalid collection if no
114 * address book is selected.
116 Akonadi::Collection currentAddressBook() const;
118 Akonadi::EntityMimeTypeFilterModel *mCollectionTree;
119 Akonadi::EntityMimeTypeFilterModel *mItemTree;
120 Akonadi::EntityMimeTypeFilterModel *mAllContactsModel;
121 Akonadi::ContactsFilterProxyModel *mContactsFilterModel;
123 QuickSearchWidget *mQuickSearchWidget;
124 Akonadi::EntityTreeView *mCollectionView;
125 Akonadi::EntityTreeView *mItemView;
126 QWidget *mDetailsPane;
127 QStackedWidget *mDetailsViewStack;
128 ContactSwitcher *mContactSwitcher;
130 QSplitter *mMainWidgetSplitter1;
131 QSplitter *mMainWidgetSplitter2;
132 Akonadi::ContactViewer *mContactDetails;
133 Akonadi::ContactGroupViewer *mContactGroupDetails;
134 QWidget *mEmptyDetails;
135 Akonadi::StandardContactActionManager *mActionManager;
136 QItemSelectionModel *mCollectionSelectionModel;
138 QActionGroup *mViewModeGroup;
140 XXPortManager *mXXPortManager;
141 ModelColumnManager *mModelColumnManager;
142 KXMLGUIClient *mXmlGuiClient;
143 KAddressBookGrantlee::GrantleeContactFormatter *mFormatter;
144 KAddressBookGrantlee::GrantleeContactGroupFormatter *mGroupFormatter;
145 GrantleeTheme::GrantleeThemeManager *mGrantleeThemeManager;
148 #endif