author | zautrix <zautrix> | 2005-07-29 17:41:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-29 17:41:39 (UTC) |
commit | 9553b882522708477d131d0d9a2c581724940ba3 (patch) (unidiff) | |
tree | c44ccf8238ed9aa2991aad829dc75302b2992f9b /korganizer | |
parent | 2f3e1ae3d057b10aa6b4dbc3de109da32563dfb3 (diff) | |
download | kdepimpi-9553b882522708477d131d0d9a2c581724940ba3.zip kdepimpi-9553b882522708477d131d0d9a2c581724940ba3.tar.gz kdepimpi-9553b882522708477d131d0d9a2c581724940ba3.tar.bz2 |
fixx
-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 | |||
@@ -96,50 +96,48 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | |||
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); |
@@ -334,49 +332,49 @@ void KOEditorDetails::insertAttendees(const QString& uid,const QStringList& name | |||
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; |
@@ -397,86 +395,86 @@ void KOEditorDetails::cancelAttendeeEvent(Incidence *event) | |||
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 | |||
@@ -70,40 +70,40 @@ class KOEditorDetails : public QWidget | |||
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 |