Diffstat (limited to 'korganizer/koeditorgeneral.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 94e1f4c..b4fe965 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -238,116 +238,130 @@ void KOEditorGeneral::pickAlarmSound() mAlarmSound = fileName; QToolTip::remove(mAlarmSoundButton); QString dispStr = i18n("Playing '%1'").arg(fileName); QToolTip::add(mAlarmSoundButton, dispStr); mAlarmProgramButton->setOn(false); mAlarmSoundButton->setOn(true); } else { mAlarmProgramButton->setOn(true); mAlarmSoundButton->setOn(false); } } if (mAlarmProgramButton->isOn()) ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); if ( mAlarmSoundButton->isOn()) ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio.Al.: ") + mAlarmSound ); } void KOEditorGeneral::pickAlarmProgram() { if (!mAlarmProgramButton->isOn()) { //mAlarmProgram = ""; QToolTip::remove(mAlarmProgramButton); QToolTip::add(mAlarmProgramButton, i18n("No program set")); mAlarmProgramButton->setOn(false); mAlarmSoundButton->setOn(true); } else { QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0)); if (!fileName.isEmpty()) { mAlarmProgram = fileName; QToolTip::remove(mAlarmProgramButton); QString dispStr = i18n("Running '%1'").arg(fileName); QToolTip::add(mAlarmProgramButton, dispStr); mAlarmSoundButton->setOn(false); mAlarmProgramButton->setOn(true); } else { mAlarmProgramButton->setOn(false); mAlarmSoundButton->setOn(true); } } if (mAlarmProgramButton->isOn()) ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); if ( mAlarmSoundButton->isOn()) ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound ); } +QString KOEditorGeneral::getFittingPath( const QString s ) +{ + int maxlen = 50; + if ( QApplication::desktop()->width() < 640 ) { + if ( QApplication::desktop()->width() < 320 ) + maxlen = 22; + else + maxlen = 35; + } + if ( s.length() > maxlen ) { + return "..."+s.right(maxlen -3); + } + return s; +} void KOEditorGeneral::enableAlarmEdit(bool enable) { if ( enable ) { if (!mAlarmProgramButton->isOn() && !mAlarmSoundButton->isOn()) { mAlarmSoundButton->setOn( true ); if ( mAlarmSound.isEmpty() ) mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; else { if ( ! QFile::exists( mAlarmSound ) ) mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; } } if (mAlarmProgramButton->isOn()) - ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); + ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) - ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound ); + ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); } else { - ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled")); + ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled for this item")); } mAlarmTimeEdit->setEnabled(enable); mAlarmSoundButton->setEnabled(enable); mAlarmProgramButton->setEnabled(enable); mAlarmIncrCombo->setEnabled(enable); } void KOEditorGeneral::disableAlarmEdit(bool disable) { enableAlarmEdit( !disable ); } void KOEditorGeneral::enableAlarm( bool enable ) { enableAlarmEdit( enable ); } void KOEditorGeneral::alarmDisable(bool disable) { if (!disable) { //mAlarmBell->setEnabled(true); mAlarmButton->setEnabled(true); } else { //mAlarmBell->setEnabled(false); mAlarmButton->setEnabled(false); mAlarmButton->setChecked(false); mAlarmTimeEdit->setEnabled(false); mAlarmSoundButton->setEnabled(false); mAlarmProgramButton->setEnabled(false); mAlarmIncrCombo->setEnabled(false); } } void KOEditorGeneral::setCategories(const QString &str) { mCategoriesLabel->setText(str); } void KOEditorGeneral::setDefaults(bool allDay) { #if 0 mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); #endif enableAlarmEdit( !allDay ); // TODO: Implement a KPrefsComboItem to solve this in a clean way. |