Diffstat (limited to 'korganizer/koeditorgeneral.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 92e5a0f..21f220c 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -122,49 +122,48 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | |||
122 | headerLayout->setColStretch( 3, 10); | 122 | headerLayout->setColStretch( 3, 10); |
123 | mCalendarBox->setMaximumWidth( 64 ); | 123 | mCalendarBox->setMaximumWidth( 64 ); |
124 | } | 124 | } |
125 | else { | 125 | else { |
126 | headerLayout->addWidget(mLocationEdit,1,1); | 126 | headerLayout->addWidget(mLocationEdit,1,1); |
127 | headerLayout->addWidget(mCalendarBox,1,2); | 127 | headerLayout->addWidget(mCalendarBox,1,2); |
128 | int str = 3; | 128 | int str = 3; |
129 | if ( QApplication::desktop()->width() < 640 ) { | 129 | if ( QApplication::desktop()->width() < 640 ) { |
130 | --str; | 130 | --str; |
131 | if ( QApplication::desktop()->width() < 320 ) | 131 | if ( QApplication::desktop()->width() < 320 ) |
132 | --str; | 132 | --str; |
133 | } | 133 | } |
134 | headerLayout->setColStretch( 1, str); | 134 | headerLayout->setColStretch( 1, str); |
135 | headerLayout->setColStretch( 2, 1); | 135 | headerLayout->setColStretch( 2, 1); |
136 | } | 136 | } |
137 | 137 | ||
138 | } | 138 | } |
139 | void KOEditorGeneral::setFocusOn( int i ) | 139 | void KOEditorGeneral::setFocusOn( int i ) |
140 | { | 140 | { |
141 | mNextFocus = i; | 141 | mNextFocus = i; |
142 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); | 142 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
143 | } | 143 | } |
144 | void KOEditorGeneral::slotSetFocusOn() | 144 | void KOEditorGeneral::slotSetFocusOn() |
145 | { | 145 | { |
146 | mNextFocus; | ||
147 | if ( mNextFocus == 1 ) { | 146 | if ( mNextFocus == 1 ) { |
148 | mDescriptionEdit->setFocus(); | 147 | mDescriptionEdit->setFocus(); |
149 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 148 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
150 | } | 149 | } |
151 | if ( mNextFocus == 2 ) { | 150 | if ( mNextFocus == 2 ) { |
152 | mSummaryEdit->setFocus(); | 151 | mSummaryEdit->setFocus(); |
153 | } | 152 | } |
154 | } | 153 | } |
155 | void KOEditorGeneral::editCategories() | 154 | void KOEditorGeneral::editCategories() |
156 | { | 155 | { |
157 | // qDebug("KOEditorGeneral::editCategories() "); | 156 | // qDebug("KOEditorGeneral::editCategories() "); |
158 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 157 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
159 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 158 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
160 | //KOGlobals::fitDialogToScreen( csd ); | 159 | //KOGlobals::fitDialogToScreen( csd ); |
161 | csd->setColorEnabled(); | 160 | csd->setColorEnabled(); |
162 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 161 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
163 | csd->exec(); | 162 | csd->exec(); |
164 | delete csd; | 163 | delete csd; |
165 | } | 164 | } |
166 | 165 | ||
167 | void KOEditorGeneral::showCatPopup() | 166 | void KOEditorGeneral::showCatPopup() |
168 | { | 167 | { |
169 | mCatPopup->clear(); | 168 | mCatPopup->clear(); |
170 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); | 169 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); |
@@ -334,49 +333,49 @@ void KOEditorGeneral::pickAlarmProgram() | |||
334 | bool oldState = mAlarmProgramButton->isOn(); | 333 | bool oldState = mAlarmProgramButton->isOn(); |
335 | 334 | ||
336 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); | 335 | QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); |
337 | if (!fileName.isEmpty()) { | 336 | if (!fileName.isEmpty()) { |
338 | mAlarmProgram = fileName; | 337 | mAlarmProgram = fileName; |
339 | QToolTip::remove(mAlarmProgramButton); | 338 | QToolTip::remove(mAlarmProgramButton); |
340 | QString dispStr = i18n("Running '%1'").arg(fileName); | 339 | QString dispStr = i18n("Running '%1'").arg(fileName); |
341 | QToolTip::add(mAlarmProgramButton, dispStr); | 340 | QToolTip::add(mAlarmProgramButton, dispStr); |
342 | mAlarmSoundButton->setOn(false); | 341 | mAlarmSoundButton->setOn(false); |
343 | mAlarmProgramButton->setOn(true); | 342 | mAlarmProgramButton->setOn(true); |
344 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); | 343 | QToolTip::add(mAlarmSoundButton, i18n("No sound set")); |
345 | } else { | 344 | } else { |
346 | mAlarmProgramButton->setOn(!oldState); | 345 | mAlarmProgramButton->setOn(!oldState); |
347 | mAlarmSoundButton->setOn(oldState); | 346 | mAlarmSoundButton->setOn(oldState); |
348 | } | 347 | } |
349 | 348 | ||
350 | if (mAlarmProgramButton->isOn()) | 349 | if (mAlarmProgramButton->isOn()) |
351 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); | 350 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); |
352 | if ( mAlarmSoundButton->isOn()) | 351 | if ( mAlarmSoundButton->isOn()) |
353 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); | 352 | ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); |
354 | 353 | ||
355 | } | 354 | } |
356 | 355 | ||
357 | 356 | ||
358 | QString KOEditorGeneral::getFittingPath( const QString s ) | 357 | QString KOEditorGeneral::getFittingPath( const QString & s ) |
359 | { | 358 | { |
360 | int maxlen = 50; | 359 | int maxlen = 50; |
361 | if ( QApplication::desktop()->width() < 640 ) { | 360 | if ( QApplication::desktop()->width() < 640 ) { |
362 | if ( QApplication::desktop()->width() < 320 ) | 361 | if ( QApplication::desktop()->width() < 320 ) |
363 | maxlen = 22; | 362 | maxlen = 22; |
364 | else | 363 | else |
365 | maxlen = 35; | 364 | maxlen = 35; |
366 | } | 365 | } |
367 | if ( s.length() > maxlen ) { | 366 | if ( s.length() > maxlen ) { |
368 | return "..."+s.right(maxlen -3); | 367 | return "..."+s.right(maxlen -3); |
369 | } | 368 | } |
370 | return s; | 369 | return s; |
371 | } | 370 | } |
372 | 371 | ||
373 | void KOEditorGeneral::enableAlarmEdit(bool enable) | 372 | void KOEditorGeneral::enableAlarmEdit(bool enable) |
374 | { | 373 | { |
375 | if ( enable ) { | 374 | if ( enable ) { |
376 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { | 375 | if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { |
377 | mAlarmSoundButton->setOn( true ); | 376 | mAlarmSoundButton->setOn( true ); |
378 | if ( mAlarmSound.isEmpty() ) | 377 | if ( mAlarmSound.isEmpty() ) |
379 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 378 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
380 | else { | 379 | else { |
381 | if ( ! QFile::exists( mAlarmSound ) ) | 380 | if ( ! QFile::exists( mAlarmSound ) ) |
382 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 381 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
@@ -599,26 +598,28 @@ void KOEditorGeneral::writeIncidence(Incidence *event) | |||
599 | if (mAlarmIncrCombo->currentItem() == 1) | 598 | if (mAlarmIncrCombo->currentItem() == 1) |
600 | j = j * 60; | 599 | j = j * 60; |
601 | else if (mAlarmIncrCombo->currentItem() == 2) | 600 | else if (mAlarmIncrCombo->currentItem() == 2) |
602 | j = j * (60 * 24); | 601 | j = j * (60 * 24); |
603 | alarm->setStartOffset( j ); | 602 | alarm->setStartOffset( j ); |
604 | 603 | ||
605 | if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { | 604 | if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { |
606 | alarm->setProcedureAlarm(mAlarmProgram); | 605 | alarm->setProcedureAlarm(mAlarmProgram); |
607 | } | 606 | } |
608 | else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) | 607 | else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) |
609 | alarm->setAudioAlarm(mAlarmSound); | 608 | alarm->setAudioAlarm(mAlarmSound); |
610 | else | 609 | else |
611 | alarm->setType(Alarm::Invalid); | 610 | alarm->setType(Alarm::Invalid); |
612 | //alarm->setAudioAlarm("default"); | 611 | //alarm->setAudioAlarm("default"); |
613 | // TODO: Deal with multiple alarms | 612 | // TODO: Deal with multiple alarms |
614 | break; // For now, stop after the first alarm | 613 | break; // For now, stop after the first alarm |
615 | } | 614 | } |
616 | } else { | 615 | } else { |
617 | Alarm* alarm = event->alarms().first(); | 616 | Alarm* alarm = event->alarms().first(); |
618 | if ( alarm ) { | 617 | if ( alarm ) { |
619 | alarm->setEnabled(false); | 618 | alarm->setEnabled(false); |
620 | alarm->setType(Alarm::Invalid); | 619 | alarm->setType(Alarm::Invalid); |
621 | } | 620 | } |
622 | } | 621 | } |
623 | event->setCalID( getCalendarID() ); | 622 | int id = getCalendarID(); |
623 | event->setCalID( id ); | ||
624 | event->setAlarmEnabled( KOPrefs::instance()->getCalendar( id )->isAlarmEnabled ); | ||
624 | } | 625 | } |