author | ulf69 <ulf69> | 2004-08-17 00:15:05 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-17 00:15:05 (UTC) |
commit | 7d15927b7e7957a80da335587598e7b62dece1a4 (patch) (unidiff) | |
tree | 607b15062fa09b278c764afbc221736a68dbd2c8 | |
parent | f3875aba68f175e8da32462f64b12fc46bc31102 (diff) | |
download | kdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.zip kdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.tar.gz kdepimpi-7d15927b7e7957a80da335587598e7b62dece1a4.tar.bz2 |
added listener to access Ka/pi via QCop
-rw-r--r-- | korganizer/koeditordetails.cpp | 39 | ||||
-rw-r--r-- | korganizer/koeditordetails.h | 7 |
2 files changed, 43 insertions, 3 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index c0e7bdd..8e2fabe 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp | |||
@@ -16,96 +16,102 @@ | |||
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 <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
38 | #include <kmessagebox.h> | 38 | #include <kmessagebox.h> |
39 | #ifndef KORG_NOKABC | 39 | #ifndef KORG_NOKABC |
40 | |||
41 | #ifdef DESKTOP_VERSION | ||
40 | #include <kabc/addresseedialog.h> | 42 | #include <kabc/addresseedialog.h> |
43 | #else //DESKTOP_VERSION | ||
44 | #include <externalapphandler.h> | ||
45 | #endif //DESKTOP_VERSION | ||
46 | |||
41 | #endif | 47 | #endif |
42 | 48 | ||
43 | #include <libkcal/incidence.h> | 49 | #include <libkcal/incidence.h> |
44 | 50 | ||
45 | #include "koprefs.h" | 51 | #include "koprefs.h" |
46 | 52 | ||
47 | #include "koeditordetails.h" | 53 | #include "koeditordetails.h" |
48 | 54 | ||
49 | template <> | 55 | template <> |
50 | CustomListViewItem<class Attendee *>::~CustomListViewItem() | 56 | CustomListViewItem<class Attendee *>::~CustomListViewItem() |
51 | { | 57 | { |
52 | delete mData; | 58 | delete mData; |
53 | } | 59 | } |
54 | 60 | ||
55 | template <> | 61 | template <> |
56 | void CustomListViewItem<class Attendee *>::updateItem() | 62 | void CustomListViewItem<class Attendee *>::updateItem() |
57 | { | 63 | { |
58 | setText(0,mData->name()); | 64 | setText(0,mData->name()); |
59 | setText(1,mData->email()); | 65 | setText(1,mData->email()); |
60 | setText(2,mData->roleStr()); | 66 | setText(2,mData->roleStr()); |
61 | setText(3,mData->statusStr()); | 67 | setText(3,mData->statusStr()); |
62 | if (mData->RSVP() && !mData->email().isEmpty()) | 68 | if (mData->RSVP() && !mData->email().isEmpty()) |
63 | setPixmap(4,SmallIcon("mailappt")); | 69 | setPixmap(4,SmallIcon("mailappt")); |
64 | else | 70 | else |
65 | setPixmap(4,SmallIcon("nomailappt")); | 71 | setPixmap(4,SmallIcon("nomailappt")); |
66 | } | 72 | } |
67 | 73 | ||
68 | 74 | ||
69 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | 75 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) |
70 | : QWidget( parent, name), mDisableItemUpdate( false ) | 76 | : QWidget( parent, name), mDisableItemUpdate( false ) |
71 | { | 77 | { |
72 | QGridLayout *topLayout = new QGridLayout(this); | 78 | QGridLayout *topLayout = new QGridLayout(this); |
73 | topLayout->setSpacing(spacing); | 79 | topLayout->setSpacing(spacing); |
74 | 80 | ||
75 | QString organizer = KOPrefs::instance()->email(); | 81 | QString organizer = KOPrefs::instance()->email(); |
76 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); | 82 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); |
77 | 83 | ||
78 | mListView = new KListView(this,"mListView"); | 84 | mListView = new KListView(this,"mListView"); |
79 | mListView->addColumn(i18n("Name"),180); | 85 | mListView->addColumn(i18n("Name"),180); |
80 | mListView->addColumn(i18n("Email"),180); | 86 | mListView->addColumn(i18n("Email"),180); |
81 | mListView->addColumn(i18n("Role"),60); | 87 | mListView->addColumn(i18n("Role"),60); |
82 | mListView->addColumn(i18n("Status"),100); | 88 | mListView->addColumn(i18n("Status"),100); |
83 | mListView->addColumn(i18n("RSVP"),35); | 89 | mListView->addColumn(i18n("RSVP"),35); |
84 | if ( KOPrefs::instance()->mCompactDialogs ) { | 90 | if ( KOPrefs::instance()->mCompactDialogs ) { |
85 | //mListView->setFixedHeight(78); | 91 | //mListView->setFixedHeight(78); |
86 | } | 92 | } |
87 | 93 | ||
88 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), | 94 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), |
89 | SLOT(updateAttendeeInput())); | 95 | SLOT(updateAttendeeInput())); |
90 | 96 | ||
91 | QLabel *attendeeLabel = new QLabel(this); | 97 | QLabel *attendeeLabel = new QLabel(this); |
92 | attendeeLabel->setText(i18n("Name:")); | 98 | attendeeLabel->setText(i18n("Name:")); |
93 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); | 99 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); |
94 | mNameEdit = new QLineEdit(this); | 100 | mNameEdit = new QLineEdit(this); |
95 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), | 101 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), |
96 | SLOT(updateAttendeeItem())); | 102 | SLOT(updateAttendeeItem())); |
97 | 103 | ||
98 | mUidEdit = new QLineEdit(0); | 104 | mUidEdit = new QLineEdit(0); |
99 | mUidEdit->setText(""); | 105 | mUidEdit->setText(""); |
100 | 106 | ||
101 | QLabel *emailLabel = new QLabel(this); | 107 | QLabel *emailLabel = new QLabel(this); |
102 | emailLabel->setText(i18n("Email:")); | 108 | emailLabel->setText(i18n("Email:")); |
103 | mEmailEdit = new QLineEdit(this); | 109 | mEmailEdit = new QLineEdit(this); |
104 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), | 110 | connect(mEmailEdit,SIGNAL(textChanged(const QString &)), |
105 | SLOT(updateAttendeeItem())); | 111 | SLOT(updateAttendeeItem())); |
106 | 112 | ||
107 | QLabel *attendeeRoleLabel = new QLabel(this); | 113 | QLabel *attendeeRoleLabel = new QLabel(this); |
108 | attendeeRoleLabel->setText(i18n("Role:")); | 114 | attendeeRoleLabel->setText(i18n("Role:")); |
109 | mRoleCombo = new QComboBox(false,this); | 115 | mRoleCombo = new QComboBox(false,this); |
110 | mRoleCombo->insertStringList(Attendee::roleList()); | 116 | mRoleCombo->insertStringList(Attendee::roleList()); |
111 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 117 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
@@ -174,116 +180,145 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | |||
174 | topLayout->setRowStretch(1,5); | 180 | topLayout->setRowStretch(1,5); |
175 | topLayout->setColStretch(0,0); | 181 | topLayout->setColStretch(0,0); |
176 | } | 182 | } |
177 | // #if 0 | 183 | // #if 0 |
178 | // topLayout->setColStretch(2,1); | 184 | // topLayout->setColStretch(2,1); |
179 | // topLayout->addWidget(statusLabel,3,3); | 185 | // topLayout->addWidget(statusLabel,3,3); |
180 | // topLayout->addWidget(mStatusCombo,3,4); | 186 | // topLayout->addWidget(mStatusCombo,3,4); |
181 | // #else | 187 | // #else |
182 | // topLayout->addWidget(statusLabel,4,3); | 188 | // topLayout->addWidget(statusLabel,4,3); |
183 | // // topLayout->addWidget(mStatusCombo,4,3); | 189 | // // topLayout->addWidget(mStatusCombo,4,3); |
184 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); | 190 | // topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); |
185 | 191 | ||
186 | // #endif | 192 | // #endif |
187 | // // topLayout->setRowStretch(5,1); | 193 | // // topLayout->setRowStretch(5,1); |
188 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); | 194 | // topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); |
189 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); | 195 | // topLayout->addMultiCellWidget(buttonBox,2,3,5,5); |
190 | // topLayout->setRowStretch(1,5); | 196 | // topLayout->setRowStretch(1,5); |
191 | // topLayout->setColStretch(0,0); | 197 | // topLayout->setColStretch(0,0); |
192 | 198 | ||
193 | #ifdef KORG_NOKABC | 199 | #ifdef KORG_NOKABC |
194 | mAddressBookButton->hide(); | 200 | mAddressBookButton->hide(); |
195 | #endif | 201 | #endif |
196 | 202 | ||
197 | updateAttendeeInput(); | 203 | updateAttendeeInput(); |
204 | |||
205 | //US listen for arriving address resultsets | ||
206 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | ||
207 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); | ||
208 | |||
198 | } | 209 | } |
199 | 210 | ||
200 | KOEditorDetails::~KOEditorDetails() | 211 | KOEditorDetails::~KOEditorDetails() |
201 | { | 212 | { |
202 | } | 213 | } |
203 | 214 | ||
204 | void KOEditorDetails::removeAttendee() | 215 | void KOEditorDetails::removeAttendee() |
205 | { | 216 | { |
206 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); | 217 | AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); |
207 | if (!aItem) return; | 218 | if (!aItem) return; |
208 | 219 | ||
209 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), | 220 | Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), |
210 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), | 221 | aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), |
211 | aItem->data()->uid()); | 222 | aItem->data()->uid()); |
212 | mdelAttendees.append(delA); | 223 | mdelAttendees.append(delA); |
213 | 224 | ||
214 | delete aItem; | 225 | delete aItem; |
215 | 226 | ||
216 | updateAttendeeInput(); | 227 | updateAttendeeInput(); |
217 | } | 228 | } |
218 | 229 | ||
219 | 230 | ||
220 | void KOEditorDetails::openAddressBook() | 231 | void KOEditorDetails::openAddressBook() |
221 | { | 232 | { |
222 | #ifndef KORG_NOKABC | 233 | #ifndef KORG_NOKABC |
223 | 234 | ||
235 | #ifdef DESKTOP_VERSION | ||
224 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 236 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
225 | uint i=0; | 237 | uint i=0; |
226 | for (i=0; i < list.count(); i++) { | 238 | for (i=0; i < list.count(); i++) { |
227 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); | 239 | insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); |
228 | } | 240 | } |
229 | 241 | #else | |
242 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | ||
243 | // the result should now arrive through method insertAttendees | ||
244 | #endif | ||
245 | |||
246 | |||
230 | #if 0 | 247 | #if 0 |
231 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); | 248 | KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); |
232 | if (!a.isEmpty()) { | 249 | if (!a.isEmpty()) { |
233 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); | 250 | insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); |
234 | } | 251 | } |
235 | #endif | 252 | #endif |
236 | #endif | 253 | #endif |
237 | } | 254 | } |
238 | 255 | ||
239 | 256 | ||
240 | void KOEditorDetails::addNewAttendee() | 257 | void KOEditorDetails::addNewAttendee() |
241 | { | 258 | { |
242 | #if 0 | 259 | #if 0 |
243 | // this is cool. If they didn't enter an email address, | 260 | // this is cool. If they didn't enter an email address, |
244 | // try to look it up in the address book and fill it in for them. | 261 | // try to look it up in the address book and fill it in for them. |
245 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { | 262 | if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { |
246 | KabAPI addrBook; | 263 | KabAPI addrBook; |
247 | QString name; | 264 | QString name; |
248 | std::list<AddressBook::Entry> entries; | 265 | std::list<AddressBook::Entry> entries; |
249 | name = mNameEdit->text(); | 266 | name = mNameEdit->text(); |
250 | if (addrBook.init() == AddressBook::NoError) { | 267 | if (addrBook.init() == AddressBook::NoError) { |
251 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { | 268 | if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { |
252 | kdDebug() << "positive match" << endl; | 269 | kdDebug() << "positive match" << endl; |
253 | // take first email address | 270 | // take first email address |
254 | if (!entries.front().emails.isEmpty() && | 271 | if (!entries.front().emails.isEmpty() && |
255 | entries.front().emails.first().length()>0) | 272 | entries.front().emails.first().length()>0) |
256 | mEmailEdit->setText(entries.front().emails.first()); | 273 | mEmailEdit->setText(entries.front().emails.first()); |
257 | } | 274 | } |
258 | } | 275 | } |
259 | } | 276 | } |
260 | #endif | 277 | #endif |
261 | 278 | ||
262 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); | 279 | Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); |
263 | insertAttendee(a); | 280 | insertAttendee(a); |
264 | } | 281 | } |
265 | 282 | ||
283 | //the map includes name/email pairs, that comes from Ka/Pi | ||
284 | void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | ||
285 | { | ||
286 | if (uid == this->name()) | ||
287 | { | ||
288 | for ( int i = 0; i < nameList.count(); i++) | ||
289 | { | ||
290 | QString _name = nameList[i]; | ||
291 | QString _email = emailList[i]; | ||
292 | QString _uid = uidList[i]; | ||
293 | |||
294 | Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); | ||
295 | insertAttendee(a); | ||
296 | } | ||
297 | } | ||
298 | |||
299 | } | ||
300 | |||
266 | 301 | ||
267 | void KOEditorDetails::insertAttendee(Attendee *a) | 302 | void KOEditorDetails::insertAttendee(Attendee *a) |
268 | { | 303 | { |
269 | AttendeeListItem *item = new AttendeeListItem(a,mListView); | 304 | AttendeeListItem *item = new AttendeeListItem(a,mListView); |
270 | mListView->setSelected( item, true ); | 305 | mListView->setSelected( item, true ); |
271 | } | 306 | } |
272 | 307 | ||
273 | void KOEditorDetails::setDefaults() | 308 | void KOEditorDetails::setDefaults() |
274 | { | 309 | { |
275 | mRsvpButton->setChecked(true); | 310 | mRsvpButton->setChecked(true); |
276 | mListView->clear(); | 311 | mListView->clear(); |
277 | mdelAttendees.clear(); | 312 | mdelAttendees.clear(); |
278 | clearAttendeeInput(); | 313 | clearAttendeeInput(); |
279 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); | 314 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); |
280 | 315 | ||
281 | mNameEdit->setText(""); | 316 | mNameEdit->setText(""); |
282 | mUidEdit->setText(""); | 317 | mUidEdit->setText(""); |
283 | mEmailEdit->setText(""); | 318 | mEmailEdit->setText(""); |
284 | mRoleCombo->setCurrentItem( 0 ); | 319 | mRoleCombo->setCurrentItem( 0 ); |
285 | mStatusCombo->setCurrentItem( 0 ); | 320 | mStatusCombo->setCurrentItem( 0 ); |
286 | 321 | ||
287 | } | 322 | } |
288 | 323 | ||
289 | void KOEditorDetails::readEvent(Incidence *event) | 324 | void KOEditorDetails::readEvent(Incidence *event) |
diff --git a/korganizer/koeditordetails.h b/korganizer/koeditordetails.h index 930b296..0cc807f 100644 --- a/korganizer/koeditordetails.h +++ b/korganizer/koeditordetails.h | |||
@@ -2,102 +2,107 @@ | |||
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 <qframe.h> | 27 | #include <qframe.h> |
27 | #include <qlabel.h> | 28 | #include <qlabel.h> |
28 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
30 | #include <qgroupbox.h> | 31 | #include <qgroupbox.h> |
31 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
32 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
33 | #include <qmultilineedit.h> | 34 | #include <qmultilineedit.h> |
34 | #include <klistview.h> | 35 | #include <klistview.h> |
35 | #include <qradiobutton.h> | 36 | #include <qradiobutton.h> |
36 | #include <qptrlist.h> | 37 | #include <qptrlist.h> |
37 | 38 | ||
38 | #include <kapplication.h> | 39 | #include <kapplication.h> |
39 | 40 | ||
40 | #include <libkcal/event.h> | 41 | #include <libkcal/event.h> |
41 | 42 | ||
42 | #include "ktimeedit.h" | 43 | #include "ktimeedit.h" |
43 | #include "customlistviewitem.h" | 44 | #include "customlistviewitem.h" |
44 | 45 | ||
45 | class KDateEdit; | 46 | class KDateEdit; |
46 | 47 | ||
47 | using namespace KCal; | 48 | using namespace KCal; |
48 | 49 | ||
49 | typedef CustomListViewItem<Attendee *> AttendeeListItem; | 50 | typedef CustomListViewItem<Attendee *> AttendeeListItem; |
50 | 51 | ||
51 | 52 | ||
52 | class KOEditorDetails : public QWidget | 53 | class KOEditorDetails : public QWidget |
53 | { | 54 | { |
54 | Q_OBJECT | 55 | Q_OBJECT |
55 | public: | 56 | public: |
56 | KOEditorDetails (int spacing = 8,QWidget* parent = 0, const char* name = 0); | 57 | KOEditorDetails (int spacing = 8,QWidget* parent = 0, const char* name = 0); |
57 | virtual ~KOEditorDetails(); | 58 | virtual ~KOEditorDetails(); |
58 | 59 | ||
59 | /** Set widgets to default values */ | 60 | /** Set widgets to default values */ |
60 | void setDefaults(); | 61 | void setDefaults(); |
61 | /** Read event object and setup widgets accordingly */ | 62 | /** Read event object and setup widgets accordingly */ |
62 | void readEvent(Incidence *); | 63 | void readEvent(Incidence *); |
63 | /** Write event settings to event object */ | 64 | /** Write event settings to event object */ |
64 | void writeEvent(Incidence *); | 65 | void writeEvent(Incidence *); |
65 | 66 | ||
66 | /** return a clone of the event with attendees to be canceld*/ | 67 | /** return a clone of the event with attendees to be canceld*/ |
67 | void cancelAttendeeEvent(Incidence *); | 68 | void cancelAttendeeEvent(Incidence *); |
68 | /** Check if the input is valid. */ | 69 | /** Check if the input is valid. */ |
69 | bool validateInput(); | 70 | bool validateInput(); |
70 | 71 | ||
71 | public slots: | 72 | public slots: |
72 | 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 | ||
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); | ||
77 | |||
73 | 78 | ||
74 | protected slots: | 79 | protected slots: |
75 | void addNewAttendee(); | 80 | void addNewAttendee(); |
76 | void removeAttendee(); | 81 | void removeAttendee(); |
77 | void openAddressBook(); | 82 | void openAddressBook(); |
78 | void updateAttendeeInput(); | 83 | void updateAttendeeInput(); |
79 | void clearAttendeeInput(); | 84 | void clearAttendeeInput(); |
80 | void fillAttendeeInput(AttendeeListItem *); | 85 | void fillAttendeeInput(AttendeeListItem *); |
81 | void updateAttendeeItem(); | 86 | void updateAttendeeItem(); |
82 | void setEnabledAttendeeInput(bool); | 87 | void setEnabledAttendeeInput(bool); |
83 | 88 | ||
84 | private: | 89 | private: |
85 | bool mDisableItemUpdate; | 90 | bool mDisableItemUpdate; |
86 | 91 | ||
87 | QLineEdit *mNameEdit; | 92 | QLineEdit *mNameEdit; |
88 | QLineEdit *mUidEdit; | 93 | QLineEdit *mUidEdit; |
89 | QLineEdit *mEmailEdit; | 94 | QLineEdit *mEmailEdit; |
90 | KListView *mListView; | 95 | KListView *mListView; |
91 | QComboBox* mRoleCombo; | 96 | QComboBox* mRoleCombo; |
92 | QCheckBox* mRsvpButton; | 97 | QCheckBox* mRsvpButton; |
93 | QComboBox* mStatusCombo; | 98 | QComboBox* mStatusCombo; |
94 | QLabel *mOrganizerLabel; | 99 | QLabel *mOrganizerLabel; |
95 | 100 | ||
96 | QPushButton* mAddButton; | 101 | QPushButton* mAddButton; |
97 | QPushButton* mRemoveButton; | 102 | QPushButton* mRemoveButton; |
98 | QPushButton* mAddressBookButton; | 103 | QPushButton* mAddressBookButton; |
99 | 104 | ||
100 | QPtrList<Attendee> mdelAttendees; | 105 | QPtrList<Attendee> mdelAttendees; |
101 | }; | 106 | }; |
102 | 107 | ||
103 | #endif | 108 | #endif |