Diffstat (limited to 'kaddressbook/kaddressbookview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/kaddressbookview.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 8646136..8f31910 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -9,64 +9,70 @@ | |||
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 KADDRESSBOOKVIEW_H | 24 | #ifndef KADDRESSBOOKVIEW_H |
25 | #define KADDRESSBOOKVIEW_H | 25 | #define KADDRESSBOOKVIEW_H |
26 | 26 | ||
27 | #ifndef KAB_EMBEDDED | 27 | #ifndef KAB_EMBEDDED |
28 | #include <klibloader.h> | 28 | #include <klibloader.h> |
29 | #endif //KAB_EMBEDDED | 29 | #endif //KAB_EMBEDDED |
30 | 30 | ||
31 | class KConfig; | 31 | class KConfig; |
32 | class QDropEvent; | 32 | class QDropEvent; |
33 | 33 | ||
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <kabc/field.h> | 35 | #include <kabc/field.h> |
36 | #include <qwidget.h> | 36 | #include <qwidget.h> |
37 | 37 | ||
38 | #include "viewconfigurewidget.h" | 38 | #include "viewconfigurewidget.h" |
39 | #include "filter.h" | 39 | #include "filter.h" |
40 | 40 | ||
41 | #ifdef DESKTOP_VERSION | ||
42 | #include <qpaintdevicemetrics.h> | ||
43 | #include <qprinter.h> | ||
44 | #include <qpainter.h> | ||
45 | #endif | ||
46 | |||
41 | namespace KABC { class AddressBook; } | 47 | namespace KABC { class AddressBook; } |
42 | 48 | ||
43 | /** | 49 | /** |
44 | Base class for all views in kaddressbook. This class implements | 50 | Base class for all views in kaddressbook. This class implements |
45 | all the common methods needed to provide a view to the user. | 51 | all the common methods needed to provide a view to the user. |
46 | 52 | ||
47 | To implement a specific view (table, card, etc), just inherit from | 53 | To implement a specific view (table, card, etc), just inherit from |
48 | this class and implement all the pure virtuals. | 54 | this class and implement all the pure virtuals. |
49 | 55 | ||
50 | @author Mike Pilone <mpilone@slac.com> | 56 | @author Mike Pilone <mpilone@slac.com> |
51 | */ | 57 | */ |
52 | class KAddressBookView : public QWidget | 58 | class KAddressBookView : public QWidget |
53 | { | 59 | { |
54 | Q_OBJECT | 60 | Q_OBJECT |
55 | 61 | ||
56 | public: | 62 | public: |
57 | enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; | 63 | enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; |
58 | 64 | ||
59 | KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); | 65 | KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); |
60 | virtual ~KAddressBookView(); | 66 | virtual ~KAddressBookView(); |
61 | 67 | ||
62 | /** | 68 | /** |
63 | Must be overloaded in subclasses. Should return a list of | 69 | Must be overloaded in subclasses. Should return a list of |
64 | all the uids of selected contacts. | 70 | all the uids of selected contacts. |
65 | */ | 71 | */ |
66 | virtual QStringList selectedUids() = 0; | 72 | virtual QStringList selectedUids() = 0; |
67 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; | 73 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; |
68 | virtual void scrollUP() = 0; | 74 | virtual void scrollUP() = 0; |
69 | virtual void scrollDOWN() = 0; | 75 | virtual void scrollDOWN() = 0; |
70 | virtual void setFocusAV() = 0; | 76 | virtual void setFocusAV() = 0; |
71 | 77 | ||
72 | /** | 78 | /** |
@@ -121,90 +127,93 @@ class KAddressBookView : public QWidget | |||
121 | this method whenever a readConfig() is called in order to get the newest | 127 | this method whenever a readConfig() is called in order to get the newest |
122 | list of fields. | 128 | list of fields. |
123 | */ | 129 | */ |
124 | KABC::Field::List fields() const; | 130 | KABC::Field::List fields() const; |
125 | 131 | ||
126 | KABC::Field::List allFields() const; | 132 | KABC::Field::List allFields() const; |
127 | 133 | ||
128 | /** | 134 | /** |
129 | Sets the active filter. This filter will be used for filtering | 135 | Sets the active filter. This filter will be used for filtering |
130 | the list of addressees to display. The view will <b>not</b> | 136 | the list of addressees to display. The view will <b>not</b> |
131 | automatically refresh itself, so in most cases you will want to call | 137 | automatically refresh itself, so in most cases you will want to call |
132 | KAddressBookView::refresh() after this method. | 138 | KAddressBookView::refresh() after this method. |
133 | */ | 139 | */ |
134 | void setFilter( const Filter& ); | 140 | void setFilter( const Filter& ); |
135 | 141 | ||
136 | /** | 142 | /** |
137 | @return The default filter type selection. If the selection | 143 | @return The default filter type selection. If the selection |
138 | is SpecificFilter, the name of the filter can be retrieved with | 144 | is SpecificFilter, the name of the filter can be retrieved with |
139 | defaultFilterName() | 145 | defaultFilterName() |
140 | */ | 146 | */ |
141 | DefaultFilterType defaultFilterType() const; | 147 | DefaultFilterType defaultFilterType() const; |
142 | 148 | ||
143 | /** | 149 | /** |
144 | @return The name of the default filter. This string is | 150 | @return The name of the default filter. This string is |
145 | only valid if defaultFilterType() is returning SpecificFilter. | 151 | only valid if defaultFilterType() is returning SpecificFilter. |
146 | */ | 152 | */ |
147 | const QString &defaultFilterName() const; | 153 | const QString &defaultFilterName() const; |
148 | 154 | ||
149 | /** | 155 | /** |
150 | @return The address book. | 156 | @return The address book. |
151 | */ | 157 | */ |
152 | KABC::AddressBook *addressBook() const; | 158 | KABC::AddressBook *addressBook() const; |
159 | void printMyView() { emit printView() ;} | ||
153 | 160 | ||
154 | public slots: | 161 | public slots: |
155 | /** | 162 | /** |
156 | Must be overloaded in subclasses to refresh the view. | 163 | Must be overloaded in subclasses to refresh the view. |
157 | Refreshing includes updating the view to ensure that only items | 164 | Refreshing includes updating the view to ensure that only items |
158 | in the document are visible. If <i>uid</i> is valid, only the | 165 | in the document are visible. If <i>uid</i> is valid, only the |
159 | addressee with uid needs to be refreshed. This is an optimization | 166 | addressee with uid needs to be refreshed. This is an optimization |
160 | only. | 167 | only. |
161 | */ | 168 | */ |
162 | virtual void refresh( QString uid = QString::null ) = 0; | 169 | virtual void refresh( QString uid = QString::null ) = 0; |
163 | 170 | ||
164 | /** | 171 | /** |
165 | This method must be overloaded in subclasses. Select (highlight) | 172 | This method must be overloaded in subclasses. Select (highlight) |
166 | the addressee matching <i>uid</i>. If uid | 173 | the addressee matching <i>uid</i>. If uid |
167 | is equal to QString::null, then all addressees should be selected. | 174 | is equal to QString::null, then all addressees should be selected. |
168 | */ | 175 | */ |
169 | #ifndef KAB_EMBEDDED | 176 | #ifndef KAB_EMBEDDED |
170 | //MOC_SKIP_BEGIN | 177 | //MOC_SKIP_BEGIN |
171 | virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; | 178 | virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; |
172 | //MOC_SKIP_END | 179 | //MOC_SKIP_END |
173 | #else //KAB_EMBEDDED | 180 | #else //KAB_EMBEDDED |
174 | //US my moc can not handle the default parameters. Is this a problem ??? | 181 | //US my moc can not handle the default parameters. Is this a problem ??? |
175 | virtual void setSelected( QString uid, bool selected) = 0; | 182 | virtual void setSelected( QString uid, bool selected) = 0; |
176 | #endif //KAB_EMBEDDED | 183 | #endif //KAB_EMBEDDED |
177 | 184 | ||
178 | signals: | 185 | signals: |
186 | |||
187 | void printView(); | ||
179 | /** | 188 | /** |
180 | This signal should be emitted by a subclass whenever an addressee | 189 | This signal should be emitted by a subclass whenever an addressee |
181 | is modified. | 190 | is modified. |
182 | */ | 191 | */ |
183 | void modified(); | 192 | void modified(); |
184 | 193 | ||
185 | /** | 194 | /** |
186 | This signal should be emitted by a subclass whenever an addressee | 195 | This signal should be emitted by a subclass whenever an addressee |
187 | is selected. Selected means that the addressee was given the focus. | 196 | is selected. Selected means that the addressee was given the focus. |
188 | Some widgets may call this 'highlighted'. The view is responsible for | 197 | Some widgets may call this 'highlighted'. The view is responsible for |
189 | emitting this signal multiple times if multiple items are selected, | 198 | emitting this signal multiple times if multiple items are selected, |
190 | with the last item selected being the last emit. | 199 | with the last item selected being the last emit. |
191 | 200 | ||
192 | @param uid The uid of the selected addressee. | 201 | @param uid The uid of the selected addressee. |
193 | 202 | ||
194 | @see KListView | 203 | @see KListView |
195 | */ | 204 | */ |
196 | void selected( const QString &uid ); | 205 | void selected( const QString &uid ); |
197 | void deleteRequest(); | 206 | void deleteRequest(); |
198 | /** | 207 | /** |
199 | This signal should be emitted by a subclass whenever an addressee | 208 | This signal should be emitted by a subclass whenever an addressee |
200 | is executed. This is defined by the KDE system wide config, but it | 209 | is executed. This is defined by the KDE system wide config, but it |
201 | either means single or doubleclicked. | 210 | either means single or doubleclicked. |
202 | 211 | ||
203 | @param ui The uid of the selected addressee | 212 | @param ui The uid of the selected addressee |
204 | 213 | ||
205 | @see KListView | 214 | @see KListView |
206 | */ | 215 | */ |
207 | void executed( const QString &uid ); | 216 | void executed( const QString &uid ); |
208 | 217 | ||
209 | /** | 218 | /** |
210 | This signal is emitted whenever a user attempts to start a drag | 219 | This signal is emitted whenever a user attempts to start a drag |