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