27 #include "alarmresources.h"
55 #include "prefdlg_p.moc"
56 #include "prefdlg.moc"
58 #include <kalarmcal/identities.h>
60 #include <kholidays/holidays.h>
61 using namespace KHolidays;
66 #include <kstandarddirs.h>
68 #include <klineedit.h>
69 #include <kaboutdata.h>
70 #include <kapplication.h>
71 #include <kiconloader.h>
72 #include <kcombobox.h>
73 #include <ktabwidget.h>
74 #include <kstandardguiitem.h>
75 #include <ksystemtimezone.h>
78 #include <kwindowinfo.h>
79 #include <kwindowsystem.h>
81 #include <ktoolinvocation.h>
86 #include <QRadioButton>
87 #include <QPushButton>
90 #include <QGridLayout>
91 #include <QHBoxLayout>
92 #include <QVBoxLayout>
94 #include <QResizeEvent>
98 using namespace KCalCore;
100 using namespace KCal;
102 using namespace KAlarmCal;
113 QLatin1String(
"xterm -sb -hold -title %t -e %c"),
114 QLatin1String(
"konsole --noclose -p tabtitle=%t -e ${SHELL:-sh} -c %c"),
115 QLatin1String(
"gnome-terminal -t %t -e %W"),
116 QLatin1String(
"eterm --pause -T %t -e %C"),
117 QLatin1String(
"Eterm --pause -T %t -e %C"),
118 QLatin1String(
"rxvt -title %t -e ${SHELL:-sh} -c %w"),
136 mInstance->resize(s);
142 KWindowInfo info = KWindowSystem::windowInfo(mInstance->winId(), NET::WMGeometry | NET::WMDesktop);
143 KWindowSystem::setCurrentDesktop(info.desktop());
145 mInstance->setWindowState(mInstance->windowState() & ~Qt::WindowMinimized);
147 mInstance->activateWindow();
151 KAlarmPrefDlg::KAlarmPrefDlg()
155 setAttribute(Qt::WA_DeleteOnClose);
156 setObjectName(QLatin1String(
"PrefDlg"));
157 setCaption(i18nc(
"@title:window",
"Configure"));
158 setButtons(Help | Default | Ok | Apply | Cancel);
159 setDefaultButton(Ok);
161 showButtonSeparator(
true);
166 mMiscPageItem->setHeader(i18nc(
"@title General preferences",
"General"));
167 mMiscPageItem->setIcon(KIcon(DesktopIcon(QLatin1String(
"preferences-other"))));
173 mTimePageItem->setIcon(KIcon(DesktopIcon(QLatin1String(
"preferences-system-time"))));
179 mStorePageItem->setIcon(KIcon(DesktopIcon(QLatin1String(
"system-file-manager"))));
184 mEmailPageItem->setHeader(i18nc(
"@title",
"Email Alarm Settings"));
185 mEmailPageItem->setIcon(KIcon(DesktopIcon(QLatin1String(
"internet-mail"))));
191 mViewPageItem->setIcon(KIcon(DesktopIcon(QLatin1String(
"preferences-desktop-theme"))));
196 mEditPageItem->setHeader(i18nc(
"@title",
"Default Alarm Edit Settings"));
197 mEditPageItem->setIcon(KIcon(DesktopIcon(QLatin1String(
"document-properties"))));
200 connect(
this, SIGNAL(okClicked()), SLOT(
slotOk()));
201 connect(
this, SIGNAL(cancelClicked()), SLOT(
slotCancel()));
202 connect(
this, SIGNAL(applyClicked()), SLOT(
slotApply()));
203 connect(
this, SIGNAL(defaultClicked()), SLOT(
slotDefault()));
204 connect(
this, SIGNAL(helpClicked()), SLOT(
slotHelp()));
216 KToolInvocation::invokeHelp(QLatin1String(
"preferences"));
224 if (!errmsg.isEmpty())
234 if (!errmsg.isEmpty())
274 KGuiItem(i18nc(
"@action:button Reset ALL tabs",
"&All")),
275 KGuiItem(i18nc(
"@action:button Reset the CURRENT tab",
"C&urrent"))))
277 case KMessageBox::Yes:
280 case KMessageBox::No:
282 static_cast<PrefsTabBase*
>(currentPage()->widget())->restore(
true,
false);
291 void KAlarmPrefDlg::restore(
bool defaults)
293 kDebug() << (defaults ?
"defaults" :
"");
313 if (!mTabScrollGroup->
sized())
326 return KDialog::minimumSizeHint();
331 KDialog::showEvent(e);
347 KPageDialog::resizeEvent(re);
354 int PrefsTabBase::mIndentWidth = 0;
358 mLabelsAligned(false)
360 mTopWidget =
new KVBox(
this);
361 mTopWidget->setMargin(0);
362 mTopWidget->setSpacing(KDialog::spacingHint());
363 setWidget(mTopWidget);
367 QStyleOptionButton opt;
368 opt.initFrom(&radio);
369 mIndentWidth = style()->subElementRect(QStyle::SE_RadioButtonIndicator, &opt).width();
371 mTopLayout = qobject_cast<QVBoxLayout*>(mTopWidget->layout());
372 Q_ASSERT(mTopLayout);
392 int end = mLabels.count();
394 for (i = 0; i < end; ++i)
396 int x = mLabels[i]->mapTo(
this, QPoint(0, 0)).x();
398 int w = x + mLabels[i]->sizeHint().width();
402 for (i = 0; i < end; ++i)
404 mLabels[i]->setFixedWidth(wid - xpos[i]);
405 mLabels[i]->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
407 mLabelsAligned =
true;
420 QVBoxLayout* vlayout =
new QVBoxLayout(group);
421 vlayout->setMargin(KDialog::marginHint());
422 vlayout->setSpacing(KDialog::spacingHint());
425 mAutoStart =
new QCheckBox(i18nc(
"@option:check",
"Start at login"), group);
426 connect(mAutoStart, SIGNAL(clicked()), SLOT(slotAutostartClicked()));
427 mAutoStart->setWhatsThis(i18nc(
"@info:whatsthis",
428 "<para>Automatically start <application>KAlarm</application> whenever you start KDE.</para>"
429 "<para>This option should always be checked unless you intend to discontinue use of <application>KAlarm</application>.</para>"));
430 vlayout->addWidget(mAutoStart, 0, Qt::AlignLeft);
432 mQuitWarn =
new QCheckBox(i18nc(
"@option:check",
"Warn before quitting"), group);
433 mQuitWarn->setWhatsThis(i18nc(
"@info:whatsthis",
"Check to display a warning prompt before quitting <application>KAlarm</application>."));
434 vlayout->addWidget(mQuitWarn, 0, Qt::AlignLeft);
436 group->setFixedHeight(group->sizeHint().height());
440 itemBox->setMargin(0);
441 mConfirmAlarmDeletion =
new QCheckBox(i18nc(
"@option:check",
"Confirm alarm deletions"), itemBox);
442 mConfirmAlarmDeletion->setMinimumSize(mConfirmAlarmDeletion->sizeHint());
443 mConfirmAlarmDeletion->setWhatsThis(i18nc(
"@info:whatsthis",
"Check to be prompted for confirmation each time you delete an alarm."));
444 itemBox->setStretchFactor(
new QWidget(itemBox), 1);
445 itemBox->setFixedHeight(itemBox->sizeHint().height());
450 box->setSpacing(KDialog::spacingHint());
451 QLabel* label =
new QLabel(i18nc(
"@label:spinbox",
"Default defer time interval:"), box);
453 mDefaultDeferTime->setMinimumSize(mDefaultDeferTime->
sizeHint());
454 box->setWhatsThis(i18nc(
"@info:whatsthis",
455 "Enter the default time interval (hours & minutes) to defer alarms, used by the Defer Alarm dialog."));
456 label->setBuddy(mDefaultDeferTime);
457 itemBox->setStretchFactor(
new QWidget(itemBox), 1);
458 itemBox->setFixedHeight(itemBox->sizeHint().height());
461 group =
new QGroupBox(i18nc(
"@title:group",
"Terminal for Command Alarms"),
topWidget());
462 group->setWhatsThis(i18nc(
"@info:whatsthis",
"Choose which application to use when a command alarm is executed in a terminal window"));
463 QGridLayout* grid =
new QGridLayout(group);
464 grid->setMargin(KDialog::marginHint());
465 grid->setSpacing(KDialog::spacingHint());
471 for (mXtermCount = 0; !
xtermCommands[mXtermCount].isNull(); ++mXtermCount)
474 QStringList args = KShell::splitArgs(cmd);
475 if (args.isEmpty() || KStandardDirs::findExe(args[0]).isEmpty())
478 radio->setMinimumSize(radio->sizeHint());
479 mXtermType->
addButton(radio, mXtermCount);
481 mXtermFirst = mXtermCount;
482 cmd.replace(QLatin1String(
"%t"), KGlobal::mainComponent().aboutData()->programName());
483 cmd.replace(QLatin1String(
"%c"), QLatin1String(
"<command>"));
484 cmd.replace(QLatin1String(
"%w"), QLatin1String(
"<command; sleep>"));
485 cmd.replace(QLatin1String(
"%C"), QLatin1String(
"[command]"));
486 cmd.replace(QLatin1String(
"%W"), QLatin1String(
"[command; sleep]"));
488 i18nc(
"@info:whatsthis",
"Check to execute command alarms in a terminal window by <icode>%1</icode>", cmd));
489 grid->addWidget(radio, (row = index/3), index % 3, Qt::AlignLeft);
494 QHBoxLayout* hlayout =
new QHBoxLayout();
495 hlayout->setSpacing(KDialog::spacingHint());
496 grid->addLayout(hlayout, row + 1, 0, 1, 3, Qt::AlignLeft);
498 hlayout->addWidget(radio);
499 connect(radio, SIGNAL(toggled(
bool)), SLOT(slotOtherTerminalToggled(
bool)));
500 mXtermType->
addButton(radio, mXtermCount);
502 mXtermFirst = mXtermCount;
504 mXtermCommand->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
505 hlayout->addWidget(mXtermCommand);
507 i18nc(
"@info:whatsthis",
"Enter the full command line needed to execute a command in your chosen terminal window. "
508 "By default the alarm's command string will be appended to what you enter here. "
509 "See the <application>KAlarm</application> Handbook for details of special codes to tailor the command line.");
510 radio->setWhatsThis(wt);
511 mXtermCommand->setWhatsThis(wt);
523 int id = mXtermFirst;
524 if (!xtermCmd.isEmpty())
526 for ( ;
id < mXtermCount; ++id)
533 mXtermCommand->setEnabled(
id == mXtermCount);
534 mXtermCommand->setText(
id == mXtermCount ? xtermCmd : QString());
541 if (xtermID >= mXtermCount)
543 QString cmd = mXtermCommand->text();
548 QStringList args = KShell::splitArgs(cmd);
549 cmd = args.isEmpty() ? QString() : args[0];
550 if (KStandardDirs::findExe(cmd).isEmpty())
552 mXtermCommand->setFocus();
554 != KMessageBox::Continue)
561 xtermID = mXtermFirst;
565 if (mQuitWarn->isEnabled())
567 bool b = mQuitWarn->isChecked();
571 bool b = mAutoStart->isChecked();
580 b = mConfirmAlarmDeletion->isChecked();
583 int i = mDefaultDeferTime->
value();
586 QString
text = (xtermID < mXtermCount) ?
xtermCommands[xtermID] : mXtermCommand->text();
592 void MiscPrefTab::slotAutostartClicked()
594 if (!mAutoStart->isChecked()
596 i18nc(
"@info",
"You should not uncheck this option unless you intend to discontinue use of <application>KAlarm</application>"),
597 QString(), KStandardGuiItem::cont(), KStandardGuiItem::cancel()
598 ) != KMessageBox::Yes)
599 mAutoStart->setChecked(
true);
602 void MiscPrefTab::slotOtherTerminalToggled(
bool on)
604 mXtermCommand->setEnabled(on);
617 itemBox->setMargin(0);
620 box->setSpacing(KDialog::spacingHint());
621 QLabel* label =
new QLabel(i18nc(
"@label:listbox",
"Time zone:"), box);
625 mTimeZone->setMaxVisibleItems(15);
628 mTimeZone->setMaxVisibleItems(15);
629 const KTimeZones::ZoneMap zones = KSystemTimeZones::zones();
630 for (KTimeZones::ZoneMap::ConstIterator it = zones.constBegin(); it != zones.constEnd(); ++it)
631 mTimeZone->addItem(it.key());
633 box->setWhatsThis(i18nc(
"@info:whatsthis",
634 "Select the time zone which <application>KAlarm</application> should use "
635 "as its default for displaying and entering dates and times."));
636 label->setBuddy(mTimeZone);
638 itemBox->setFixedHeight(box->sizeHint().height());
642 itemBox->setMargin(0);
643 box =
new KHBox(itemBox);
645 box->setSpacing(KDialog::spacingHint());
646 label =
new QLabel(i18nc(
"@label:listbox",
"Holiday region:"), box);
649 mHolidays->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
651 label->setBuddy(mHolidays);
652 box->setWhatsThis(i18nc(
"@info:whatsthis",
653 "Select which holiday region to use"));
655 QStringList regions = HolidayRegion::regionCodes();
656 QMap<QString, QString> regionsMap;
657 foreach (
const QString& regionCode, regions)
659 QString name = HolidayRegion::name(regionCode);
660 QString languageName = KGlobal::locale()->languageCodeToName(HolidayRegion::languageCode(regionCode));
661 QString label = languageName.isEmpty() ? name : i18nc(
"Holiday region, region language",
"%1 (%2)", name, languageName);
662 regionsMap.insert(label, regionCode);
665 mHolidays->addItem(i18nc(
"No holiday region",
"None"), QString());
666 for (QMapIterator<QString, QString> it(regionsMap); it.hasNext(); )
669 mHolidays->addItem(it.key(), it.value());
674 itemBox->setMargin(0);
675 box =
new KHBox(itemBox);
677 box->setSpacing(KDialog::spacingHint());
678 label =
new QLabel(i18nc(
"@label:spinbox",
"Start of day for date-only alarms:"), box);
681 label->setBuddy(mStartOfDay);
682 box->setWhatsThis(i18nc(
"@info:whatsthis",
683 "<para>The earliest time of day at which a date-only alarm will be triggered.</para>"
686 itemBox->setFixedHeight(box->sizeHint().height());
690 QBoxLayout* layout =
new QVBoxLayout(group);
691 layout->setMargin(KDialog::marginHint());
692 layout->setSpacing(KDialog::spacingHint());
695 layout->addWidget(daybox);
696 QGridLayout* wgrid =
new QGridLayout(daybox);
697 wgrid->setSpacing(KDialog::spacingHint());
698 const KLocale* locale = KGlobal::locale();
699 for (
int i = 0; i < 7; ++i)
703 wgrid->addWidget(mWorkDays[i], i/3, i%3, Qt::AlignLeft);
705 daybox->setFixedHeight(daybox->sizeHint().height());
706 daybox->setWhatsThis(i18nc(
"@info:whatsthis",
"Check the days in the week which are work days"));
709 itemBox->setMargin(0);
710 layout->addWidget(itemBox);
711 box =
new KHBox(itemBox);
713 box->setSpacing(KDialog::spacingHint());
714 label =
new QLabel(i18nc(
"@label:spinbox",
"Daily start time:"), box);
717 label->setBuddy(mWorkStart);
718 box->setWhatsThis(i18nc(
"@info:whatsthis",
719 "<para>Enter the start time of the working day.</para>"
724 itemBox->setMargin(0);
725 layout->addWidget(itemBox);
726 box =
new KHBox(itemBox);
728 box->setSpacing(KDialog::spacingHint());
729 label =
new QLabel(i18nc(
"@label:spinbox",
"Daily end time:"), box);
732 label->setBuddy(mWorkEnd);
733 box->setWhatsThis(i18nc(
"@info:whatsthis",
734 "<para>Enter the end time of the working day.</para>"
737 box->setFixedHeight(box->sizeHint().height());
741 layout =
new QVBoxLayout(group);
742 layout->setMargin(KDialog::marginHint());
743 layout->setSpacing(KDialog::spacingHint());
746 itemBox->setMargin(0);
747 layout->addWidget(itemBox);
748 box =
new KHBox(itemBox);
750 box->setSpacing(KDialog::spacingHint());
751 label =
new QLabel(i18nc(
"@label:spinbox",
"KOrganizer event duration:"), box);
753 mKOrgEventDuration =
new TimeSpinBox(0, 5999, box);
754 mKOrgEventDuration->setMinimumSize(mKOrgEventDuration->
sizeHint());
755 box->setWhatsThis(i18nc(
"@info:whatsthis",
756 "<para>Enter the event duration in hours and minutes, for alarms which are copied to KOrganizer.</para>"
758 label->setBuddy(mKOrgEventDuration);
759 itemBox->setStretchFactor(
new QWidget(itemBox), 1);
760 itemBox->setFixedHeight(itemBox->sizeHint().height());
774 QString zone = tz.name();
775 int count = mTimeZone->count();
776 while (tzindex < count && mTimeZone->itemText(tzindex) != zone)
778 if (tzindex >= count)
781 mTimeZone->setCurrentIndex(tzindex);
784 mHolidays->setCurrentIndex(i);
789 for (
int i = 0; i < 7; ++i)
792 mWorkDays[i]->setChecked(x);
800 KTimeZone tz = mTimeZone->
timeZone();
804 KTimeZone tz = KSystemTimeZones::zone(mTimeZone->currentText());
808 QString hol = mHolidays->itemData(mHolidays->currentIndex()).toString();
811 int t = mStartOfDay->
value();
812 QTime sodt(t/60, t%60, 0);
815 t = mWorkStart->
value();
817 t = mWorkEnd->
value();
819 QBitArray workDays(7);
820 for (
int i = 0; i < 7; ++i)
821 if (mWorkDays[i]->isChecked())
825 t = mKOrgEventDuration->
value();
838 mCheckKeepChanges(false)
843 QBoxLayout* layout =
new QVBoxLayout(group);
844 layout->setMargin(KDialog::marginHint());
845 layout->setSpacing(KDialog::spacingHint());
847 mDefaultResource =
new QRadioButton(i18nc(
"@option:radio",
"Store in default calendar"), group);
848 bgroup->addButton(mDefaultResource);
849 mDefaultResource->setWhatsThis(i18nc(
"@info:whatsthis",
"Add all new alarms and alarm templates to the default calendars, without prompting."));
850 layout->addWidget(mDefaultResource, 0, Qt::AlignLeft);
851 mAskResource =
new QRadioButton(i18nc(
"@option:radio",
"Prompt for which calendar to store in"), group);
852 bgroup->addButton(mAskResource);
853 mAskResource->setWhatsThis(i18nc(
"@info:whatsthis",
854 "<para>When saving a new alarm or alarm template, prompt for which calendar to store it in, if there is more than one active calendar.</para>"
855 "<para>Note that archived alarms are always stored in the default archived alarm calendar.</para>"));
856 layout->addWidget(mAskResource, 0, Qt::AlignLeft);
860 QGridLayout* grid =
new QGridLayout(group);
861 grid->setMargin(KDialog::marginHint());
862 grid->setSpacing(KDialog::spacingHint());
863 grid->setColumnStretch(1, 1);
865 mKeepArchived =
new QCheckBox(i18nc(
"@option:check",
"Keep alarms after expiry"), group);
866 connect(mKeepArchived, SIGNAL(toggled(
bool)), SLOT(slotArchivedToggled(
bool)));
867 mKeepArchived->setWhatsThis(
868 i18nc(
"@info:whatsthis",
"Check to archive alarms after expiry or deletion (except deleted alarms which were never triggered)."));
869 grid->addWidget(mKeepArchived, 0, 0, 1, 2, Qt::AlignLeft);
873 box->setSpacing(KDialog::spacingHint());
874 mPurgeArchived =
new QCheckBox(i18nc(
"@option:check",
"Discard archived alarms after:"), box);
875 mPurgeArchived->setMinimumSize(mPurgeArchived->sizeHint());
876 connect(mPurgeArchived, SIGNAL(toggled(
bool)), SLOT(slotArchivedToggled(
bool)));
877 mPurgeAfter =
new SpinBox(box);
878 mPurgeAfter->setMinimum(1);
879 mPurgeAfter->setSingleShiftStep(10);
880 mPurgeAfter->setMinimumSize(mPurgeAfter->sizeHint());
881 mPurgeAfterLabel =
new QLabel(i18nc(
"@label Time unit for user-entered number",
"days"), box);
882 mPurgeAfterLabel->setMinimumSize(mPurgeAfterLabel->sizeHint());
883 mPurgeAfterLabel->setBuddy(mPurgeAfter);
884 box->setWhatsThis(i18nc(
"@info:whatsthis",
"Uncheck to store archived alarms indefinitely. Check to enter how long archived alarms should be stored."));
885 grid->addWidget(box, 1, 1, Qt::AlignLeft);
887 mClearArchived =
new QPushButton(i18nc(
"@action:button",
"Clear Archived Alarms"), group);
888 mClearArchived->setFixedSize(mClearArchived->sizeHint());
889 connect(mClearArchived, SIGNAL(clicked()), SLOT(slotClearArchived()));
893 mClearArchived->setWhatsThis((AlarmResources::instance()->activeCount(CalEvent::ARCHIVED,
false) <= 1)
895 ? i18nc(
"@info:whatsthis",
"Delete all existing archived alarms.")
896 : i18nc(
"@info:whatsthis",
"Delete all existing archived alarms (from the default archived alarm calendar only)."));
897 grid->addWidget(mClearArchived, 2, 1, Qt::AlignLeft);
898 group->setFixedHeight(group->sizeHint().height());
905 mCheckKeepChanges = defaults;
907 mAskResource->setChecked(
true);
909 mDefaultResource->setChecked(
true);
912 mOldKeepArchived = keepDays;
913 setArchivedControls(keepDays);
914 mCheckKeepChanges =
true;
919 bool b = mAskResource->isChecked();
922 int days = !mKeepArchived->isChecked() ? 0 : mPurgeArchived->isChecked() ? mPurgeAfter->value() : -1;
928 void StorePrefTab::setArchivedControls(
int purgeDays)
930 mKeepArchived->setChecked(purgeDays);
931 mPurgeArchived->setChecked(purgeDays > 0);
932 mPurgeAfter->setValue(purgeDays > 0 ? purgeDays : 0);
933 slotArchivedToggled(
true);
936 void StorePrefTab::slotArchivedToggled(
bool)
938 bool keep = mKeepArchived->isChecked();
939 if (keep && !mOldKeepArchived && mCheckKeepChanges
943 && !AlarmResources::instance()->getStandardResource(CalEvent::ARCHIVED))
947 i18nc(
"@info",
"<para>A default calendar is required in order to archive alarms, but none is currently enabled.</para>"
948 "<para>If you wish to keep expired alarms, please first use the calendars view to select a default "
949 "archived alarms calendar.</para>"));
950 mKeepArchived->setChecked(
false);
953 mOldKeepArchived = keep;
954 mPurgeArchived->setEnabled(keep);
955 mPurgeAfter->setEnabled(keep && mPurgeArchived->isChecked());
956 mPurgeAfterLabel->setEnabled(keep);
957 mClearArchived->setEnabled(keep);
960 void StorePrefTab::slotClearArchived()
965 bool single = AlarmResources::instance()->activeCount(CalEvent::ARCHIVED,
false) <= 1;
968 : i18nc(
"@info",
"Do you really want to delete all alarms in the default archived alarm calendar?"))
969 != KMessageBox::Continue)
981 mAddressChanged(false),
982 mBccAddressChanged(false)
986 box->setSpacing(2*KDialog::spacingHint());
987 new QLabel(i18nc(
"@label",
"Email client:"), box);
989 QString kmailOption = i18nc(
"@option:radio",
"KMail");
990 QString sendmailOption = i18nc(
"@option:radio",
"Sendmail");
992 mKMailButton->setMinimumSize(mKMailButton->sizeHint());
994 mSendmailButton =
new RadioButton(sendmailOption, box);
995 mSendmailButton->setMinimumSize(mSendmailButton->sizeHint());
997 connect(mEmailClient, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotEmailClientChanged(QAbstractButton*)));
998 box->setFixedHeight(box->sizeHint().height());
999 box->setWhatsThis(i18nc(
"@info:whatsthis",
1000 "<para>Choose how to send email when an email alarm is triggered."
1001 "<list><item><interface>%1</interface>: The email is sent automatically via <application>KMail</application>. <application>KMail</application> is started first if necessary.</item>"
1002 "<item><interface>%2</interface>: The email is sent automatically. This option will only work if "
1003 "your system is configured to use <application>sendmail</application> or a sendmail compatible mail transport agent.</item></list></para>",
1004 kmailOption, sendmailOption));
1008 mEmailCopyToKMail =
new QCheckBox(i18nc(
"@option:check",
"Copy sent emails into <application>KMail</application>'s <resource>%1</resource> folder",
KAMail::i18n_sent_mail()), box);
1009 mEmailCopyToKMail->setWhatsThis(i18nc(
"@info:whatsthis",
"After sending an email, store a copy in <application>KMail</application>'s <resource>%1</resource> folder",
KAMail::i18n_sent_mail()));
1010 box->setStretchFactor(
new QWidget(box), 1);
1011 box->setFixedHeight(box->sizeHint().height());
1015 mEmailQueuedNotify =
new QCheckBox(i18nc(
"@option:check",
"Notify when remote emails are queued"), box);
1016 mEmailQueuedNotify->setWhatsThis(
1017 i18nc(
"@info:whatsthis",
"Display a notification message whenever an email alarm has queued an email for sending to a remote system. "
1018 "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."));
1019 box->setStretchFactor(
new QWidget(box), 1);
1020 box->setFixedHeight(box->sizeHint().height());
1024 QGridLayout* grid =
new QGridLayout(group);
1025 grid->setMargin(KDialog::marginHint());
1026 grid->setSpacing(KDialog::spacingHint());
1027 grid->setColumnStretch(2, 1);
1030 QLabel *label =
new Label(i18nc(
"@label 'From' email address",
"From:"), group);
1031 grid->addWidget(label, 1, 0);
1033 connect(mFromAddressGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotFromAddrChanged(QAbstractButton*)));
1038 label->setBuddy(mFromAddrButton);
1039 grid->addWidget(mFromAddrButton, 1, 1);
1041 connect(mEmailAddress, SIGNAL(textChanged(QString)), SLOT(slotAddressChanged()));
1042 QString whatsThis = i18nc(
"@info:whatsthis",
"Your email address, used to identify you as the sender when sending email alarms.");
1043 mFromAddrButton->setWhatsThis(whatsThis);
1044 mEmailAddress->setWhatsThis(whatsThis);
1046 grid->addWidget(mEmailAddress, 1, 2);
1049 mFromCCentreButton =
new RadioButton(i18nc(
"@option:radio",
"Use address from System Settings"), group);
1051 mFromCCentreButton->setWhatsThis(
1052 i18nc(
"@info:whatsthis",
"Check to use the email address set in KDE System Settings, to identify you as the sender when sending email alarms."));
1053 grid->addWidget(mFromCCentreButton, 2, 1, 1, 2, Qt::AlignLeft);
1056 mFromKMailButton =
new RadioButton(i18nc(
"@option:radio",
"Use <application>KMail</application> identities"), group);
1058 mFromKMailButton->setWhatsThis(
1059 i18nc(
"@info:whatsthis",
"Check to use <application>KMail</application>'s email identities to identify you as the sender when sending email alarms. "
1060 "For existing email alarms, <application>KMail</application>'s default identity will be used. "
1061 "For new email alarms, you will be able to pick which of <application>KMail</application>'s identities to use."));
1062 grid->addWidget(mFromKMailButton, 3, 1, 1, 2, Qt::AlignLeft);
1065 grid->setRowMinimumHeight(4, KDialog::spacingHint());
1066 label =
new Label(i18nc(
"@label 'Bcc' email address",
"Bcc:"), group);
1067 grid->addWidget(label, 5, 0);
1069 connect(mBccAddressGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotBccAddrChanged(QAbstractButton*)));
1074 label->setBuddy(mBccAddrButton);
1075 grid->addWidget(mBccAddrButton, 5, 1);
1076 mEmailBccAddress =
new KLineEdit(group);
1077 whatsThis = i18nc(
"@info:whatsthis",
"Your email address, used for blind copying email alarms to yourself. "
1078 "If you want blind copies to be sent to your account on the computer which <application>KAlarm</application> runs on, you can simply enter your user login name.");
1079 mBccAddrButton->setWhatsThis(whatsThis);
1080 mEmailBccAddress->setWhatsThis(whatsThis);
1082 grid->addWidget(mEmailBccAddress, 5, 2);
1085 mBccCCentreButton =
new RadioButton(i18nc(
"@option:radio",
"Use address from System Settings"), group);
1087 mBccCCentreButton->setWhatsThis(
1088 i18nc(
"@info:whatsthis",
"Check to use the email address set in KDE System Settings, for blind copying email alarms to yourself."));
1089 grid->addWidget(mBccCCentreButton, 6, 1, 1, 2, Qt::AlignLeft);
1091 group->setFixedHeight(group->sizeHint().height());
1104 mAddressChanged = mBccAddressChanged =
false;
1112 bool b = mEmailCopyToKMail->isChecked();
1116 QString
text = mEmailAddress->text().trimmed();
1120 b = (mBccAddressGroup->checkedButton() == mBccCCentreButton);
1122 text = mEmailBccAddress->text().trimmed();
1125 b = mEmailQueuedNotify->isChecked();
1137 void EmailPrefTab::setEmailBccAddress(
bool useSystemSettings,
const QString& address)
1140 mEmailBccAddress->setText(useSystemSettings ? QString() : address.trimmed());
1143 void EmailPrefTab::slotEmailClientChanged(QAbstractButton* button)
1145 mEmailCopyToKMail->setEnabled(button == mSendmailButton);
1148 void EmailPrefTab::slotFromAddrChanged(QAbstractButton* button)
1150 mEmailAddress->setEnabled(button == mFromAddrButton);
1151 mAddressChanged =
true;
1154 void EmailPrefTab::slotBccAddrChanged(QAbstractButton* button)
1156 mEmailBccAddress->setEnabled(button == mBccAddrButton);
1157 mBccAddressChanged =
true;
1162 if (mAddressChanged)
1164 mAddressChanged =
false;
1166 if (!errmsg.isEmpty())
1169 if (mBccAddressChanged)
1171 mBccAddressChanged =
false;
1172 return validateAddr(mBccAddressGroup, mEmailBccAddress, i18nc(
"@info/plain",
"No valid 'Bcc' email address is specified."));
1179 QString errmsg = i18nc(
"@info",
"<para>%1</para><para>Are you sure you want to save your changes?</para>", msg);
1185 errmsg = i18nc(
"@info",
"No email address is currently set in KDE System Settings. %1", errmsg);
1188 if (Identities::identitiesExist())
1190 errmsg = i18nc(
"@info",
"No <application>KMail</application> identities currently exist. %1", errmsg);
1192 case Preferences::MAIL_FROM_ADDR:
1193 if (!addr->text().trimmed().isEmpty())
1208 KLocalizedString defsetting = ki18nc(
"@info:whatsthis",
"The default setting for <interface>%1</interface> in the alarm edit dialog.");
1213 topGeneral->setMargin(KDialog::marginHint()/2);
1214 topGeneral->setSpacing(KDialog::spacingHint());
1215 mTabGeneral = mTabs->addTab(topGeneral, i18nc(
"@title:tab",
"General"));
1217 topTypes->setMargin(KDialog::marginHint()/2);
1218 topTypes->setSpacing(KDialog::spacingHint());
1219 mTabTypes = mTabs->addTab(topTypes, i18nc(
"@title:tab",
"Alarm Types"));
1221 topFontColour->setMargin(KDialog::marginHint()/2);
1222 topFontColour->setSpacing(KDialog::spacingHint());
1223 mTabFontColour = mTabs->addTab(topFontColour, i18nc(
"@title:tab",
"Font && Color"));
1228 mCopyToKOrganizer->setMinimumSize(mCopyToKOrganizer->sizeHint());
1234 box->setSpacing(KDialog::spacingHint());
1236 mLateCancel->setMinimumSize(mLateCancel->sizeHint());
1238 box->setStretchFactor(
new QWidget(box), 1);
1242 QHBoxLayout* hlayout =
new QHBoxLayout(iBox);
1243 hlayout->setSpacing(KDialog::spacingHint());
1244 QLabel* label =
new QLabel(i18nc(
"@label:listbox",
"Recurrence:"), iBox);
1245 hlayout->addWidget(label);
1254 mRecurPeriod->setFixedSize(mRecurPeriod->sizeHint());
1255 hlayout->addWidget(mRecurPeriod);
1256 label->setBuddy(mRecurPeriod);
1257 iBox->setWhatsThis(i18nc(
"@info:whatsthis",
"The default setting for the recurrence rule in the alarm edit dialog."));
1258 hlayout->addStretch();
1263 vbox->setSpacing(KDialog::spacingHint());
1264 label =
new QLabel(i18nc(
"@label",
"In non-leap years, repeat yearly February 29th alarms on:"), vbox);
1265 label->setAlignment(Qt::AlignLeft);
1266 label->setWordWrap(
true);
1269 itemBox->setSpacing(2*KDialog::spacingHint());
1272 widget->setFixedWidth(3*KDialog::spacingHint());
1274 radio->setMinimumSize(radio->sizeHint());
1276 radio =
new QRadioButton(i18nc(
"@option:radio",
"March &1st"), itemBox);
1277 radio->setMinimumSize(radio->sizeHint());
1279 radio =
new QRadioButton(i18nc(
"@option:radio",
"Do not repeat"), itemBox);
1280 radio->setMinimumSize(radio->sizeHint());
1282 itemBox->setFixedHeight(itemBox->sizeHint().height());
1283 vbox->setWhatsThis(i18nc(
"@info:whatsthis",
1284 "For yearly recurrences, choose what date, if any, alarms due on February 29th should occur in non-leap years."
1285 "<note>The next scheduled occurrence of existing alarms is not re-evaluated when you change this setting.</note>"));
1287 QVBoxLayout* lay = qobject_cast<QVBoxLayout*>(topGeneral->layout());
1293 QVBoxLayout* vlayout =
new QVBoxLayout(group);
1294 vlayout->setMargin(KDialog::marginHint());
1295 vlayout->setSpacing(KDialog::spacingHint());
1298 mConfirmAck->setMinimumSize(mConfirmAck->sizeHint());
1300 vlayout->addWidget(mConfirmAck, 0, Qt::AlignLeft);
1303 mAutoClose->setMinimumSize(mAutoClose->sizeHint());
1305 vlayout->addWidget(mAutoClose, 0, Qt::AlignLeft);
1307 box =
new KHBox(group);
1309 box->setSpacing(KDialog::spacingHint());
1310 vlayout->addWidget(box);
1311 label =
new QLabel(i18nc(
"@label:listbox",
"Reminder units:"), box);
1315 mReminderUnits->setFixedSize(mReminderUnits->sizeHint());
1316 label->setBuddy(mReminderUnits);
1317 box->setWhatsThis(i18nc(
"@info:whatsthis",
"The default units for the reminder in the alarm edit dialog, for alarms due soon."));
1318 box->setStretchFactor(
new QWidget(box), 1);
1321 mSpecialActionsButton->setFixedSize(mSpecialActionsButton->sizeHint());
1324 QGroupBox* bbox =
new QGroupBox(i18nc(
"@title:group Audio options group",
"Sound"), topTypes);
1325 vlayout =
new QVBoxLayout(bbox);
1326 vlayout->setMargin(KDialog::marginHint());
1327 vlayout->setSpacing(KDialog::spacingHint());
1329 hlayout =
new QHBoxLayout();
1330 hlayout->setMargin(0);
1331 vlayout->addLayout(hlayout);
1336 if (
theApp()->speechEnabled())
1338 mSound->setMinimumSize(mSound->sizeHint());
1340 hlayout->addWidget(mSound);
1341 hlayout->addStretch();
1343 mSoundRepeat =
new QCheckBox(i18nc(
"@option:check",
"Repeat sound file"), bbox);
1344 mSoundRepeat->setMinimumSize(mSoundRepeat->sizeHint());
1345 mSoundRepeat->setWhatsThis(
1346 i18nc(
"@info:whatsthis sound file 'Repeat' checkbox",
"The default setting for sound file <interface>%1</interface> in the alarm edit dialog.",
SoundWidget::i18n_chk_Repeat()));
1347 hlayout->addWidget(mSoundRepeat);
1349 box =
new KHBox(bbox);
1351 box->setSpacing(KDialog::spacingHint());
1352 mSoundFileLabel =
new QLabel(i18nc(
"@label:textbox",
"Sound file:"), box);
1354 mSoundFileLabel->setBuddy(mSoundFile);
1356 mSoundFileBrowse->setIcon(KIcon(SmallIcon(QLatin1String(
"document-open"))));
1357 int size = mSoundFileBrowse->sizeHint().height();
1358 mSoundFileBrowse->setFixedSize(size, size);
1359 connect(mSoundFileBrowse, SIGNAL(clicked()), SLOT(slotBrowseSoundFile()));
1360 mSoundFileBrowse->setToolTip(i18nc(
"@info:tooltip",
"Choose a sound file"));
1361 box->setWhatsThis(i18nc(
"@info:whatsthis",
"Enter the default sound file to use in the alarm edit dialog."));
1362 box->setFixedHeight(box->sizeHint().height());
1363 vlayout->addWidget(box);
1364 bbox->setFixedHeight(bbox->sizeHint().height());
1367 group =
new QGroupBox(i18nc(
"@title:group",
"Command Alarms"), topTypes);
1368 vlayout =
new QVBoxLayout(group);
1369 vlayout->setMargin(KDialog::marginHint());
1370 vlayout->setSpacing(KDialog::spacingHint());
1371 hlayout =
new QHBoxLayout();
1372 hlayout->setMargin(0);
1373 vlayout->addLayout(hlayout);
1376 mCmdScript->setMinimumSize(mCmdScript->sizeHint());
1378 hlayout->addWidget(mCmdScript);
1379 hlayout->addStretch();
1382 mCmdXterm->setMinimumSize(mCmdXterm->sizeHint());
1384 hlayout->addWidget(mCmdXterm);
1387 group =
new QGroupBox(i18nc(
"@title:group",
"Email Alarms"), topTypes);
1388 vlayout =
new QVBoxLayout(group);
1389 vlayout->setMargin(KDialog::marginHint());
1390 vlayout->setSpacing(KDialog::spacingHint());
1394 mEmailBcc->setMinimumSize(mEmailBcc->sizeHint());
1396 vlayout->addWidget(mEmailBcc, 0, Qt::AlignLeft);
1398 lay = qobject_cast<QVBoxLayout*>(topTypes->layout());
1403 mFontChooser =
new FontColourChooser(topFontColour, QStringList(), i18nc(
"@title:group",
"Message Font && Color"),
true);
1409 if (allTabs || mTabs->currentIndex() == mTabGeneral)
1422 default: index = 0;
break;
1424 mRecurPeriod->setCurrentIndex(index);
1427 if (allTabs || mTabs->currentIndex() == mTabTypes)
1439 mReminderUnits->setCurrentIndex(index);
1440 KAEvent::ExtraActionOptions opts(0);
1442 opts |= KAEvent::ExecPreActOnDeferral;
1444 opts |= KAEvent::CancelOnPreActError;
1446 opts |= KAEvent::DontShowPreActError;
1455 if (allTabs || mTabs->currentIndex() == mTabFontColour)
1465 bool b = mAutoClose->isChecked();
1468 b = mConfirmAck->isChecked();
1472 switch (mReminderUnits->currentIndex())
1488 KAEvent::ExtraActionOptions opts = mSpecialActionsButton->
options();
1489 b = opts & KAEvent::ExecPreActOnDeferral;
1492 b = opts & KAEvent::CancelOnPreActError;
1495 b = opts & KAEvent::DontShowPreActError;
1499 switch (mSound->currentIndex())
1509 text = mSoundFile->text();
1512 b = mSoundRepeat->isChecked();
1515 b = mCmdScript->isChecked();
1521 b = mEmailBcc->isChecked();
1524 b = mCopyToKOrganizer->isChecked();
1527 int i = mLateCancel->isChecked() ? 1 : 0;
1531 switch (mRecurPeriod->currentIndex())
1547 QColor colour = mFontChooser->
fgColour();
1553 QFont font = mFontChooser->
font();
1559 void EditPrefTab::slotBrowseSoundFile()
1564 mSoundFile->setText(url);
1583 mSoundFile->setFocus();
1584 return i18nc(
"@info",
"You must enter a sound file when <interface>%1</interface> is selected as the default sound type",
SoundPicker::i18n_combo_File());;
1599 topGeneral->setMargin(KDialog::marginHint()/2);
1600 topGeneral->setSpacing(KDialog::spacingHint());
1601 mTabGeneral = mTabs->addTab(topGeneral, i18nc(
"@title:tab",
"General"));
1603 topWindows->setMargin(KDialog::marginHint()/2);
1604 topWindows->setSpacing(KDialog::spacingHint());
1605 mTabWindows = mTabs->addTab(topWindows, i18nc(
"@title:tab",
"Alarm Windows"));
1608 mShowInSystemTray =
new QGroupBox(i18nc(
"@option:check",
"Show in system tray"), topGeneral);
1609 mShowInSystemTray->setCheckable(
true);
1610 mShowInSystemTray->setWhatsThis(
1611 i18nc(
"@info:whatsthis",
"<para>Check to show <application>KAlarm</application>'s icon in the system tray."
1612 " Showing it in the system tray provides easy access and a status indication.</para>"));
1613 QGridLayout* grid =
new QGridLayout(mShowInSystemTray);
1614 grid->setMargin(KDialog::marginHint());
1615 grid->setSpacing(KDialog::spacingHint());
1616 grid->setColumnStretch(1, 1);
1619 mAutoHideSystemTray =
new ButtonGroup(mShowInSystemTray);
1620 connect(mAutoHideSystemTray, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotAutoHideSysTrayChanged(QAbstractButton*)));
1622 QRadioButton* radio =
new QRadioButton(i18nc(
"@option:radio Always show KAlarm icon",
"Always show"), mShowInSystemTray);
1623 mAutoHideSystemTray->
addButton(radio, 0);
1624 radio->setWhatsThis(
1625 i18nc(
"@info:whatsthis",
1626 "Check to show <application>KAlarm</application>'s icon in the system tray "
1627 "regardless of whether alarms are due."));
1628 grid->addWidget(radio, 0, 0, 1, 2, Qt::AlignLeft);
1630 radio =
new QRadioButton(i18nc(
"@option:radio",
"Automatically hide if no active alarms"), mShowInSystemTray);
1631 mAutoHideSystemTray->
addButton(radio, 1);
1632 radio->setWhatsThis(
1633 i18nc(
"@info:whatsthis",
1634 "Check to automatically hide <application>KAlarm</application>'s icon in "
1635 "the system tray if there are no active alarms. When hidden, the icon can "
1636 "always be made visible by use of the system tray option to show hidden icons."));
1637 grid->addWidget(radio, 1, 0, 1, 2, Qt::AlignLeft);
1639 QString
text = i18nc(
"@info:whatsthis",
1640 "Check to automatically hide <application>KAlarm</application>'s icon in the "
1641 "system tray if no alarms are due within the specified time period. When hidden, "
1642 "the icon can always be made visible by use of the system tray option to show hidden icons.");
1643 radio =
new QRadioButton(i18nc(
"@option:radio",
"Automatically hide if no alarm due within time period:"), mShowInSystemTray);
1644 radio->setWhatsThis(text);
1645 mAutoHideSystemTray->
addButton(radio, 2);
1646 grid->addWidget(radio, 2, 0, 1, 2, Qt::AlignLeft);
1647 mAutoHideSystemTrayPeriod =
new TimePeriod(
true, mShowInSystemTray);
1648 mAutoHideSystemTrayPeriod->setWhatsThis(text);
1649 mAutoHideSystemTrayPeriod->setMaximumWidth(mAutoHideSystemTrayPeriod->sizeHint().width());
1650 grid->addWidget(mAutoHideSystemTrayPeriod, 3, 1, 1, 1, Qt::AlignLeft);
1651 mShowInSystemTray->setMaximumHeight(mShowInSystemTray->sizeHint().height());
1654 QGroupBox* group =
new QGroupBox(i18nc(
"@title:group",
"System Tray Tooltip"), topGeneral);
1655 grid =
new QGridLayout(group);
1656 grid->setMargin(KDialog::marginHint());
1657 grid->setSpacing(KDialog::spacingHint());
1658 grid->setColumnStretch(2, 1);
1662 mTooltipShowAlarms =
new QCheckBox(i18nc(
"@option:check",
"Show next &24 hours' alarms"), group);
1663 mTooltipShowAlarms->setMinimumSize(mTooltipShowAlarms->sizeHint());
1664 connect(mTooltipShowAlarms, SIGNAL(toggled(
bool)), SLOT(slotTooltipAlarmsToggled(
bool)));
1665 mTooltipShowAlarms->setWhatsThis(
1666 i18nc(
"@info:whatsthis",
"Specify whether to include in the system tray tooltip, a summary of alarms due in the next 24 hours."));
1667 grid->addWidget(mTooltipShowAlarms, 0, 0, 1, 3, Qt::AlignLeft);
1671 box->setSpacing(KDialog::spacingHint());
1672 mTooltipMaxAlarms =
new QCheckBox(i18nc(
"@option:check",
"Maximum number of alarms to show:"), box);
1673 mTooltipMaxAlarms->setMinimumSize(mTooltipMaxAlarms->sizeHint());
1674 connect(mTooltipMaxAlarms, SIGNAL(toggled(
bool)), SLOT(slotTooltipMaxToggled(
bool)));
1675 mTooltipMaxAlarmCount =
new SpinBox(1, 99, box);
1676 mTooltipMaxAlarmCount->setSingleShiftStep(5);
1677 mTooltipMaxAlarmCount->setMinimumSize(mTooltipMaxAlarmCount->sizeHint());
1679 i18nc(
"@info:whatsthis",
"Uncheck to display all of the next 24 hours' alarms in the system tray tooltip. "
1680 "Check to enter an upper limit on the number to be displayed."));
1681 grid->addWidget(box, 1, 1, 1, 2, Qt::AlignLeft);
1684 mTooltipShowTime->setMinimumSize(mTooltipShowTime->sizeHint());
1685 connect(mTooltipShowTime, SIGNAL(toggled(
bool)), SLOT(slotTooltipTimeToggled(
bool)));
1686 mTooltipShowTime->setWhatsThis(i18nc(
"@info:whatsthis",
"Specify whether to show in the system tray tooltip, the time at which each alarm is due."));
1687 grid->addWidget(mTooltipShowTime, 2, 1, 1, 2, Qt::AlignLeft);
1690 mTooltipShowTimeTo->setMinimumSize(mTooltipShowTimeTo->sizeHint());
1691 connect(mTooltipShowTimeTo, SIGNAL(toggled(
bool)), SLOT(slotTooltipTimeToToggled(
bool)));
1692 mTooltipShowTimeTo->setWhatsThis(i18nc(
"@info:whatsthis",
"Specify whether to show in the system tray tooltip, how long until each alarm is due."));
1693 grid->addWidget(mTooltipShowTimeTo, 3, 1, 1, 2, Qt::AlignLeft);
1695 box =
new KHBox(group);
1697 box->setSpacing(KDialog::spacingHint());
1698 mTooltipTimeToPrefixLabel =
new QLabel(i18nc(
"@label:textbox",
"Prefix:"), box);
1699 mTooltipTimeToPrefix =
new KLineEdit(box);
1700 mTooltipTimeToPrefixLabel->setBuddy(mTooltipTimeToPrefix);
1701 box->setWhatsThis(i18nc(
"@info:whatsthis",
"Enter the text to be displayed in front of the time until the alarm, in the system tray tooltip."));
1702 box->setFixedHeight(box->sizeHint().height());
1703 grid->addWidget(box, 4, 2, Qt::AlignLeft);
1704 group->setMaximumHeight(group->sizeHint().height());
1706 group =
new QGroupBox(i18nc(
"@title:group",
"Alarm List"), topGeneral);
1707 QHBoxLayout* hlayout =
new QHBoxLayout(group);
1708 hlayout->setMargin(KDialog::marginHint());
1709 QVBoxLayout* colourLayout =
new QVBoxLayout();
1710 colourLayout->setMargin(0);
1711 hlayout->addLayout(colourLayout);
1713 box =
new KHBox(group);
1715 box->setSpacing(KDialog::spacingHint()/2);
1716 colourLayout->addWidget(box);
1717 QLabel* label1 =
new QLabel(i18nc(
"@label:listbox",
"Disabled alarm color:"), box);
1718 box->setStretchFactor(
new QWidget(box), 0);
1720 label1->setBuddy(mDisabledColour);
1721 box->setWhatsThis(i18nc(
"@info:whatsthis",
"Choose the text color in the alarm list for disabled alarms."));
1723 box =
new KHBox(group);
1725 box->setSpacing(KDialog::spacingHint()/2);
1726 colourLayout->addWidget(box);
1727 QLabel* label2 =
new QLabel(i18nc(
"@label:listbox",
"Archived alarm color:"), box);
1728 box->setStretchFactor(
new QWidget(box), 0);
1730 label2->setBuddy(mArchivedColour);
1731 box->setWhatsThis(i18nc(
"@info:whatsthis",
"Choose the text color in the alarm list for archived alarms."));
1732 hlayout->addStretch();
1734 QVBoxLayout* lay = qobject_cast<QVBoxLayout*>(topGeneral->layout());
1738 group =
new QGroupBox(i18nc(
"@title:group",
"Alarm Message Windows"), topWindows);
1739 grid =
new QGridLayout(group);
1740 grid->setMargin(KDialog::marginHint());
1741 grid->setSpacing(KDialog::spacingHint());
1742 grid->setColumnStretch(1, 1);
1745 connect(mWindowPosition, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotWindowPosChanged(QAbstractButton*)));
1747 QString whatsthis = i18nc(
"@info:whatsthis",
1748 "<para>Choose how to reduce the chance of alarm messages being accidentally acknowledged:"
1749 "<list><item>Position alarm message windows as far as possible from the current mouse cursor location, or</item>"
1750 "<item>Position alarm message windows in the center of the screen, but disable buttons for a short time after the window is displayed.</item></list></para>");
1751 radio =
new QRadioButton(i18nc(
"@option:radio",
"Position windows far from mouse cursor"), group);
1753 radio->setWhatsThis(whatsthis);
1754 grid->addWidget(radio, 0, 0, 1, 2, Qt::AlignLeft);
1755 radio =
new QRadioButton(i18nc(
"@option:radio",
"Center windows, delay activating window buttons"), group);
1757 radio->setWhatsThis(whatsthis);
1758 grid->addWidget(radio, 1, 0, 1, 2, Qt::AlignLeft);
1761 itemBox->setMargin(0);
1762 box =
new KHBox(itemBox);
1764 box->setSpacing(KDialog::spacingHint());
1765 mWindowButtonDelayLabel =
new QLabel(i18nc(
"@label:spinbox",
"Button activation delay (seconds):"), box);
1766 mWindowButtonDelay =
new QSpinBox(box);
1767 mWindowButtonDelay->setRange(1, 10);
1768 mWindowButtonDelayLabel->setBuddy(mWindowButtonDelay);
1769 box->setWhatsThis(i18nc(
"@info:whatsthis",
1770 "Enter how long its buttons should remain disabled after the alarm message window is shown."));
1771 itemBox->setStretchFactor(
new QWidget(itemBox), 1);
1772 grid->addWidget(itemBox, 2, 1, Qt::AlignLeft);
1774 grid->setRowMinimumHeight(3, KDialog::spacingHint());
1776 mModalMessages =
new QCheckBox(i18nc(
"@option:check",
"Message windows have a title bar and take keyboard focus"), group);
1777 mModalMessages->setMinimumSize(mModalMessages->sizeHint());
1778 mModalMessages->setWhatsThis(i18nc(
"@info:whatsthis",
1779 "<para>Specify the characteristics of alarm message windows:"
1780 "<list><item>If checked, the window is a normal window with a title bar, which grabs keyboard input when it is displayed.</item>"
1781 "<item>If unchecked, the window does not interfere with your typing when "
1782 "it is displayed, but it has no title bar and cannot be moved or resized.</item></list></para>"));
1783 grid->addWidget(mModalMessages, 4, 0, 1, 2, Qt::AlignLeft);
1785 lay = qobject_cast<QVBoxLayout*>(topWindows->layout());
1792 if (allTabs || mTabs->currentIndex() == mTabGeneral)
1799 case -1:
id = 1;
break;
1800 case 0:
id = 0;
break;
1812 Duration duration((secs ? secs : days), (secs ? Duration::Seconds : Duration::Days));
1813 mAutoHideSystemTrayPeriod->
setPeriod(duration,
false, units);
1825 if (allTabs || mTabs->currentIndex() == mTabWindows)
1835 QColor colour = mDisabledColour->color();
1838 colour = mArchivedColour->color();
1841 int n = mTooltipShowAlarms->isChecked() ? -1 : 0;
1842 if (n && mTooltipMaxAlarms->isChecked())
1843 n = mTooltipMaxAlarmCount->value();
1846 bool b = mTooltipShowTime->isChecked();
1849 b = mTooltipShowTimeTo->isChecked();
1852 QString
text = mTooltipTimeToPrefix->text();
1855 b = mShowInSystemTray->isChecked();
1862 case 0: n = 0;
break;
1863 case 1: n = -1;
break;
1865 n = mAutoHideSystemTrayPeriod->
period().asSeconds() / 60;
1873 n = mWindowButtonDelay->value();
1876 b = mModalMessages->isChecked();
1882 void ViewPrefTab::setTooltip(
int maxAlarms,
bool time,
bool timeTo,
const QString& prefix)
1889 mTooltipShowAlarms->blockSignals(
true);
1890 mTooltipShowTime->blockSignals(
true);
1891 mTooltipShowTimeTo->blockSignals(
true);
1893 mTooltipShowAlarms->setChecked(maxAlarms);
1894 mTooltipMaxAlarms->setChecked(maxAlarms > 0);
1895 mTooltipMaxAlarmCount->setValue(maxAlarms > 0 ? maxAlarms : 1);
1896 mTooltipShowTime->setChecked(time);
1897 mTooltipShowTimeTo->setChecked(timeTo);
1898 mTooltipTimeToPrefix->setText(prefix);
1900 mTooltipShowAlarms->blockSignals(
false);
1901 mTooltipShowTime->blockSignals(
false);
1902 mTooltipShowTimeTo->blockSignals(
false);
1905 slotTooltipTimeToToggled(timeTo);
1906 slotTooltipAlarmsToggled(maxAlarms);
1909 void ViewPrefTab::slotTooltipAlarmsToggled(
bool on)
1911 mTooltipMaxAlarms->setEnabled(on);
1912 mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isChecked());
1913 mTooltipShowTime->setEnabled(on);
1914 mTooltipShowTimeTo->setEnabled(on);
1915 on = on && mTooltipShowTimeTo->isChecked();
1916 mTooltipTimeToPrefix->setEnabled(on);
1917 mTooltipTimeToPrefixLabel->setEnabled(on);
1920 void ViewPrefTab::slotTooltipMaxToggled(
bool on)
1922 mTooltipMaxAlarmCount->setEnabled(on && mTooltipMaxAlarms->isEnabled());
1925 void ViewPrefTab::slotTooltipTimeToggled(
bool on)
1927 if (!on && !mTooltipShowTimeTo->isChecked())
1928 mTooltipShowTimeTo->setChecked(
true);
1931 void ViewPrefTab::slotTooltipTimeToToggled(
bool on)
1933 if (!on && !mTooltipShowTime->isChecked())
1934 mTooltipShowTime->setChecked(
true);
1935 on = on && mTooltipShowTimeTo->isEnabled();
1936 mTooltipTimeToPrefix->setEnabled(on);
1937 mTooltipTimeToPrefixLabel->setEnabled(on);
1940 void ViewPrefTab::slotAutoHideSysTrayChanged(QAbstractButton* button)
1942 mAutoHideSystemTrayPeriod->setEnabled(mAutoHideSystemTray->
id(button) == 2);
1945 void ViewPrefTab::slotWindowPosChanged(QAbstractButton* button)
1947 bool enable = mWindowPosition->
id(button);
1948 mWindowButtonDelay->setEnabled(enable);
1949 mWindowButtonDelayLabel->setEnabled(enable);
static int defaultDeferTime()
Get Default defer time interval.
void addAlignedLabel(QLabel *)
static void setMessageFont(const QFont &v)
Set Message font.
static CmdLogType defaultCmdLogType()
Get Command output.
static void setEmailAddress(MailFrom, const QString &address)
static int questionYesNoCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|WindowModal))
static void setDefaultCmdScript(bool v)
Set Enter script.
virtual void restore(bool defaults, bool allTabs)
static int messageButtonDelay()
Get Delay before message window buttons are enabled.
static void setCmdXTermCommand(const QString &cmd)
static Akonadi::Collection getStandard(CalEvent::Type, bool useDefault=false)
Return the standard collection for a specified mime type.
static bool defaultCopyToKOrganizer()
Get Show in KOrganizer.
static QString i18n_combo_AtLogin()
static void setDefaultCmdLogType(CmdLogType v)
Set Command output.
static QString controlCentreAddress()
static MailClient emailClient()
Get Email client.
static void setStartOfDay(const QTime &)
static QString i18n_chk_EnterScript()
static QString i18n_chk_ConfirmAck()
KCal::Duration period() const
static void setArchivedKeepDays(int v)
Set Days to keep expired alarms.
static QString i18n_chk_CopyEmailToSelf()
virtual void restore(bool defaults, bool allTabs)
void setPeriod(const KCal::Duration &period, bool dateOnly, Units defaultUnits)
static void setWorkDayStart(const QTime &t)
static void setShowTooltipTimeToAlarm(bool v)
Set Show time to alarms in system tray tooltip.
QString weekDayName(int day, const KLocale *)
static QColor defaultBgColour()
Get Background color.
static QString i18n_chk_CancelIfLate()
QVBoxLayout * topLayout() const
static void setAutoStartChangedByUser(bool c)
virtual QByteArray text(quint32 serialNumber) const =0
StorePrefTab * mStorePage
KPageWidgetItem * mEditPageItem
static void setConfirmAlarmDeletion(bool yes)
static void setTimeZone(const KTimeZone &)
static void setMessageButtonDelay(int v)
Set Delay before message window buttons are enabled.
EmailPrefTab * mEmailPage
virtual void apply(bool syncToDisc)
int localeDayInWeek_to_weekDay(int index)
virtual void resizeEvent(QResizeEvent *)
static Feb29Type defaultFeb29Type()
Get In non-leap years, repeat yearly February 29th alarms on:
static QString i18n_sent_mail()
static QString i18n_label_Sound()
static int kOrgEventDuration()
Get KOrganizer event duration.
virtual void restore(bool defaults, bool allTabs)
static int autoHideSystemTray()
Get Auto-hide in system tray if no alarms due within period.
static QString defaultPreAction()
Get Pre-alarm action.
static void setEmailQueuedNotify(bool yes)
static void setDefaultSoundRepeat(bool v)
Set Repeat sound file.
static void setWorkDayEnd(const QTime &t)
static QString i18n_combo_Speak()
static void setArchivedColour(const QColor &v)
Set Archived alarm color.
static void setTooltipAlarmCount(int v)
Set Number of alarms to show in system tray tooltip.
static void setAskAutoStart(bool yes)
static bool defaultSoundRepeat()
Get Repeat sound file.
static QString browseFile(QString &initialDir, const QString &initialFile=QString())
Display a dialog to choose a sound file, initially highlighting initialFile if non-null.
static void setAutoStart(bool v)
Set Start at login.
static SoundType defaultSoundType()
Get Sound.
static QString i18n_combo_NoRecur()
static QFont messageFont()
Get Message font.
static int archivedKeepDays()
Get Days to keep expired alarms.
KVBox * topWidget() const
static void setDefaultSoundFile(const QString &v)
Set Sound file.
KTimeZone timeZone() const
static bool showTooltipAlarmTime()
Get Show alarm times in system tray tooltip.
static void setShowInSystemTray(bool v)
Set Show in system tray.
virtual void apply(bool syncToDisc)
static void setTooltipTimeToPrefix(const QString &v)
Set Time-to-alarm prefix in system tray tooltip.
the KAlarm application object
static QString defaultPostAction()
Get Post-alarm action.
KPageWidgetItem * mViewPageItem
virtual void restore(bool defaults, bool allTabs)
PrefsTabBase(StackedScrollGroup *)
virtual void restore(bool defaults, bool allTabs)
static QString i18n_combo_Daily()
virtual void apply(bool syncToDisc)=0
static QTime startOfDay()
static bool autoStart()
Get Start at login.
KPageWidgetItem * mEmailPageItem
static QString cmdXTermCommand()
virtual QSize sizeHint() const
static bool defaultAutoClose()
Get Auto-close window after late-cancellation time.
static void setHolidayRegion(const QString ®ionCode)
virtual bool useDefaults(bool def)
static MailFrom emailBccFrom()
void setFgColour(const QColor &)
static KTimeZone timeZone(bool reload=false)
EmailPrefTab(StackedScrollGroup *)
static bool showTooltipTimeToAlarm()
Get Show time to alarms in system tray tooltip.
static QColor disabledColour()
Get Disabled alarm color.
static void setDefaultLateCancel(int v)
Set Cancel if late (minutes)
ViewPrefTab(StackedScrollGroup *)
static QString i18n_combo_HourlyMinutely()
virtual void apply(bool syncToDisc)
static void setDefaultConfirmAck(bool v)
Set Confirm acknowledgement.
static QString i18n_combo_None()
static void setModalMessages(bool v)
Set Message windows have a title bar and take keyboard focus.
static QString i18n_NeedFromEmailAddress()
static QString i18n_chk_AutoCloseWin()
static void setEmailClient(MailClient v)
Set Email client.
static void setDefaultPostAction(const QString &v)
Set Post-alarm action.
static bool askResource()
Get Prompt for which calendar to store in.
void setFont(const QFont &, bool onlyFixed=false)
static QString i18n_combo_Monthly()
static bool emailCopyToKMail()
MiscPrefTab(StackedScrollGroup *)
virtual void restore(bool defaults, bool allTabs)
KPageWidgetItem * mTimePageItem
static void setDefaultRecurPeriod(RecurType v)
Set Recurrence period.
static TimePeriod::Units defaultReminderUnits()
Get Reminder units.
static bool defaultExecPreActionOnDeferral()
Get Execute pre-alarm action for deferred alarms.
static QTime workDayEnd()
static void setDefaultFgColour(const QColor &v)
Set Foreground color.
virtual void showEvent(QShowEvent *)
static void setAskResource(bool v)
Set Prompt for which calendar to store in.
static void setDefaultExecPreActionOnDeferral(bool v)
Set Execute pre-alarm action for deferred alarms.
static void setDefaultDeferTime(int v)
Set Default defer time interval.
static bool defaultDontShowPreActionError()
Get Do not notify pre-alarm action errors.
static void setQuitWarn(bool yes)
StorePrefTab(StackedScrollGroup *)
virtual void setValue(int minutes)
static const KHolidays::HolidayRegion & holidays()
static Akonadi::Collection::List enabledCollections(CalEvent::Type, bool writable)
Return the enabled collections which contain a specified mime type.
static QColor archivedColour()
Get Archived alarm color.
static int defaultLateCancel()
Get Cancel if late (minutes)
virtual void showEvent(QShowEvent *)
static QBitArray workDays()
static void setKOrgEventDuration(int v)
Set KOrganizer event duration.
static void setDefaultPreAction(const QString &v)
Set Pre-alarm action.
static void setWorkDays(const QBitArray &)
static void setDefaultSoundType(SoundType v)
Set Sound.
static int warningContinueCancel(QWidget *parent, ButtonCode defaultButton, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const QString &dontAskAgainName=QString())
TimePrefTab(StackedScrollGroup *)
static bool defaultConfirmAck()
Get Confirm acknowledgement.
static QString emailBccAddress()
void setTimeZone(const KTimeZone &tz)
static QString i18n_radio_ExecInTermWindow()
static int warningYesNo(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous|WindowModal))
static void setEmailCopyToKMail(bool yes)
static bool defaultCancelOnPreActionError()
Get Cancel alarm on pre-alarm action error.
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Options(Notify|WindowModal))
static QString i18n_chk_AutoCloseWinLC()
KPageWidgetItem * mStorePageItem
virtual void setValue(int minutes)
static QColor defaultFgColour()
Get Foreground color.
static QString emailAddress()
EditPrefTab(StackedScrollGroup *)
virtual void slotDefault()
static bool defaultEmailBcc()
Get Copy email to self.
static QString i18n_chk_ShowAlarmTime()
static bool modalMessages()
Get Message windows have a title bar and take keyboard focus.
static int tooltipAlarmCount()
Get Number of alarms to show in system tray tooltip.
virtual QSize minimumSizeHint() const
virtual void apply(bool syncToDisc)
static QString xtermCommands[]
static void setDefaultDontShowPreActionError(bool v)
Set Do not notify pre-alarm action errors.
static void setShowTooltipAlarmTime(bool v)
Set Show alarm times in system tray tooltip.
static void setAutoHideSystemTray(int v)
Set Auto-hide in system tray if no alarms due within period.
void setBgColour(const QColor &)
static QString i18n_combo_Beep()
virtual void apply(bool syncToDisc)
static void setDefaultCancelOnPreActionError(bool v)
Set Cancel alarm on pre-alarm action error.
static void setEmailBccAddress(bool useSystemSettings, const QString &address)
static Preferences * self()
static QString defaultSoundFile()
Get Sound file.
static bool showInSystemTray()
Get Show in system tray.
virtual void slotCancel()
static void setDefaultBgColour(const QColor &v)
Set Background color.
static QString i18n_chk_ShowInKOrganizer()
static QString shiftWhatsThis()
static QString i18n_combo_Yearly()
static void setDefaultEmailBcc(bool v)
Set Copy email to self.
static bool confirmAlarmDeletion()
static QString i18n_combo_File()
static bool defaultCmdScript()
Get Enter script.
static QString i18n_combo_Weekly()
static void setDefaultReminderUnits(TimePeriod::Units v)
Set Reminder units.
static void setDisabledColour(const QColor &v)
Set Disabled alarm color.
static void setNoAutoStart(bool v)
Set Suppress autostart at login.
static const char PREF_DIALOG_NAME[]
static QString i18n_chk_ExecInTermWindow()
static void setDefaultCopyToKOrganizer(bool v)
Set Show in KOrganizer.
static void setDefaultAutoClose(bool v)
Set Auto-close window after late-cancellation time.
static void setDefaultFeb29Type(Feb29Type v)
Set In non-leap years, repeat yearly February 29th alarms on:
static RecurType defaultRecurPeriod()
Get Recurrence period.
static QString tooltipTimeToPrefix()
Get Time-to-alarm prefix in system tray tooltip.
static QTime workDayStart()
static QString i18n_chk_ShowTimeToAlarm()
KPageWidgetItem * mMiscPageItem
static bool emailQueuedNotify()
static MailFrom emailFrom()
virtual void apply(bool syncToDisc)