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/features/distributionlistwidget.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
Diffstat (limited to 'kaddressbook/features/distributionlistwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/features/distributionlistwidget.h | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/kaddressbook/features/distributionlistwidget.h b/kaddressbook/features/distributionlistwidget.h new file mode 100644 index 0000000..82bac3d --- a/dev/null +++ b/kaddressbook/features/distributionlistwidget.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | This file is part of KAddressBook. | ||
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | ||
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 DISTRIBUTIONLISTWIDGET_H | ||
25 | #define DISTRIBUTIONLISTWIDGET_H | ||
26 | |||
27 | #include <kdialogbase.h> | ||
28 | #include <klistview.h> | ||
29 | |||
30 | #include "extensionwidget.h" | ||
31 | |||
32 | class QButtonGroup; | ||
33 | class QComboBox; | ||
34 | class QLabel; | ||
35 | class QListView; | ||
36 | |||
37 | class DistributionListView; | ||
38 | class KABCore; | ||
39 | |||
40 | namespace KABC { | ||
41 | class AddressBook; | ||
42 | class DistributionListManager; | ||
43 | } | ||
44 | |||
45 | class DistributionListWidget : public ExtensionWidget | ||
46 | { | ||
47 | Q_OBJECT | ||
48 | |||
49 | public: | ||
50 | DistributionListWidget( KABCore*, QWidget *parent, const char *name = 0 ); | ||
51 | virtual ~DistributionListWidget(); | ||
52 | |||
53 | void contactsSelectionChanged(); | ||
54 | |||
55 | QString title() const; | ||
56 | QString identifier() const; | ||
57 | |||
58 | public slots: | ||
59 | void save(); | ||
60 | void dropped( QDropEvent*, QListViewItem* ); | ||
61 | |||
62 | private slots: | ||
63 | void createList(); | ||
64 | void editList(); | ||
65 | void removeList(); | ||
66 | void addContact(); | ||
67 | void removeContact(); | ||
68 | void changeEmail(); | ||
69 | void updateNameCombo(); | ||
70 | void updateContactView(); | ||
71 | void selectionContactViewChanged(); | ||
72 | void changed(); | ||
73 | |||
74 | protected: | ||
75 | void dropEvent( QDropEvent* ); | ||
76 | |||
77 | private: | ||
78 | QComboBox *mNameCombo; | ||
79 | QLabel *mListLabel; | ||
80 | DistributionListView *mContactView; | ||
81 | |||
82 | KABC::DistributionListManager *mManager; | ||
83 | QPushButton *mCreateListButton; | ||
84 | QPushButton *mEditListButton; | ||
85 | QPushButton *mRemoveListButton; | ||
86 | QPushButton *mChangeEmailButton; | ||
87 | QPushButton *mAddContactButton; | ||
88 | QPushButton *mRemoveContactButton; | ||
89 | }; | ||
90 | |||
91 | /** | ||
92 | @short Helper class | ||
93 | */ | ||
94 | class DistributionListView : public KListView | ||
95 | { | ||
96 | Q_OBJECT | ||
97 | |||
98 | public: | ||
99 | DistributionListView( QWidget *parent, const char* name = 0 ); | ||
100 | |||
101 | protected: | ||
102 | void dragEnterEvent( QDragEnterEvent *e ); | ||
103 | void dropEvent( QDropEvent *e ); | ||
104 | void viewportDragMoveEvent( QDragMoveEvent *e ); | ||
105 | void viewportDropEvent( QDropEvent *e ); | ||
106 | }; | ||
107 | |||
108 | /** | ||
109 | @short Helper class | ||
110 | */ | ||
111 | class EmailSelector : public KDialogBase | ||
112 | { | ||
113 | public: | ||
114 | EmailSelector( const QStringList &emails, const QString ¤t, | ||
115 | QWidget *parent ); | ||
116 | |||
117 | QString selected(); | ||
118 | |||
119 | static QString getEmail( const QStringList &emails, const QString ¤t, | ||
120 | QWidget *parent ); | ||
121 | |||
122 | private: | ||
123 | QButtonGroup *mButtonGroup; | ||
124 | }; | ||
125 | |||
126 | |||
127 | #ifdef KAB_EMBEDDED | ||
128 | class DistributionListFactory : public ExtensionFactory | ||
129 | { | ||
130 | public: | ||
131 | ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name ) | ||
132 | { | ||
133 | return new DistributionListWidget( core, parent, name ); | ||
134 | } | ||
135 | |||
136 | QString identifier() const | ||
137 | { | ||
138 | return "distribution_list_editor"; | ||
139 | } | ||
140 | }; | ||
141 | #endif //KAB_EMBEDDED | ||
142 | |||
143 | #endif | ||