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 added to KMail's outbox if KMail is running. If not, "
00606 "a KMail composer window is displayed to enable you to send the email.\n"
00607 "Sendmail: The email is sent automatically. This option will only work if "
00608 "your system is configured to use 'sendmail' or a sendmail compatible mail transport agent."));
00609
00610 box = new QHBox(mPage);
00611 mEmailCopyToKMail = new QCheckBox(i18n("Co&py sent emails into KMail's %1 folder").arg(KAMail::i18n_sent_mail()), box);
00612 mEmailCopyToKMail->setFixedSize(mEmailCopyToKMail->sizeHint());
00613 QWhatsThis::add(mEmailCopyToKMail,
00614 i18n("After sending an email, store a copy in KMail's %1 folder").arg(KAMail::i18n_sent_mail()));
00615 box->setStretchFactor(new QWidget(box), 1);
00616 box->setFixedHeight(box->sizeHint().height());
00617
00618
00619 QGroupBox* group = new QGroupBox(i18n("Your Email Address"), mPage);
00620 QGridLayout* grid = new QGridLayout(group, 6, 3, KDialog::marginHint(), KDialog::spacingHint());
00621 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2);
00622 grid->setColStretch(1, 1);
00623
00624
00625 label = new Label(EditAlarmDlg::i18n_f_EmailFrom(), group);
00626 label->setFixedSize(label->sizeHint());
00627 grid->addWidget(label, 1, 0);
00628 mFromAddressGroup = new ButtonGroup(group);
00629 mFromAddressGroup->hide();
00630 connect(mFromAddressGroup, SIGNAL(buttonSet(int)), SLOT(slotFromAddrChanged(int)));
00631
00632
00633 radio = new RadioButton(group);
00634 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_ADDR);
00635 radio->setFixedSize(radio->sizeHint());
00636 label->setBuddy(radio);
00637 grid->addWidget(radio, 1, 1);
00638 mEmailAddress = new QLineEdit(group);
00639 connect(mEmailAddress, SIGNAL(textChanged(const QString&)), SLOT(slotAddressChanged()));
00640 QString whatsThis = i18n("Your email address, used to identify you as the sender when sending email alarms.");
00641 QWhatsThis::add(radio, whatsThis);
00642 QWhatsThis::add(mEmailAddress, whatsThis);
00643 radio->setFocusWidget(mEmailAddress);
00644 grid->addWidget(mEmailAddress, 1, 2);
00645
00646
00647 radio = new RadioButton(i18n("&Use address from Control Center"), group);
00648 radio->setFixedSize(radio->sizeHint());
00649 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_CONTROL_CENTRE);
00650 QWhatsThis::add(radio,
00651 i18n("Check to use the email address set in the KDE Control Center, to identify you as the sender when sending email alarms."));
00652 grid->addMultiCellWidget(radio, 2, 2, 1, 2, Qt::AlignAuto);
00653
00654
00655 radio = new RadioButton(i18n("Use KMail &identities"), group);
00656 radio->setFixedSize(radio->sizeHint());
00657 mFromAddressGroup->insert(radio, Preferences::MAIL_FROM_KMAIL);
00658 QWhatsThis::add(radio,
00659 i18n("Check to use KMail's email identities to identify you as the sender when sending email alarms. "
00660 "For existing email alarms, KMail's default identity will be used. "
00661 "For new email alarms, you will be able to pick which of KMail's identities to use."));
00662 grid->addMultiCellWidget(radio, 3, 3, 1, 2, Qt::AlignAuto);
00663
00664
00665 grid->addRowSpacing(4, KDialog::spacingHint());
00666 label = new Label(i18n("'Bcc' email address", "&Bcc:"), group);
00667 label->setFixedSize(label->sizeHint());
00668 grid->addWidget(label, 5, 0);
00669 mBccAddressGroup = new ButtonGroup(group);
00670 mBccAddressGroup->hide();
00671 connect(mBccAddressGroup, SIGNAL(buttonSet(int)), SLOT(slotBccAddrChanged(int)));
00672
00673
00674 radio = new RadioButton(group);
00675 radio->setFixedSize(radio->sizeHint());
00676 mBccAddressGroup->insert(radio, Preferences::MAIL_FROM_ADDR);
00677 label->setBuddy(radio);
00678 grid->addWidget(radio, 5, 1);
00679 mEmailBccAddress = new QLineEdit(group);
00680 whatsThis = i18n("Your email address, used for blind copying email alarms to yourself. "
00681 "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.");
00682 QWhatsThis::add(radio, whatsThis);
00683 QWhatsThis::add(mEmailBccAddress, whatsThis);
00684 radio->setFocusWidget(mEmailBccAddress);
00685 grid->addWidget(mEmailBccAddress, 5, 2);
00686
00687
00688 radio = new RadioButton(i18n("Us&e address from Control Center"), group);
00689 radio->setFixedSize(radio->sizeHint());
00690 mBccAddressGroup->insert(radio, Preferences::MAIL_FROM_CONTROL_CENTRE);
00691 QWhatsThis::add(radio,
00692 i18n("Check to use the email address set in the KDE Control Center, for blind copying email alarms to yourself."));
00693 grid->addMultiCellWidget(radio, 6, 6, 1, 2, Qt::AlignAuto);
00694
00695 group->setFixedHeight(group->sizeHint().height());
00696
00697 box = new QHBox(mPage);
00698 mEmailQueuedNotify = new QCheckBox(i18n("&Notify when remote emails are queued"), box);
00699 mEmailQueuedNotify->setFixedSize(mEmailQueuedNotify->sizeHint());
00700 QWhatsThis::add(mEmailQueuedNotify,
00701 i18n("Display a notification message whenever an email alarm has queued an email for sending to a remote system. "
00702 "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."));
00703 box->setStretchFactor(new QWidget(box), 1);
00704 box->setFixedHeight(box->sizeHint().height());
00705
00706 mPage->setStretchFactor(new QWidget(mPage), 1);
00707 }
00708
00709 void EmailPrefTab::restore()
00710 {
00711 mEmailClient->setButton(Preferences::mEmailClient);
00712 mEmailCopyToKMail->setChecked(Preferences::emailCopyToKMail());
00713 setEmailAddress(Preferences::mEmailFrom, Preferences::mEmailAddress);
00714 setEmailBccAddress((Preferences::mEmailBccFrom == Preferences::MAIL_FROM_CONTROL_CENTRE), Preferences::mEmailBccAddress);
00715 mEmailQueuedNotify->setChecked(Preferences::emailQueuedNotify());
00716 mAddressChanged = mBccAddressChanged = false;
00717 }
00718
00719 void EmailPrefTab::apply(bool syncToDisc)
00720 {
00721 int client = mEmailClient->id(mEmailClient->selected());
00722 Preferences::mEmailClient = (client >= 0) ? Preferences::MailClient(client) : Preferences::default_emailClient;
00723 Preferences::mEmailCopyToKMail = mEmailCopyToKMail->isChecked();
00724 Preferences::setEmailAddress(static_cast<Preferences::MailFrom>(mFromAddressGroup->selectedId()), mEmailAddress->text().stripWhiteSpace());
00725 Preferences::setEmailBccAddress((mBccAddressGroup->selectedId() == Preferences::MAIL_FROM_CONTROL_CENTRE), mEmailBccAddress->text().stripWhiteSpace());
00726 Preferences::setEmailQueuedNotify(mEmailQueuedNotify->isChecked());
00727 PrefsTabBase::apply(syncToDisc);
00728 }
00729
00730 void EmailPrefTab::setDefaults()
00731 {
00732 mEmailClient->setButton(Preferences::default_emailClient);
00733 setEmailAddress(Preferences::default_emailFrom(), Preferences::default_emailAddress);
00734 setEmailBccAddress((Preferences::default_emailBccFrom == Preferences::MAIL_FROM_CONTROL_CENTRE), Preferences::default_emailBccAddress);
00735 mEmailQueuedNotify->setChecked(Preferences::default_emailQueuedNotify);
00736 }
00737
00738 void EmailPrefTab::setEmailAddress(Preferences::MailFrom from, const QString& address)
00739 {
00740 mFromAddressGroup->setButton(from);
00741 mEmailAddress->setText(from == Preferences::MAIL_FROM_ADDR ? address.stripWhiteSpace() : QString());
00742 }
00743
00744 void EmailPrefTab::setEmailBccAddress(bool useControlCentre, const QString& address)
00745 {
00746 mBccAddressGroup->setButton(useControlCentre ? Preferences::MAIL_FROM_CONTROL_CENTRE : Preferences::MAIL_FROM_ADDR);
00747 mEmailBccAddress->setText(useControlCentre ? QString() : address.stripWhiteSpace());
00748 }
00749
00750 void EmailPrefTab::slotEmailClientChanged(int id)
00751 {
00752 mEmailCopyToKMail->setEnabled(id == Preferences::SENDMAIL);
00753 }
00754
00755 void EmailPrefTab::slotFromAddrChanged(int id)
00756 {
00757 mEmailAddress->setEnabled(id == Preferences::MAIL_FROM_ADDR);
00758 mAddressChanged = true;
00759 }
00760
00761 void EmailPrefTab::slotBccAddrChanged(int id)
00762 {
00763 mEmailBccAddress->setEnabled(id == Preferences::MAIL_FROM_ADDR);
00764 mBccAddressChanged = true;
00765 }
00766
00767 QString EmailPrefTab::validate()
00768 {
00769 if (mAddressChanged)
00770 {
00771 mAddressChanged = false;
00772 QString errmsg = validateAddr(mFromAddressGroup, mEmailAddress, KAMail::i18n_NeedFromEmailAddress());
00773 if (!errmsg.isEmpty())
00774 return errmsg;
00775 }
00776 if (mBccAddressChanged)
00777 {
00778 mBccAddressChanged = false;
00779 return validateAddr(mBccAddressGroup, mEmailBccAddress, i18n("No valid 'Bcc' email address is specified."));
00780 }
00781 return QString::null;
00782 }
00783
00784 QString EmailPrefTab::validateAddr(ButtonGroup* group, QLineEdit* addr, const QString& msg)
00785 {
00786 QString errmsg = i18n("%1\nAre you sure you want to save your changes?").arg(msg);
00787 switch (group->selectedId())
00788 {
00789 case Preferences::MAIL_FROM_CONTROL_CENTRE:
00790 if (!KAMail::controlCentreAddress().isEmpty())
00791 return QString::null;
00792 errmsg = i18n("No email address is currently set in the KDE Control Center. %1").arg(errmsg);
00793 break;
00794 case Preferences::MAIL_FROM_KMAIL:
00795 if (KAMail::identitiesExist())
00796 return QString::null;
00797 errmsg = i18n("No KMail identities currently exist. %1").arg(errmsg);
00798 break;
00799 case Preferences::MAIL_FROM_ADDR:
00800 if (!addr->text().stripWhiteSpace().isEmpty())
00801 return QString::null;
00802 break;
00803 }
00804 return errmsg;
00805 }
00806
00807
00808
00809
00810
00811
00812 FontColourPrefTab::FontColourPrefTab(QVBox* frame)
00813 : PrefsTabBase(frame)
00814 {
00815 mFontChooser = new FontColourChooser(mPage, 0, false, QStringList(), i18n("Message Font && Color"), true, false);
00816
00817 QHBox* layoutBox = new QHBox(mPage);
00818 QHBox* box = new QHBox(layoutBox);
00819 box->setSpacing(KDialog::spacingHint());
00820 QLabel* label1 = new QLabel(i18n("Di&sabled alarm color:"), box);
00821
00822 box->setStretchFactor(new QWidget(box), 1);
00823 mDisabledColour = new KColorCombo(box);
00824 mDisabledColour->setMinimumSize(mDisabledColour->sizeHint());
00825 label1->setBuddy(mDisabledColour);
00826 QWhatsThis::add(box,
00827 i18n("Choose the text color in the alarm list for disabled alarms."));
00828 layoutBox->setStretchFactor(new QWidget(layoutBox), 1);
00829 layoutBox->setFixedHeight(layoutBox->sizeHint().height());
00830
00831 layoutBox = new QHBox(mPage);
00832 box = new QHBox(layoutBox);
00833 box->setSpacing(KDialog::spacingHint());
00834 QLabel* label2 = new QLabel(i18n("E&xpired alarm color:"), box);
00835
00836 box->setStretchFactor(new QWidget(box), 1);
00837 mExpiredColour = new KColorCombo(box);
00838 mExpiredColour->setMinimumSize(mExpiredColour->sizeHint());
00839 label2->setBuddy(mExpiredColour);
00840 QWhatsThis::add(box,
00841 i18n("Choose the text color in the alarm list for expired alarms."));
00842 layoutBox->setStretchFactor(new QWidget(layoutBox), 1);
00843 layoutBox->setFixedHeight(layoutBox->sizeHint().height());
00844
00845
00846 QSize size = label1->sizeHint();
00847 QSize size2 = label2->sizeHint();
00848 if (size2.width() > size.width())
00849 size.setWidth(size2.width());
00850 label1->setFixedSize(size);
00851 label2->setFixedSize(size);
00852
00853 mPage->setStretchFactor(new QWidget(mPage), 1);
00854 }
00855
00856 void FontColourPrefTab::restore()
00857 {
00858 mFontChooser->setBgColour(Preferences::mDefaultBgColour);
00859 mFontChooser->setColours(Preferences::mMessageColours);
00860 mFontChooser->setFont(Preferences::mMessageFont);
00861 mDisabledColour->setColor(Preferences::mDisabledColour);
00862 mExpiredColour->setColor(Preferences::mExpiredColour);
00863 }
00864
00865 void FontColourPrefTab::apply(bool syncToDisc)
00866 {
00867 Preferences::mDefaultBgColour = mFontChooser->bgColour();
00868 Preferences::mMessageColours = mFontChooser->colours();
00869 Preferences::mMessageFont = mFontChooser->font();
00870 Preferences::mDisabledColour = mDisabledColour->color();
00871 Preferences::mExpiredColour = mExpiredColour->color();
00872 PrefsTabBase::apply(syncToDisc);
00873 }
00874
00875 void FontColourPrefTab::setDefaults()
00876 {
00877 mFontChooser->setBgColour(Preferences::default_defaultBgColour);
00878 mFontChooser->setColours(Preferences::default_messageColours);
00879 mFontChooser->setFont(Preferences::default_messageFont());
00880 mDisabledColour->setColor(Preferences::default_disabledColour);
00881 mExpiredColour->setColor(Preferences::default_expiredColour);
00882 }
00883
00884
00885
00886
00887
00888
00889 EditPrefTab::EditPrefTab(QVBox* frame)
00890 : PrefsTabBase(frame)
00891 {
00892
00893
00894 int alignment = QApplication::reverseLayout() ? Qt::AlignRight : Qt::AlignLeft;
00895
00896 int groupTopMargin = fontMetrics().lineSpacing()/2;
00897 QString defsetting = i18n("The default setting for \"%1\" in the alarm edit dialog.");
00898 QString soundSetting = i18n("Check to select %1 as the default setting for \"%2\" in the alarm edit dialog.");
00899
00900
00901 QGroupBox* group = new QGroupBox(i18n("Display Alarms"), mPage);
00902 QBoxLayout* layout = new QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint());
00903 layout->addSpacing(groupTopMargin);
00904
00905 mConfirmAck = new QCheckBox(EditAlarmDlg::i18n_k_ConfirmAck(), group, "defConfAck");
00906 mConfirmAck->setMinimumSize(mConfirmAck->sizeHint());
00907 QWhatsThis::add(mConfirmAck, defsetting.arg(EditAlarmDlg::i18n_ConfirmAck()));
00908 layout->addWidget(mConfirmAck, 0, Qt::AlignAuto);
00909
00910 mAutoClose = new QCheckBox(LateCancelSelector::i18n_i_AutoCloseWinLC(), group, "defAutoClose");
00911 mAutoClose->setMinimumSize(mAutoClose->sizeHint());
00912 QWhatsThis::add(mAutoClose, defsetting.arg(LateCancelSelector::i18n_AutoCloseWin()));
00913 layout->addWidget(mAutoClose, 0, Qt::AlignAuto);
00914
00915 QHBox* box = new QHBox(group);
00916 box->setSpacing(KDialog::spacingHint());
00917 layout->addWidget(box);
00918 QLabel* label = new QLabel(i18n("Reminder &units:"), box);
00919 label->setFixedSize(label->sizeHint());
00920 mReminderUnits = new QComboBox(box, "defWarnUnits");
00921 mReminderUnits->insertItem(TimePeriod::i18n_Hours_Mins(), TimePeriod::HOURS_MINUTES);
00922 mReminderUnits->insertItem(TimePeriod::i18n_Days(), TimePeriod::DAYS);
00923 mReminderUnits->insertItem(TimePeriod::i18n_Weeks(), TimePeriod::WEEKS);
00924 mReminderUnits->setFixedSize(mReminderUnits->sizeHint());
00925 label->setBuddy(mReminderUnits);
00926 QWhatsThis::add(box,
00927 i18n("The default units for the reminder in the alarm edit dialog."));
00928 box->setStretchFactor(new QWidget(box), 1);
00929
00930 mSpecialActionsButton = new SpecialActionsButton(EditAlarmDlg::i18n_SpecialActions(), box);
00931 mSpecialActionsButton->setFixedSize(mSpecialActionsButton->sizeHint());
00932
00933
00934 QButtonGroup* bgroup = new QButtonGroup(SoundPicker::i18n_Sound(), mPage, "soundGroup");
00935 layout = new QVBoxLayout(bgroup, KDialog::marginHint(), KDialog::spacingHint());
00936 layout->addSpacing(groupTopMargin);
00937
00938 QBoxLayout* hlayout = new QHBoxLayout(layout, KDialog::spacingHint());
00939 mSound = new QComboBox(false, bgroup, "defSound");
00940 mSound->insertItem(SoundPicker::i18n_None());
00941 mSound->insertItem(SoundPicker::i18n_Beep());
00942 mSound->insertItem(SoundPicker::i18n_File());
00943 if (theApp()->speechEnabled())
00944 mSound->insertItem(SoundPicker::i18n_Speak());
00945 mSound->setMinimumSize(mSound->sizeHint());
00946 QWhatsThis::add(mSound, defsetting.arg(SoundPicker::i18n_Sound()));
00947 hlayout->addWidget(mSound);
00948 hlayout->addStretch(1);
00949
00950 #ifndef WITHOUT_ARTS
00951 mSoundRepeat = new QCheckBox(i18n("Repea&t sound file"), bgroup, "defRepeatSound");
00952 mSoundRepeat->setMinimumSize(mSoundRepeat->sizeHint());
00953 QWhatsThis::add(mSoundRepeat, i18n("sound file \"Repeat\" checkbox", "The default setting for sound file \"%1\" in the alarm edit dialog.").arg(SoundDlg::i18n_Repeat()));
00954 hlayout->addWidget(mSoundRepeat);
00955 #endif
00956
00957 box = new QHBox(bgroup);
00958 box->setSpacing(KDialog::spacingHint());
00959 mSoundFileLabel = new QLabel(i18n("Sound &file:"), box);
00960 mSoundFileLabel->setFixedSize(mSoundFileLabel->sizeHint());
00961 mSoundFile = new QLineEdit(box);
00962 mSoundFileLabel->setBuddy(mSoundFile);
00963 mSoundFileBrowse = new QPushButton(box);
00964 mSoundFileBrowse->setPixmap(SmallIcon("fileopen"));
00965 mSoundFileBrowse->setFixedSize(mSoundFileBrowse->sizeHint());
00966 connect(mSoundFileBrowse, SIGNAL(clicked()), SLOT(slotBrowseSoundFile()));
00967 QToolTip::add(mSoundFileBrowse, i18n("Choose a sound file"));
00968 QWhatsThis::add(box,
00969 i18n("Enter the default sound file to use in the alarm edit dialog."));
00970 box->setFixedHeight(box->sizeHint().height());
00971 layout->addWidget(box);
00972 bgroup->setFixedHeight(bgroup->sizeHint().height());
00973
00974
00975 group = new QGroupBox(i18n("Command Alarms"), mPage);
00976 layout = new QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint());
00977 layout->addSpacing(groupTopMargin);
00978 layout = new QHBoxLayout(layout, KDialog::spacingHint());
00979
00980 mCmdScript = new QCheckBox(EditAlarmDlg::i18n_p_EnterScript(), group, "defCmdScript");
00981 mCmdScript->setMinimumSize(mCmdScript->sizeHint());
00982 QWhatsThis::add(mCmdScript, defsetting.arg(EditAlarmDlg::i18n_EnterScript()));
00983 layout->addWidget(mCmdScript);
00984 layout->addStretch();
00985
00986 mCmdXterm = new QCheckBox(EditAlarmDlg::i18n_w_ExecInTermWindow(), group, "defCmdXterm");
00987 mCmdXterm->setMinimumSize(mCmdXterm->sizeHint());
00988 QWhatsThis::add(mCmdXterm, defsetting.arg(EditAlarmDlg::i18n_ExecInTermWindow()));
00989 layout->addWidget(mCmdXterm);
00990
00991
00992 group = new QGroupBox(i18n("Email Alarms"), mPage);
00993 layout = new QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint());
00994 layout->addSpacing(groupTopMargin);
00995
00996
00997 mEmailBcc = new QCheckBox(EditAlarmDlg::i18n_e_CopyEmailToSelf(), group, "defEmailBcc");
00998 mEmailBcc->setMinimumSize(mEmailBcc->sizeHint());
00999 QWhatsThis::add(mEmailBcc, defsetting.arg(EditAlarmDlg::i18n_CopyEmailToSelf()));
01000 layout->addWidget(mEmailBcc, 0, Qt::AlignAuto);
01001
01002
01003
01004 mCopyToKOrganizer = new QCheckBox(EditAlarmDlg::i18n_g_ShowInKOrganizer(), mPage, "defShowKorg");
01005 mCopyToKOrganizer->setMinimumSize(mCopyToKOrganizer->sizeHint());
01006 QWhatsThis::add(mCopyToKOrganizer, defsetting.arg(EditAlarmDlg::i18n_ShowInKOrganizer()));
01007
01008
01009 box = new QHBox(mPage);
01010 box->setSpacing(KDialog::spacingHint());
01011 mLateCancel = new QCheckBox(LateCancelSelector::i18n_n_CancelIfLate(), box, "defCancelLate");
01012 mLateCancel->setMinimumSize(mLateCancel->sizeHint());
01013 QWhatsThis::add(mLateCancel, defsetting.arg(LateCancelSelector::i18n_CancelIfLate()));
01014 box->setStretchFactor(new QWidget(box), 1);
01015
01016
01017 QHBox* itemBox = new QHBox(box);
01018 itemBox->setSpacing(KDialog::spacingHint());
01019 label = new QLabel(i18n("&Recurrence:"), itemBox);
01020 label->setFixedSize(label->sizeHint());
01021 mRecurPeriod = new QComboBox(itemBox, "defRecur");
01022 mRecurPeriod->insertItem(RecurrenceEdit::i18n_NoRecur());
01023 mRecurPeriod->insertItem(RecurrenceEdit::i18n_AtLogin());
01024 mRecurPeriod->insertItem(RecurrenceEdit::i18n_HourlyMinutely());
01025 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Daily());
01026 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Weekly());
01027 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Monthly());
01028 mRecurPeriod->insertItem(RecurrenceEdit::i18n_Yearly());
01029 mRecurPeriod->setFixedSize(mRecurPeriod->sizeHint());
01030 label->setBuddy(mRecurPeriod);
01031 QWhatsThis::add(itemBox,
01032 i18n("The default setting for the recurrence rule in the alarm edit dialog."));
01033 box->setFixedHeight(itemBox->sizeHint().height());
01034
01035
01036 QVBox* vbox = new QVBox(mPage);
01037 vbox->setSpacing(KDialog::spacingHint());
01038 label = new QLabel(i18n("In non-leap years, repeat yearly February 29th alarms on:"), vbox);
01039 label->setAlignment(alignment | Qt::WordBreak);
01040 itemBox = new QHBox(vbox);
01041 itemBox->setSpacing(2*KDialog::spacingHint());
01042 mFeb29 = new QButtonGroup(itemBox);
01043 mFeb29->hide();
01044 QWidget* widget = new QWidget(itemBox);
01045 widget->setFixedWidth(3*KDialog::spacingHint());
01046 QRadioButton* radio = new QRadioButton(i18n("February 2&8th"), itemBox);
01047 radio->setMinimumSize(radio->sizeHint());
01048 mFeb29->insert(radio, KARecurrence::FEB29_FEB28);
01049 radio = new QRadioButton(i18n("March &1st"), itemBox);
01050 radio->setMinimumSize(radio->sizeHint());
01051 mFeb29->insert(radio, KARecurrence::FEB29_MAR1);
01052 radio = new QRadioButton(i18n("Do ¬ repeat"), itemBox);
01053 radio->setMinimumSize(radio->sizeHint());
01054 mFeb29->insert(radio, KARecurrence::FEB29_FEB29);
01055 itemBox->setFixedHeight(itemBox->sizeHint().height());
01056 QWhatsThis::add(vbox,
01057 i18n("For yearly recurrences, choose what date, if any, alarms due on February 29th should occur in non-leap years.\n"
01058 "Note that the next scheduled occurrence of existing alarms is not re-evaluated when you change this setting."));
01059
01060 mPage->setStretchFactor(new QWidget(mPage), 1);
01061 }
01062
01063 void EditPrefTab::restore()
01064 {
01065 mAutoClose->setChecked(Preferences::mDefaultAutoClose);
01066 mConfirmAck->setChecked(Preferences::mDefaultConfirmAck);
01067 mReminderUnits->setCurrentItem(Preferences::mDefaultReminderUnits);
01068 mSpecialActionsButton->setActions(Preferences::mDefaultPreAction, Preferences::mDefaultPostAction);
01069 mSound->setCurrentItem(soundIndex(Preferences::mDefaultSoundType));
01070 mSoundFile->setText(Preferences::mDefaultSoundFile);
01071 #ifndef WITHOUT_ARTS
01072 mSoundRepeat->setChecked(Preferences::mDefaultSoundRepeat);
01073 #endif
01074 mCmdScript->setChecked(Preferences::mDefaultCmdScript);
01075 mCmdXterm->setChecked(Preferences::mDefaultCmdLogType == EditAlarmDlg::EXEC_IN_TERMINAL);
01076 mEmailBcc->setChecked(Preferences::mDefaultEmailBcc);
01077 mCopyToKOrganizer->setChecked(Preferences::mDefaultCopyToKOrganizer);
01078 mLateCancel->setChecked(Preferences::mDefaultLateCancel);
01079 mRecurPeriod->setCurrentItem(recurIndex(Preferences::mDefaultRecurPeriod));
01080 mFeb29->setButton(Preferences::mDefaultFeb29Type);
01081 }
01082
01083 void EditPrefTab::apply(bool syncToDisc)
01084 {
01085 Preferences::mDefaultAutoClose = mAutoClose->isChecked();
01086 Preferences::mDefaultConfirmAck = mConfirmAck->isChecked();
01087 Preferences::mDefaultReminderUnits = static_cast<TimePeriod::Units>(mReminderUnits->currentItem());
01088 Preferences::mDefaultPreAction = mSpecialActionsButton->preAction();
01089 Preferences::mDefaultPostAction = mSpecialActionsButton->postAction();
01090 switch (mSound->currentItem())
01091 {
01092 case 3: Preferences::mDefaultSoundType = SoundPicker::SPEAK; break;
01093 case 2: Preferences::mDefaultSoundType = SoundPicker::PLAY_FILE; break;
01094 case 1: Preferences::mDefaultSoundType = SoundPicker::BEEP; break;
01095 case 0:
01096 default: Preferences::mDefaultSoundType = SoundPicker::NONE; break;
01097 }
01098 Preferences::mDefaultSoundFile = mSoundFile->text();
01099 #ifndef WITHOUT_ARTS
01100 Preferences::mDefaultSoundRepeat = mSoundRepeat->isChecked();
01101 #endif
01102 Preferences::mDefaultCmdScript = mCmdScript->isChecked();
01103 Preferences::mDefaultCmdLogType = (mCmdXterm->isChecked() ? EditAlarmDlg::EXEC_IN_TERMINAL : EditAlarmDlg::DISCARD_OUTPUT);
01104 Preferences::mDefaultEmailBcc = mEmailBcc->isChecked();
01105 Preferences::mDefaultCopyToKOrganizer = mCopyToKOrganizer->isChecked();
01106 Preferences::mDefaultLateCancel = mLateCancel->isChecked() ? 1 : 0;
01107 switch (mRecurPeriod->currentItem())
01108 {
01109 case 6: Preferences::mDefaultRecurPeriod = RecurrenceEdit::ANNUAL; break;
01110 case 5: Preferences::mDefaultRecurPeriod = RecurrenceEdit::MONTHLY; break;
01111 case 4: Preferences::mDefaultRecurPeriod = RecurrenceEdit::WEEKLY; break;
01112 case 3: Preferences::mDefaultRecurPeriod = RecurrenceEdit::DAILY; break;
01113 case 2: Preferences::mDefaultRecurPeriod = RecurrenceEdit::SUBDAILY; break;
01114 case 1: Preferences::mDefaultRecurPeriod = RecurrenceEdit::AT_LOGIN; break;
01115 case 0:
01116 default: Preferences::mDefaultRecurPeriod = RecurrenceEdit::NO_RECUR; break;
01117 }
01118 int feb29 = mFeb29->selectedId();
01119 Preferences::mDefaultFeb29Type = (feb29 >= 0) ? static_cast<KARecurrence::Feb29Type>(feb29) : Preferences::default_defaultFeb29Type;
01120 PrefsTabBase::apply(syncToDisc);
01121 }
01122
01123 void EditPrefTab::setDefaults()
01124 {
01125 mAutoClose->setChecked(Preferences::default_defaultAutoClose);
01126 mConfirmAck->setChecked(Preferences::default_defaultConfirmAck);
01127 mReminderUnits->setCurrentItem(Preferences::default_defaultReminderUnits);
01128 mSpecialActionsButton->setActions(Preferences::default_defaultPreAction, Preferences::default_defaultPostAction);
01129 mSound->setCurrentItem(soundIndex(Preferences::default_defaultSoundType));
01130 mSoundFile->setText(Preferences::default_defaultSoundFile);
01131 #ifndef WITHOUT_ARTS
01132 mSoundRepeat->setChecked(Preferences::default_defaultSoundRepeat);
01133 #endif
01134 mCmdScript->setChecked(Preferences::default_defaultCmdScript);
01135 mCmdXterm->setChecked(Preferences::default_defaultCmdLogType == EditAlarmDlg::EXEC_IN_TERMINAL);
01136 mEmailBcc->setChecked(Preferences::default_defaultEmailBcc);
01137 mCopyToKOrganizer->setChecked(Preferences::default_defaultCopyToKOrganizer);
01138 mLateCancel->setChecked(Preferences::default_defaultLateCancel);
01139 mRecurPeriod->setCurrentItem(recurIndex(Preferences::default_defaultRecurPeriod));
01140 mFeb29->setButton(Preferences::default_defaultFeb29Type);
01141 }
01142
01143 void EditPrefTab::slotBrowseSoundFile()
01144 {
01145 QString defaultDir;
01146 QString url = SoundPicker::browseFile(defaultDir, mSoundFile->text());
01147 if (!url.isEmpty())
01148 mSoundFile->setText(url);
01149 }
01150
01151 int EditPrefTab::soundIndex(SoundPicker::Type type)
01152 {
01153 switch (type)
01154 {
01155 case SoundPicker::SPEAK: return 3;
01156 case SoundPicker::PLAY_FILE: return 2;
01157 case SoundPicker::BEEP: return 1;
01158 case SoundPicker::NONE:
01159 default: return 0;
01160 }
01161 }
01162
01163 int EditPrefTab::recurIndex(RecurrenceEdit::RepeatType type)
01164 {
01165 switch (type)
01166 {
01167 case RecurrenceEdit::ANNUAL: return 6;
01168 case RecurrenceEdit::MONTHLY: return 5;
01169 case RecurrenceEdit::WEEKLY: return 4;
01170 case RecurrenceEdit::DAILY: return 3;
01171 case RecurrenceEdit::SUBDAILY: return 2;
01172 case RecurrenceEdit::AT_LOGIN: return 1;
01173 case RecurrenceEdit::NO_RECUR:
01174 default: return 0;
01175 }
01176 }
01177
01178 QString EditPrefTab::validate()
01179 {
01180 if (mSound->currentItem() == SoundPicker::PLAY_FILE && mSoundFile->text().isEmpty())
01181 {
01182 mSoundFile->setFocus();
01183 return i18n("You must enter a sound file when %1 is selected as the default sound type").arg(SoundPicker::i18n_File());;
01184 }
01185 return QString::null;
01186 }
01187
01188
01189
01190
01191
01192
01193 ViewPrefTab::ViewPrefTab(QVBox* frame)
01194 : PrefsTabBase(frame)
01195 {
01196 QGroupBox* group = new QGroupBox(i18n("Alarm List"), mPage);
01197 QBoxLayout* layout = new QVBoxLayout(group, KDialog::marginHint(), KDialog::spacingHint());
01198 layout->addSpacing(fontMetrics().lineSpacing()/2);
01199
01200 mListShowTime = new QCheckBox(MainWindow::i18n_t_ShowAlarmTime(), group, "listTime");
01201 mListShowTime->setMinimumSize(mListShowTime->sizeHint());
01202 connect(mListShowTime, SIGNAL(toggled(bool)), SLOT(slotListTimeToggled(bool)));
01203 QWhatsThis::add(mListShowTime,
01204 i18n("Specify whether to show in the alarm list, the time at which each alarm is due"));
01205 layout->addWidget(mListShowTime, 0, Qt::AlignAuto);
01206
01207 mListShowTimeTo = new QCheckBox(MainWindow::i18n_n_ShowTimeToAlarm(), group, "listTimeTo");
01208 mListShowTimeTo->setMinimumSize(mListShowTimeTo->sizeHint());
01209 connect(mListShowTimeTo, SIGNAL(toggled(bool)), SLOT(slotListTimeToToggled(bool)));
01210 QWhatsThis::add(mListShowTimeTo,
01211 i18n("Specify whether to show in the alarm list, how long until each alarm is due"));
01212 layout->addWidget(mListShowTimeTo, 0, Qt::AlignAuto);
01213 group->setMaximumHeight(group->sizeHint().height());
01214
01215 group = new QGroupBox(i18n("System Tray Tooltip"), mPage);
01216 QGridLayout* grid = new QGridLayout(group, 5, 3, KDialog::marginHint(), KDialog::spacingHint());
01217 grid->setColStretch(2, 1);
01218 grid->addColSpacing(0, indentWidth());
01219 grid->addColSpacing(1, indentWidth());
01220 grid->addRowSpacing(0, fontMetrics().lineSpacing()/2);
01221
01222 mTooltipShowAlarms = new QCheckBox(i18n("Show next &24 hours' alarms"), group, "tooltipShow");
01223 mTooltipShowAlarms->setMinimumSize(mTooltipShowAlarms->sizeHint());
01224 connect(mTooltipShowAlarms, SIGNAL(toggled(bool)), SLOT(slotTooltipAlarmsToggled(bool)));
01225 QWhatsThis::add(mTooltipShowAlarms,
01226 i18n("Specify whether to include in the system tray tooltip, a summary of alarms due in the next 24 hours"));
01227 grid->addMultiCellWidget(mTooltipShowAlarms, 1, 1, 0, 2, Qt::AlignAuto);
01228
01229 QHBox* box = new QHBox(group);
01230 box->setSpacing(KDialog::spacingHint());
01231 mTooltipMaxAlarms = new QCheckBox(i18n("Ma&ximum number of alarms to show:"), box, "tooltipMax");
01232 mTooltipMaxAlarms->setMinimumSize(mTooltipMaxAlarms->sizeHint());
01233 connect(mTooltipMaxAlarms, SIGNAL(toggled(bool)), SLOT(slotTooltipMaxToggled(bool)));
01234 mTooltipMaxAlarmCount = new SpinBox(1, 99, 1, box);
01235 mTooltipMaxAlarmCount->setLineShiftStep(5);
01236 mTooltipMaxAlarmCount->setMinimumSize(mTooltipMaxAlarmCount->sizeHint());
01237 QWhatsThis::add(box,
01238 i18n("Uncheck to display all of the next 24 hours' alarms in the system tray tooltip. "
01239 "Check to enter an upper limit on the number to be displayed."));
01240 grid->addMultiCellWidget(box, 2, 2, 1, 2, Qt::AlignAuto);
01241
01242 mTooltipShowTime = new QCheckBox(MainWindow::i18n_m_ShowAlarmTime(), group, "tooltipTime");
01243 mTooltipShowTime->setMinimumSize(mTooltipShowTime->sizeHint());
01244 connect(mTooltipShowTime, SIGNAL(toggled(bool)), SLOT(slotTooltipTimeToggled(bool)));
01245 QWhatsThis::add(mTooltipShowTime,
01246 i18n("Specify whether to show in the system tray tooltip, the time at which each alarm is due"));
01247 grid->addMultiCellWidget(mTooltipShowTime, 3, 3, 1, 2, Qt::AlignAuto);
01248
01249 mTooltipShowTimeTo = new QCheckBox(MainWindow::i18n_l_ShowTimeToAlarm(), group, "tooltipTimeTo");
01250 mTooltipShowTimeTo->setMinimumSize(mTooltipShowTimeTo->sizeHint());
01251 connect(mTooltipShowTimeTo, SIGNAL(toggled(bool)), SLOT(slotTooltipTimeToToggled(bool)));
01252 QWhatsThis::add(mTooltipShowTimeTo,
01253 i18n("Specify whether to show in the system tray tooltip, how long until each alarm is due"));
01254 grid->addMultiCellWidget(mTooltipShowTimeTo, 4, 4, 1, 2, Qt::AlignAuto);
01255
01256 box = new QHBox(group);
01257 box->setSpacing(KDialog::spacingHint());
01258 mTooltipTimeToPrefixLabel = new QLabel(i18n("&Prefix:"), box);
01259 mTooltipTimeToPrefixLabel->setFixedSize(mTooltipTimeToPrefixLabel->sizeHint());
01260 mTooltipTimeToPrefix = new QLineEdit(box);
01261 mTooltipTimeToPrefixLabel->setBuddy(mTooltipTimeToPrefix);
01262 QWhatsThis::add(box,
01263 i18n("Enter the text to be displayed in front of the time until the alarm, in the system tray tooltip"));
01264 box->setFixedHeight(box->sizeHint().height());
01265 grid->addWidget(box, 5, 2, Qt::AlignAuto);
01266 group->setMaximumHeight(group->sizeHint().height());
01267
01268 mModalMessages = new QCheckBox(i18n("Message &windows have a title bar and take keyboard focus"), mPage, "modalMsg");
01269 mModalMessages->setMinimumSize(mModalMessages->sizeHint());
01270 QWhatsThis::add(mModalMessages,
01271 i18n("Specify the characteristics of alarm message windows:\n"
01272 "- If checked, the window is a normal window with a title bar, which grabs keyboard input when it is displayed.\n"
01273 "- If unchecked, the window does not interfere with your typing when "
01274 "it is displayed, but it has no title bar and cannot be moved or resized."));
01275
01276 mShowExpiredAlarms = new QCheckBox(MainWindow::i18n_e_ShowExpiredAlarms(), mPage, "showExpired");
01277 mShowExpiredAlarms->setMinimumSize(mShowExpiredAlarms->sizeHint());
01278 QWhatsThis::add(mShowExpiredAlarms,
01279 i18n("Specify whether to show expired alarms in the alarm list"));
01280
01281 QHBox* itemBox = new QHBox(mPage);
01282 box = new QHBox(itemBox);
01283 box->setSpacing(KDialog::spacingHint());
01284 QLabel* label = new QLabel(i18n("System tray icon &update interval:"), box);
01285 mDaemonTrayCheckInterval = new SpinBox(1, 9999, 1, box, "daemonCheck");
01286 mDaemonTrayCheckInterval->setLineShiftStep(10);
01287 mDaemonTrayCheckInterval->setMinimumSize(mDaemonTrayCheckInterval->sizeHint());
01288 label->setBuddy(mDaemonTrayCheckInterval);
01289 label = new QLabel(i18n("seconds"), box);
01290 QWhatsThis::add(box,
01291 i18n("How often to update the system tray icon to indicate whether or not the Alarm Daemon is monitoring alarms."));
01292 itemBox->setStretchFactor(new QWidget(itemBox), 1);
01293 itemBox->setFixedHeight(box->sizeHint().height());
01294
01295 mPage->setStretchFactor(new QWidget(mPage), 1);
01296 }
01297
01298 void ViewPrefTab::restore()
01299 {
01300 setList(Preferences::mShowAlarmTime,
01301 Preferences::mShowTimeToAlarm);
01302 setTooltip(Preferences::mTooltipAlarmCount,
01303 Preferences::mShowTooltipAlarmTime,
01304 Preferences::mShowTooltipTimeToAlarm,
01305 Preferences::mTooltipTimeToPrefix);
01306 mModalMessages->setChecked(Preferences::mModalMessages);
01307 mShowExpiredAlarms->setChecked(Preferences::mShowExpiredAlarms);
01308 mDaemonTrayCheckInterval->setValue(Preferences::mDaemonTrayCheckInterval);
01309 }
01310
01311 void ViewPrefTab::apply(bool syncToDisc)
01312 {
01313 Preferences::mShowAlarmTime = mListShowTime->isChecked();
01314 Preferences::mShowTimeToAlarm = mListShowTimeTo->isChecked();
01315 int n = mTooltipShowAlarms->isChecked() ? -1 : 0;
01316 if (n && mTooltipMaxAlarms->isChecked())
01317 n = mTooltipMaxAlarmCount->value();
01318 Preferences::mTooltipAlarmCount = n;
01319 Preferences::mShowTooltipAlarmTime = mTooltipShowTime->isChecked();
01320 Preferences::mShowTooltipTimeToAlarm = mTooltipShowTimeTo->isChecked();
01321 Preferences::mTooltipTimeToPrefix = mTooltipTimeToPrefix->text();
01322 Preferences::mModalMessages = mModalMessages->isChecked();
01323 Preferences::mShowExpiredAlarms = mShowExpiredAlarms->isChecked();
01324 Preferences::mDaemonTrayCheckInterval = mDaemonTrayCheckInterval->value();
01325 PrefsTabBase::apply(syncToDisc);
01326 }
01327
01328 void ViewPrefTab::setDefaults()
01329 {
01330 setList(Preferences::default_showAlarmTime,
01331 Preferences::default_showTimeToAlarm);
01332 setTooltip(Preferences::default_tooltipAlarmCount,
01333 Preferences::default_showTooltipAlarmTime,
01334 Preferences::default_showTooltipTimeToAlarm,
01335 Preferences::default_tooltipTimeToPrefix);
01336 mModalMessages->setChecked(Preferences::default_modalMessages);
01337 mShowExpiredAlarms->setChecked(Preferences::default_showExpiredAlarms);
01338 mDaemonTrayCheckInterval->setValue(Preferences::default_daemonTrayCheckInterval);
01339 }
01340
01341 void ViewPrefTab::setList(bool time, bool timeTo)
01342 {
01343 if (!timeTo)
01344 time = true;
01345
01346
01347
01348 mListShowTime->blockSignals(true);
01349 mListShowTimeTo->blockSignals(true);
01350
01351 mListShowTime->setChecked(time);
01352 mListShowTimeTo->setChecked(timeTo);
01353
01354 mListShowTime->blockSignals(false);
01355 mListShowTimeTo->blockSignals(false);
01356 }
01357
01358 void ViewPrefTab::setTooltip(int maxAlarms, bool time, bool timeTo, const QString& prefix)
01359 {
01360 if (!timeTo)
01361 time = true;
01362
01363
01364
01365 mTooltipShowAlarms->blockSignals(true);
01366 mTooltipShowTime->blockSignals(true);
01367 mTooltipShowTimeTo->blockSignals(true);
01368
01369 mTooltipShowAlarms->setChecked(maxAlarms);
01370 mTooltipMaxAlarms->setChecked(maxAlarms > 0);
01371 mTooltipMaxAlarmCount->setValue(maxAlarms > 0 ? maxAlarms : 1);
01372 mTooltipShowTime->setChecked(time);
01373 mTooltipShowTimeTo->setChecked(timeTo);
01374 mTooltipTimeToPrefix->setText(prefix);
01375
01376 mTooltipShowAlarms->blockSignals(false);
01377 mTooltipShowTime->blockSignals(false);
01378 mTooltipShowTimeTo->blockSignals(false);
01379
01380
01381 slotTooltipTimeToToggled(timeTo);
01382 slotTooltipAlarmsToggled(maxAlarms);
01383 }
01384
01385 void ViewPrefTab::slotListTimeToggled(bool on)
01386 {
01387 if (!on && !mListShowTimeTo->isChecked())
01388 mListShowTimeTo->setChecked(true);
01389 }
01390
01391 void ViewPrefTab::slotListTimeToToggled(bool on)
01392 {
01393 if (!on && !mListShowTime->isChecked())
01394 mListShowTime->setChecked(true);
01395 }
01396
01397 void ViewPrefTab::slotTooltipAlarmsToggled(bool on)
01398 {
01399 mTooltipMaxAlarms->setEnabled(on);
01400 mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isChecked());
01401 mTooltipShowTime->setEnabled(on);
01402 mTooltipShowTimeTo->setEnabled(on);
01403 on = on && mTooltipShowTimeTo->isChecked();
01404 mTooltipTimeToPrefix->setEnabled(on);
01405 mTooltipTimeToPrefixLabel->setEnabled(on);
01406 }
01407
01408 void ViewPrefTab::slotTooltipMaxToggled(bool on)
01409 {
01410 mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isEnabled());
01411 }
01412
01413 void ViewPrefTab::slotTooltipTimeToggled(bool on)
01414 {
01415 if (!on && !mTooltipShowTimeTo->isChecked())
01416 mTooltipShowTimeTo->setChecked(true);
01417 }
01418
01419 void ViewPrefTab::slotTooltipTimeToToggled(bool on)
01420 {
01421 if (!on && !mTooltipShowTime->isChecked())
01422 mTooltipShowTime->setChecked(true);
01423 on = on && mTooltipShowTimeTo->isEnabled();
01424 mTooltipTimeToPrefix->setEnabled(on);
01425 mTooltipTimeToPrefixLabel->setEnabled(on);
01426 }