Diffstat (limited to 'korganizer/koeditorgeneral.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 21f220c..8105432 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -19,25 +19,32 @@ | |||
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 <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qtooltip.h> | 25 | #include <qtooltip.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 <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3HBoxLayout> | ||
37 | #include <QLabel> | ||
38 | #include <Q3GridLayout> | ||
39 | #include <Q3PtrList> | ||
40 | #include <Q3PopupMenu> | ||
35 | 41 | ||
42 | #include <QDesktopWidget> | ||
36 | 43 | ||
37 | #include <kglobal.h> | 44 | #include <kglobal.h> |
38 | #include <kdialog.h> | 45 | #include <kdialog.h> |
39 | #include <kdebug.h> | 46 | #include <kdebug.h> |
40 | #include <klocale.h> | 47 | #include <klocale.h> |
41 | #include <kiconloader.h> | 48 | #include <kiconloader.h> |
42 | #include <kmessagebox.h> | 49 | #include <kmessagebox.h> |
43 | #include <kfiledialog.h> | 50 | #include <kfiledialog.h> |
@@ -64,19 +71,19 @@ KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | |||
64 | { | 71 | { |
65 | mNextFocus = 0; | 72 | mNextFocus = 0; |
66 | } | 73 | } |
67 | 74 | ||
68 | KOEditorGeneral::~KOEditorGeneral() | 75 | KOEditorGeneral::~KOEditorGeneral() |
69 | { | 76 | { |
70 | } | 77 | } |
71 | 78 | ||
72 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 79 | void KOEditorGeneral::initHeader(QWidget *parent,Q3BoxLayout *topLayout) |
73 | { | 80 | { |
74 | QGridLayout *headerLayout = new QGridLayout(topLayout); | 81 | Q3GridLayout *headerLayout = new Q3GridLayout(topLayout); |
75 | 82 | ||
76 | #if 0 | 83 | #if 0 |
77 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); | 84 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); |
78 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); | 85 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); |
79 | #endif | 86 | #endif |
80 | // 1 on pda | 87 | // 1 on pda |
81 | // 11 on desktop | 88 | // 11 on desktop |
82 | headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); | 89 | headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); |
@@ -190,67 +197,67 @@ void KOEditorGeneral::selectedCatPopup( int index ) | |||
190 | if ( categories.find ( colcat ) != categories.end () ) { | 197 | if ( categories.find ( colcat ) != categories.end () ) { |
191 | categories.remove( colcat ); | 198 | categories.remove( colcat ); |
192 | categories.prepend( colcat ); | 199 | categories.prepend( colcat ); |
193 | } | 200 | } |
194 | } | 201 | } |
195 | setCategories( categories.join(",") ); | 202 | setCategories( categories.join(",") ); |
196 | } | 203 | } |
197 | 204 | ||
198 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 205 | void KOEditorGeneral::initCategories(QWidget *parent, Q3BoxLayout *topLayout) |
199 | { | 206 | { |
200 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 207 | Q3BoxLayout *categoriesLayout = new Q3HBoxLayout( topLayout ); |
201 | mCatPopup = new QPopupMenu ( parent ); | 208 | mCatPopup = new Q3PopupMenu ( parent ); |
202 | mCatPopup->setCheckable (true); | 209 | mCatPopup->setCheckable (true); |
203 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); | 210 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); |
204 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); | 211 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); |
205 | mCategoriesButton = new QPushButton(parent); | 212 | mCategoriesButton = new QPushButton(parent); |
206 | mCategoriesButton->setText(i18n("Categories...")); | 213 | mCategoriesButton->setText(i18n("Categories...")); |
207 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 214 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
208 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 215 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
209 | categoriesLayout->addWidget(mCategoriesButton); | 216 | categoriesLayout->addWidget(mCategoriesButton); |
210 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); | 217 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); |
211 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); | 218 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); |
212 | mCategoriesLabel->setPopup( mCatPopup ); | 219 | mCategoriesLabel->setPopup( mCatPopup ); |
213 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 220 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
214 | categoriesLayout->addWidget(mCategoriesLabel,1); | 221 | categoriesLayout->addWidget(mCategoriesLabel,1); |
215 | } | 222 | } |
216 | 223 | ||
217 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) | 224 | void KOEditorGeneral::initSecrecy(QWidget *parent, Q3BoxLayout *topLayout) |
218 | { | 225 | { |
219 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); | 226 | Q3BoxLayout *secrecyLayout = new Q3HBoxLayout( topLayout ); |
220 | 227 | ||
221 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); | 228 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); |
222 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); | 229 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); |
223 | secrecyLayout->addWidget(mCancelBox); | 230 | secrecyLayout->addWidget(mCancelBox); |
224 | secrecyLayout->addWidget(secrecyLabel); | 231 | secrecyLayout->addWidget(secrecyLabel); |
225 | 232 | ||
226 | mSecrecyCombo = new QComboBox(parent); | 233 | mSecrecyCombo = new QComboBox(parent); |
227 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); | 234 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); |
228 | secrecyLayout->addWidget(mSecrecyCombo); | 235 | secrecyLayout->addWidget(mSecrecyCombo); |
229 | } | 236 | } |
230 | 237 | ||
231 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) | 238 | void KOEditorGeneral::initDescription(QWidget *parent,Q3BoxLayout *topLayout) |
232 | { | 239 | { |
233 | mDescriptionEdit = new KTextEdit(parent); | 240 | mDescriptionEdit = new KTextEdit(parent); |
234 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); | 241 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); |
235 | mDescriptionEdit->append(""); | 242 | mDescriptionEdit->append(""); |
236 | mDescriptionEdit->setReadOnly(false); | 243 | mDescriptionEdit->setReadOnly(false); |
237 | mDescriptionEdit->setOverwriteMode(false); | 244 | mDescriptionEdit->setOverwriteMode(false); |
238 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); | 245 | mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); |
239 | topLayout->addWidget(mDescriptionEdit); | 246 | topLayout->addWidget(mDescriptionEdit); |
240 | #ifndef DESKTOP_VERSION | 247 | #ifndef DESKTOP_VERSION |
241 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); | 248 | QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); |
242 | #endif | 249 | #endif |
243 | 250 | ||
244 | } | 251 | } |
245 | 252 | ||
246 | void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) | 253 | void KOEditorGeneral::initAlarm(QWidget *parent,Q3BoxLayout *topLayout) |
247 | { | 254 | { |
248 | QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); | 255 | Q3BoxLayout *alarmLayout = new Q3HBoxLayout(topLayout); |
249 | 256 | ||
250 | //mAlarmBell = new QLabel(parent); | 257 | //mAlarmBell = new QLabel(parent); |
251 | //mAlarmBell->setPixmap(SmallIcon("bell")); | 258 | //mAlarmBell->setPixmap(SmallIcon("bell")); |
252 | //alarmLayout->addWidget(mAlarmBell); | 259 | //alarmLayout->addWidget(mAlarmBell); |
253 | if ( QApplication::desktop()->width() < 320 ) | 260 | if ( QApplication::desktop()->width() < 320 ) |
254 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); | 261 | mAlarmButton = new QCheckBox(i18n("Rem."),parent); |
255 | else | 262 | else |
256 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); | 263 | mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); |
@@ -523,17 +530,17 @@ void KOEditorGeneral::readIncidence(Incidence *event) | |||
523 | } | 530 | } |
524 | mAlarmButton->setChecked( event->isAlarmEnabled() ); | 531 | mAlarmButton->setChecked( event->isAlarmEnabled() ); |
525 | mSecrecyCombo->setCurrentItem(event->secrecy()); | 532 | mSecrecyCombo->setCurrentItem(event->secrecy()); |
526 | mCancelBox->setChecked( event->cancelled() ); | 533 | mCancelBox->setChecked( event->cancelled() ); |
527 | mAlarmProgramButton->setOn(false); | 534 | mAlarmProgramButton->setOn(false); |
528 | mAlarmSoundButton->setOn(false); | 535 | mAlarmSoundButton->setOn(false); |
529 | 536 | ||
530 | // set up alarm stuff | 537 | // set up alarm stuff |
531 | QPtrList<Alarm> alarms = event->alarms(); | 538 | Q3PtrList<Alarm> alarms = event->alarms(); |
532 | Alarm* alarm; | 539 | Alarm* alarm; |
533 | mAlarmIncrCombo->setCurrentItem(0); | 540 | mAlarmIncrCombo->setCurrentItem(0); |
534 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 541 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
535 | int offset; | 542 | int offset; |
536 | if ( alarm->hasTime() ) { | 543 | if ( alarm->hasTime() ) { |
537 | QDateTime t = alarm->time(); | 544 | QDateTime t = alarm->time(); |
538 | offset = event->dtStart().secsTo( t ); | 545 | offset = event->dtStart().secsTo( t ); |
539 | } else { | 546 | } else { |
@@ -585,17 +592,17 @@ void KOEditorGeneral::writeIncidence(Incidence *event) | |||
585 | event->setDescription(mDescriptionEdit->text()); | 592 | event->setDescription(mDescriptionEdit->text()); |
586 | event->setCategories(mCategoriesLabel->text()); | 593 | event->setCategories(mCategoriesLabel->text()); |
587 | event->setSecrecy(mSecrecyCombo->currentItem()); | 594 | event->setSecrecy(mSecrecyCombo->currentItem()); |
588 | event->setCancelled(mCancelBox->isChecked() );; | 595 | event->setCancelled(mCancelBox->isChecked() );; |
589 | // alarm stuff | 596 | // alarm stuff |
590 | if (mAlarmButton->isChecked()) { | 597 | if (mAlarmButton->isChecked()) { |
591 | if (event->alarms().count() == 0) | 598 | if (event->alarms().count() == 0) |
592 | event->newAlarm(); | 599 | event->newAlarm(); |
593 | QPtrList<Alarm> alarms = event->alarms(); | 600 | Q3PtrList<Alarm> alarms = event->alarms(); |
594 | Alarm *alarm; | 601 | Alarm *alarm; |
595 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 602 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
596 | alarm->setEnabled(true); | 603 | alarm->setEnabled(true); |
597 | int j = mAlarmTimeEdit->value()* -60; | 604 | int j = mAlarmTimeEdit->value()* -60; |
598 | if (mAlarmIncrCombo->currentItem() == 1) | 605 | if (mAlarmIncrCombo->currentItem() == 1) |
599 | j = j * 60; | 606 | j = j * 60; |
600 | else if (mAlarmIncrCombo->currentItem() == 2) | 607 | else if (mAlarmIncrCombo->currentItem() == 2) |
601 | j = j * (60 * 24); | 608 | j = j * (60 * 24); |