author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kaddressbook/viewmanager.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | kaddressbook/viewmanager.h | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h new file mode 100644 index 0000000..a18e87d --- a/dev/null +++ b/kaddressbook/viewmanager.h | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | This file is part of KAddressBook. | ||
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #ifndef VIEWMANAGER_H | ||
25 | #define VIEWMANAGER_H | ||
26 | |||
27 | #include <qwidget.h> | ||
28 | #include <qstringlist.h> | ||
29 | #include <kaddressbookview.h> | ||
30 | #include <qdict.h> | ||
31 | |||
32 | class KAction; | ||
33 | class KSelectAction; | ||
34 | |||
35 | class KABCore; | ||
36 | class QWidgetStack; | ||
37 | class QDropEvent; | ||
38 | |||
39 | namespace KABC { class AddressBook; } | ||
40 | |||
41 | /** | ||
42 | The view manager manages the views and everything related to them. The | ||
43 | manager will load the views at startup and display a view when told to | ||
44 | make one active. | ||
45 | |||
46 | The view manager will also create and manage all dialogs directly related to | ||
47 | views (ie: AddView, ConfigureView, DeleteView, etc). | ||
48 | */ | ||
49 | class ViewManager : public QWidget | ||
50 | { | ||
51 | Q_OBJECT | ||
52 | public: | ||
53 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); | ||
54 | ~ViewManager(); | ||
55 | |||
56 | void restoreSettings(); | ||
57 | void saveSettings(); | ||
58 | |||
59 | void unloadViews(); | ||
60 | KSelectAction * getFilterAction() { return mActionSelectFilter; } | ||
61 | |||
62 | QStringList selectedUids() const; | ||
63 | QStringList selectedEmails() const; | ||
64 | KABC::Addressee::List selectedAddressees() const; | ||
65 | |||
66 | public slots: | ||
67 | |||
68 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); | ||
69 | void setSelected( const QString &uid, bool); | ||
70 | //US added another method with no parameter, since my moc compiler does not support default parameters. | ||
71 | void setSelected(); | ||
72 | |||
73 | |||
74 | |||
75 | //US added another method with no parameter, since my moc compiler does not support default parameters. | ||
76 | void refreshView(); | ||
77 | void refreshView( const QString &uid); | ||
78 | |||
79 | void editView(); | ||
80 | void deleteView(); | ||
81 | void addView(); | ||
82 | |||
83 | protected slots: | ||
84 | /** | ||
85 | Called whenever the user drops something in the active view. | ||
86 | This method will try to decode what was dropped, and if it was | ||
87 | a valid addressee, add it to the addressbook. | ||
88 | */ | ||
89 | void dropped( QDropEvent* ); | ||
90 | |||
91 | /** | ||
92 | Called whenever the user attempts to start a drag in the view. | ||
93 | This method will convert all the selected addressees into text (vcard) | ||
94 | and create a drag object. | ||
95 | */ | ||
96 | void startDrag(); | ||
97 | |||
98 | signals: | ||
99 | /** | ||
100 | Emitted whenever the user selects an entry in the view. | ||
101 | */ | ||
102 | void selected( const QString &uid ); | ||
103 | void deleteRequest( ); | ||
104 | |||
105 | /** | ||
106 | Emitted whenever the user activates an entry in the view. | ||
107 | */ | ||
108 | void executed( const QString &uid ); | ||
109 | |||
110 | /** | ||
111 | Emitted whenever the address book is modified in some way. | ||
112 | */ | ||
113 | void modified(); | ||
114 | |||
115 | /** | ||
116 | Emitted whenever a url is dragged on a view. | ||
117 | */ | ||
118 | void urlDropped( const KURL& ); | ||
119 | |||
120 | private slots: | ||
121 | void setActiveView( const QString &name ); | ||
122 | void setActiveFilter( int index ); | ||
123 | void configureFilters(); | ||
124 | |||
125 | private: | ||
126 | void createViewFactories(); | ||
127 | QStringList filterNames() const; | ||
128 | int filterPosition( const QString &name ) const; | ||
129 | QStringList viewNames() const; | ||
130 | int viewPosition( const QString &name ) const; | ||
131 | void initActions(); | ||
132 | void initGUI(); | ||
133 | |||
134 | KABCore *mCore; | ||
135 | |||
136 | Filter mCurrentFilter; | ||
137 | Filter::List mFilterList; | ||
138 | |||
139 | QDict<KAddressBookView> mViewDict; | ||
140 | QDict<ViewFactory> mViewFactoryDict; | ||
141 | QStringList mViewNameList; | ||
142 | |||
143 | QWidgetStack *mViewWidgetStack; | ||
144 | KAddressBookView *mActiveView; | ||
145 | |||
146 | KAction *mActionDeleteView; | ||
147 | KSelectAction *mActionSelectFilter; | ||
148 | KSelectAction *mActionSelectView; | ||
149 | |||
150 | }; | ||
151 | |||
152 | #endif | ||