-rw-r--r-- | kaddressbook/viewmanager.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index ab5d372..4bbdbc7 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -1,161 +1,163 @@ | |||
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 | //Added by qt3to4: | ||
30 | #include <QDropEvent> | ||
29 | #include <kaddressbookview.h> | 31 | #include <kaddressbookview.h> |
30 | #include <qdict.h> | 32 | #include <q3dict.h> |
31 | #include "filter.h" | 33 | #include "filter.h" |
32 | 34 | ||
33 | class KAction; | 35 | class KAction; |
34 | class KSelectAction; | 36 | class KSelectAction; |
35 | 37 | ||
36 | class KABCore; | 38 | class KABCore; |
37 | class QWidgetStack; | 39 | class Q3WidgetStack; |
38 | class QDropEvent; | 40 | class QDropEvent; |
39 | 41 | ||
40 | namespace KABC { class AddressBook; } | 42 | namespace KABC { class AddressBook; } |
41 | 43 | ||
42 | /** | 44 | /** |
43 | The view manager manages the views and everything related to them. The | 45 | The view manager manages the views and everything related to them. The |
44 | manager will load the views at startup and display a view when told to | 46 | manager will load the views at startup and display a view when told to |
45 | make one active. | 47 | make one active. |
46 | 48 | ||
47 | The view manager will also create and manage all dialogs directly related to | 49 | The view manager will also create and manage all dialogs directly related to |
48 | views (ie: AddView, ConfigureView, DeleteView, etc). | 50 | views (ie: AddView, ConfigureView, DeleteView, etc). |
49 | */ | 51 | */ |
50 | class ViewManager : public QWidget | 52 | class ViewManager : public QWidget |
51 | { | 53 | { |
52 | Q_OBJECT | 54 | Q_OBJECT |
53 | public: | 55 | public: |
54 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); | 56 | ViewManager( KABCore *core, QWidget *parent, const char *name = 0 ); |
55 | ~ViewManager(); | 57 | ~ViewManager(); |
56 | 58 | ||
57 | void restoreSettings(); | 59 | void restoreSettings(); |
58 | void saveSettings(); | 60 | void saveSettings(); |
59 | void doSearch( const QString& s ,KABC::Field *field ); | 61 | void doSearch( const QString& s ,KABC::Field *field ); |
60 | 62 | ||
61 | void unloadViews(); | 63 | void unloadViews(); |
62 | KSelectAction * getFilterAction() { return mActionSelectFilter; } | 64 | KSelectAction * getFilterAction() { return mActionSelectFilter; } |
63 | Filter getFilterByName( const QString &name ) const; | 65 | Filter getFilterByName( const QString &name ) const; |
64 | 66 | ||
65 | QStringList selectedUids() const; | 67 | QStringList selectedUids() const; |
66 | QStringList selectedEmails() const; | 68 | QStringList selectedEmails() const; |
67 | KABC::Addressee::List selectedAddressees() const; | 69 | KABC::Addressee::List selectedAddressees() const; |
68 | void setListSelected(QStringList); | 70 | void setListSelected(QStringList); |
69 | void setFocusAV(); | 71 | void setFocusAV(); |
70 | 72 | ||
71 | public slots: | 73 | public slots: |
72 | void printView() { if (mActiveView) mActiveView->printMyView() ;} | 74 | void printView() { if (mActiveView) mActiveView->printMyView() ;} |
73 | void scrollUP(); | 75 | void scrollUP(); |
74 | void scrollDOWN(); | 76 | void scrollDOWN(); |
75 | 77 | ||
76 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); | 78 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); |
77 | void setSelected( const QString &uid, bool); | 79 | void setSelected( const QString &uid, bool); |
78 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 80 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
79 | void setSelected(); | 81 | void setSelected(); |
80 | 82 | ||
81 | 83 | ||
82 | 84 | ||
83 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 85 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
84 | void refreshView(); | 86 | void refreshView(); |
85 | void refreshView( const QString &uid); | 87 | void refreshView( const QString &uid); |
86 | 88 | ||
87 | void editView(); | 89 | void editView(); |
88 | void deleteView(); | 90 | void deleteView(); |
89 | void addView(); | 91 | void addView(); |
90 | 92 | ||
91 | protected slots: | 93 | protected slots: |
92 | /** | 94 | /** |
93 | Called whenever the user drops something in the active view. | 95 | Called whenever the user drops something in the active view. |
94 | This method will try to decode what was dropped, and if it was | 96 | This method will try to decode what was dropped, and if it was |
95 | a valid addressee, add it to the addressbook. | 97 | a valid addressee, add it to the addressbook. |
96 | */ | 98 | */ |
97 | void dropped( QDropEvent* ); | 99 | void dropped( QDropEvent* ); |
98 | 100 | ||
99 | /** | 101 | /** |
100 | Called whenever the user attempts to start a drag in the view. | 102 | Called whenever the user attempts to start a drag in the view. |
101 | This method will convert all the selected addressees into text (vcard) | 103 | This method will convert all the selected addressees into text (vcard) |
102 | and create a drag object. | 104 | and create a drag object. |
103 | */ | 105 | */ |
104 | void startDrag(); | 106 | void startDrag(); |
105 | 107 | ||
106 | signals: | 108 | signals: |
107 | /** | 109 | /** |
108 | Emitted whenever the user selects an entry in the view. | 110 | Emitted whenever the user selects an entry in the view. |
109 | */ | 111 | */ |
110 | void selected( const QString &uid ); | 112 | void selected( const QString &uid ); |
111 | void deleteRequest( ); | 113 | void deleteRequest( ); |
112 | 114 | ||
113 | /** | 115 | /** |
114 | Emitted whenever the user activates an entry in the view. | 116 | Emitted whenever the user activates an entry in the view. |
115 | */ | 117 | */ |
116 | void executed( const QString &uid ); | 118 | void executed( const QString &uid ); |
117 | 119 | ||
118 | /** | 120 | /** |
119 | Emitted whenever the address book is modified in some way. | 121 | Emitted whenever the address book is modified in some way. |
120 | */ | 122 | */ |
121 | void modified(); | 123 | void modified(); |
122 | 124 | ||
123 | /** | 125 | /** |
124 | Emitted whenever a url is dragged on a view. | 126 | Emitted whenever a url is dragged on a view. |
125 | */ | 127 | */ |
126 | void urlDropped( const KURL& ); | 128 | void urlDropped( const KURL& ); |
127 | 129 | ||
128 | private slots: | 130 | private slots: |
129 | void selectView( const QString &name ); | 131 | void selectView( const QString &name ); |
130 | void setActiveView( const QString &name ); | 132 | void setActiveView( const QString &name ); |
131 | void setActiveFilter( int index ); | 133 | void setActiveFilter( int index ); |
132 | void configureFilters(); | 134 | void configureFilters(); |
133 | 135 | ||
134 | private: | 136 | private: |
135 | void createViewFactories(); | 137 | void createViewFactories(); |
136 | QStringList filterNames() const; | 138 | QStringList filterNames() const; |
137 | int filterPosition( const QString &name ) const; | 139 | int filterPosition( const QString &name ) const; |
138 | QStringList viewNames() const; | 140 | QStringList viewNames() const; |
139 | int viewPosition( const QString &name ) const; | 141 | int viewPosition( const QString &name ) const; |
140 | void initActions(); | 142 | void initActions(); |
141 | void initGUI(); | 143 | void initGUI(); |
142 | 144 | ||
143 | KABCore *mCore; | 145 | KABCore *mCore; |
144 | 146 | ||
145 | Filter mCurrentFilter; | 147 | Filter mCurrentFilter; |
146 | Filter::List mFilterList; | 148 | Filter::List mFilterList; |
147 | 149 | ||
148 | QDict<KAddressBookView> mViewDict; | 150 | Q3Dict<KAddressBookView> mViewDict; |
149 | QDict<ViewFactory> mViewFactoryDict; | 151 | Q3Dict<ViewFactory> mViewFactoryDict; |
150 | QStringList mViewNameList; | 152 | QStringList mViewNameList; |
151 | 153 | ||
152 | QWidgetStack *mViewWidgetStack; | 154 | Q3WidgetStack *mViewWidgetStack; |
153 | KAddressBookView *mActiveView; | 155 | KAddressBookView *mActiveView; |
154 | 156 | ||
155 | KAction *mActionDeleteView; | 157 | KAction *mActionDeleteView; |
156 | KSelectAction *mActionSelectFilter; | 158 | KSelectAction *mActionSelectFilter; |
157 | KSelectAction *mActionSelectView; | 159 | KSelectAction *mActionSelectView; |
158 | 160 | ||
159 | }; | 161 | }; |
160 | 162 | ||
161 | #endif | 163 | #endif |