summaryrefslogtreecommitdiffabout
path: root/korganizer/koeditordetails.cpp
Unidiff
Diffstat (limited to 'korganizer/koeditordetails.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeditordetails.cpp38
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
@@ -19,20 +19,26 @@
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>
@@ -77,13 +83,13 @@ void CustomListViewItem<Attendee *>::updateItem()
77} 83}
78 84
79 85
80KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) 86KOEditorDetails::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
@@ -98,17 +104,17 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
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:"));
@@ -137,13 +143,13 @@ KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
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);
@@ -362,25 +368,25 @@ void KOEditorDetails::setDefaults()
362 368
363void KOEditorDetails::readEvent(Incidence *event) 369void 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
377void KOEditorDetails::writeEvent(Incidence *event) 383void 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 }
@@ -401,13 +407,13 @@ bool KOEditorDetails::validateInput()
401{ 407{
402 return true; 408 return true;
403} 409}
404 410
405void KOEditorDetails::updateAttendeeInput() 411void 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 }
@@ -448,24 +454,24 @@ void KOEditorDetails::setEnabledAttendeeInput( bool 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
454void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c ) 460void 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}
461void KOEditorDetails::updateAttendeeItem() 467void 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() );