Diffstat (limited to 'korganizer/koeditordetails.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | korganizer/koeditordetails.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp index 9a4b4ec..a01c838 100644 --- a/korganizer/koeditordetails.cpp +++ b/korganizer/koeditordetails.cpp | |||
@@ -13,32 +13,38 @@ | |||
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 <q3filedialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <q3vbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <q3buttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <q3vgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <q3widgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapp.h> | 32 | #include <qapplication.h> |
33 | #include <QDesktopWidget> | ||
34 | //Added by qt3to4: | ||
35 | #include <Q3GridLayout> | ||
36 | #include <QLabel> | ||
37 | #include <Q3PtrList> | ||
38 | #include <Q3VBoxLayout> | ||
33 | 39 | ||
34 | #include <klocale.h> | 40 | #include <klocale.h> |
35 | #include <kglobal.h> | 41 | #include <kglobal.h> |
36 | #include <kdialog.h> | 42 | #include <kdialog.h> |
37 | #include <kiconloader.h> | 43 | #include <kiconloader.h> |
38 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
39 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
40 | #ifndef KORG_NOKABC | 46 | #ifndef KORG_NOKABC |
41 | 47 | ||
42 | #ifdef DESKTOP_VERSION | 48 | #ifdef DESKTOP_VERSION |
43 | #include <kabc/addresseedialog.h> | 49 | #include <kabc/addresseedialog.h> |
44 | #else //DESKTOP_VERSION | 50 | #else //DESKTOP_VERSION |
@@ -71,50 +77,50 @@ void CustomListViewItem<Attendee *>::updateItem() | |||
71 | setSortKey(4,"j"); | 77 | setSortKey(4,"j"); |
72 | } | 78 | } |
73 | else { | 79 | else { |
74 | setPixmap(4,SmallIcon("nomailappt")); | 80 | setPixmap(4,SmallIcon("nomailappt")); |
75 | setSortKey(4,"n"); | 81 | setSortKey(4,"n"); |
76 | } | 82 | } |
77 | } | 83 | } |
78 | 84 | ||
79 | 85 | ||
80 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | 86 | KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) |
81 | : QWidget( parent, name), mDisableItemUpdate( false ) | 87 | : QWidget( parent, name), mDisableItemUpdate( false ) |
82 | { | 88 | { |
83 | QGridLayout *topLayout = new QGridLayout(this); | 89 | Q3GridLayout *topLayout = new Q3GridLayout(this); |
84 | topLayout->setSpacing(spacing); | 90 | topLayout->setSpacing(spacing); |
85 | topLayout->setMargin(KDialog::marginHint()-2); | 91 | topLayout->setMargin(KDialog::marginHint()-2); |
86 | 92 | ||
87 | QString organizer = KOPrefs::instance()->email(); | 93 | QString organizer = KOPrefs::instance()->email(); |
88 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); | 94 | mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); |
89 | 95 | ||
90 | mListView = new KListView(this,"mListView"); | 96 | mListView = new KListView(this,"mListView"); |
91 | mListView->addColumn(i18n("Name"),180); | 97 | mListView->addColumn(i18n("Name"),180); |
92 | mListView->addColumn(i18n("Email"),180); | 98 | mListView->addColumn(i18n("Email"),180); |
93 | mListView->addColumn(i18n("Role"),60); | 99 | mListView->addColumn(i18n("Role"),60); |
94 | mListView->addColumn(i18n("Status"),100); | 100 | mListView->addColumn(i18n("Status"),100); |
95 | mListView->addColumn(i18n("RSVP"),35); | 101 | mListView->addColumn(i18n("RSVP"),35); |
96 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { | 102 | if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { |
97 | int hei = 80; | 103 | int hei = 80; |
98 | if ( QApplication::desktop()->height() <= 240 ) | 104 | if ( QApplication::desktop()->height() <= 240 ) |
99 | hei = 60; | 105 | hei = 60; |
100 | mListView->setFixedHeight(hei); | 106 | mListView->setFixedHeight(hei); |
101 | } | 107 | } |
102 | mListView->setAllColumnsShowFocus (true ); | 108 | mListView->setAllColumnsShowFocus (true ); |
103 | //mListView->setSingleClick( true ); | 109 | //mListView->setSingleClick( true ); |
104 | connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), | 110 | connect(mListView,SIGNAL(selectionChanged(Q3ListViewItem *)), |
105 | SLOT(updateAttendeeInput())); | 111 | SLOT(updateAttendeeInput())); |
106 | 112 | ||
107 | connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), | 113 | connect(mListView,SIGNAL(executed(Q3ListViewItem * ,const QPoint&, int )), |
108 | SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); | 114 | SLOT(itemClicked(Q3ListViewItem * ,const QPoint& , int ))); |
109 | 115 | ||
110 | mRsvpButton = new QCheckBox(this); | 116 | mRsvpButton = new QCheckBox(this); |
111 | mRsvpButton->setText(i18n("Request response")); | 117 | mRsvpButton->setText(i18n("Request response")); |
112 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); | 118 | mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); |
113 | QLabel *attendeeLabel = new QLabel(this); | 119 | QLabel *attendeeLabel = new QLabel(this); |
114 | attendeeLabel->setText(i18n("Name:")); | 120 | attendeeLabel->setText(i18n("Name:")); |
115 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); | 121 | attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); |
116 | mNameEdit = new QLineEdit(this); | 122 | mNameEdit = new QLineEdit(this); |
117 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), | 123 | connect(mNameEdit,SIGNAL(textChanged(const QString &)), |
118 | SLOT(updateAttendeeItem())); | 124 | SLOT(updateAttendeeItem())); |
119 | 125 | ||
120 | 126 | ||
@@ -131,25 +137,25 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) | |||
131 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 137 | connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
132 | 138 | ||
133 | QLabel *statusLabel = new QLabel(this); | 139 | QLabel *statusLabel = new QLabel(this); |
134 | statusLabel->setText( i18n("Status:") ); | 140 | statusLabel->setText( i18n("Status:") ); |
135 | 141 | ||
136 | mStatusCombo = new QComboBox(false,this); | 142 | mStatusCombo = new QComboBox(false,this); |
137 | mStatusCombo->insertStringList(Attendee::statusList()); | 143 | mStatusCombo->insertStringList(Attendee::statusList()); |
138 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); | 144 | connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); |
139 | 145 | ||
140 | 146 | ||
141 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); | 147 | connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); |
142 | QWidget *buttonBox = new QWidget(this); | 148 | QWidget *buttonBox = new QWidget(this); |
143 | QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); | 149 | Q3VBoxLayout *buttonLayout = new Q3VBoxLayout(buttonBox); |
144 | 150 | ||
145 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); | 151 | QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); |
146 | buttonLayout->addWidget(newButton); | 152 | buttonLayout->addWidget(newButton); |
147 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); | 153 | connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); |
148 | 154 | ||
149 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); | 155 | mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); |
150 | buttonLayout->addWidget(mRemoveButton); | 156 | buttonLayout->addWidget(mRemoveButton); |
151 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); | 157 | connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); |
152 | 158 | ||
153 | // buttonLayout->addWidget(mAddressBookButton); | 159 | // buttonLayout->addWidget(mAddressBookButton); |
154 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); | 160 | connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); |
155 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); | 161 | //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); |
@@ -356,37 +362,37 @@ void KOEditorDetails::setDefaults() | |||
356 | mUidEdit = ""; | 362 | mUidEdit = ""; |
357 | mEmailEdit->setText(""); | 363 | mEmailEdit->setText(""); |
358 | mRoleCombo->setCurrentItem( 0 ); | 364 | mRoleCombo->setCurrentItem( 0 ); |
359 | mStatusCombo->setCurrentItem( 0 ); | 365 | mStatusCombo->setCurrentItem( 0 ); |
360 | 366 | ||
361 | } | 367 | } |
362 | 368 | ||
363 | void KOEditorDetails::readEvent(Incidence *event) | 369 | void KOEditorDetails::readEvent(Incidence *event) |
364 | { | 370 | { |
365 | setDefaults(); | 371 | setDefaults(); |
366 | //mListView->clear(); | 372 | //mListView->clear(); |
367 | //mdelAttendees.clear(); | 373 | //mdelAttendees.clear(); |
368 | QPtrList<Attendee> tmpAList = event->attendees(); | 374 | Q3PtrList<Attendee> tmpAList = event->attendees(); |
369 | Attendee *a; | 375 | Attendee *a; |
370 | for (a = tmpAList.first(); a; a = tmpAList.next()) | 376 | for (a = tmpAList.first(); a; a = tmpAList.next()) |
371 | insertAttendee(new Attendee(*a)); | 377 | insertAttendee(new Attendee(*a)); |
372 | 378 | ||
373 | mListView->setSelected( mListView->firstChild(), true ); | 379 | mListView->setSelected( mListView->firstChild(), true ); |
374 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); | 380 | mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer())); |
375 | } | 381 | } |
376 | 382 | ||
377 | void KOEditorDetails::writeEvent(Incidence *event) | 383 | void KOEditorDetails::writeEvent(Incidence *event) |
378 | { | 384 | { |
379 | event->clearAttendees(); | 385 | event->clearAttendees(); |
380 | QListViewItem *item; | 386 | Q3ListViewItem *item; |
381 | AttendeeListItem *a; | 387 | AttendeeListItem *a; |
382 | for (item = mListView->firstChild(); item; | 388 | for (item = mListView->firstChild(); item; |
383 | item = item->nextSibling()) { | 389 | item = item->nextSibling()) { |
384 | a = (AttendeeListItem *)item; | 390 | a = (AttendeeListItem *)item; |
385 | event->addAttendee(new Attendee(*(a->data()))); | 391 | event->addAttendee(new Attendee(*(a->data()))); |
386 | } | 392 | } |
387 | event->setOrganizer(KOPrefs::instance()->email()); | 393 | event->setOrganizer(KOPrefs::instance()->email()); |
388 | } | 394 | } |
389 | 395 | ||
390 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) | 396 | void KOEditorDetails::cancelAttendeeEvent(Incidence *event) |
391 | { | 397 | { |
392 | event->clearAttendees(); | 398 | event->clearAttendees(); |
@@ -395,25 +401,25 @@ void KOEditorDetails::cancelAttendeeEvent(Incidence *event) | |||
395 | event->addAttendee(new Attendee(*att)); | 401 | event->addAttendee(new Attendee(*att)); |
396 | } | 402 | } |
397 | mdelAttendees.clear(); | 403 | mdelAttendees.clear(); |
398 | } | 404 | } |
399 | 405 | ||
400 | bool KOEditorDetails::validateInput() | 406 | bool KOEditorDetails::validateInput() |
401 | { | 407 | { |
402 | return true; | 408 | return true; |
403 | } | 409 | } |
404 | 410 | ||
405 | void KOEditorDetails::updateAttendeeInput() | 411 | void KOEditorDetails::updateAttendeeInput() |
406 | { | 412 | { |
407 | QListViewItem *item = mListView->selectedItem(); | 413 | Q3ListViewItem *item = mListView->selectedItem(); |
408 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 414 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
409 | if (aItem) { | 415 | if (aItem) { |
410 | fillAttendeeInput( aItem ); | 416 | fillAttendeeInput( aItem ); |
411 | } else { | 417 | } else { |
412 | clearAttendeeInput(); | 418 | clearAttendeeInput(); |
413 | } | 419 | } |
414 | } | 420 | } |
415 | 421 | ||
416 | void KOEditorDetails::clearAttendeeInput() | 422 | void KOEditorDetails::clearAttendeeInput() |
417 | { | 423 | { |
418 | mNameEdit->setText(""); | 424 | mNameEdit->setText(""); |
419 | mUidEdit = ""; | 425 | mUidEdit = ""; |
@@ -442,36 +448,36 @@ void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem ) | |||
442 | 448 | ||
443 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) | 449 | void KOEditorDetails::setEnabledAttendeeInput( bool enabled ) |
444 | { | 450 | { |
445 | mNameEdit->setEnabled( enabled ); | 451 | mNameEdit->setEnabled( enabled ); |
446 | mEmailEdit->setEnabled( enabled ); | 452 | mEmailEdit->setEnabled( enabled ); |
447 | mRoleCombo->setEnabled( enabled ); | 453 | mRoleCombo->setEnabled( enabled ); |
448 | mStatusCombo->setEnabled( enabled ); | 454 | mStatusCombo->setEnabled( enabled ); |
449 | mRsvpButton->setEnabled( enabled ); | 455 | mRsvpButton->setEnabled( enabled ); |
450 | 456 | ||
451 | mRemoveButton->setEnabled( enabled ); | 457 | mRemoveButton->setEnabled( enabled ); |
452 | } | 458 | } |
453 | 459 | ||
454 | void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) | 460 | void KOEditorDetails::itemClicked(Q3ListViewItem * item ,const QPoint & pnt, int c ) |
455 | { | 461 | { |
456 | if ( item && c == 4 ) { | 462 | if ( item && c == 4 ) { |
457 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); | 463 | mRsvpButton->setChecked( !mRsvpButton->isChecked() ); |
458 | updateAttendeeItem(); | 464 | updateAttendeeItem(); |
459 | } | 465 | } |
460 | } | 466 | } |
461 | void KOEditorDetails::updateAttendeeItem() | 467 | void KOEditorDetails::updateAttendeeItem() |
462 | { | 468 | { |
463 | if (mDisableItemUpdate) return; | 469 | if (mDisableItemUpdate) return; |
464 | 470 | ||
465 | QListViewItem *item = mListView->selectedItem(); | 471 | Q3ListViewItem *item = mListView->selectedItem(); |
466 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); | 472 | AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item ); |
467 | if ( !aItem ) return; | 473 | if ( !aItem ) return; |
468 | 474 | ||
469 | Attendee *a = aItem->data(); | 475 | Attendee *a = aItem->data(); |
470 | 476 | ||
471 | a->setName( mNameEdit->text() ); | 477 | a->setName( mNameEdit->text() ); |
472 | a->setUid( mUidEdit ); | 478 | a->setUid( mUidEdit ); |
473 | a->setEmail( mEmailEdit->text() ); | 479 | a->setEmail( mEmailEdit->text() ); |
474 | if ( mEmailEdit->text().isEmpty() ) | 480 | if ( mEmailEdit->text().isEmpty() ) |
475 | mRsvpButton->setChecked( false ); | 481 | mRsvpButton->setChecked( false ); |
476 | a->setRSVP( mRsvpButton->isChecked() ); | 482 | a->setRSVP( mRsvpButton->isChecked() ); |
477 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); | 483 | a->setRole( Attendee::Role( mRoleCombo->currentItem() ) ); |