summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-19 20:48:51 (UTC)
committer zautrix <zautrix>2004-08-19 20:48:51 (UTC)
commitd9b7a7296b031b3cf3e510a163367b9c4ab42d7a (patch) (unidiff)
tree6423ca29d29c43e1cd4298c81f2031762199e36a
parent895e3797f6437347fd73b87a3bf9d4cecfa5a5a9 (diff)
downloadkdepimpi-d9b7a7296b031b3cf3e510a163367b9c4ab42d7a.zip
kdepimpi-d9b7a7296b031b3cf3e510a163367b9c4ab42d7a.tar.gz
kdepimpi-d9b7a7296b031b3cf3e510a163367b9c4ab42d7a.tar.bz2
added missing ifdef for dektop version
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditordetails.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index 8e2fabe..2e1ae6e 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -1,432 +1,433 @@
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 <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 40
41#ifdef DESKTOP_VERSION 41#ifdef DESKTOP_VERSION
42#include <kabc/addresseedialog.h> 42#include <kabc/addresseedialog.h>
43#else //DESKTOP_VERSION 43#else //DESKTOP_VERSION
44#include <externalapphandler.h> 44#include <externalapphandler.h>
45#endif //DESKTOP_VERSION 45#endif //DESKTOP_VERSION
46 46
47#endif 47#endif
48 48
49#include <libkcal/incidence.h> 49#include <libkcal/incidence.h>
50 50
51#include "koprefs.h" 51#include "koprefs.h"
52 52
53#include "koeditordetails.h" 53#include "koeditordetails.h"
54 54
55template <> 55template <>
56CustomListViewItem<class Attendee *>::~CustomListViewItem() 56CustomListViewItem<class Attendee *>::~CustomListViewItem()
57{ 57{
58 delete mData; 58 delete mData;
59} 59}
60 60
61template <> 61template <>
62void CustomListViewItem<class Attendee *>::updateItem() 62void CustomListViewItem<class Attendee *>::updateItem()
63{ 63{
64 setText(0,mData->name()); 64 setText(0,mData->name());
65 setText(1,mData->email()); 65 setText(1,mData->email());
66 setText(2,mData->roleStr()); 66 setText(2,mData->roleStr());
67 setText(3,mData->statusStr()); 67 setText(3,mData->statusStr());
68 if (mData->RSVP() && !mData->email().isEmpty()) 68 if (mData->RSVP() && !mData->email().isEmpty())
69 setPixmap(4,SmallIcon("mailappt")); 69 setPixmap(4,SmallIcon("mailappt"));
70 else 70 else
71 setPixmap(4,SmallIcon("nomailappt")); 71 setPixmap(4,SmallIcon("nomailappt"));
72} 72}
73 73
74 74
75KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) 75KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
76 : QWidget( parent, name), mDisableItemUpdate( false ) 76 : QWidget( parent, name), mDisableItemUpdate( false )
77{ 77{
78 QGridLayout *topLayout = new QGridLayout(this); 78 QGridLayout *topLayout = new QGridLayout(this);
79 topLayout->setSpacing(spacing); 79 topLayout->setSpacing(spacing);
80 80
81 QString organizer = KOPrefs::instance()->email(); 81 QString organizer = KOPrefs::instance()->email();
82 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); 82 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
83 83
84 mListView = new KListView(this,"mListView"); 84 mListView = new KListView(this,"mListView");
85 mListView->addColumn(i18n("Name"),180); 85 mListView->addColumn(i18n("Name"),180);
86 mListView->addColumn(i18n("Email"),180); 86 mListView->addColumn(i18n("Email"),180);
87 mListView->addColumn(i18n("Role"),60); 87 mListView->addColumn(i18n("Role"),60);
88 mListView->addColumn(i18n("Status"),100); 88 mListView->addColumn(i18n("Status"),100);
89 mListView->addColumn(i18n("RSVP"),35); 89 mListView->addColumn(i18n("RSVP"),35);
90 if ( KOPrefs::instance()->mCompactDialogs ) { 90 if ( KOPrefs::instance()->mCompactDialogs ) {
91 //mListView->setFixedHeight(78); 91 //mListView->setFixedHeight(78);
92 } 92 }
93 93
94 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), 94 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
95 SLOT(updateAttendeeInput())); 95 SLOT(updateAttendeeInput()));
96 96
97 QLabel *attendeeLabel = new QLabel(this); 97 QLabel *attendeeLabel = new QLabel(this);
98 attendeeLabel->setText(i18n("Name:")); 98 attendeeLabel->setText(i18n("Name:"));
99 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); 99 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
100 mNameEdit = new QLineEdit(this); 100 mNameEdit = new QLineEdit(this);
101 connect(mNameEdit,SIGNAL(textChanged(const QString &)), 101 connect(mNameEdit,SIGNAL(textChanged(const QString &)),
102 SLOT(updateAttendeeItem())); 102 SLOT(updateAttendeeItem()));
103 103
104 mUidEdit = new QLineEdit(0); 104 mUidEdit = new QLineEdit(0);
105 mUidEdit->setText(""); 105 mUidEdit->setText("");
106 106
107 QLabel *emailLabel = new QLabel(this); 107 QLabel *emailLabel = new QLabel(this);
108 emailLabel->setText(i18n("Email:")); 108 emailLabel->setText(i18n("Email:"));
109 mEmailEdit = new QLineEdit(this); 109 mEmailEdit = new QLineEdit(this);
110 connect(mEmailEdit,SIGNAL(textChanged(const QString &)), 110 connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
111 SLOT(updateAttendeeItem())); 111 SLOT(updateAttendeeItem()));
112 112
113 QLabel *attendeeRoleLabel = new QLabel(this); 113 QLabel *attendeeRoleLabel = new QLabel(this);
114 attendeeRoleLabel->setText(i18n("Role:")); 114 attendeeRoleLabel->setText(i18n("Role:"));
115 mRoleCombo = new QComboBox(false,this); 115 mRoleCombo = new QComboBox(false,this);
116 mRoleCombo->insertStringList(Attendee::roleList()); 116 mRoleCombo->insertStringList(Attendee::roleList());
117 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 117 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
118 118
119 QLabel *statusLabel = new QLabel(this); 119 QLabel *statusLabel = new QLabel(this);
120 statusLabel->setText( i18n("Status:") ); 120 statusLabel->setText( i18n("Status:") );
121 121
122 mStatusCombo = new QComboBox(false,this); 122 mStatusCombo = new QComboBox(false,this);
123 mStatusCombo->insertStringList(Attendee::statusList()); 123 mStatusCombo->insertStringList(Attendee::statusList());
124 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 124 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
125 125
126 mRsvpButton = new QCheckBox(this); 126 mRsvpButton = new QCheckBox(this);
127 mRsvpButton->setText(i18n("Request response")); 127 mRsvpButton->setText(i18n("Request response"));
128 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); 128 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem()));
129 QWidget *buttonBox = new QWidget(this); 129 QWidget *buttonBox = new QWidget(this);
130 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); 130 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox);
131 131
132 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); 132 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox);
133 buttonLayout->addWidget(newButton); 133 buttonLayout->addWidget(newButton);
134 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); 134 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee()));
135 135
136 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); 136 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox);
137 buttonLayout->addWidget(mRemoveButton); 137 buttonLayout->addWidget(mRemoveButton);
138 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); 138 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee()));
139 139
140 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); 140 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
141 // buttonLayout->addWidget(mAddressBookButton); 141 // buttonLayout->addWidget(mAddressBookButton);
142 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); 142 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook()));
143 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); 143 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () );
144 144
145 if (qApp->desktop()->width() < 300 ) { 145 if (qApp->desktop()->width() < 300 ) {
146 mListView->setFixedHeight(80); 146 mListView->setFixedHeight(80);
147 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); 147 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3);
148 topLayout->addMultiCellWidget(mListView,1,1,0,3); 148 topLayout->addMultiCellWidget(mListView,1,1,0,3);
149 topLayout->addWidget(attendeeLabel,3,0); 149 topLayout->addWidget(attendeeLabel,3,0);
150 topLayout->addMultiCellWidget(mNameEdit,3,3,1,2); 150 topLayout->addMultiCellWidget(mNameEdit,3,3,1,2);
151 topLayout->addWidget(emailLabel,4,0); 151 topLayout->addWidget(emailLabel,4,0);
152 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2); 152 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,2);
153 topLayout->addWidget(attendeeRoleLabel,5,0); 153 topLayout->addWidget(attendeeRoleLabel,5,0);
154 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 154 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
155 topLayout->addWidget(statusLabel,6,0); 155 topLayout->addWidget(statusLabel,6,0);
156 topLayout->addMultiCellWidget(mStatusCombo,6,6,1,2); 156 topLayout->addMultiCellWidget(mStatusCombo,6,6,1,2);
157 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3); 157 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,3);
158 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 158 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
159 topLayout->addMultiCellWidget(buttonBox,3,4,3,3); 159 topLayout->addMultiCellWidget(buttonBox,3,4,3,3);
160 topLayout->setRowStretch(1,2); 160 topLayout->setRowStretch(1,2);
161 topLayout->setColStretch(0,0); 161 topLayout->setColStretch(0,0);
162 topLayout->setColStretch(1,2); 162 topLayout->setColStretch(1,2);
163 topLayout->setColStretch(2,1); 163 topLayout->setColStretch(2,1);
164 topLayout->setColStretch(3,1); 164 topLayout->setColStretch(3,1);
165 165
166 } else { 166 } else {
167 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); 167 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5);
168 topLayout->addMultiCellWidget(mListView,1,1,0,5); 168 topLayout->addMultiCellWidget(mListView,1,1,0,5);
169 topLayout->addWidget(attendeeLabel,3,0); 169 topLayout->addWidget(attendeeLabel,3,0);
170 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); 170 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4);
171 topLayout->addWidget(emailLabel,4,0); 171 topLayout->addWidget(emailLabel,4,0);
172 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); 172 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4);
173 topLayout->addWidget(attendeeRoleLabel,5,0); 173 topLayout->addWidget(attendeeRoleLabel,5,0);
174 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 174 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
175 topLayout->addWidget(statusLabel,5,3); 175 topLayout->addWidget(statusLabel,5,3);
176 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); 176 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5);
177 topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5); 177 topLayout->addMultiCellWidget(mAddressBookButton,2,2,4,5);
178 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 178 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
179 topLayout->addMultiCellWidget(buttonBox,3,4,5,5); 179 topLayout->addMultiCellWidget(buttonBox,3,4,5,5);
180 topLayout->setRowStretch(1,5); 180 topLayout->setRowStretch(1,5);
181 topLayout->setColStretch(0,0); 181 topLayout->setColStretch(0,0);
182 } 182 }
183// #if 0 183// #if 0
184// topLayout->setColStretch(2,1); 184// topLayout->setColStretch(2,1);
185// topLayout->addWidget(statusLabel,3,3); 185// topLayout->addWidget(statusLabel,3,3);
186// topLayout->addWidget(mStatusCombo,3,4); 186// topLayout->addWidget(mStatusCombo,3,4);
187// #else 187// #else
188// topLayout->addWidget(statusLabel,4,3); 188// topLayout->addWidget(statusLabel,4,3);
189// // topLayout->addWidget(mStatusCombo,4,3); 189// // topLayout->addWidget(mStatusCombo,4,3);
190// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5); 190// topLayout->addMultiCellWidget(mStatusCombo,4,4,4,5);
191 191
192// #endif 192// #endif
193// // topLayout->setRowStretch(5,1); 193// // topLayout->setRowStretch(5,1);
194// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1); 194// topLayout->addMultiCellWidget(mRsvpButton,5,5,0,1);
195// topLayout->addMultiCellWidget(buttonBox,2,3,5,5); 195// topLayout->addMultiCellWidget(buttonBox,2,3,5,5);
196// topLayout->setRowStretch(1,5); 196// topLayout->setRowStretch(1,5);
197// topLayout->setColStretch(0,0); 197// topLayout->setColStretch(0,0);
198 198
199#ifdef KORG_NOKABC 199#ifdef KORG_NOKABC
200 mAddressBookButton->hide(); 200 mAddressBookButton->hide();
201#endif 201#endif
202 202
203 updateAttendeeInput(); 203 updateAttendeeInput();
204 204#ifndef DESKTOP_VERSION
205//US listen for arriving address resultsets 205//US listen for arriving address resultsets
206 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 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&))); 207 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
208#endif
208 209
209} 210}
210 211
211KOEditorDetails::~KOEditorDetails() 212KOEditorDetails::~KOEditorDetails()
212{ 213{
213} 214}
214 215
215void KOEditorDetails::removeAttendee() 216void KOEditorDetails::removeAttendee()
216{ 217{
217 AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem(); 218 AttendeeListItem *aItem = (AttendeeListItem *)mListView->selectedItem();
218 if (!aItem) return; 219 if (!aItem) return;
219 220
220 Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(), 221 Attendee *delA = new Attendee(aItem->data()->name(),aItem->data()->email(),
221 aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(), 222 aItem->data()->RSVP(),aItem->data()->status(),aItem->data()->role(),
222 aItem->data()->uid()); 223 aItem->data()->uid());
223 mdelAttendees.append(delA); 224 mdelAttendees.append(delA);
224 225
225 delete aItem; 226 delete aItem;
226 227
227 updateAttendeeInput(); 228 updateAttendeeInput();
228} 229}
229 230
230 231
231void KOEditorDetails::openAddressBook() 232void KOEditorDetails::openAddressBook()
232{ 233{
233#ifndef KORG_NOKABC 234#ifndef KORG_NOKABC
234 235
235#ifdef DESKTOP_VERSION 236#ifdef DESKTOP_VERSION
236 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 237 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
237 uint i=0; 238 uint i=0;
238 for (i=0; i < list.count(); i++) { 239 for (i=0; i < list.count(); i++) {
239 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) ); 240 insertAttendee( new Attendee( list[i].realName(), list[i].preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,list[i].uid()) );
240 } 241 }
241#else 242#else
242 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 243 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 // the result should now arrive through method insertAttendees
244#endif 245#endif
245 246
246 247
247#if 0 248#if 0
248 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); 249 KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
249 if (!a.isEmpty()) { 250 if (!a.isEmpty()) {
250 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) ); 251 insertAttendee( new Attendee( a.realName(), a.preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,a.uid()) );
251 } 252 }
252#endif 253#endif
253#endif 254#endif
254} 255}
255 256
256 257
257void KOEditorDetails::addNewAttendee() 258void KOEditorDetails::addNewAttendee()
258{ 259{
259#if 0 260#if 0
260 // this is cool. If they didn't enter an email address, 261 // this is cool. If they didn't enter an email address,
261 // try to look it up in the address book and fill it in for them. 262 // try to look it up in the address book and fill it in for them.
262 if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) { 263 if (QString(mEmailEdit->text()).stripWhiteSpace().isEmpty()) {
263 KabAPI addrBook; 264 KabAPI addrBook;
264 QString name; 265 QString name;
265 std::list<AddressBook::Entry> entries; 266 std::list<AddressBook::Entry> entries;
266 name = mNameEdit->text(); 267 name = mNameEdit->text();
267 if (addrBook.init() == AddressBook::NoError) { 268 if (addrBook.init() == AddressBook::NoError) {
268 if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) { 269 if (addrBook.getEntryByName(name, entries, 1) == AddressBook::NoError) {
269 kdDebug() << "positive match" << endl; 270 kdDebug() << "positive match" << endl;
270 // take first email address 271 // take first email address
271 if (!entries.front().emails.isEmpty() && 272 if (!entries.front().emails.isEmpty() &&
272 entries.front().emails.first().length()>0) 273 entries.front().emails.first().length()>0)
273 mEmailEdit->setText(entries.front().emails.first()); 274 mEmailEdit->setText(entries.front().emails.first());
274 } 275 }
275 } 276 }
276 } 277 }
277#endif 278#endif
278 279
279 Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)")); 280 Attendee *a = new Attendee(i18n("(EmptyName)"),i18n("(EmptyEmail)"));
280 insertAttendee(a); 281 insertAttendee(a);
281} 282}
282 283
283//the map includes name/email pairs, that comes from Ka/Pi 284//the map includes name/email pairs, that comes from Ka/Pi
284void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 285void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
285{ 286{
286 if (uid == this->name()) 287 if (uid == this->name())
287 { 288 {
288 for ( int i = 0; i < nameList.count(); i++) 289 for ( int i = 0; i < nameList.count(); i++)
289 { 290 {
290 QString _name = nameList[i]; 291 QString _name = nameList[i];
291 QString _email = emailList[i]; 292 QString _email = emailList[i];
292 QString _uid = uidList[i]; 293 QString _uid = uidList[i];
293 294
294 Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid); 295 Attendee *a = new Attendee(_name,_email,false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant, _uid);
295 insertAttendee(a); 296 insertAttendee(a);
296 } 297 }
297 } 298 }
298 299
299} 300}
300 301
301 302
302void KOEditorDetails::insertAttendee(Attendee *a) 303void KOEditorDetails::insertAttendee(Attendee *a)
303{ 304{
304 AttendeeListItem *item = new AttendeeListItem(a,mListView); 305 AttendeeListItem *item = new AttendeeListItem(a,mListView);
305 mListView->setSelected( item, true ); 306 mListView->setSelected( item, true );
306} 307}
307 308
308void KOEditorDetails::setDefaults() 309void KOEditorDetails::setDefaults()
309{ 310{
310 mRsvpButton->setChecked(true); 311 mRsvpButton->setChecked(true);
311 mListView->clear(); 312 mListView->clear();
312 mdelAttendees.clear(); 313 mdelAttendees.clear();
313 clearAttendeeInput(); 314 clearAttendeeInput();
314 mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email())); 315 mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email()));
315 316
316 mNameEdit->setText(""); 317 mNameEdit->setText("");
317 mUidEdit->setText(""); 318 mUidEdit->setText("");
318 mEmailEdit->setText(""); 319 mEmailEdit->setText("");
319 mRoleCombo->setCurrentItem( 0 ); 320 mRoleCombo->setCurrentItem( 0 );
320 mStatusCombo->setCurrentItem( 0 ); 321 mStatusCombo->setCurrentItem( 0 );
321 322
322} 323}
323 324
324void KOEditorDetails::readEvent(Incidence *event) 325void KOEditorDetails::readEvent(Incidence *event)
325{ 326{
326 setDefaults(); 327 setDefaults();
327 //mListView->clear(); 328 //mListView->clear();
328 //mdelAttendees.clear(); 329 //mdelAttendees.clear();
329 QPtrList<Attendee> tmpAList = event->attendees(); 330 QPtrList<Attendee> tmpAList = event->attendees();
330 Attendee *a; 331 Attendee *a;
331 for (a = tmpAList.first(); a; a = tmpAList.next()) 332 for (a = tmpAList.first(); a; a = tmpAList.next())
332 insertAttendee(new Attendee(*a)); 333 insertAttendee(new Attendee(*a));
333 334
334 mListView->setSelected( mListView->firstChild(), true ); 335 mListView->setSelected( mListView->firstChild(), true );
335 mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); 336 mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer()));
336} 337}
337 338
338void KOEditorDetails::writeEvent(Incidence *event) 339void KOEditorDetails::writeEvent(Incidence *event)
339{ 340{
340 event->clearAttendees(); 341 event->clearAttendees();
341 QListViewItem *item; 342 QListViewItem *item;
342 AttendeeListItem *a; 343 AttendeeListItem *a;
343 for (item = mListView->firstChild(); item; 344 for (item = mListView->firstChild(); item;
344 item = item->nextSibling()) { 345 item = item->nextSibling()) {
345 a = (AttendeeListItem *)item; 346 a = (AttendeeListItem *)item;
346 event->addAttendee(new Attendee(*(a->data()))); 347 event->addAttendee(new Attendee(*(a->data())));
347 } 348 }
348 event->setOrganizer(KOPrefs::instance()->email()); 349 event->setOrganizer(KOPrefs::instance()->email());
349} 350}
350 351
351void KOEditorDetails::cancelAttendeeEvent(Incidence *event) 352void KOEditorDetails::cancelAttendeeEvent(Incidence *event)
352{ 353{
353 event->clearAttendees(); 354 event->clearAttendees();
354 Attendee * att; 355 Attendee * att;
355 for (att=mdelAttendees.first();att;att=mdelAttendees.next()) { 356 for (att=mdelAttendees.first();att;att=mdelAttendees.next()) {
356 event->addAttendee(new Attendee(*att)); 357 event->addAttendee(new Attendee(*att));
357 } 358 }
358 mdelAttendees.clear(); 359 mdelAttendees.clear();
359} 360}
360 361
361bool KOEditorDetails::validateInput() 362bool KOEditorDetails::validateInput()
362{ 363{
363 return true; 364 return true;
364} 365}
365 366
366void KOEditorDetails::updateAttendeeInput() 367void KOEditorDetails::updateAttendeeInput()
367{ 368{
368 QListViewItem *item = mListView->selectedItem(); 369 QListViewItem *item = mListView->selectedItem();
369 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 370 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
370 if (aItem) { 371 if (aItem) {
371 fillAttendeeInput( aItem ); 372 fillAttendeeInput( aItem );
372 } else { 373 } else {
373 clearAttendeeInput(); 374 clearAttendeeInput();
374 } 375 }
375} 376}
376 377
377void KOEditorDetails::clearAttendeeInput() 378void KOEditorDetails::clearAttendeeInput()
378{ 379{
379 mNameEdit->setText(""); 380 mNameEdit->setText("");
380 mUidEdit->setText(""); 381 mUidEdit->setText("");
381 mEmailEdit->setText(""); 382 mEmailEdit->setText("");
382 mRoleCombo->setCurrentItem(0); 383 mRoleCombo->setCurrentItem(0);
383 mStatusCombo->setCurrentItem(0); 384 mStatusCombo->setCurrentItem(0);
384 mRsvpButton->setChecked(true); 385 mRsvpButton->setChecked(true);
385 setEnabledAttendeeInput( false ); 386 setEnabledAttendeeInput( false );
386} 387}
387 388
388void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) 389void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem )
389{ 390{
390 Attendee *a = aItem->data(); 391 Attendee *a = aItem->data();
391 mDisableItemUpdate = true; 392 mDisableItemUpdate = true;
392 mNameEdit->setText(a->name()); 393 mNameEdit->setText(a->name());
393 mUidEdit->setText(a->uid()); 394 mUidEdit->setText(a->uid());
394 mEmailEdit->setText(a->email()); 395 mEmailEdit->setText(a->email());
395 mRoleCombo->setCurrentItem(a->role()); 396 mRoleCombo->setCurrentItem(a->role());
396 mStatusCombo->setCurrentItem(a->status()); 397 mStatusCombo->setCurrentItem(a->status());
397 mRsvpButton->setChecked(a->RSVP()); 398 mRsvpButton->setChecked(a->RSVP());
398 399
399 mDisableItemUpdate = false; 400 mDisableItemUpdate = false;
400 401
401 setEnabledAttendeeInput( true ); 402 setEnabledAttendeeInput( true );
402} 403}
403 404
404void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) 405void KOEditorDetails::setEnabledAttendeeInput( bool enabled )
405{ 406{
406 mNameEdit->setEnabled( enabled ); 407 mNameEdit->setEnabled( enabled );
407 mEmailEdit->setEnabled( enabled ); 408 mEmailEdit->setEnabled( enabled );
408 mRoleCombo->setEnabled( enabled ); 409 mRoleCombo->setEnabled( enabled );
409 mStatusCombo->setEnabled( enabled ); 410 mStatusCombo->setEnabled( enabled );
410 mRsvpButton->setEnabled( enabled ); 411 mRsvpButton->setEnabled( enabled );
411 412
412 mRemoveButton->setEnabled( enabled ); 413 mRemoveButton->setEnabled( enabled );
413} 414}
414 415
415void KOEditorDetails::updateAttendeeItem() 416void KOEditorDetails::updateAttendeeItem()
416{ 417{
417 if (mDisableItemUpdate) return; 418 if (mDisableItemUpdate) return;
418 419
419 QListViewItem *item = mListView->selectedItem(); 420 QListViewItem *item = mListView->selectedItem();
420 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); 421 AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
421 if ( !aItem ) return; 422 if ( !aItem ) return;
422 423
423 Attendee *a = aItem->data(); 424 Attendee *a = aItem->data();
424 425
425 a->setName( mNameEdit->text() ); 426 a->setName( mNameEdit->text() );
426 a->setUid( mUidEdit->text() ); 427 a->setUid( mUidEdit->text() );
427 a->setEmail( mEmailEdit->text() ); 428 a->setEmail( mEmailEdit->text() );
428 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); 429 a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
429 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); 430 a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
430 a->setRSVP( mRsvpButton->isChecked() ); 431 a->setRSVP( mRsvpButton->isChecked() );
431 aItem->updateItem(); 432 aItem->updateItem();
432} 433}