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