-rw-r--r-- | korganizer/koeditordetails.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 6ecf978..7354940 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp | |||
@@ -20,100 +20,104 @@ | |||
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 | ||
55 | template <> | 55 | template <> |
56 | CustomListViewItem<class Attendee *>::~CustomListViewItem() | 56 | CustomListViewItem<class Attendee *>::~CustomListViewItem() |
57 | { | 57 | { |
58 | delete mData; | 58 | delete mData; |
59 | } | 59 | } |
60 | 60 | ||
61 | template <> | 61 | template <> |
62 | void CustomListViewItem<class Attendee *>::updateItem() | 62 | void 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 | setSortKey(4,"j"); |
71 | } | ||
72 | else { | ||
71 | setPixmap(4,SmallIcon("nomailappt")); | 73 | setPixmap(4,SmallIcon("nomailappt")); |
74 | setSortKey(4,"n"); | ||
75 | } | ||
72 | } | 76 | } |
73 | 77 | ||
74 | 78 | ||
75 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | 79 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) |
76 | : QWidget( parent, name), mDisableItemUpdate( false ) | 80 | : QWidget( parent, name), mDisableItemUpdate( false ) |
77 | { | 81 | { |
78 | QGridLayout *topLayout = new QGridLayout(this); | 82 | QGridLayout *topLayout = new QGridLayout(this); |
79 | topLayout->setSpacing(spacing); | 83 | topLayout->setSpacing(spacing); |
80 | 84 | ||
81 | QString organizer = KOPrefs::instance()->email(); | 85 | QString organizer = KOPrefs::instance()->email(); |
82 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); | 86 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); |
83 | 87 | ||
84 | mListView = new KListView(this,"mListView"); | 88 | mListView = new KListView(this,"mListView"); |
85 | mListView->addColumn(i18n("Name"),180); | 89 | mListView->addColumn(i18n("Name"),180); |
86 | mListView->addColumn(i18n("Email"),180); | 90 | mListView->addColumn(i18n("Email"),180); |
87 | mListView->addColumn(i18n("Role"),60); | 91 | mListView->addColumn(i18n("Role"),60); |
88 | mListView->addColumn(i18n("Status"),100); | 92 | mListView->addColumn(i18n("Status"),100); |
89 | mListView->addColumn(i18n("RSVP"),35); | 93 | mListView->addColumn(i18n("RSVP"),35); |
90 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { | 94 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { |
91 | int hei = 80; | 95 | int hei = 80; |
92 | if ( QApplication::desktop()->height() <= 240 ) | 96 | if ( QApplication::desktop()->height() <= 240 ) |
93 | hei = 60; | 97 | hei = 60; |
94 | mListView->setFixedHeight(hei); | 98 | mListView->setFixedHeight(hei); |
95 | } | 99 | } |
96 | mListView->setAllColumnsShowFocus (true ); | 100 | mListView->setAllColumnsShowFocus (true ); |
97 | //mListView->setSingleClick( true ); | 101 | //mListView->setSingleClick( true ); |
98 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), | 102 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), |
99 | SLOT(updateAttendeeInput())); | 103 | SLOT(updateAttendeeInput())); |
100 | 104 | ||
101 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), | 105 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), |
102 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); | 106 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); |
103 | 107 | ||
104 | mRsvpButton = new QCheckBox(this); | 108 | mRsvpButton = new QCheckBox(this); |
105 | mRsvpButton->setText(i18n("Request response")); | 109 | mRsvpButton->setText(i18n("Request response")); |
106 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); | 110 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); |
107 | QLabel *attendeeLabel = new QLabel(this); | 111 | QLabel *attendeeLabel = new QLabel(this); |
108 | attendeeLabel->setText(i18n("Name:")); | 112 | attendeeLabel->setText(i18n("Name:")); |
109 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); | 113 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); |
110 | mNameEdit = new QLineEdit(this); | 114 | mNameEdit = new QLineEdit(this); |
111 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), | 115 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), |
112 | SLOT(updateAttendeeItem())); | 116 | SLOT(updateAttendeeItem())); |
113 | 117 | ||
114 | mUidEdit = new QLineEdit(0); | 118 | mUidEdit = new QLineEdit(0); |
115 | mUidEdit->setText(""); | 119 | mUidEdit->setText(""); |
116 | 120 | ||
117 | QLabel *emailLabel = new QLabel(this); | 121 | QLabel *emailLabel = new QLabel(this); |
118 | emailLabel->setText(i18n("Email:")); | 122 | emailLabel->setText(i18n("Email:")); |
119 | mEmailEdit = new QLineEdit(this); | 123 | mEmailEdit = new QLineEdit(this); |
@@ -422,53 +426,55 @@ void KOEditorDetails::clearAttendeeInput() | |||
422 | 426 | ||
423 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) | 427 | void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) |
424 | { | 428 | { |
425 | Attendee *a = aItem->data(); | 429 | Attendee *a = aItem->data(); |
426 | mDisableItemUpdate = true; | 430 | mDisableItemUpdate = true; |
427 | mNameEdit->setText(a->name()); | 431 | mNameEdit->setText(a->name()); |
428 | mUidEdit->setText(a->uid()); | 432 | mUidEdit->setText(a->uid()); |
429 | mEmailEdit->setText(a->email()); | 433 | mEmailEdit->setText(a->email()); |
430 | mRoleCombo->setCurrentItem(a->role()); | 434 | mRoleCombo->setCurrentItem(a->role()); |
431 | mStatusCombo->setCurrentItem(a->status()); | 435 | mStatusCombo->setCurrentItem(a->status()); |
432 | mRsvpButton->setChecked(a->RSVP()); | 436 | mRsvpButton->setChecked(a->RSVP()); |
433 | 437 | ||
434 | mDisableItemUpdate = false; | 438 | mDisableItemUpdate = false; |
435 | 439 | ||
436 | setEnabledAttendeeInput( true ); | 440 | setEnabledAttendeeInput( true ); |
437 | } | 441 | } |
438 | 442 | ||
439 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) | 443 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) |
440 | { | 444 | { |
441 | mNameEdit->setEnabled( enabled ); | 445 | mNameEdit->setEnabled( enabled ); |
442 | mEmailEdit->setEnabled( enabled ); | 446 | mEmailEdit->setEnabled( enabled ); |
443 | mRoleCombo->setEnabled( enabled ); | 447 | mRoleCombo->setEnabled( enabled ); |
444 | mStatusCombo->setEnabled( enabled ); | 448 | mStatusCombo->setEnabled( enabled ); |
445 | mRsvpButton->setEnabled( enabled ); | 449 | mRsvpButton->setEnabled( enabled ); |
446 | 450 | ||
447 | mRemoveButton->setEnabled( enabled ); | 451 | mRemoveButton->setEnabled( enabled ); |
448 | } | 452 | } |
449 | 453 | ||
450 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) | 454 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) |
451 | { | 455 | { |
452 | if ( item && c == 4 ) { | 456 | if ( item && c == 4 ) { |
453 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); | 457 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); |
454 | updateAttendeeItem(); | 458 | updateAttendeeItem(); |
455 | } | 459 | } |
456 | } | 460 | } |
457 | void KOEditorDetails::updateAttendeeItem() | 461 | void KOEditorDetails::updateAttendeeItem() |
458 | { | 462 | { |
459 | if (mDisableItemUpdate) return; | 463 | if (mDisableItemUpdate) return; |
460 | 464 | ||
461 | QListViewItem *item = mListView->selectedItem(); | 465 | QListViewItem *item = mListView->selectedItem(); |
462 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 466 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
463 | if ( !aItem ) return; | 467 | if ( !aItem ) return; |
464 | 468 | ||
465 | Attendee *a = aItem->data(); | 469 | Attendee *a = aItem->data(); |
466 | 470 | ||
467 | a->setName( mNameEdit->text() ); | 471 | a->setName( mNameEdit->text() ); |
468 | a->setUid( mUidEdit->text() ); | 472 | a->setUid( mUidEdit->text() ); |
469 | a->setEmail( mEmailEdit->text() ); | 473 | a->setEmail( mEmailEdit->text() ); |
474 | if ( mEmailEdit->text().isEmpty() ) | ||
475 | mRsvpButton->setChecked( false ); | ||
476 | a->setRSVP( mRsvpButton->isChecked() ); | ||
470 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); | 477 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); |
471 | a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); | 478 | a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) ); |
472 | a->setRSVP( mRsvpButton->isChecked() ); | ||
473 | aItem->updateItem(); | 479 | aItem->updateItem(); |
474 | } | 480 | } |