Diffstat (limited to 'kaddressbook/views/kaddressbookiconview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.h | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h new file mode 100644 index 0000000..3afada3 --- a/dev/null +++ b/kaddressbook/views/kaddressbookiconview.h | |||
@@ -0,0 +1,130 @@ | |||
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 KADDRESSBOOKICONVIEW_H | ||
25 | #define KADDRESSBOOKICONVIEW_H | ||
26 | |||
27 | #include <qstring.h> | ||
28 | #ifndef KAB_EMBEDDED | ||
29 | #include <kiconview.h> | ||
30 | #else //KAB_EMBEDDED | ||
31 | #include <qiconview.h> | ||
32 | #include <qptrlist.h> | ||
33 | #include <klocale.h> | ||
34 | #endif //KAB_EMBEDDED | ||
35 | #include "kaddressbookview.h" | ||
36 | |||
37 | class QIconViewItem; | ||
38 | class KConfig; | ||
39 | class AddresseeIconView; | ||
40 | class AddresseeIconViewItem; | ||
41 | class QIconDragItem; | ||
42 | class KAddressBookIconView; | ||
43 | |||
44 | namespace KABC { class AddressBook; } | ||
45 | |||
46 | /** This is an example kaddressbook view that is implemented using | ||
47 | * KIconView. This view is not the most useful view, but it displays | ||
48 | * how simple implementing a new view can be. | ||
49 | */ | ||
50 | class KAddressBookIconView : public KAddressBookView | ||
51 | { | ||
52 | Q_OBJECT | ||
53 | |||
54 | public: | ||
55 | KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent, | ||
56 | const char *name = 0 ); | ||
57 | virtual ~KAddressBookIconView(); | ||
58 | |||
59 | virtual QStringList selectedUids(); | ||
60 | virtual QString type() const { return "Icon"; } | ||
61 | |||
62 | virtual void readConfig(KConfig *config); | ||
63 | |||
64 | public slots: | ||
65 | void refresh(QString uid = QString::null); | ||
66 | #ifndef KAB_EMBEDDED | ||
67 | //MOC_SKIP_BEGIN | ||
68 | void setSelected(QString uid = QString::null, bool selected = true); | ||
69 | //MOC_SKIP_END | ||
70 | #else //KAB_EMBEDDED | ||
71 | //US my MOC do not like default parameters ??? | ||
72 | void setSelected(QString uid, bool selected); | ||
73 | #endif //KAB_EMBEDDED | ||
74 | |||
75 | protected slots: | ||
76 | void addresseeExecuted(QIconViewItem *item); | ||
77 | void addresseeSelected(); | ||
78 | |||
79 | private: | ||
80 | AddresseeIconView *mIconView; | ||
81 | QPtrList<AddresseeIconViewItem> mIconList; | ||
82 | }; | ||
83 | |||
84 | |||
85 | #ifndef KAB_EMBEDDED | ||
86 | //MOC_SKIP_BEGIN | ||
87 | class AddresseeIconView : public KIconView | ||
88 | //MOC_SKIP_END | ||
89 | #else //KAB_EMBEDDED | ||
90 | class AddresseeIconView : public QIconView | ||
91 | #endif //KAB_EMBEDDED | ||
92 | { | ||
93 | Q_OBJECT | ||
94 | |||
95 | public: | ||
96 | AddresseeIconView(QWidget *parent, const char *name); | ||
97 | ~AddresseeIconView(); | ||
98 | |||
99 | signals: | ||
100 | void addresseeDropped(QDropEvent *); | ||
101 | void startAddresseeDrag(); | ||
102 | |||
103 | protected: | ||
104 | virtual QDragObject *dragObject(); | ||
105 | |||
106 | protected slots: | ||
107 | void itemDropped(QDropEvent *, const QValueList<QIconDragItem> &); | ||
108 | }; | ||
109 | |||
110 | class IconViewFactory : public ViewFactory | ||
111 | { | ||
112 | public: | ||
113 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | ||
114 | { | ||
115 | return new KAddressBookIconView( ab, parent, name ); | ||
116 | } | ||
117 | |||
118 | QString type() const { return "Icon"; } | ||
119 | |||
120 | QString description() const { return i18n( "Icons represent contacts. Very simple view." ); } | ||
121 | }; | ||
122 | /* | ||
123 | extern "C" { | ||
124 | void *init_libkaddrbk_iconview() | ||
125 | { | ||
126 | return ( new IconViewFactory ); | ||
127 | } | ||
128 | } | ||
129 | */ | ||
130 | #endif | ||