00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kalarm.h"
00022
00023 #include <qobjectlist.h>
00024 #include <qlayout.h>
00025 #include <qbuttongroup.h>
00026 #include <qvbox.h>
00027 #include <qlineedit.h>
00028 #include <qcheckbox.h>
00029 #include <qradiobutton.h>
00030 #include <qpushbutton.h>
00031 #include <qcombobox.h>
00032 #include <qwhatsthis.h>
00033 #include <qtooltip.h>
00034 #include <qstyle.h>
00035
00036 #include <kglobal.h>
00037 #include <klocale.h>
00038 #include <kstandarddirs.h>
00039 #include <kshell.h>
00040 #include <kmessagebox.h>
00041 #include <kaboutdata.h>
00042 #include <kapplication.h>
00043 #include <kiconloader.h>
00044 #include <kcolorcombo.h>
00045 #include <kstdguiitem.h>
00046 #ifdef Q_WS_X11
00047 #include <kwin.h>
00048 #endif
00049 #include <kdebug.h>
00050
00051 #include <kalarmd/kalarmd.h>
00052
00053 #include "alarmcalendar.h"
00054 #include "alarmtimewidget.h"
00055 #include "daemon.h"
00056 #include "editdlg.h"
00057 #include "fontcolour.h"
00058 #include "functions.h"
00059 #include "kalarmapp.h"
00060 #include "kamail.h"
00061 #include "label.h"
00062 #include "latecancel.h"
00063 #include "mainwindow.h"
00064 #include "preferences.h"
00065 #include "radiobutton.h"
00066 #include "recurrenceedit.h"
00067 #ifndef WITHOUT_ARTS
00068 #include "sounddlg.h"
00069 #endif
00070 #include "soundpicker.h"
00071 #include "specialactions.h"
00072 #include "timeedit.h"
00073 #include "timespinbox.h"
00074 #include "traywindow.h"
00075 #include "prefdlg.moc"
00076
00077
00078
00079
00080
00081
00082
00083 static QString xtermCommands[] = {
00084 QString::fromLatin1("xterm -sb -hold -title %t -e %c"),
00085 QString::fromLatin1("konsole --noclose -T %t -e ${SHELL:-sh} -c %c"),
00086 QString::fromLatin1("gnome-terminal -t %t -e %W"),
00087 QString::fromLatin1("eterm --pause -T %t -e %C"),
00088 QString::fromLatin1("Eterm --pause -T %t -e %C"),
00089 QString::fromLatin1("rxvt -title %t -e ${SHELL:-sh} -c %w"),
00090 QString::null
00091 };
00092
00093
00094
00095
00096
00097
00098 KAlarmPrefDlg* KAlarmPrefDlg::mInstance = 0;
00099
00100 void KAlarmPrefDlg::display()
00101 {
00102 if (!mInstance)
00103 {
00104 mInstance = new KAlarmPrefDlg;
00105 mInstance->show();
00106 }
00107 else
00108 {
00109 #ifdef Q_WS_X11
00110 KWin::WindowInfo info = KWin::windowInfo(mInstance->winId(), NET::WMGeometry | NET::WMDesktop);
00111 KWin::setCurrentDesktop(info.desktop());
00112 #endif
00113 mInstance->showNormal();
00114 mInstance->raise();
00115 mInstance->setActiveWindow();
00116 }
00117 }
00118
00119 KAlarmPrefDlg::KAlarmPrefDlg()
00120 : KDialogBase(IconList, i18n("Preferences"), Help | Default | Ok | Apply | Cancel, Ok, 0, "PrefDlg", false, true)
00121 {
00122 setWFlags(Qt::WDestructiveClose);
00123 setIconListAllVisible(true);
00124
00125 QVBox* frame = addVBoxPage(i18n("General"), i18n("General"), DesktopIcon("misc"));
00126 mMiscPage = new MiscPrefTab(frame);
00127
00128 frame = addVBoxPage(i18n("Email"), i18n("Email Alarm Settings"), DesktopIcon("mail_generic"));
00129 mEmailPage = new EmailPrefTab(frame);
00130
00131 frame = addVBoxPage(i18n("View"), i18n("View Settings"), DesktopIcon("view_choose"));
00132 mViewPage = new ViewPrefTab(frame);
00133
00134 frame = addVBoxPage(i18n("Font & Color"), i18n("Default Font and Color"), DesktopIcon("colorize"));
00135 mFontColourPage = new FontColourPrefTab(frame);
00136
00137 frame = addVBoxPage(i18n("Edit"), i18n("Default Alarm Edit Settings"), DesktopIcon("edit"));
00138 mEditPage = new EditPrefTab(frame);
00139
00140 restore();
00141 adjustSize();
00142 }
00143
00144 KAlarmPrefDlg::~KAlarmPrefDlg()
00145 {
00146 mInstance = 0;
00147 }
00148
00149
00150 void KAlarmPrefDlg::slotDefault()
00151 {
00152 kdDebug(5950) << "KAlarmPrefDlg::slotDefault()" << endl;
00153 mFontColourPage->setDefaults();
00154 mEmailPage->setDefaults();
00155 mViewPage->setDefaults();
00156 mEditPage->setDefaults();
00157 mMiscPage->setDefaults();
00158 }
00159
00160 void KAlarmPrefDlg::slotHelp()
00161 {
00162 kapp->invokeHelp("preferences");
00163 }
00164
00165
00166 void KAlarmPrefDlg::slotApply()
00167 {
00168 kdDebug(5950) << "KAlarmPrefDlg::slotApply()" << endl;
00169 QString errmsg = mEmailPage->validate();
00170 if (!errmsg.isEmpty())
00171 {
00172 showPage(pageIndex(mEmailPage->parentWidget()));
00173 if (KMessageBox::warningYesNo(this, errmsg) != KMessageBox::Yes)
00174 {
00175 mValid = false;
00176 return;
00177 }
00178 }
00179 errmsg = mEditPage->validate();
00180 if (!errmsg.isEmpty())
00181 {
00182 showPage(pageIndex(mEditPage->parentWidget()));
00183 KMessageBox::sorry(this, errmsg);
00184 mValid = false;
00185 return;
00186 }
00187 mValid = true;
00188 mFontColourPage->apply(false);
00189 mEmailPage->apply(false);
00190 mViewPage->apply(false);
00191 mEditPage->apply(false);
00192 mMiscPage->apply(false);
00193 Preferences::syncToDisc();
00194 }
00195
00196
00197 void KAlarmPrefDlg::slotOk()
00198 {
00199 kdDebug(5950) << "KAlarmPrefDlg::slotOk()" << endl;
00200 mValid = true;
00201 slotApply();
00202 if (mValid)
00203 KDialogBase::slotOk();
00204 }
00205
00206
00207 void KAlarmPrefDlg::slotCancel()
00208 {
00209 kdDebug(5950) << "KAlarmPrefDlg::slotCancel()" << endl;
00210 restore();
00211 KDialogBase::slotCancel();
00212 }
00213
00214
00215 void KAlarmPrefDlg::restore()
00216 {
00217 kdDebug(5950) << "KAlarmPrefDlg::restore()" << endl;
00218 mFontColourPage->restore();
00219 mEmailPage->restore();
00220 mViewPage->restore();
00221 mEditPage->restore();
00222 mMiscPage->restore();
00223 }
00224
00225
00226
00227
00228
00229 int PrefsTabBase::mIndentWidth = 0;
00230
00231 PrefsTabBase::PrefsTabBase(QVBox* frame)
00232 : QWidget(frame),
00233 mPage(frame)
00234 {
00235 if (!mIndentWidth)
00236 mIndentWidth = 3 * KDialog::spacingHint();
00237 }
00238
00239 void PrefsTabBase::apply(bool syncToDisc)
00240 {
00241 Preferences::save(syncToDisc);
00242 }
00243
00244
00245
00246
00247
00248
00249
00250 MiscPrefTab::MiscPrefTab(QVBox* frame)
00251 : PrefsTabBase(frame)
00252 {
00253
00254 int alignment = QApplication::reverseLayout() ? Qt::AlignRight : Qt::AlignLeft;
00255
00256 QGroupBox* group = new QButtonGroup(i18n("Run Mode"), mPage, "modeGroup");
00257 QGridLayout* grid = new QGridLayout(group, 6, 2, KDialog::marginHint(), KDialog::spacingHint());
00258 grid->setColStretch(2, 1);
00259 grid->addColSpacing(0, indentWidth());
00260 grid->addColSpacing(1, indentWidth());
00261 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2);
00262
00263
00264 mRunOnDemand = new QRadioButton(i18n("&Run only on demand"), group, "runDemand");
00265 mRunOnDemand->setFixedSize(mRunOnDemand->sizeHint());
00266 connect(mRunOnDemand, SIGNAL(toggled(bool)), SLOT(slotRunModeToggled(bool)));
00267 QWhatsThis::add(mRunOnDemand,
00268 i18n("Check to run KAlarm only when required.\n\n"
00269 "Notes:\n"
00270 "1. Alarms are displayed even when KAlarm is not running, since alarm monitoring is done by the alarm daemon.\n"
00271 "2. With this option selected, the system tray icon can be displayed or hidden independently of KAlarm."));
00272 grid->addMultiCellWidget(mRunOnDemand, 1, 1, 0, 2, alignment);
00273
00274
00275 mRunInSystemTray = new QRadioButton(i18n("Run continuously in system &tray"), group, "runTray");
00276 mRunInSystemTray->setFixedSize(mRunInSystemTray->sizeHint());
00277 connect(mRunInSystemTray, SIGNAL(toggled(bool)), SLOT(slotRunModeToggled(bool)));
00278 QWhatsThis::add(mRunInSystemTray,
00279 i18n("Check to run KAlarm continuously in the KDE system tray.\n\n"
00280 "Notes:\n"
00281 "1. With this option selected, closing the system tray icon will quit KAlarm.\n"
00282 "2. You do not need to select this option in order for alarms to be displayed, since alarm monitoring is done by the alarm daemon."
00283 " Running in the system tray simply provides easy access and a status indication."));
00284 grid->addMultiCellWidget(mRunInSystemTray, 2, 2, 0, 2, alignment);
00285
00286
00287 mDisableAlarmsIfStopped = new QCheckBox(i18n("Disa&ble alarms while not running"), group, "disableAl");
00288 mDisableAlarmsIfStopped->setFixedSize(mDisableAlarmsIfStopped->sizeHint());
00289 connect(mDisableAlarmsIfStopped, SIGNAL(toggled(bool)), SLOT(slotDisableIfStoppedToggled(bool)));
00290 QWhatsThis::add(mDisableAlarmsIfStopped,
00291 i18n("Check to disable alarms whenever KAlarm is not running. Alarms will only appear while the system tray icon is visible."));
00292 grid->addMultiCellWidget(mDisableAlarmsIfStopped, 3, 3, 1, 2, alignment);
00293
00294 mQuitWarn = new QCheckBox(i18n("Warn before &quitting"), group, "disableAl");
00295 mQuitWarn->setFixedSize(mQuitWarn->sizeHint());
00296 QWhatsThis::add(mQuitWarn,
00297 i18n("Check to display a warning prompt before quitting KAlarm."));
00298 grid->addWidget(mQuitWarn, 4, 2, alignment);
00299
00300 mAutostartTrayIcon = new QCheckBox(i18n("Autostart at &login"), group, "autoTray");
00301 #ifdef AUTOSTART_BY_KALARMD
00302 connect(mAutostartTrayIcon, SIGNAL(toggled(bool)), SLOT(slotAutostartToggled(bool)));
00303 #endif
00304 grid->addMultiCellWidget(mAutostartTrayIcon, 5, 5, 0, 2, alignment);
00305
00306
00307 mAutostartDaemon = new QCheckBox(i18n("Start alarm monitoring at lo&gin"), group, "startDaemon");
00308 mAutostartDaemon->setFixedSize(mAutostartDaemon->sizeHint());
00309 connect(mAutostartDaemon, SIGNAL(clicked()), SLOT(slotAutostartDaemonClicked()));
00310 QWhatsThis::add(mAutostartDaemon,
00311 i18n("Automatically start alarm monitoring whenever you start KDE, by running the alarm daemon (%1).\n\n"
00312 "This option should always be checked unless you intend to discontinue use of KAlarm.")
00313 .arg(QString::fromLatin1(DAEMON_APP_NAME)));
00314 grid->addMultiCellWidget(mAutostartDaemon, 6, 6, 0, 2, alignment);
00315
00316 group->setFixedHeight(group->sizeHint().height());
00317
00318
00319 QHBox* itemBox = new QHBox(mPage);
00320 QHBox* box = new QHBox(itemBox);
00321 box->setSpacing(KDialog::spacingHint());
00322 QLabel* label = new QLabel(i18n("&Start of day for date-only alarms:"), box);
00323 mStartOfDay = new TimeEdit(box);
00324 mStartOfDay->setFixedSize(mStartOfDay->sizeHint());
00325 label->setBuddy(mStartOfDay);
00326 static const QString startOfDayText = i18n("The earliest time of day at which a date-only alarm (i.e. "
00327 "an alarm with \"any time\" specified) will be triggered.");
00328 QWhatsThis::add(box, QString("%1\n\n%2").arg(startOfDayText).arg(TimeSpinBox::shiftWhatsThis()));
00329 itemBox->setStretchFactor(new QWidget(itemBox), 1);
00330 itemBox->setFixedHeight(box->sizeHint().height());
00331
00332
00333 itemBox = new QHBox(mPage);
00334 mConfirmAlarmDeletion = new QCheckBox(i18n("Con&firm alarm deletions"), itemBox, "confirmDeletion");
00335 mConfirmAlarmDeletion->setMinimumSize(mConfirmAlarmDeletion->sizeHint());
00336 QWhatsThis::add(mConfirmAlarmDeletion,
00337 i18n("Check to be prompted for confirmation each time you delete an alarm."));
00338 itemBox->setStretchFactor(new QWidget(itemBox), 1);
00339 itemBox->setFixedHeight(itemBox->sizeHint().height());
00340
00341
00342 group = new QGroupBox(i18n("Expired Alarms"), mPage);
00343 grid = new QGridLayout(group, 2, 2, KDialog::marginHint(), KDialog::spacingHint());
00344 grid->setColStretch(1, 1);
00345 grid->addColSpacing(0, indentWidth());
00346 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2);
00347 mKeepExpired = new QCheckBox(i18n("Keep alarms after e&xpiry"), group, "keepExpired");
00348 mKeepExpired->setFixedSize(mKeepExpired->sizeHint());
00349 connect(mKeepExpired, SIGNAL(toggled(bool)), SLOT(slotExpiredToggled(bool)));
00350 QWhatsThis::add(mKeepExpired,
00351 i18n("Check to store alarms after expiry or deletion (except deleted alarms which were never triggered)."));
00352 grid->addMultiCellWidget(mKeepExpired, 1, 1, 0, 1, alignment);
00353
00354 box = new QHBox(group);
00355 box->setSpacing(KDialog::spacingHint());
00356 mPurgeExpired = new QCheckBox(i18n("Discard ex&pired alarms after:"), box, "purgeExpired");
00357 mPurgeExpired->setMinimumSize(mPurgeExpired->sizeHint());
00358 connect(mPurgeExpired, SIGNAL(toggled(bool)), SLOT(slotExpiredToggled(bool)));
00359 mPurgeAfter = new SpinBox(box);
00360 mPurgeAfter->setMinValue(1);
00361 mPurgeAfter->setLineShiftStep(10);
00362 mPurgeAfter->setMinimumSize(mPurgeAfter->sizeHint());
00363 mPurgeAfterLabel = new QLabel(i18n("da&ys"), box);
00364 mPurgeAfterLabel->setMinimumSize(mPurgeAfterLabel->sizeHint());
00365 mPurgeAfterLabel->setBuddy(mPurgeAfter);
00366 QWhatsThis::add(box,
00367 i18n("Uncheck to store expired alarms indefinitely. Check to enter how long expired alarms should be stored."));
00368 grid->addWidget(box, 2, 1, alignment);
00369
00370 mClearExpired = new QPushButton(i18n("Clear Expired Alar&ms"), group);
00371 mClearExpired->setFixedSize(mClearExpired->sizeHint());
00372 connect(mClearExpired, SIGNAL(clicked()), SLOT(slotClearExpired()));
00373 QWhatsThis::add(mClearExpired,
00374 i18n("Delete all existing expired alarms."));
00375 grid->addWidget(mClearExpired, 3, 1, alignment);
00376 group->setFixedHeight(group->sizeHint().height());
00377
00378
00379 group = new QGroupBox(i18n("Terminal for Command Alarms"), mPage);
00380 QWhatsThis::add(group,
00381 i18n("Choose which application to use when a command alarm is executed in a terminal window"));
00382 grid = new QGridLayout(group, 1, 3, KDialog::marginHint(), KDialog::spacingHint());
00383 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2);
00384 int row = 0;
00385
00386 mXtermType = new QButtonGroup(group);
00387 mXtermType->hide();
00388 QString whatsThis = i18n("The parameter is a command line, e.g. 'xterm -e'", "Check to execute command alarms in a terminal window by '%1'");
00389 int index = 0;
00390 for (mXtermCount = 0; !xtermCommands[mXtermCount].isNull(); ++mXtermCount)
00391 {
00392 QString cmd = xtermCommands[mXtermCount];
00393 QStringList args = KShell::splitArgs(cmd);
00394 if (args.isEmpty() || KStandardDirs::findExe(args[0]).isEmpty())
00395 continue;
00396 QRadioButton* radio = new QRadioButton(args[0], group);
00397 radio->setMinimumSize(radio->sizeHint());
00398 mXtermType->insert(radio, mXtermCount);
00399 cmd.replace("%t", kapp->aboutData()->programName());
00400 cmd.replace("%c", "<command>");
00401 cmd.replace("%w", "<command; sleep>");
00402 cmd.replace("%C", "[command]");
00403 cmd.replace("%W", "[command; sleep]");
00404 QWhatsThis::add(radio, whatsThis.arg(cmd));
00405 grid->addWidget(radio, (row = index/3 + 1), index % 3, Qt::AlignAuto);
00406 ++index;
00407 }
00408
00409 box = new QHBox(group);
00410 grid->addMultiCellWidget(box, row + 1, row + 1, 0, 2, Qt::AlignAuto);
00411 QRadioButton* radio = new QRadioButton(i18n("Other:"), box);
00412 radio->setFixedSize(radio->sizeHint());
00413 connect(radio, SIGNAL(toggled(bool)), SLOT(slotOtherTerminalToggled(bool)));
00414 mXtermType->insert(radio, mXtermCount);
00415 mXtermCommand = new QLineEdit(box);
00416 QWhatsThis::add(box,
00417 i18n("Enter the full command line needed to execute a command in your chosen terminal window. "
00418 "By default the alarm's command string will be appended to what you enter here. "
00419 "See the KAlarm Handbook for details of special codes to tailor the command line."));
00420
00421 mPage->setStretchFactor(new QWidget(mPage), 1);
00422 }
00423
00424 void MiscPrefTab::restore()
00425 {
00426 mAutostartDaemon->setChecked(Daemon::autoStart());
00427 bool systray = Preferences::mRunInSystemTray;
00428 mRunInSystemTray->setChecked(systray);
00429 mRunOnDemand->setChecked(!systray);
00430 mDisableAlarmsIfStopped->setChecked(Preferences::mDisableAlarmsIfStopped);
00431 mQuitWarn->setChecked(Preferences::quitWarn());
00432 mAutostartTrayIcon->setChecked(Preferences::mAutostartTrayIcon);
00433 mConfirmAlarmDeletion->setChecked(Preferences::confirmAlarmDeletion());
00434 mStartOfDay->setValue(Preferences::mStartOfDay);
00435 setExpiredControls(Preferences::mExpiredKeepDays);
00436 QString xtermCmd = Preferences::cmdXTermCommand();
00437 int id = 0;
00438 if (!xtermCmd.isEmpty())
00439 {
00440 for ( ; id < mXtermCount; ++id)
00441 {
00442 if (mXtermType->find(id) && xtermCmd == xtermCommands[id])
00443 break;
00444 }
00445 }
00446 mXtermType->setButton(id);
00447 mXtermCommand->setEnabled(id == mXtermCount);
00448 mXtermCommand->setText(id == mXtermCount ? xtermCmd : "");
00449 slotDisableIfStoppedToggled(true);
00450 }
00451
00452 void MiscPrefTab::apply(bool syncToDisc)
00453 {
00454
00455 int xtermID = mXtermType->selectedId();
00456 if (xtermID >= mXtermCount)
00457 {
00458 QString cmd = mXtermCommand->text();
00459 if (cmd.isEmpty())
00460 xtermID = 0;
00461 else
00462 {
00463 QStringList args = KShell::splitArgs(cmd);
00464 cmd = args.isEmpty() ? QString::null : args[0];
00465 if (KStandardDirs::findExe(cmd).isEmpty())
00466 {
00467 mXtermCommand->setFocus();
00468 if (KMessageBox::warningContinueCancel(this, i18n("Command to invoke terminal window not found:\n%1").arg(cmd))
00469 != KMessageBox::Continue)
00470 return;
00471 }
00472 }
00473 }
00474 bool systray = mRunInSystemTray->isChecked();
00475 Preferences::mRunInSystemTray = systray;
00476 Preferences::mDisableAlarmsIfStopped = mDisableAlarmsIfStopped->isChecked();
00477 if (mQuitWarn->isEnabled())
00478 Preferences::setQuitWarn(mQuitWarn->isChecked());
00479 Preferences::mAutostartTrayIcon = mAutostartTrayIcon->isChecked();
00480 #ifdef AUTOSTART_BY_KALARMD
00481 bool newAutostartDaemon = mAutostartDaemon->isChecked() || Preferences::mAutostartTrayIcon;
00482 #else
00483 bool newAutostartDaemon = mAutostartDaemon->isChecked();
00484 #endif
00485 if (newAutostartDaemon != Daemon::autoStart())
00486 Daemon::enableAutoStart(newAutostartDaemon);
00487 Preferences::setConfirmAlarmDeletion(mConfirmAlarmDeletion->isChecked());
00488 int sod = mStartOfDay->value();
00489 Preferences::mStartOfDay.setHMS(sod/60, sod%60, 0);
00490 Preferences::mExpiredKeepDays = !mKeepExpired->isChecked() ? 0
00491 : mPurgeExpired->isChecked() ? mPurgeAfter->value() : -1;
00492 Preferences::mCmdXTermCommand = (xtermID < mXtermCount) ? xtermCommands[xtermID] : mXtermCommand->text();
00493 PrefsTabBase::apply(syncToDisc);
00494 }
00495
00496 void MiscPrefTab::setDefaults()
00497 {
00498 mAutostartDaemon->setChecked(true);
00499 bool systray = Preferences::default_runInSystemTray;
00500 mRunInSystemTray->setChecked(systray);
00501 mRunOnDemand->setChecked(!systray);
00502 mDisableAlarmsIfStopped->setChecked(Preferences::default_disableAlarmsIfStopped);
00503 mQuitWarn->setChecked(Preferences::default_quitWarn);
00504 mAutostartTrayIcon->setChecked(Preferences::default_autostartTrayIcon);
00505 mConfirmAlarmDeletion->setChecked(Preferences::default_confirmAlarmDeletion);
00506 mStartOfDay->setValue(Preferences::default_startOfDay);
00507 setExpiredControls(Preferences::default_expiredKeepDays);
00508 mXtermType->setButton(0);
00509 mXtermCommand->setEnabled(false);
00510 slotDisableIfStoppedToggled(true);
00511 }
00512
00513 void MiscPrefTab::slotAutostartDaemonClicked()
00514 {
00515 if (!mAutostartDaemon->isChecked()
00516 && KMessageBox::warningYesNo(this,
00517 i18n("You should not uncheck this option unless you intend to discontinue use of KAlarm"),
00518 QString::null, KStdGuiItem::cont(), KStdGuiItem::cancel()
00519 ) != KMessageBox::Yes)
00520 mAutostartDaemon->setChecked(true);
00521 }
00522
00523 void MiscPrefTab::slotRunModeToggled(bool)
00524 {
00525 bool systray = mRunInSystemTray->isOn();
00526 mAutostartTrayIcon->setText(systray ? i18n("Autostart at &login") : i18n("Autostart system tray &icon at login"));
00527 QWhatsThis::add(mAutostartTrayIcon, (systray ? i18n("Check to run KAlarm whenever you start KDE.")
00528 : i18n("Check to display the system tray icon whenever you start KDE.")));
00529 mDisableAlarmsIfStopped->setEnabled(systray);
00530 slotDisableIfStoppedToggled(true);
00531 }
00532
00533
00534
00535
00536
00537 void MiscPrefTab::slotAutostartToggled(bool)
00538 {
00539 #ifdef AUTOSTART_BY_KALARMD
00540 mAutostartDaemon->setEnabled(!mAutostartTrayIcon->isChecked());
00541 #endif
00542 }
00543
00544 void MiscPrefTab::slotDisableIfStoppedToggled(bool)
00545 {
00546 bool enable = mDisableAlarmsIfStopped->isEnabled() && mDisableAlarmsIfStopped->isChecked();
00547 mQuitWarn->setEnabled(enable);
00548 }
00549
00550 void MiscPrefTab::setExpiredControls(int purgeDays)
00551 {
00552 mKeepExpired->setChecked(purgeDays);
00553 mPurgeExpired->setChecked(purgeDays > 0);
00554 mPurgeAfter->setValue(purgeDays > 0 ? purgeDays : 0);
00555 slotExpiredToggled(true);
00556 }
00557
00558 void MiscPrefTab::slotExpiredToggled(bool)
00559 {
00560 bool keep = mKeepExpired->isChecked();
00561 bool after = keep && mPurgeExpired->isChecked();
00562 mPurgeExpired->setEnabled(keep);
00563 mPurgeAfter->setEnabled(after);
00564 mPurgeAfterLabel->setEnabled(keep);
00565 mClearExpired->setEnabled(keep);
00566 }
00567
00568 void MiscPrefTab::slotClearExpired()
00569 {
00570 AlarmCalendar* cal = AlarmCalendar::expiredCalendarOpen();
00571 if (cal)
00572 cal->purgeAll();
00573 }
00574
00575 void MiscPrefTab::slotOtherTerminalToggled(bool on)
00576 {
00577 mXtermCommand->setEnabled(on);
00578 }
00579
00580
00581
00582
00583
00584
00585 EmailPrefTab::EmailPrefTab(QVBox* frame)
00586 : PrefsTabBase(frame),
00587 mAddressChanged(false),
00588 mBccAddressChanged(false)
00589 {
00590 QHBox* box = new QHBox(mPage);
00591 box->setSpacing(2*KDialog::spacingHint());
00592 QLabel* label = new QLabel(i18n("Email client:"), box);
00593 mEmailClient = new ButtonGroup(box);
00594 mEmailClient->hide();
00595 RadioButton* radio = new RadioButton(i18n("&KMail"), box, "kmail");
00596 radio->setMinimumSize(radio->sizeHint());
00597 mEmailClient->insert(radio, Preferences::KMAIL);
00598 radio = new RadioButton(i18n("&Sendmail"), box, "sendmail");
00599 radio->setMinimumSize(radio->sizeHint());
00600 mEmailClient->insert(radio, Preferences::SENDMAIL);
00601 connect(mEmailClient, SIGNAL(buttonSet(int)), SLOT(slotEmailClientChanged(int)));
00602 box->setFixedHeight(box->sizeHint().height());
00603 QWhatsThis::add(box,
00604 i18n("Choose how to send email when an email alarm is triggered.\n"
00605 "KMail: The email is sent automatically via KMail. KMail is started first if necessary.\n"
00606 "Sendmail: The email is sent automatically. This option will only work if "
00607 "your system is configured to use sendmail or a sendmail compatible mail transport agent."));
00608
00609 box = new QHBox(mPage);
00610 mEmailCopyToKMail = new QCheckBox(i18n("Co&py sent emails into KMail's %1 folder").arg(KAMail::i18n_sent_mail()), box);
00611 mEmailCopyToKMail->setFixedSize(mEmailCopyToKMail->sizeHint());
00612 QWhatsThis::add(mEmailCopyToKMail,
00613 i18n("After sending an email, store a copy in KMail's %1 folder").arg(KAMail::i18n_sent_mail()));
00614 box->setStretchFactor(new QWidget(box), 1);
00615 box->setFixedHeight(box->sizeHint().height());
00616
00617
00618 QGroupBox* group = new QGroupBox(i18n("Your Email Address"), mPage);
00619 QGridLayout* grid = new QGridLayout(group, 6, 3, KDialog::marginHint(), KDialog::spacingHint());
00620 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2);
00621 grid->setColStretch(1, 1);
00622
00623
00624 label = new Label(EditAlarmDlg::i18n_f_EmailFrom(), group);
00625 label->setFixedSize(label->sizeHint());
00626 grid->addWidget(label, 1, 0);
00627 mFromAddressGroup = new ButtonGroup(group);
00628 mFromAddressGroup->hide();
00629 connect(mFromAddressGroup, SIGNAL(buttonSet(int)), SLOT(slotFromAddrChanged(int)));
00630
00631
00632 radio = new RadioButton(group);
00633 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_ADDR);
00634 radio->setFixedSize(radio->sizeHint());
00635 label->setBuddy(radio);
00636 grid->addWidget(radio, 1, 1);
00637 mEmailAddress = new QLineEdit(group);
00638 connect(mEmailAddress, SIGNAL(textChanged(const QString&)), SLOT(slotAddressChanged()));
00639 QString whatsThis = i18n("Your email address, used to identify you as the sender when sending email alarms.");
00640 QWhatsThis::add(radio, whatsThis);
00641 QWhatsThis::add(mEmailAddress, whatsThis);
00642 radio->setFocusWidget(mEmailAddress);
00643 grid->addWidget(mEmailAddress, 1, 2);
00644
00645
00646 radio = new RadioButton(i18n("&Use address from Control Center"), group);
00647 radio->setFixedSize(radio->sizeHint());
00648 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_CONTROL_CENTRE);
00649 QWhatsThis::add(radio,
00650 i18n("Check to use the email address set in the KDE Control Center, to identify you as the sender when sending email alarms."));
00651 grid->addMultiCellWidget(radio, 2, 2, 1, 2, Qt::AlignAuto);
00652
00653
00654 radio = new RadioButton(i18n("Use KMail &identities"), group);
00655 radio->setFixedSize(radio->sizeHint());
00656 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_KMAIL);
00657 QWhatsThis::add(radio,
00658 i18n("Check to use KMail's email identities to identify you as the sender when sending email alarms. "
00659 "For existing email alarms, KMail's default identity will be used. "
00660 "For new email alarms, you will be able to pick which of KMail's identities to use."));
00661 grid->addMultiCellWidget(radio, 3, 3, 1, 2, Qt::AlignAuto);
00662
00663
00664 grid->addRowSpacing(4, KDialog::spacingHint());
00665 label = new Label(i18n("'Bcc' email address", "&Bcc:"), group);
00666 label->setFixedSize(label->sizeHint());
00667 grid->addWidget(label, 5, 0);
00668 mBccAddressGroup = new ButtonGroup(group);
00669 mBccAddressGroup->hide();
00670 connect(mBccAddressGroup, SIGNAL(buttonSet(int)), SLOT(slotBccAddrChanged(int)));
00671
00672
00673 radio = new RadioButton(group);
00674 radio->setFixedSize(radio->sizeHint());
00675 mBccAddressGroup->insert(radio, Preferences::MAIL_FROM_ADDR);
00676 label->setBuddy(radio);
00677 grid->addWidget(radio, 5, 1);
00678 mEmailBccAddress = new QLineEdit(group);
00679 whatsThis = i18n("Your email address, used for blind copying email alarms to yourself. "
00680 "If you want blind copies to be sent to your account on the computer which KAlarm runs on, you can simply enter your user login name.");
00681 QWhatsThis::add(radio, whatsThis);
00682 QWhatsThis::add(mEmailBccAddress, whatsThis);
00683 radio->setFocusWidget(mEmailBccAddress);
00684 grid->addWidget(mEmailBccAddress, 5, 2);
00685
00686
00687 radio = new RadioButton(i18n("Us&e address from Control Center"), group);
00688 radio->setFixedSize(radio->sizeHint());
00689 mBccAddressGroup->insert(radio, Preferences::MAIL_FROM_CONTROL_CENTRE);
00690 QWhatsThis::add(radio,
00691 i18n("Check to use the email address set in the KDE Control Center, for blind copying email alarms to yourself."));
00692 grid->addMultiCellWidget(radio, 6, 6, 1, 2, Qt::AlignAuto);
00693
00694 group->setFixedHeight(group->sizeHint().height());
00695
00696 box = new QHBox(mPage);
00697 mEmailQueuedNotify = new QCheckBox(i18n("&Notify when remote emails are queued"), box);
00698 mEmailQueuedNotify->setFixedSize(mEmailQueuedNotify->sizeHint());
00699 QWhatsThis::add(mEmailQueuedNotify,
00700 i18n("Display a notification message whenever an email alarm has queued an email for sending to a remote system. "
00701 "This could be useful if, for example, you have a dial-up connection, so that you can then ensure that the email is actually transmitted."));
00702 box->setStretchFactor(new QWidget(box), 1);
00703 box->setFixedHeight(box->sizeHint().height());
00704
00705 mPage->setStretchFactor(new QWidget(mPage), 1);
00706 }
00707
00708 void EmailPrefTab::restore()
00709 {
00710 mEmailClient->setButton(Preferences::mEmailClient);
00711 mEmailCopyToKMail->setChecked(Preferences::emailCopyToKMail());
00712 setEmailAddress(Preferences::mEmailFrom, Preferences::mEmailAddress);
00713 setEmailBccAddress((Preferences::mEmailBccFrom == Preferences::MAIL_FROM_CONTROL_CENTRE), Preferences::mEmailBccAddress);
00714 mEmailQueuedNotify->setChecked(Preferences::emailQueuedNotify());
00715 mAddressChanged = mBccAddressChanged = false;
00716 }
00717
00718 void EmailPrefTab::apply(bool syncToDisc)
00719 {
00720 int client = mEmailClient->id(mEmailClient->selected());
00721 Preferences::mEmailClient = (client >= 0) ? Preferences::MailClient(client) : Preferences::default_emailClient;
00722 Preferences::mEmailCopyToKMail = mEmailCopyToKMail->isChecked();
00723 Preferences::setEmailAddress(static_cast<Preferences::MailFrom>(mFromAddressGroup->selectedId()), mEmailAddress->text().stripWhiteSpace());
00724 Preferences::setEmailBccAddress((mBccAddressGroup->selectedId() == Preferences::MAIL_FROM_CONTROL_CENTRE), mEmailBccAddress->text().stripWhiteSpace());
00725 Preferences::setEmailQueuedNotify(mEmailQueuedNotify->isChecked());
00726 PrefsTabBase::apply(syncToDisc);
00727 }
00728
00729 void EmailPrefTab::setDefaults()
00730 {
00731 mEmailClient->setButton(Preferences::default_emailClient);
00732 setEmailAddress(Preferences::default_emailFrom(), Preferences::default_emailAddress);
00733 setEmailBccAddress((Preferences::default_emailBccFrom == Preferences::MAIL_FROM_CONTROL_CENTRE), Preferences::default_emailBccAddress);
00734 mEmailQueuedNotify->setChecked(Preferences::default_emailQueuedNotify);
00735 }
00736
00737 void EmailPrefTab::setEmailAddress(Preferences::MailFrom from, const QString& address)
00738 {
00739 mFromAddressGroup->setButton(from);
00740 mEmailAddress->setText(from == Preferences::MAIL_FROM_ADDR ? address.stripWhiteSpace() : QString());
00741 }
00742
00743 void EmailPrefTab::setEmailBccAddress(bool useControlCentre, const QString& address)
00744 {
00745 mBccAddressGroup->setButton(useControlCentre ? Preferences::MAIL_FROM_CONTROL_CENTRE : Preferences::MAIL_FROM_ADDR);
00746 mEmailBccAddress->setText(useControlCentre ? QString() : address.stripWhiteSpace());
00747 }
00748
00749 void EmailPrefTab::slotEmailClientChanged(int id)
00750 {
00751 mEmailCopyToKMail->setEnabled(id == Preferences::SENDMAIL);
00752 }
00753
00754 void EmailPrefTab::slotFromAddrChanged(int id)
00755 {
00756 mEmailAddress->setEnabled(id == Preferences::MAIL_FROM_ADDR);
00757 mAddressChanged = true;
00758 }
00759
00760 void EmailPrefTab::slotBccAddrChanged(int id)
00761 {
00762 mEmailBccAddress->setEnabled(id == Preferences::MAIL_FROM_ADDR);
00763 mBccAddressChanged = true;
00764 }
00765
00766 QString EmailPrefTab::validate()
00767 {
00768 if (mAddressChanged)
00769 {
00770 mAddressChanged = false;
00771 QString errmsg = validateAddr(mFromAddressGroup, mEmailAddress, KAMail::i18n_NeedFromEmailAddress());
00772 if (!errmsg.isEmpty())
00773 return errmsg;
00774 }
00775 if (mBccAddressChanged)
00776 {
00777 mBccAddressChanged = false;
00778 return validateAddr(mBccAddressGroup, mEmailBccAddress, i18n("No valid 'Bcc' email address is specified."));
00779 }
00780 return QString::null;
00781 }
00782
00783 QString EmailPrefTab::validateAddr(ButtonGroup* group, QLineEdit* addr, const QString& msg)
00784 {
00785 QString errmsg = i18n("%1\nAre you sure you want to save your changes?").arg(msg);
00786 switch (group->selectedId())
00787 {
00788 case Preferences::MAIL_FROM_CONTROL_CENTRE:
00789 if (!KAMail::controlCentreAddress().isEmpty())
00790 return QString::null;
00791 errmsg = i18n("No email address is currently set in the KDE Control Center. %1").arg(errmsg);
00792 break;
00793 case Preferences::MAIL_FROM_KMAIL:
00794 if (KAMail::identitiesExist())
00795 return QString::null;
00796 errmsg = i18n("No KMail identities currently exist. %1").arg(errmsg);
00797 break;
00798 case Preferences::MAIL_FROM_ADDR:
00799 if (!addr->text().stripWhiteSpace().isEmpty())
00800 return QString::null;
00801 break;
00802 }
00803 return errmsg;
00804 }
00805
00806
00807
00808
00809
00810
00811 FontColourPrefTab::FontColourPrefTab(QVBox* frame)
00812 : PrefsTabBase(frame)
00813 {
00814 mFontChooser = new FontColourChooser(mPage, 0, false, QStringList(), i18n("Message Font && Color"), true, false);
00815
00816 QHBox* layoutBox = new QHBox(mPage);
00817 QHBox* box = new QHBox(layoutBox);
00818 box->setSpacing(KDialog::spacingHint());
00819 QLabel* label1 = new QLabel(i18n("Di&sabled alarm color:"), box);
00820
00821 box->setStretchFactor(new QWidget(box), 1);
00822 mDisabledColour = new KColorCombo(box);
00823 mDisabledColour->setMinimumSize(mDisabledColour->sizeHint());
00824 label1->setBuddy(mDisabledColour);
00825 QWhatsThis::add(box,
00826 i18n("Choose the text color in the alarm list for disabled alarms."));
00827 layoutBox->setStretchFactor(new QWidget(layoutBox), 1);
00828 layoutBox->setFixedHeight(layoutBox->sizeHint().height());
00829
00830 layoutBox = new QHBox(mPage);
00831 box = new QHBox(layoutBox);
00832 box->setSpacing(KDialog::spacingHint());
00833 QLabel* label2 = new QLabel(i18n("E&xpired alarm color:"), box);
00834
00835 box->setStretchFactor(new QWidget(box), 1);
00836 mExpiredColour = new KColorCombo(box);
00837 mExpiredColour->setMinimumSize(mExpiredColour->sizeHint());
00838 label2->setBuddy(mExpiredColour);
00839 QWhatsThis::add(box,
00840 i18n("Choose the text color in the alarm list for expired alarms."));
00841 layoutBox->setStretchFactor(new QWidget(layoutBox), 1);
00842 layoutBox->setFixedHeight(layoutBox->sizeHint().height());
00843
00844
00845 QSize size = label1->sizeHint();
00846 QSize size2 = label2->sizeHint();
00847 if (size2.width() > size.width())
00848 size.setWidth(size2.width());
00849 label1->setFixedSize(size);
00850 label2->setFixedSize(size);
00851
00852 mPage->setStretchFactor(new QWidget(mPage), 1);
00853 }
00854
00855 void FontColourPrefTab::restore()
00856 {
00857 mFontChooser->setBgColour(Preferences::mDefaultBgColour);
00858 mFontChooser->setColours(Preferences::mMessageColours);
00859 mFontChooser->setFont(Preferences::mMessageFont);
00860 mDisabledColour->setColor(Preferences::mDisabledColour);
00861 mExpiredColour->setColor(Preferences::mExpiredColour);
00862 }
00863
00864 void FontColourPrefTab::apply(bool syncToDisc)
00865 {
00866 Preferences::mDefaultBgColour = mFontChooser->bgColour();
00867 Preferences::mMessageColours = mFontChooser->colours();
00868 Preferences::mMessageFont = mFontChooser->font();
00869 Preferences::mDisabledColour = mDisabledColour->color();
00870 Preferences::mExpiredColour = mExpiredColour->color();
00871 PrefsTabBase::apply(syncToDisc);
00872 }
00873
00874 void FontColourPrefTab::setDefaults()
00875 {
00876 mFontChooser->setBgColour(Preferences::default_defaultBgColour);
00877 mFontChooser->setColours(Preferences::default_messageColours);
00878 mFontChooser->setFont(Preferences::default_messageFont());
00879 mDisabledColour->setColor(Preferences::default_disabledColour);
00880 mExpiredColour->setColor(Preferences::default_expiredColour);
00881 }
00882
00883
00884
00885
00886
00887
00888 EditPrefTab::EditPrefTab(QVBox* frame)
00889 : PrefsTabBase(frame)
00890 {
00891
00892
00893 int alignment = QApplication::reverseLayout() ? Qt::AlignRight : Qt::AlignLeft;
00894
00895 int groupTopMargin = fontMetrics().lineSpacing()/2;
00896 QString defsetting = i18n("The default setting for \"%1\" in the alarm edit dialog.");
00897 QString soundSetting = i18n("Check to select %1 as the default setting for \"%2\" in the alarm edit dialog.");
00898
00899
00900 QGroupBox* group = new QGroupBox(i18n("Display Alarms"), mPage);
00901 QBoxLayout* layout = new QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint());
00902 layout->addSpacing(groupTopMargin);
00903
00904 mConfirmAck = new QCheckBox(EditAlarmDlg::i18n_k_ConfirmAck(), group, "defConfAck");
00905 mConfirmAck->setMinimumSize(mConfirmAck->sizeHint());
00906 QWhatsThis::add(mConfirmAck, defsetting.arg(EditAlarmDlg::i18n_ConfirmAck()));
00907 layout->addWidget(mConfirmAck, 0, Qt::AlignAuto);
00908
00909 mAutoClose = new QCheckBox(LateCancelSelector::i18n_i_AutoCloseWinLC(), group, "defAutoClose");
00910 mAutoClose->setMinimumSize(mAutoClose->sizeHint());
00911 QWhatsThis::add(mAutoClose, defsetting.arg(LateCancelSelector::i18n_AutoCloseWin()));
00912 layout->addWidget(mAutoClose, 0, Qt::AlignAuto);
00913
00914 QHBox* box = new QHBox(group);
00915 box->setSpacing(KDialog::spacingHint());
00916 layout->addWidget(box);
00917 QLabel* label = new QLabel(i18n("Reminder &units:"), box);
00918 label->setFixedSize(label->sizeHint());
00919 mReminderUnits = new QComboBox(box, "defWarnUnits");
00920 mReminderUnits->insertItem(TimePeriod::i18n_Hours_Mins(), TimePeriod::HOURS_MINUTES);
00921 mReminderUnits->insertItem(TimePeriod::i18n_Days(), TimePeriod::DAYS);
00922 mReminderUnits->insertItem(TimePeriod::i18n_Weeks(), TimePeriod::WEEKS);
00923 mReminderUnits->setFixedSize(mReminderUnits->sizeHint());
00924 label->setBuddy(mReminderUnits);
00925 QWhatsThis::add(box,
00926 i18n("The default units for the reminder in the alarm edit dialog."));
00927 box->setStretchFactor(new QWidget(box), 1);
00928
00929 mSpecialActionsButton = new SpecialActionsButton(EditAlarmDlg::i18n_SpecialActions(), box);
00930 mSpecialActionsButton->setFixedSize(mSpecialActionsButton->sizeHint());
00931
00932
00933 QButtonGroup* bgroup = new QButtonGroup(SoundPicker::i18n_Sound(), mPage, "soundGroup");
00934 layout = new QVBoxLayout(bgroup, KDialog::marginHint(), KDialog::spacingHint());
00935 layout->addSpacing(groupTopMargin);
00936
00937 QBoxLayout* hlayout = new QHBoxLayout(layout, KDialog::spacingHint());
00938 mSound = new QComboBox(false, bgroup, "defSound");
00939 mSound->insertItem(SoundPicker::i18n_None());
00940 mSound->insertItem(SoundPicker::i18n_Beep());
00941 mSound->insertItem(SoundPicker::i18n_File());
00942 if (theApp()->speechEnabled())
00943 mSound->insertItem(SoundPicker::i18n_Speak());
00944 mSound->setMinimumSize(mSound->sizeHint());
00945 QWhatsThis::add(mSound, defsetting.arg(SoundPicker::i18n_Sound()));
00946 hlayout->addWidget(mSound);
00947 hlayout->addStretch(1);
00948
00949 #ifndef WITHOUT_ARTS
00950 mSoundRepeat = new QCheckBox(i18n("Repea&t sound file"), bgroup, "defRepeatSound");
00951 mSoundRepeat->setMinimumSize(mSoundRepeat->sizeHint());
00952 QWhatsThis::add(mSoundRepeat, i18n("sound file \"Repeat\" checkbox", "The default setting for sound file \"%1\" in the alarm edit dialog.").arg(SoundDlg::i18n_Repeat()));
00953 hlayout->addWidget(mSoundRepeat);
00954 #endif
00955
00956 box = new QHBox(bgroup);
00957 box->setSpacing(KDialog::spacingHint());
00958 mSoundFileLabel = new QLabel(i18n("Sound &file:"), box);
00959 mSoundFileLabel->setFixedSize(mSoundFileLabel->sizeHint());
00960 mSoundFile = new QLineEdit(box);
00961 mSoundFileLabel->setBuddy(mSoundFile);
00962 mSoundFileBrowse = new QPushButton(box);
00963 mSoundFileBrowse->setPixmap(SmallIcon("fileopen"));
00964 mSoundFileBrowse->setFixedSize(mSoundFileBrowse->sizeHint());
00965 connect(mSoundFileBrowse, SIGNAL(clicked()), SLOT(slotBrowseSoundFile()));
00966 QToolTip::add(mSoundFileBrowse, i18n("Choose a sound file"));
00967 QWhatsThis::add(box,
00968 i18n("Enter the default sound file to use in the alarm edit dialog."));
00969 box->setFixedHeight(box->sizeHint().height());
00970 layout->addWidget(box);
00971 bgroup->setFixedHeight(bgroup->sizeHint().height());
00972
00973
00974 group = new QGroupBox(i18n("Command Alarms"), mPage);
00975 layout = new QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint());
00976 layout->addSpacing(groupTopMargin);
00977 layout = new QHBoxLayout(layout, KDialog::spacingHint());
00978
00979 mCmdScript = new QCheckBox(EditAlarmDlg::i18n_p_EnterScript(), group, "defCmdScript");
00980 mCmdScript->setMinimumSize(mCmdScript->sizeHint());
00981 QWhatsThis::add(mCmdScript, defsetting.arg(EditAlarmDlg::i18n_EnterScript()));
00982 layout->addWidget(mCmdScript);
00983 layout->addStretch();
00984
00985 mCmdXterm = new QCheckBox(EditAlarmDlg::i18n_w_ExecInTermWindow(), group, "defCmdXterm");
00986 mCmdXterm->setMinimumSize(mCmdXterm->sizeHint());
00987 QWhatsThis::add(mCmdXterm, defsetting.arg(EditAlarmDlg::i18n_ExecInTermWindow()));
00988 layout->addWidget(mCmdXterm);
00989
00990
00991 group = new QGroupBox(i18n("Email Alarms"), mPage);
00992 layout = new QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint());
00993 layout->addSpacing(groupTopMargin);
00994
00995
00996 mEmailBcc = new QCheckBox(EditAlarmDlg::i18n_e_CopyEmailToSelf(), group, "defEmailBcc");
00997 mEmailBcc->setMinimumSize(mEmailBcc->sizeHint());
00998 QWhatsThis::add(mEmailBcc, defsetting.arg(EditAlarmDlg::i18n_CopyEmailToSelf()));
00999 layout->addWidget(mEmailBcc, 0, Qt::AlignAuto);
01000
01001
01002
01003 mCopyToKOrganizer = new QCheckBox(EditAlarmDlg::i18n_g_ShowInKOrganizer(), mPage, "defShowKorg");
01004 mCopyToKOrganizer->setMinimumSize(mCopyToKOrganizer->sizeHint());
01005 QWhatsThis::add(mCopyToKOrganizer, defsetting.arg(EditAlarmDlg::i18n_ShowInKOrganizer()));
01006
01007
01008 box = new QHBox(mPage);
01009 box->setSpacing(KDialog::spacingHint());
01010 mLateCancel = new QCheckBox(LateCancelSelector::i18n_n_CancelIfLate(), box, "defCancelLate");
01011 mLateCancel->setMinimumSize(mLateCancel->sizeHint());
01012 QWhatsThis::add(mLateCancel, defsetting.arg(LateCancelSelector::i18n_CancelIfLate()));
01013 box->setStretchFactor(new QWidget(box), 1);
01014
01015
01016 QHBox* itemBox = new QHBox(box);
01017 itemBox->setSpacing(KDialog::spacingHint());
01018 label = new QLabel(i18n("&Recurrence:"), itemBox);
01019 label->setFixedSize(label->sizeHint());
01020 mRecurPeriod = new QComboBox(itemBox, "defRecur");
01021 mRecurPeriod->insertItem(RecurrenceEdit::i18n_NoRecur());
01022 mRecurPeriod->insertItem(RecurrenceEdit::i18n_AtLogin());
01023 mRecurPeriod->insertItem(RecurrenceEdit::i18n_HourlyMinutely());
01024 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Daily());
01025 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Weekly());
01026 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Monthly());
01027 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Yearly());
01028 mRecurPeriod->setFixedSize(mRecurPeriod->sizeHint());
01029 label->setBuddy(mRecurPeriod);
01030 QWhatsThis::add(itemBox,
01031 i18n("The default setting for the recurrence rule in the alarm edit dialog."));
01032 box->setFixedHeight(itemBox->sizeHint().height());
01033
01034
01035 QVBox* vbox = new QVBox(mPage);
01036 vbox->setSpacing(KDialog::spacingHint());
01037 label = new QLabel(i18n("In non-leap years, repeat yearly February 29th alarms on:"), vbox);
01038 label->setAlignment(alignment | Qt::WordBreak);
01039 itemBox = new QHBox(vbox);
01040 itemBox->setSpacing(2*KDialog::spacingHint());
01041 mFeb29 = new QButtonGroup(itemBox);
01042 mFeb29->hide();
01043 QWidget* widget = new QWidget(itemBox);
01044 widget->setFixedWidth(3*KDialog::spacingHint());
01045 QRadioButton* radio = new QRadioButton(i18n("February 2&8th"), itemBox);
01046 radio->setMinimumSize(radio->sizeHint());
01047 mFeb29->insert(radio, KARecurrence::FEB29_FEB28);
01048 radio = new QRadioButton(i18n("March &1st"), itemBox);
01049 radio->setMinimumSize(radio->sizeHint());
01050 mFeb29->insert(radio, KARecurrence::FEB29_MAR1);
01051 radio = new QRadioButton(i18n("Do ¬ repeat"), itemBox);
01052 radio->setMinimumSize(radio->sizeHint());
01053 mFeb29->insert(radio, KARecurrence::FEB29_FEB29);
01054 itemBox->setFixedHeight(itemBox->sizeHint().height());
01055 QWhatsThis::add(vbox,
01056 i18n("For yearly recurrences, choose what date, if any, alarms due on February 29th should occur in non-leap years.\n"
01057 "Note that the next scheduled occurrence of existing alarms is not re-evaluated when you change this setting."));
01058
01059 mPage->setStretchFactor(new QWidget(mPage), 1);
01060 }
01061
01062 void EditPrefTab::restore()
01063 {
01064 mAutoClose->setChecked(Preferences::mDefaultAutoClose);
01065 mConfirmAck->setChecked(Preferences::mDefaultConfirmAck);
01066 mReminderUnits->setCurrentItem(Preferences::mDefaultReminderUnits);
01067 mSpecialActionsButton->setActions(Preferences::mDefaultPreAction, Preferences::mDefaultPostAction);
01068 mSound->setCurrentItem(soundIndex(Preferences::mDefaultSoundType));
01069 mSoundFile->setText(Preferences::mDefaultSoundFile);
01070 #ifndef WITHOUT_ARTS
01071 mSoundRepeat->setChecked(Preferences::mDefaultSoundRepeat);
01072 #endif
01073 mCmdScript->setChecked(Preferences::mDefaultCmdScript);
01074 mCmdXterm->setChecked(Preferences::mDefaultCmdLogType == EditAlarmDlg::EXEC_IN_TERMINAL);
01075 mEmailBcc->setChecked(Preferences::mDefaultEmailBcc);
01076 mCopyToKOrganizer->setChecked(Preferences::mDefaultCopyToKOrganizer);
01077 mLateCancel->setChecked(Preferences::mDefaultLateCancel);
01078 mRecurPeriod->setCurrentItem(recurIndex(Preferences::mDefaultRecurPeriod));
01079 mFeb29->setButton(Preferences::mDefaultFeb29Type);
01080 }
01081
01082 void EditPrefTab::apply(bool syncToDisc)
01083 {
01084 Preferences::mDefaultAutoClose = mAutoClose->isChecked();
01085 Preferences::mDefaultConfirmAck = mConfirmAck->isChecked();
01086 Preferences::mDefaultReminderUnits = static_cast<TimePeriod::Units>(mReminderUnits->currentItem());
01087 Preferences::mDefaultPreAction = mSpecialActionsButton->preAction();
01088 Preferences::mDefaultPostAction = mSpecialActionsButton->postAction();
01089 switch (mSound->currentItem())
01090 {
01091 case 3: Preferences::mDefaultSoundType = SoundPicker::SPEAK; break;
01092 case 2: Preferences::mDefaultSoundType = SoundPicker::PLAY_FILE; break;
01093 case 1: Preferences::mDefaultSoundType = SoundPicker::BEEP; break;
01094 case 0:
01095 default: Preferences::mDefaultSoundType = SoundPicker::NONE; break;
01096 }
01097 Preferences::mDefaultSoundFile = mSoundFile->text();
01098 #ifndef WITHOUT_ARTS
01099 Preferences::mDefaultSoundRepeat = mSoundRepeat->isChecked();
01100 #endif
01101 Preferences::mDefaultCmdScript = mCmdScript->isChecked();
01102 Preferences::mDefaultCmdLogType = (mCmdXterm->isChecked() ? EditAlarmDlg::EXEC_IN_TERMINAL : EditAlarmDlg::DISCARD_OUTPUT);
01103 Preferences::mDefaultEmailBcc = mEmailBcc->isChecked();
01104 Preferences::mDefaultCopyToKOrganizer = mCopyToKOrganizer->isChecked();
01105 Preferences::mDefaultLateCancel = mLateCancel->isChecked() ? 1 : 0;
01106 switch (mRecurPeriod->currentItem())
01107 {
01108 case 6: Preferences::mDefaultRecurPeriod = RecurrenceEdit::ANNUAL; break;
01109 case 5: Preferences::mDefaultRecurPeriod = RecurrenceEdit::MONTHLY; break;
01110 case 4: Preferences::mDefaultRecurPeriod = RecurrenceEdit::WEEKLY; break;
01111 case 3: Preferences::mDefaultRecurPeriod = RecurrenceEdit::DAILY; break;
01112 case 2: Preferences::mDefaultRecurPeriod = RecurrenceEdit::SUBDAILY; break;
01113 case 1: Preferences::mDefaultRecurPeriod = RecurrenceEdit::AT_LOGIN; break;
01114 case 0:
01115 default: Preferences::mDefaultRecurPeriod = RecurrenceEdit::NO_RECUR; break;
01116 }
01117 int feb29 = mFeb29->selectedId();
01118 Preferences::mDefaultFeb29Type = (feb29 >= 0) ? static_cast<KARecurrence::Feb29Type>(feb29) : Preferences::default_defaultFeb29Type;
01119 PrefsTabBase::apply(syncToDisc);
01120 }
01121
01122 void EditPrefTab::setDefaults()
01123 {
01124 mAutoClose->setChecked(Preferences::default_defaultAutoClose);
01125 mConfirmAck->setChecked(Preferences::default_defaultConfirmAck);
01126 mReminderUnits->setCurrentItem(Preferences::default_defaultReminderUnits);
01127 mSpecialActionsButton->setActions(Preferences::default_defaultPreAction, Preferences::default_defaultPostAction);
01128 mSound->setCurrentItem(soundIndex(Preferences::default_defaultSoundType));
01129 mSoundFile->setText(Preferences::default_defaultSoundFile);
01130 #ifndef WITHOUT_ARTS
01131 mSoundRepeat->setChecked(Preferences::default_defaultSoundRepeat);
01132 #endif
01133 mCmdScript->setChecked(Preferences::default_defaultCmdScript);
01134 mCmdXterm->setChecked(Preferences::default_defaultCmdLogType == EditAlarmDlg::EXEC_IN_TERMINAL);
01135 mEmailBcc->setChecked(Preferences::default_defaultEmailBcc);
01136 mCopyToKOrganizer->setChecked(Preferences::default_defaultCopyToKOrganizer);
01137 mLateCancel->setChecked(Preferences::default_defaultLateCancel);
01138 mRecurPeriod->setCurrentItem(recurIndex(Preferences::default_defaultRecurPeriod));
01139 mFeb29->setButton(Preferences::default_defaultFeb29Type);
01140 }
01141
01142 void EditPrefTab::slotBrowseSoundFile()
01143 {
01144 QString defaultDir;
01145 QString url = SoundPicker::browseFile(defaultDir, mSoundFile->text());
01146 if (!url.isEmpty())
01147 mSoundFile->setText(url);
01148 }
01149
01150 int EditPrefTab::soundIndex(SoundPicker::Type type)
01151 {
01152 switch (type)
01153 {
01154 case SoundPicker::SPEAK: return 3;
01155 case SoundPicker::PLAY_FILE: return 2;
01156 case SoundPicker::BEEP: return 1;
01157 case SoundPicker::NONE:
01158 default: return 0;
01159 }
01160 }
01161
01162 int EditPrefTab::recurIndex(RecurrenceEdit::RepeatType type)
01163 {
01164 switch (type)
01165 {
01166 case RecurrenceEdit::ANNUAL: return 6;
01167 case RecurrenceEdit::MONTHLY: return 5;
01168 case RecurrenceEdit::WEEKLY: return 4;
01169 case RecurrenceEdit::DAILY: return 3;
01170 case RecurrenceEdit::SUBDAILY: return 2;
01171 case RecurrenceEdit::AT_LOGIN: return 1;
01172 case RecurrenceEdit::NO_RECUR:
01173 default: return 0;
01174 }
01175 }
01176
01177 QString EditPrefTab::validate()
01178 {
01179 if (mSound->currentItem() == SoundPicker::PLAY_FILE && mSoundFile->text().isEmpty())
01180 {
01181 mSoundFile->setFocus();
01182 return i18n("You must enter a sound file when %1 is selected as the default sound type").arg(SoundPicker::i18n_File());;
01183 }
01184 return QString::null;
01185 }
01186
01187
01188
01189
01190
01191
01192 ViewPrefTab::ViewPrefTab(QVBox* frame)
01193 : PrefsTabBase(frame)
01194 {
01195 QGroupBox* group = new QGroupBox(i18n("Alarm List"), mPage);
01196 QBoxLayout* layout = new QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint());
01197 layout->addSpacing(fontMetrics().lineSpacing()/2);
01198
01199 mListShowTime = new QCheckBox(MainWindow::i18n_t_ShowAlarmTime(), group, "listTime");
01200 mListShowTime->setMinimumSize(mListShowTime->sizeHint());
01201 connect(mListShowTime, SIGNAL(toggled(bool)), SLOT(slotListTimeToggled(bool)));
01202 QWhatsThis::add(mListShowTime,
01203 i18n("Specify whether to show in the alarm list, the time at which each alarm is due"));
01204 layout->addWidget(mListShowTime, 0, Qt::AlignAuto);
01205
01206 mListShowTimeTo = new QCheckBox(MainWindow::i18n_n_ShowTimeToAlarm(), group, "listTimeTo");
01207 mListShowTimeTo->setMinimumSize(mListShowTimeTo->sizeHint());
01208 connect(mListShowTimeTo, SIGNAL(toggled(bool)), SLOT(slotListTimeToToggled(bool)));
01209 QWhatsThis::add(mListShowTimeTo,
01210 i18n("Specify whether to show in the alarm list, how long until each alarm is due"));
01211 layout->addWidget(mListShowTimeTo, 0, Qt::AlignAuto);
01212 group->setMaximumHeight(group->sizeHint().height());
01213
01214 group = new QGroupBox(i18n("System Tray Tooltip"), mPage);
01215 QGridLayout* grid = new QGridLayout(group, 5, 3, KDialog::marginHint(), KDialog::spacingHint());
01216 grid->setColStretch(2, 1);
01217 grid->addColSpacing(0, indentWidth());
01218 grid->addColSpacing(1, indentWidth());
01219 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2);
01220
01221 mTooltipShowAlarms = new QCheckBox(i18n("Show next &24 hours' alarms"), group, "tooltipShow");
01222 mTooltipShowAlarms->setMinimumSize(mTooltipShowAlarms->sizeHint());
01223 connect(mTooltipShowAlarms, SIGNAL(toggled(bool)), SLOT(slotTooltipAlarmsToggled(bool)));
01224 QWhatsThis::add(mTooltipShowAlarms,
01225 i18n("Specify whether to include in the system tray tooltip, a summary of alarms due in the next 24 hours"));
01226 grid->addMultiCellWidget(mTooltipShowAlarms, 1, 1, 0, 2, Qt::AlignAuto);
01227
01228 QHBox* box = new QHBox(group);
01229 box->setSpacing(KDialog::spacingHint());
01230 mTooltipMaxAlarms = new QCheckBox(i18n("Ma&ximum number of alarms to show:"), box, "tooltipMax");
01231 mTooltipMaxAlarms->setMinimumSize(mTooltipMaxAlarms->sizeHint());
01232 connect(mTooltipMaxAlarms, SIGNAL(toggled(bool)), SLOT(slotTooltipMaxToggled(bool)));
01233 mTooltipMaxAlarmCount = new SpinBox(1, 99, 1, box);
01234 mTooltipMaxAlarmCount->setLineShiftStep(5);
01235 mTooltipMaxAlarmCount->setMinimumSize(mTooltipMaxAlarmCount->sizeHint());
01236 QWhatsThis::add(box,
01237 i18n("Uncheck to display all of the next 24 hours' alarms in the system tray tooltip. "
01238 "Check to enter an upper limit on the number to be displayed."));
01239 grid->addMultiCellWidget(box, 2, 2, 1, 2, Qt::AlignAuto);
01240
01241 mTooltipShowTime = new QCheckBox(MainWindow::i18n_m_ShowAlarmTime(), group, "tooltipTime");
01242 mTooltipShowTime->setMinimumSize(mTooltipShowTime->sizeHint());
01243 connect(mTooltipShowTime, SIGNAL(toggled(bool)), SLOT(slotTooltipTimeToggled(bool)));
01244 QWhatsThis::add(mTooltipShowTime,
01245 i18n("Specify whether to show in the system tray tooltip, the time at which each alarm is due"));
01246 grid->addMultiCellWidget(mTooltipShowTime, 3, 3, 1, 2, Qt::AlignAuto);
01247
01248 mTooltipShowTimeTo = new QCheckBox(MainWindow::i18n_l_ShowTimeToAlarm(), group, "tooltipTimeTo");
01249 mTooltipShowTimeTo->setMinimumSize(mTooltipShowTimeTo->sizeHint());
01250 connect(mTooltipShowTimeTo, SIGNAL(toggled(bool)), SLOT(slotTooltipTimeToToggled(bool)));
01251 QWhatsThis::add(mTooltipShowTimeTo,
01252 i18n("Specify whether to show in the system tray tooltip, how long until each alarm is due"));
01253 grid->addMultiCellWidget(mTooltipShowTimeTo, 4, 4, 1, 2, Qt::AlignAuto);
01254
01255 box = new QHBox(group);
01256 box->setSpacing(KDialog::spacingHint());
01257 mTooltipTimeToPrefixLabel = new QLabel(i18n("&Prefix:"), box);
01258 mTooltipTimeToPrefixLabel->setFixedSize(mTooltipTimeToPrefixLabel->sizeHint());
01259 mTooltipTimeToPrefix = new QLineEdit(box);
01260 mTooltipTimeToPrefixLabel->setBuddy(mTooltipTimeToPrefix);
01261 QWhatsThis::add(box,
01262 i18n("Enter the text to be displayed in front of the time until the alarm, in the system tray tooltip"));
01263 box->setFixedHeight(box->sizeHint().height());
01264 grid->addWidget(box, 5, 2, Qt::AlignAuto);
01265 group->setMaximumHeight(group->sizeHint().height());
01266
01267 mModalMessages = new QCheckBox(i18n("Message &windows have a title bar and take keyboard focus"), mPage, "modalMsg");
01268 mModalMessages->setMinimumSize(mModalMessages->sizeHint());
01269 QWhatsThis::add(mModalMessages,
01270 i18n("Specify the characteristics of alarm message windows:\n"
01271 "- If checked, the window is a normal window with a title bar, which grabs keyboard input when it is displayed.\n"
01272 "- If unchecked, the window does not interfere with your typing when "
01273 "it is displayed, but it has no title bar and cannot be moved or resized."));
01274
01275 mShowExpiredAlarms = new QCheckBox(MainWindow::i18n_e_ShowExpiredAlarms(), mPage, "showExpired");
01276 mShowExpiredAlarms->setMinimumSize(mShowExpiredAlarms->sizeHint());
01277 QWhatsThis::add(mShowExpiredAlarms,
01278 i18n("Specify whether to show expired alarms in the alarm list"));
01279
01280 QHBox* itemBox = new QHBox(mPage);
01281 box = new QHBox(itemBox);
01282 box->setSpacing(KDialog::spacingHint());
01283 QLabel* label = new QLabel(i18n("System tray icon &update interval:"), box);
01284 mDaemonTrayCheckInterval = new SpinBox(1, 9999, 1, box, "daemonCheck");
01285 mDaemonTrayCheckInterval->setLineShiftStep(10);
01286 mDaemonTrayCheckInterval->setMinimumSize(mDaemonTrayCheckInterval->sizeHint());
01287 label->setBuddy(mDaemonTrayCheckInterval);
01288 label = new QLabel(i18n("seconds"), box);
01289 QWhatsThis::add(box,
01290 i18n("How often to update the system tray icon to indicate whether or not the Alarm Daemon is monitoring alarms."));
01291 itemBox->setStretchFactor(new QWidget(itemBox), 1);
01292 itemBox->setFixedHeight(box->sizeHint().height());
01293
01294 mPage->setStretchFactor(new QWidget(mPage), 1);
01295 }
01296
01297 void ViewPrefTab::restore()
01298 {
01299 setList(Preferences::mShowAlarmTime,
01300 Preferences::mShowTimeToAlarm);
01301 setTooltip(Preferences::mTooltipAlarmCount,
01302 Preferences::mShowTooltipAlarmTime,
01303 Preferences::mShowTooltipTimeToAlarm,
01304 Preferences::mTooltipTimeToPrefix);
01305 mModalMessages->setChecked(Preferences::mModalMessages);
01306 mShowExpiredAlarms->setChecked(Preferences::mShowExpiredAlarms);
01307 mDaemonTrayCheckInterval->setValue(Preferences::mDaemonTrayCheckInterval);
01308 }
01309
01310 void ViewPrefTab::apply(bool syncToDisc)
01311 {
01312 Preferences::mShowAlarmTime = mListShowTime->isChecked();
01313 Preferences::mShowTimeToAlarm = mListShowTimeTo->isChecked();
01314 int n = mTooltipShowAlarms->isChecked() ? -1 : 0;
01315 if (n && mTooltipMaxAlarms->isChecked())
01316 n = mTooltipMaxAlarmCount->value();
01317 Preferences::mTooltipAlarmCount = n;
01318 Preferences::mShowTooltipAlarmTime = mTooltipShowTime->isChecked();
01319 Preferences::mShowTooltipTimeToAlarm = mTooltipShowTimeTo->isChecked();
01320 Preferences::mTooltipTimeToPrefix = mTooltipTimeToPrefix->text();
01321 Preferences::mModalMessages = mModalMessages->isChecked();
01322 Preferences::mShowExpiredAlarms = mShowExpiredAlarms->isChecked();
01323 Preferences::mDaemonTrayCheckInterval = mDaemonTrayCheckInterval->value();
01324 PrefsTabBase::apply(syncToDisc);
01325 }
01326
01327 void ViewPrefTab::setDefaults()
01328 {
01329 setList(Preferences::default_showAlarmTime,
01330 Preferences::default_showTimeToAlarm);
01331 setTooltip(Preferences::default_tooltipAlarmCount,
01332 Preferences::default_showTooltipAlarmTime,
01333 Preferences::default_showTooltipTimeToAlarm,
01334 Preferences::default_tooltipTimeToPrefix);
01335 mModalMessages->setChecked(Preferences::default_modalMessages);
01336 mShowExpiredAlarms->setChecked(Preferences::default_showExpiredAlarms);
01337 mDaemonTrayCheckInterval->setValue(Preferences::default_daemonTrayCheckInterval);
01338 }
01339
01340 void ViewPrefTab::setList(bool time, bool timeTo)
01341 {
01342 if (!timeTo)
01343 time = true;
01344
01345
01346
01347 mListShowTime->blockSignals(true);
01348 mListShowTimeTo->blockSignals(true);
01349
01350 mListShowTime->setChecked(time);
01351 mListShowTimeTo->setChecked(timeTo);
01352
01353 mListShowTime->blockSignals(false);
01354 mListShowTimeTo->blockSignals(false);
01355 }
01356
01357 void ViewPrefTab::setTooltip(int maxAlarms, bool time, bool timeTo, const QString& prefix)
01358 {
01359 if (!timeTo)
01360 time = true;
01361
01362
01363
01364 mTooltipShowAlarms->blockSignals(true);
01365 mTooltipShowTime->blockSignals(true);
01366 mTooltipShowTimeTo->blockSignals(true);
01367
01368 mTooltipShowAlarms->setChecked(maxAlarms);
01369 mTooltipMaxAlarms->setChecked(maxAlarms > 0);
01370 mTooltipMaxAlarmCount->setValue(maxAlarms > 0 ? maxAlarms : 1);
01371 mTooltipShowTime->setChecked(time);
01372 mTooltipShowTimeTo->setChecked(timeTo);
01373 mTooltipTimeToPrefix->setText(prefix);
01374
01375 mTooltipShowAlarms->blockSignals(false);
01376 mTooltipShowTime->blockSignals(false);
01377 mTooltipShowTimeTo->blockSignals(false);
01378
01379
01380 slotTooltipTimeToToggled(timeTo);
01381 slotTooltipAlarmsToggled(maxAlarms);
01382 }
01383
01384 void ViewPrefTab::slotListTimeToggled(bool on)
01385 {
01386 if (!on && !mListShowTimeTo->isChecked())
01387 mListShowTimeTo->setChecked(true);
01388 }
01389
01390 void ViewPrefTab::slotListTimeToToggled(bool on)
01391 {
01392 if (!on && !mListShowTime->isChecked())
01393 mListShowTime->setChecked(true);
01394 }
01395
01396 void ViewPrefTab::slotTooltipAlarmsToggled(bool on)
01397 {
01398 mTooltipMaxAlarms->setEnabled(on);
01399 mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isChecked());
01400 mTooltipShowTime->setEnabled(on);
01401 mTooltipShowTimeTo->setEnabled(on);
01402 on = on && mTooltipShowTimeTo->isChecked();
01403 mTooltipTimeToPrefix->setEnabled(on);
01404 mTooltipTimeToPrefixLabel->setEnabled(on);
01405 }
01406
01407 void ViewPrefTab::slotTooltipMaxToggled(bool on)
01408 {
01409 mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isEnabled());
01410 }
01411
01412 void ViewPrefTab::slotTooltipTimeToggled(bool on)
01413 {
01414 if (!on && !mTooltipShowTimeTo->isChecked())
01415 mTooltipShowTimeTo->setChecked(true);
01416 }
01417
01418 void ViewPrefTab::slotTooltipTimeToToggled(bool on)
01419 {
01420 if (!on && !mTooltipShowTime->isChecked())
01421 mTooltipShowTime->setChecked(true);
01422 on = on && mTooltipShowTimeTo->isEnabled();
01423 mTooltipTimeToPrefix->setEnabled(on);
01424 mTooltipTimeToPrefixLabel->setEnabled(on);
01425 }