-rw-r--r-- | korganizer/koeditordetails.cpp | 10 | ||||
-rw-r--r-- | korganizer/koeditordetails.h | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 479bd8b..b90b9eb 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp | |||
@@ -1,482 +1,480 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
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 thse hope that it will be useful, | 10 | This program is distributed in thse 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 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapp.h> | 32 | #include <qapp.h> |
33 | 33 | ||
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | #include <kdialog.h> | 36 | #include <kdialog.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | #ifndef KORG_NOKABC | 40 | #ifndef KORG_NOKABC |
41 | 41 | ||
42 | #ifdef DESKTOP_VERSION | 42 | #ifdef DESKTOP_VERSION |
43 | #include <kabc/addresseedialog.h> | 43 | #include <kabc/addresseedialog.h> |
44 | #else //DESKTOP_VERSION | 44 | #else //DESKTOP_VERSION |
45 | #include <externalapphandler.h> | 45 | #include <externalapphandler.h> |
46 | #endif //DESKTOP_VERSION | 46 | #endif //DESKTOP_VERSION |
47 | 47 | ||
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #include <libkcal/incidence.h> | 50 | #include <libkcal/incidence.h> |
51 | 51 | ||
52 | #include "koprefs.h" | 52 | #include "koprefs.h" |
53 | 53 | ||
54 | #include "koeditordetails.h" | 54 | #include "koeditordetails.h" |
55 | 55 | ||
56 | template <> | 56 | template <> |
57 | CustomListViewItem<class Attendee *>::~CustomListViewItem() | 57 | CustomListViewItem<class Attendee *>::~CustomListViewItem() |
58 | { | 58 | { |
59 | delete mData; | 59 | delete mData; |
60 | } | 60 | } |
61 | 61 | ||
62 | template <> | 62 | template <> |
63 | void CustomListViewItem<class Attendee *>::updateItem() | 63 | void CustomListViewItem<class Attendee *>::updateItem() |
64 | { | 64 | { |
65 | setText(0,mData->name()); | 65 | setText(0,mData->name()); |
66 | setText(1,mData->email()); | 66 | setText(1,mData->email()); |
67 | setText(2,mData->roleStr()); | 67 | setText(2,mData->roleStr()); |
68 | setText(3,mData->statusStr()); | 68 | setText(3,mData->statusStr()); |
69 | if (mData->RSVP() && !mData->email().isEmpty()) { | 69 | if (mData->RSVP() && !mData->email().isEmpty()) { |
70 | setPixmap(4,SmallIcon("mailappt")); | 70 | setPixmap(4,SmallIcon("mailappt")); |
71 | setSortKey(4,"j"); | 71 | setSortKey(4,"j"); |
72 | } | 72 | } |
73 | else { | 73 | else { |
74 | setPixmap(4,SmallIcon("nomailappt")); | 74 | setPixmap(4,SmallIcon("nomailappt")); |
75 | setSortKey(4,"n"); | 75 | setSortKey(4,"n"); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | 80 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) |
81 | : QWidget( parent, name), mDisableItemUpdate( false ) | 81 | : QWidget( parent, name), mDisableItemUpdate( false ) |
82 | { | 82 | { |
83 | QGridLayout *topLayout = new QGridLayout(this); | 83 | QGridLayout *topLayout = new QGridLayout(this); |
84 | topLayout->setSpacing(spacing); | 84 | topLayout->setSpacing(spacing); |
85 | topLayout->setMargin(KDialog::marginHint()-2); | 85 | topLayout->setMargin(KDialog::marginHint()-2); |
86 | 86 | ||
87 | QString organizer = KOPrefs::instance()->email(); | 87 | QString organizer = KOPrefs::instance()->email(); |
88 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); | 88 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); |
89 | 89 | ||
90 | mListView = new KListView(this,"mListView"); | 90 | mListView = new KListView(this,"mListView"); |
91 | mListView->addColumn(i18n("Name"),180); | 91 | mListView->addColumn(i18n("Name"),180); |
92 | mListView->addColumn(i18n("Email"),180); | 92 | mListView->addColumn(i18n("Email"),180); |
93 | mListView->addColumn(i18n("Role"),60); | 93 | mListView->addColumn(i18n("Role"),60); |
94 | mListView->addColumn(i18n("Status"),100); | 94 | mListView->addColumn(i18n("Status"),100); |
95 | mListView->addColumn(i18n("RSVP"),35); | 95 | mListView->addColumn(i18n("RSVP"),35); |
96 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { | 96 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { |
97 | int hei = 80; | 97 | int hei = 80; |
98 | if ( QApplication::desktop()->height() <= 240 ) | 98 | if ( QApplication::desktop()->height() <= 240 ) |
99 | hei = 60; | 99 | hei = 60; |
100 | mListView->setFixedHeight(hei); | 100 | mListView->setFixedHeight(hei); |
101 | } | 101 | } |
102 | mListView->setAllColumnsShowFocus (true ); | 102 | mListView->setAllColumnsShowFocus (true ); |
103 | //mListView->setSingleClick( true ); | 103 | //mListView->setSingleClick( true ); |
104 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), | 104 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), |
105 | SLOT(updateAttendeeInput())); | 105 | SLOT(updateAttendeeInput())); |
106 | 106 | ||
107 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), | 107 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), |
108 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); | 108 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); |
109 | 109 | ||
110 | mRsvpButton = new QCheckBox(this); | 110 | mRsvpButton = new QCheckBox(this); |
111 | mRsvpButton->setText(i18n("Request response")); | 111 | mRsvpButton->setText(i18n("Request response")); |
112 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); | 112 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); |
113 | QLabel *attendeeLabel = new QLabel(this); | 113 | QLabel *attendeeLabel = new QLabel(this); |
114 | attendeeLabel->setText(i18n("Name:")); | 114 | attendeeLabel->setText(i18n("Name:")); |
115 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); | 115 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); |
116 | mNameEdit = new QLineEdit(this); | 116 | mNameEdit = new QLineEdit(this); |
117 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), | 117 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), |
118 | SLOT(updateAttendeeItem())); | 118 | SLOT(updateAttendeeItem())); |
119 | 119 | ||
120 | mUidEdit = new QLineEdit(0); | ||
121 | mUidEdit->setText(""); | ||
122 | 120 | ||
123 | QLabel *emailLabel = new QLabel(this); | 121 | QLabel *emailLabel = new QLabel(this); |
124 | emailLabel->setText(i18n("Email:")); | 122 | emailLabel->setText(i18n("Email:")); |
125 | mEmailEdit = new QLineEdit(this); | 123 | mEmailEdit = new QLineEdit(this); |
126 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), | 124 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), |
127 | SLOT(updateAttendeeItem())); | 125 | SLOT(updateAttendeeItem())); |
128 | 126 | ||
129 | QLabel *attendeeRoleLabel = new QLabel(this); | 127 | QLabel *attendeeRoleLabel = new QLabel(this); |
130 | attendeeRoleLabel->setText(i18n("Role:")); | 128 | attendeeRoleLabel->setText(i18n("Role:")); |
131 | mRoleCombo = new QComboBox(false,this); | 129 | mRoleCombo = new QComboBox(false,this); |
132 | mRoleCombo->insertStringList(Attendee::roleList()); | 130 | mRoleCombo->insertStringList(Attendee::roleList()); |
133 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 131 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
134 | 132 | ||
135 | QLabel *statusLabel = new QLabel(this); | 133 | QLabel *statusLabel = new QLabel(this); |
136 | statusLabel->setText( i18n("Status:") ); | 134 | statusLabel->setText( i18n("Status:") ); |
137 | 135 | ||
138 | mStatusCombo = new QComboBox(false,this); | 136 | mStatusCombo = new QComboBox(false,this); |
139 | mStatusCombo->insertStringList(Attendee::statusList()); | 137 | mStatusCombo->insertStringList(Attendee::statusList()); |
140 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 138 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
141 | 139 | ||
142 | 140 | ||
143 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); | 141 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); |
144 | QWidget *buttonBox = new QWidget(this); | 142 | QWidget *buttonBox = new QWidget(this); |
145 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); | 143 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); |
146 | 144 | ||
147 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); | 145 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); |
148 | buttonLayout->addWidget(newButton); | 146 | buttonLayout->addWidget(newButton); |
149 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); | 147 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); |
150 | 148 | ||
151 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); | 149 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); |
152 | buttonLayout->addWidget(mRemoveButton); | 150 | buttonLayout->addWidget(mRemoveButton); |
153 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); | 151 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); |
154 | 152 | ||
155 | // buttonLayout->addWidget(mAddressBookButton); | 153 | // buttonLayout->addWidget(mAddressBookButton); |
156 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); | 154 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); |
157 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); | 155 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); |
158 | if ( QApplication::desktop()->height() <= 240 ) { | 156 | if ( QApplication::desktop()->height() <= 240 ) { |
159 | mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); | 157 | mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); |
160 | mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); | 158 | mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); |
161 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | 159 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); |
162 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | 160 | topLayout->addMultiCellWidget(mListView,1,1,0,5); |
163 | topLayout->addWidget(attendeeLabel,3,0); | 161 | topLayout->addWidget(attendeeLabel,3,0); |
164 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | 162 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); |
165 | topLayout->addWidget(emailLabel,4,0); | 163 | topLayout->addWidget(emailLabel,4,0); |
166 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | 164 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); |
167 | topLayout->addWidget(attendeeRoleLabel,5,0); | 165 | topLayout->addWidget(attendeeRoleLabel,5,0); |
168 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | 166 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); |
169 | topLayout->addWidget(statusLabel,5,3); | 167 | topLayout->addWidget(statusLabel,5,3); |
170 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | 168 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); |
171 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); | 169 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); |
172 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 170 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
173 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | 171 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); |
174 | topLayout->setRowStretch(1,5); | 172 | topLayout->setRowStretch(1,5); |
175 | topLayout->setColStretch(0,0); | 173 | topLayout->setColStretch(0,0); |
176 | } else { | 174 | } else { |
177 | if (qApp->desktop()->width() < 640 ) { | 175 | if (qApp->desktop()->width() < 640 ) { |
178 | if ( qApp->desktop()->width() < 300 ) | 176 | if ( qApp->desktop()->width() < 300 ) |
179 | topLayout->setSpacing(1); | 177 | topLayout->setSpacing(1); |
180 | ;//mListView->setFixedHeight(80); | 178 | ;//mListView->setFixedHeight(80); |
181 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); | 179 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); |
182 | topLayout->addMultiCellWidget(mListView,1,1,0,3); | 180 | topLayout->addMultiCellWidget(mListView,1,1,0,3); |
183 | topLayout->addWidget(attendeeLabel,3,0); | 181 | topLayout->addWidget(attendeeLabel,3,0); |
184 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); | 182 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); |
185 | topLayout->addWidget(emailLabel,4,0); | 183 | topLayout->addWidget(emailLabel,4,0); |
186 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); | 184 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); |
187 | topLayout->addWidget(attendeeRoleLabel,5,0); | 185 | topLayout->addWidget(attendeeRoleLabel,5,0); |
188 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); | 186 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,3); |
189 | topLayout->addWidget(statusLabel,6,0); | 187 | topLayout->addWidget(statusLabel,6,0); |
190 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); | 188 | topLayout->addMultiCellWidget(mStatusCombo,6,6,1,3); |
191 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); | 189 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); |
192 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 190 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
193 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); | 191 | topLayout->addMultiCellWidget(buttonBox,3,4,3,3); |
194 | topLayout->setRowStretch(1,2); | 192 | topLayout->setRowStretch(1,2); |
195 | topLayout->setColStretch(0,0); | 193 | topLayout->setColStretch(0,0); |
196 | topLayout->setColStretch(1,2); | 194 | topLayout->setColStretch(1,2); |
197 | topLayout->setColStretch(2,1); | 195 | topLayout->setColStretch(2,1); |
198 | topLayout->setColStretch(3,1); | 196 | topLayout->setColStretch(3,1); |
199 | } else { | 197 | } else { |
200 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); | 198 | topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); |
201 | topLayout->addMultiCellWidget(mListView,1,1,0,5); | 199 | topLayout->addMultiCellWidget(mListView,1,1,0,5); |
202 | topLayout->addWidget(attendeeLabel,3,0); | 200 | topLayout->addWidget(attendeeLabel,3,0); |
203 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); | 201 | topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); |
204 | topLayout->addWidget(emailLabel,4,0); | 202 | topLayout->addWidget(emailLabel,4,0); |
205 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); | 203 | topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); |
206 | topLayout->addWidget(attendeeRoleLabel,5,0); | 204 | topLayout->addWidget(attendeeRoleLabel,5,0); |
207 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); | 205 | topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); |
208 | topLayout->addWidget(statusLabel,5,3); | 206 | topLayout->addWidget(statusLabel,5,3); |
209 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); | 207 | topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); |
210 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); | 208 | topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); |
211 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); | 209 | topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); |
212 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); | 210 | topLayout->addMultiCellWidget(buttonBox,3,4,5,5); |
213 | topLayout->setRowStretch(1,5); | 211 | topLayout->setRowStretch(1,5); |
214 | topLayout->setColStretch(0,0); | 212 | topLayout->setColStretch(0,0); |
215 | } | 213 | } |
216 | } | 214 | } |
217 | // #if 0 | 215 | // #if 0 |
218 | // topLayout->setColStretch(2,1); | 216 | // topLayout->setColStretch(2,1); |
219 | // topLayout->addWidget(statusLabel,3,3); | 217 | // topLayout->addWidget(statusLabel,3,3); |
220 | // topLayout->addWidget(mStatusCombo,3,4); | 218 | // topLayout->addWidget(mStatusCombo,3,4); |
221 | // #else | 219 | // #else |
222 | // topLayout->addWidget(statusLabel,4,3); | 220 | // topLayout->addWidget(statusLabel,4,3); |
223 | // // topLayout->addWidget(mStatusCombo,4,3); | 221 | // // topLayout->addWidget(mStatusCombo,4,3); |
224 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); | 222 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); |
225 | 223 | ||
226 | // #endif | 224 | // #endif |
227 | // // topLayout->setRowStretch(5,1); | 225 | // // topLayout->setRowStretch(5,1); |
228 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); | 226 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); |
229 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); | 227 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); |
230 | // topLayout->setRowStretch(1,5); | 228 | // topLayout->setRowStretch(1,5); |
231 | // topLayout->setColStretch(0,0); | 229 | // topLayout->setColStretch(0,0); |
232 | 230 | ||
233 | #ifdef KORG_NOKABC | 231 | #ifdef KORG_NOKABC |
234 | mAddressBookButton->hide(); | 232 | mAddressBookButton->hide(); |
235 | #endif | 233 | #endif |
236 | 234 | ||
237 | updateAttendeeInput(); | 235 | updateAttendeeInput(); |
238 | #ifndef DESKTOP_VERSION | 236 | #ifndef DESKTOP_VERSION |
239 | //US listen for arriving address resultsets | 237 | //US listen for arriving address resultsets |
240 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 238 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), |
241 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 239 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
242 | #endif | 240 | #endif |
243 | 241 | ||
244 | } | 242 | } |
245 | 243 | ||
246 | KOEditorDetails::~KOEditorDetails() | 244 | KOEditorDetails::~KOEditorDetails() |
247 | { | 245 | { |
248 | } | 246 | } |
249 | 247 | ||
250 | void KOEditorDetails::removeAttendee() | 248 | void KOEditorDetails::removeAttendee() |
251 | { | 249 | { |
252 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); | 250 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); |
253 | if (!aItem) return; | 251 | if (!aItem) return; |
254 | 252 | ||
255 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), | 253 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), |
256 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), | 254 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), |
257 | aItem->data()->uid()); | 255 | aItem->data()->uid()); |
258 | mdelAttendees.append(delA); | 256 | mdelAttendees.append(delA); |
259 | 257 | ||
260 | delete aItem; | 258 | delete aItem; |
261 | 259 | ||
262 | updateAttendeeInput(); | 260 | updateAttendeeInput(); |
263 | } | 261 | } |
264 | 262 | ||
265 | 263 | ||
266 | void KOEditorDetails::openAddressBook() | 264 | void KOEditorDetails::openAddressBook() |
267 | { | 265 | { |
268 | #ifndef KORG_NOKABC | 266 | #ifndef KORG_NOKABC |
269 | 267 | ||
270 | #ifdef DESKTOP_VERSION | 268 | #ifdef DESKTOP_VERSION |
271 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 269 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
272 | uint i=0; | 270 | uint i=0; |
273 | for (i=0; i < list.count(); i++) { | 271 | for (i=0; i < list.count(); i++) { |
274 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); | 272 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); |
275 | } | 273 | } |
276 | #else | 274 | #else |
277 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 275 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
278 | // the result should now arrive through method insertAttendees | 276 | // the result should now arrive through method insertAttendees |
279 | #endif | 277 | #endif |
280 | 278 | ||
281 | 279 | ||
282 | #if 0 | 280 | #if 0 |
283 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); | 281 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); |
284 | if (!a.isEmpty()) { | 282 | if (!a.isEmpty()) { |
285 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); | 283 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); |
286 | } | 284 | } |
287 | #endif | 285 | #endif |
288 | #endif | 286 | #endif |
289 | } | 287 | } |
290 | 288 | ||
291 | 289 | ||
292 | void KOEditorDetails::addNewAttendee() | 290 | void KOEditorDetails::addNewAttendee() |
293 | { | 291 | { |
294 | #if 0 | 292 | #if 0 |
295 | // this is cool. If they didn't enter an email address, | 293 | // this is cool. If they didn't enter an email address, |
296 | // try to look it up in the address book and fill it in for them. | 294 | // try to look it up in the address book and fill it in for them. |
297 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { | 295 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { |
298 | KabAPI addrBook; | 296 | KabAPI addrBook; |
299 | QString name; | 297 | QString name; |
300 | std::list<AddressBook::Entry> entries; | 298 | std::list<AddressBook::Entry> entries; |
301 | name = mNameEdit->text(); | 299 | name = mNameEdit->text(); |
302 | if (addrBook.init() == AddressBook::NoError) { | 300 | if (addrBook.init() == AddressBook::NoError) { |
303 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { | 301 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { |
304 | kdDebug() << "positive match" << endl; | 302 | kdDebug() << "positive match" << endl; |
305 | // take first email address | 303 | // take first email address |
306 | if (!entries.front().emails.isEmpty() && | 304 | if (!entries.front().emails.isEmpty() && |
307 | entries.front().emails.first().length()>0) | 305 | entries.front().emails.first().length()>0) |
308 | mEmailEdit->setText(entries.front().emails.first()); | 306 | mEmailEdit->setText(entries.front().emails.first()); |
309 | } | 307 | } |
310 | } | 308 | } |
311 | } | 309 | } |
312 | #endif | 310 | #endif |
313 | 311 | ||
314 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); | 312 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); |
315 | insertAttendee(a); | 313 | insertAttendee(a); |
316 | } | 314 | } |
317 | 315 | ||
318 | //the map includes name/email pairs, that comes from Ka/Pi | 316 | //the map includes name/email pairs, that comes from Ka/Pi |
319 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 317 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
320 | { | 318 | { |
321 | if (uid == this->name()) | 319 | if (uid == this->name()) |
322 | { | 320 | { |
323 | for ( int i = 0; i < nameList.count(); i++) | 321 | for ( int i = 0; i < nameList.count(); i++) |
324 | { | 322 | { |
325 | QString _name = nameList[i]; | 323 | QString _name = nameList[i]; |
326 | QString _email = emailList[i]; | 324 | QString _email = emailList[i]; |
327 | QString _uid = uidList[i]; | 325 | QString _uid = uidList[i]; |
328 | 326 | ||
329 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); | 327 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); |
330 | insertAttendee(a); | 328 | insertAttendee(a); |
331 | } | 329 | } |
332 | } | 330 | } |
333 | 331 | ||
334 | } | 332 | } |
335 | 333 | ||
336 | void KOEditorDetails::insertAttendee(Attendee *a) | 334 | void KOEditorDetails::insertAttendee(Attendee *a) |
337 | { | 335 | { |
338 | AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); | 336 | AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild(); |
339 | while (first) { | 337 | while (first) { |
340 | if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) | 338 | if ( first->data()->name() == a->name() && first->data()->email() == a->email() ) |
341 | return; | 339 | return; |
342 | first = (AttendeeListItem*) first->nextSibling(); | 340 | first = (AttendeeListItem*) first->nextSibling(); |
343 | } | 341 | } |
344 | 342 | ||
345 | AttendeeListItem *item = new AttendeeListItem(a,mListView); | 343 | AttendeeListItem *item = new AttendeeListItem(a,mListView); |
346 | mListView->setSelected( item, true ); | 344 | mListView->setSelected( item, true ); |
347 | } | 345 | } |
348 | 346 | ||
349 | void KOEditorDetails::setDefaults() | 347 | void KOEditorDetails::setDefaults() |
350 | { | 348 | { |
351 | mRsvpButton->setChecked(true); | 349 | mRsvpButton->setChecked(true); |
352 | mListView->clear(); | 350 | mListView->clear(); |
353 | mdelAttendees.clear(); | 351 | mdelAttendees.clear(); |
354 | clearAttendeeInput(); | 352 | clearAttendeeInput(); |
355 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); | 353 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); |
356 | 354 | ||
357 | mNameEdit->setText(""); | 355 | mNameEdit->setText(""); |
358 | mUidEdit->setText(""); | 356 | mUidEdit = ""; |
359 | mEmailEdit->setText(""); | 357 | mEmailEdit->setText(""); |
360 | mRoleCombo->setCurrentItem( 0 ); | 358 | mRoleCombo->setCurrentItem( 0 ); |
361 | mStatusCombo->setCurrentItem( 0 ); | 359 | mStatusCombo->setCurrentItem( 0 ); |
362 | 360 | ||
363 | } | 361 | } |
364 | 362 | ||
365 | void KOEditorDetails::readEvent(Incidence *event) | 363 | void KOEditorDetails::readEvent(Incidence *event) |
366 | { | 364 | { |
367 | setDefaults(); | 365 | setDefaults(); |
368 | //mListView->clear(); | 366 | //mListView->clear(); |
369 | //mdelAttendees.clear(); | 367 | //mdelAttendees.clear(); |
370 | QPtrList<Attendee> tmpAList = event->attendees(); | 368 | QPtrList<Attendee> tmpAList = event->attendees(); |
371 | Attendee *a; | 369 | Attendee *a; |
372 | for (a = tmpAList.first(); a; a = tmpAList.next()) | 370 | for (a = tmpAList.first(); a; a = tmpAList.next()) |
373 | insertAttendee(new Attendee(*a)); | 371 | insertAttendee(new Attendee(*a)); |
374 | 372 | ||
375 | mListView->setSelected( mListView->firstChild(), true ); | 373 | mListView->setSelected( mListView->firstChild(), true ); |
376 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); | 374 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); |
377 | } | 375 | } |
378 | 376 | ||
379 | void KOEditorDetails::writeEvent(Incidence *event) | 377 | void KOEditorDetails::writeEvent(Incidence *event) |
380 | { | 378 | { |
381 | event->clearAttendees(); | 379 | event->clearAttendees(); |
382 | QListViewItem *item; | 380 | QListViewItem *item; |
383 | AttendeeListItem *a; | 381 | AttendeeListItem *a; |
384 | for (item = mListView->firstChild(); item; | 382 | for (item = mListView->firstChild(); item; |
385 | item = item->nextSibling()) { | 383 | item = item->nextSibling()) { |
386 | a = (AttendeeListItem *)item; | 384 | a = (AttendeeListItem *)item; |
387 | event->addAttendee(new Attendee(*(a->data()))); | 385 | event->addAttendee(new Attendee(*(a->data()))); |
388 | } | 386 | } |
389 | event->setOrganizer(KOPrefs::instance()->email()); | 387 | event->setOrganizer(KOPrefs::instance()->email()); |
390 | } | 388 | } |
391 | 389 | ||
392 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) | 390 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) |
393 | { | 391 | { |
394 | event->clearAttendees(); | 392 | event->clearAttendees(); |
395 | Attendee * att; | 393 | Attendee * att; |
396 | for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { | 394 | for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { |
397 | event->addAttendee(new Attendee(*att)); | 395 | event->addAttendee(new Attendee(*att)); |
398 | } | 396 | } |
399 | mdelAttendees.clear(); | 397 | mdelAttendees.clear(); |
400 | } | 398 | } |
401 | 399 | ||
402 | bool KOEditorDetails::validateInput() | 400 | bool KOEditorDetails::validateInput() |
403 | { | 401 | { |
404 | return true; | 402 | return true; |
405 | } | 403 | } |
406 | 404 | ||
407 | void KOEditorDetails::updateAttendeeInput() | 405 | void KOEditorDetails::updateAttendeeInput() |
408 | { | 406 | { |
409 | QListViewItem *item = mListView->selectedItem(); | 407 | QListViewItem *item = mListView->selectedItem(); |
410 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 408 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
411 | if (aItem) { | 409 | if (aItem) { |
412 | fillAttendeeInput( aItem ); | 410 | fillAttendeeInput( aItem ); |
413 | } else { | 411 | } else { |
414 | clearAttendeeInput(); | 412 | clearAttendeeInput(); |
415 | } | 413 | } |
416 | } | 414 | } |
417 | 415 | ||
418 | void KOEditorDetails::clearAttendeeInput() | 416 | void KOEditorDetails::clearAttendeeInput() |
419 | { | 417 | { |
420 | mNameEdit->setText(""); | 418 | mNameEdit->setText(""); |
421 | mUidEdit->setText(""); | 419 | mUidEdit = ""; |
422 | mEmailEdit->setText(""); | 420 | mEmailEdit->setText(""); |
423 | mRoleCombo->setCurrentItem(0); | 421 | mRoleCombo->setCurrentItem(0); |
424 | mStatusCombo->setCurrentItem(0); | 422 | mStatusCombo->setCurrentItem(0); |
425 | mRsvpButton->setChecked(true); | 423 | mRsvpButton->setChecked(true); |
426 | setEnabledAttendeeInput( false ); | 424 | setEnabledAttendeeInput( false ); |
427 | } | 425 | } |
428 | 426 | ||
429 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) | 427 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) |
430 | { | 428 | { |
431 | Attendee *a = aItem->data(); | 429 | Attendee *a = aItem->data(); |
432 | mDisableItemUpdate = true; | 430 | mDisableItemUpdate = true; |
433 | mNameEdit->setText(a->name()); | 431 | mNameEdit->setText(a->name()); |
434 | mUidEdit->setText(a->uid()); | 432 | mUidEdit = a->uid(); |
435 | mEmailEdit->setText(a->email()); | 433 | mEmailEdit->setText(a->email()); |
436 | mRoleCombo->setCurrentItem(a->role()); | 434 | mRoleCombo->setCurrentItem(a->role()); |
437 | mStatusCombo->setCurrentItem(a->status()); | 435 | mStatusCombo->setCurrentItem(a->status()); |
438 | mRsvpButton->setChecked(a->RSVP()); | 436 | mRsvpButton->setChecked(a->RSVP()); |
439 | 437 | ||
440 | mDisableItemUpdate = false; | 438 | mDisableItemUpdate = false; |
441 | 439 | ||
442 | setEnabledAttendeeInput( true ); | 440 | setEnabledAttendeeInput( true ); |
443 | } | 441 | } |
444 | 442 | ||
445 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) | 443 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) |
446 | { | 444 | { |
447 | mNameEdit->setEnabled( enabled ); | 445 | mNameEdit->setEnabled( enabled ); |
448 | mEmailEdit->setEnabled( enabled ); | 446 | mEmailEdit->setEnabled( enabled ); |
449 | mRoleCombo->setEnabled( enabled ); | 447 | mRoleCombo->setEnabled( enabled ); |
450 | mStatusCombo->setEnabled( enabled ); | 448 | mStatusCombo->setEnabled( enabled ); |
451 | mRsvpButton->setEnabled( enabled ); | 449 | mRsvpButton->setEnabled( enabled ); |
452 | 450 | ||
453 | mRemoveButton->setEnabled( enabled ); | 451 | mRemoveButton->setEnabled( enabled ); |
454 | } | 452 | } |
455 | 453 | ||
456 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) | 454 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) |
457 | { | 455 | { |
458 | if ( item && c == 4 ) { | 456 | if ( item && c == 4 ) { |
459 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); | 457 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); |
460 | updateAttendeeItem(); | 458 | updateAttendeeItem(); |
461 | } | 459 | } |
462 | } | 460 | } |
463 | void KOEditorDetails::updateAttendeeItem() | 461 | void KOEditorDetails::updateAttendeeItem() |
464 | { | 462 | { |
465 | if (mDisableItemUpdate) return; | 463 | if (mDisableItemUpdate) return; |
466 | 464 | ||
467 | QListViewItem *item = mListView->selectedItem(); | 465 | QListViewItem *item = mListView->selectedItem(); |
468 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 466 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
469 | if ( !aItem ) return; | 467 | if ( !aItem ) return; |
470 | 468 | ||
471 | Attendee *a = aItem->data(); | 469 | Attendee *a = aItem->data(); |
472 | 470 | ||
473 | a->setName( mNameEdit->text() ); | 471 | a->setName( mNameEdit->text() ); |
474 | a->setUid( mUidEdit->text() ); | 472 | a->setUid( mUidEdit ); |
475 | a->setEmail( mEmailEdit->text() ); | 473 | a->setEmail( mEmailEdit->text() ); |
476 | if ( mEmailEdit->text().isEmpty() ) | 474 | if ( mEmailEdit->text().isEmpty() ) |
477 | mRsvpButton->setChecked( false ); | 475 | mRsvpButton->setChecked( false ); |
478 | a->setRSVP( mRsvpButton->isChecked() ); | 476 | a->setRSVP( mRsvpButton->isChecked() ); |
479 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); | 477 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); |
480 | a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); | 478 | a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); |
481 | aItem->updateItem(); | 479 | aItem->updateItem(); |
482 | } | 480 | } |
diff --git a/korganizer/koeditordetails.h b/korganizer/koeditordetails.h index a33ee82..5f8f6f2 100644 --- a/korganizer/koeditordetails.h +++ b/korganizer/koeditordetails.h | |||
@@ -1,109 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
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 | #ifndef _KOEDITORDETAILS_H | 23 | #ifndef _KOEDITORDETAILS_H |
24 | #define _KOEDITORDETAILS_H | 24 | #define _KOEDITORDETAILS_H |
25 | 25 | ||
26 | #include <qmap.h> | 26 | #include <qmap.h> |
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qgroupbox.h> | 31 | #include <qgroupbox.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qmultilineedit.h> | 34 | #include <qmultilineedit.h> |
35 | #include <klistview.h> | 35 | #include <klistview.h> |
36 | #include <qradiobutton.h> | 36 | #include <qradiobutton.h> |
37 | #include <qptrlist.h> | 37 | #include <qptrlist.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | 40 | ||
41 | #include <libkcal/event.h> | 41 | #include <libkcal/event.h> |
42 | 42 | ||
43 | #include "ktimeedit.h" | 43 | #include "ktimeedit.h" |
44 | #include "customlistviewitem.h" | 44 | #include "customlistviewitem.h" |
45 | 45 | ||
46 | class KDateEdit; | 46 | class KDateEdit; |
47 | 47 | ||
48 | using namespace KCal; | 48 | using namespace KCal; |
49 | 49 | ||
50 | typedef CustomListViewItem<Attendee *> AttendeeListItem; | 50 | typedef CustomListViewItem<Attendee *> AttendeeListItem; |
51 | 51 | ||
52 | 52 | ||
53 | class KOEditorDetails : public QWidget | 53 | class KOEditorDetails : public QWidget |
54 | { | 54 | { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | public: | 56 | public: |
57 | KOEditorDetails (int spacing = 8,QWidget* parent = 0, const char* name = 0); | 57 | KOEditorDetails (int spacing = 8,QWidget* parent = 0, const char* name = 0); |
58 | virtual ~KOEditorDetails(); | 58 | virtual ~KOEditorDetails(); |
59 | 59 | ||
60 | /** Set widgets to default values */ | 60 | /** Set widgets to default values */ |
61 | void setDefaults(); | 61 | void setDefaults(); |
62 | /** Read event object and setup widgets accordingly */ | 62 | /** Read event object and setup widgets accordingly */ |
63 | void readEvent(Incidence *); | 63 | void readEvent(Incidence *); |
64 | /** Write event settings to event object */ | 64 | /** Write event settings to event object */ |
65 | void writeEvent(Incidence *); | 65 | void writeEvent(Incidence *); |
66 | 66 | ||
67 | /** return a clone of the event with attendees to be canceld*/ | 67 | /** return a clone of the event with attendees to be canceld*/ |
68 | void cancelAttendeeEvent(Incidence *); | 68 | void cancelAttendeeEvent(Incidence *); |
69 | /** Check if the input is valid. */ | 69 | /** Check if the input is valid. */ |
70 | bool validateInput(); | 70 | bool validateInput(); |
71 | 71 | ||
72 | public slots: | 72 | public slots: |
73 | void insertAttendee(Attendee *); | 73 | void insertAttendee(Attendee *); |
74 | // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi | 74 | // called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi |
75 | // The first parameter is a uniqueid. It can be used to identify if event | 75 | // The first parameter is a uniqueid. It can be used to identify if event |
76 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); | 76 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); |
77 | 77 | ||
78 | 78 | ||
79 | protected slots: | 79 | protected slots: |
80 | void addNewAttendee(); | 80 | void addNewAttendee(); |
81 | void removeAttendee(); | 81 | void removeAttendee(); |
82 | void openAddressBook(); | 82 | void openAddressBook(); |
83 | void updateAttendeeInput(); | 83 | void updateAttendeeInput(); |
84 | void clearAttendeeInput(); | 84 | void clearAttendeeInput(); |
85 | void fillAttendeeInput(AttendeeListItem *); | 85 | void fillAttendeeInput(AttendeeListItem *); |
86 | void itemClicked(QListViewItem *,const QPoint & pnt, int c); | 86 | void itemClicked(QListViewItem *,const QPoint & pnt, int c); |
87 | void updateAttendeeItem(); | 87 | void updateAttendeeItem(); |
88 | void setEnabledAttendeeInput(bool); | 88 | void setEnabledAttendeeInput(bool); |
89 | 89 | ||
90 | private: | 90 | private: |
91 | bool mDisableItemUpdate; | 91 | bool mDisableItemUpdate; |
92 | 92 | ||
93 | QLineEdit *mNameEdit; | 93 | QLineEdit *mNameEdit; |
94 | QLineEdit *mUidEdit; | 94 | QString mUidEdit; |
95 | QLineEdit *mEmailEdit; | 95 | QLineEdit *mEmailEdit; |
96 | KListView *mListView; | 96 | KListView *mListView; |
97 | QComboBox* mRoleCombo; | 97 | QComboBox* mRoleCombo; |
98 | QCheckBox* mRsvpButton; | 98 | QCheckBox* mRsvpButton; |
99 | QComboBox* mStatusCombo; | 99 | QComboBox* mStatusCombo; |
100 | QLabel *mOrganizerLabel; | 100 | QLabel *mOrganizerLabel; |
101 | 101 | ||
102 | QPushButton* mAddButton; | 102 | QPushButton* mAddButton; |
103 | QPushButton* mRemoveButton; | 103 | QPushButton* mRemoveButton; |
104 | QPushButton* mAddressBookButton; | 104 | QPushButton* mAddressBookButton; |
105 | 105 | ||
106 | QPtrList<Attendee> mdelAttendees; | 106 | QPtrList<Attendee> mdelAttendees; |
107 | }; | 107 | }; |
108 | 108 | ||
109 | #endif | 109 | #endif |