25 #include "recurrenceedit.moc" 
   26 #include "recurrenceedit_p.moc" 
   41 #include <kalarmcal/kaevent.h> 
   42 #include <kalarmcal/karecurrence.h> 
   45 #include <kcalcore/event.h> 
   46 using namespace KCalCore;
 
   48 #include <kcal/event.h> 
   54 #include <kcalendarsystem.h> 
   55 #include <kiconloader.h> 
   57 #include <kmessagebox.h> 
   59 #include <kdatecombobox.h> 
   61 #include <QPushButton> 
   63 #include <QStackedWidget> 
   64 #include <QListWidget> 
   66 #include <QGridLayout> 
   67 #include <QHBoxLayout> 
   68 #include <QVBoxLayout> 
   69 #include <QtAlgorithms> 
   76         virtual QSize sizeHint()
 const  { 
return minimumSizeHint(); }
 
   93       mRuleButtonType(INVALID_RECUR),
 
   98       mNoEmitTypeChanged(true),
 
  102     QVBoxLayout* topLayout = 
new QVBoxLayout(
this);
 
  103     topLayout->setMargin(0);
 
  104     topLayout->setSpacing(KDialog::spacingHint());
 
  113     QGroupBox* recurGroup = 
new QGroupBox(i18nc(
"@title:group", 
"Recurrence Rule"), 
this);
 
  114     topLayout->addWidget(recurGroup);
 
  115     QHBoxLayout* hlayout = 
new QHBoxLayout(recurGroup);
 
  116     hlayout->setMargin(KDialog::marginHint());
 
  117     hlayout->setSpacing(KDialog::marginHint());   
 
  120     QVBoxLayout* vlayout = 
new QVBoxLayout();
 
  121     vlayout->setSpacing(0);
 
  122     vlayout->setMargin(0);
 
  123     hlayout->addLayout(vlayout);
 
  125     connect(mRuleButtonGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(periodClicked(QAbstractButton*)));
 
  126     connect(mRuleButtonGroup, SIGNAL(buttonSet(QAbstractButton*)), SIGNAL(
contentsChanged()));
 
  129     mNoneButton->setFixedSize(mNoneButton->sizeHint());
 
  131     mNoneButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Do not repeat the alarm"));
 
  132     mRuleButtonGroup->
addButton(mNoneButton);
 
  133     vlayout->addWidget(mNoneButton);
 
  136     mAtLoginButton->setFixedSize(mAtLoginButton->sizeHint());
 
  138     mAtLoginButton->setWhatsThis(i18nc(
"@info:whatsthis",
 
  139                                       "<para>Trigger the alarm at the specified date/time and at every login until then.</para>" 
  140                                       "<para>Note that it will also be triggered any time <application>KAlarm</application> is restarted.</para>"));
 
  141     mRuleButtonGroup->
addButton(mAtLoginButton);
 
  142     vlayout->addWidget(mAtLoginButton);
 
  145     mSubDailyButton->setFixedSize(mSubDailyButton->sizeHint());
 
  147     mSubDailyButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm at hourly/minutely intervals"));
 
  148     mRuleButtonGroup->
addButton(mSubDailyButton);
 
  149     vlayout->addWidget(mSubDailyButton);
 
  152     mDailyButton->setFixedSize(mDailyButton->sizeHint());
 
  154     mDailyButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm at daily intervals"));
 
  155     mRuleButtonGroup->
addButton(mDailyButton);
 
  156     vlayout->addWidget(mDailyButton);
 
  159     mWeeklyButton->setFixedSize(mWeeklyButton->sizeHint());
 
  161     mWeeklyButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm at weekly intervals"));
 
  162     mRuleButtonGroup->
addButton(mWeeklyButton);
 
  163     vlayout->addWidget(mWeeklyButton);
 
  166     mMonthlyButton->setFixedSize(mMonthlyButton->sizeHint());
 
  168     mMonthlyButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm at monthly intervals"));
 
  169     mRuleButtonGroup->
addButton(mMonthlyButton);
 
  170     vlayout->addWidget(mMonthlyButton);
 
  173     mYearlyButton->setFixedSize(mYearlyButton->sizeHint());
 
  175     mYearlyButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm at annual intervals"));
 
  176     mRuleButtonGroup->
addButton(mYearlyButton);
 
  177     vlayout->addWidget(mYearlyButton);
 
  178     vlayout->addStretch();    
 
  181     mSubRepetition = 
new RepetitionButton(i18nc(
"@action:button", 
"Sub-Repetition"), 
true, recurGroup);
 
  182     mSubRepetition->setFixedSize(mSubRepetition->sizeHint());
 
  184     mSubRepetition->setWhatsThis(i18nc(
"@info:whatsthis",
 
  185                                        "Set up a repetition within the recurrence, to trigger the alarm multiple times each time the recurrence is due."));
 
  189     vlayout->addSpacing(KDialog::spacingHint());
 
  190     vlayout->addWidget(mSubRepetition);
 
  193     vlayout = 
new QVBoxLayout();
 
  194     vlayout->setMargin(0);
 
  195     hlayout->addLayout(vlayout);
 
  197     divider->setFrameStyle(QFrame::VLine | QFrame::Sunken);
 
  198     vlayout->addWidget(divider, 1);
 
  201     mRuleStack = 
new QStackedWidget(recurGroup);
 
  202     hlayout->addWidget(mRuleStack);
 
  203     hlayout->addStretch(1);
 
  204     mNoRule       = 
new NoRule(mRuleStack);
 
  205     mSubDailyRule = 
new SubDailyRule(mReadOnly, mRuleStack);
 
  206     mDailyRule    = 
new DailyRule(mReadOnly, mRuleStack);
 
  207     mWeeklyRule   = 
new WeeklyRule(mReadOnly, mRuleStack);
 
  208     mMonthlyRule  = 
new MonthlyRule(mReadOnly, mRuleStack);
 
  209     mYearlyRule   = 
new YearlyRule(mReadOnly, mRuleStack);
 
  222     mRuleStack->addWidget(mNoRule);
 
  223     mRuleStack->addWidget(mSubDailyRule);
 
  224     mRuleStack->addWidget(mDailyRule);
 
  225     mRuleStack->addWidget(mWeeklyRule);
 
  226     mRuleStack->addWidget(mMonthlyRule);
 
  227     mRuleStack->addWidget(mYearlyRule);
 
  228     hlayout->addSpacing(KDialog::marginHint());
 
  233     mRangeButtonBox = 
new QGroupBox(i18nc(
"@title:group", 
"Recurrence End"), 
this);
 
  234     topLayout->addWidget(mRangeButtonBox);
 
  235     mRangeButtonGroup = 
new ButtonGroup(mRangeButtonBox);
 
  236     connect(mRangeButtonGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(rangeTypeClicked()));
 
  237     connect(mRangeButtonGroup, SIGNAL(buttonSet(QAbstractButton*)), SIGNAL(
contentsChanged()));
 
  239     vlayout = 
new QVBoxLayout(mRangeButtonBox);
 
  240     vlayout->setMargin(KDialog::marginHint());
 
  241     vlayout->setSpacing(KDialog::spacingHint());
 
  242     mNoEndDateButton = 
new RadioButton(i18nc(
"@option:radio", 
"No end"), mRangeButtonBox);
 
  243     mNoEndDateButton->setFixedSize(mNoEndDateButton->sizeHint());
 
  245     mNoEndDateButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm indefinitely"));
 
  246     mRangeButtonGroup->
addButton(mNoEndDateButton);
 
  247     vlayout->addWidget(mNoEndDateButton, 1, Qt::AlignLeft);
 
  248     QSize size = mNoEndDateButton->size();
 
  250     hlayout = 
new QHBoxLayout();
 
  251     hlayout->setMargin(0);
 
  252     vlayout->addLayout(hlayout);
 
  253     mRepeatCountButton = 
new RadioButton(i18nc(
"@option:radio", 
"End after:"), mRangeButtonBox);
 
  255     mRepeatCountButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm for the number of times specified"));
 
  256     mRangeButtonGroup->
addButton(mRepeatCountButton);
 
  257     mRepeatCountEntry = 
new SpinBox(1, 9999, mRangeButtonBox);
 
  258     mRepeatCountEntry->setFixedSize(mRepeatCountEntry->sizeHint());
 
  259     mRepeatCountEntry->setSingleShiftStep(10);
 
  260     mRepeatCountEntry->setSelectOnStep(
false);
 
  261     mRepeatCountEntry->setReadOnly(mReadOnly);
 
  262     mRepeatCountEntry->setWhatsThis(i18nc(
"@info:whatsthis", 
"Enter the total number of times to trigger the alarm"));
 
  263     connect(mRepeatCountEntry, SIGNAL(valueChanged(
int)), SLOT(repeatCountChanged(
int)));
 
  264     connect(mRepeatCountEntry, SIGNAL(valueChanged(
int)), SIGNAL(
contentsChanged()));
 
  266     mRepeatCountLabel = 
new QLabel(i18nc(
"@label", 
"occurrence(s)"), mRangeButtonBox);
 
  267     mRepeatCountLabel->setFixedSize(mRepeatCountLabel->sizeHint());
 
  268     hlayout->addWidget(mRepeatCountButton);
 
  269     hlayout->addSpacing(KDialog::spacingHint());
 
  270     hlayout->addWidget(mRepeatCountEntry);
 
  271     hlayout->addWidget(mRepeatCountLabel);
 
  272     hlayout->addStretch();
 
  273     size = size.expandedTo(mRepeatCountButton->sizeHint());
 
  275     hlayout = 
new QHBoxLayout();
 
  276     hlayout->setMargin(0);
 
  277     vlayout->addLayout(hlayout);
 
  278     mEndDateButton = 
new RadioButton(i18nc(
"@option:radio", 
"End by:"), mRangeButtonBox);
 
  280     mEndDateButton->setWhatsThis(
 
  281           i18nc(
"@info:whatsthis", 
"<para>Repeat the alarm until the date/time specified.</para>" 
  282                 "<para><note>This applies to the main recurrence only. It does not limit any sub-repetition which will occur regardless after the last main recurrence.</note></para>"));
 
  283     mRangeButtonGroup->
addButton(mEndDateButton);
 
  284     mEndDateEdit = 
new KDateComboBox(mRangeButtonBox);
 
  285     mEndDateEdit->setOptions(mReadOnly ? KDateComboBox::Options(0) : KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker);
 
  286     static const QString tzText = i18nc(
"@info/plain", 
"This uses the same time zone as the start time.");
 
  287     mEndDateEdit->setWhatsThis(i18nc(
"@info:whatsthis",
 
  288           "<para>Enter the last date to repeat the alarm.</para><para>%1</para>", tzText));
 
  289     connect(mEndDateEdit, SIGNAL(dateEdited(QDate)), SIGNAL(
contentsChanged()));
 
  291     mEndTimeEdit = 
new TimeEdit(mRangeButtonBox);
 
  292     mEndTimeEdit->setFixedSize(mEndTimeEdit->sizeHint());
 
  294     mEndTimeEdit->setWhatsThis(i18nc(
"@info:whatsthis",
 
  296     connect(mEndTimeEdit, SIGNAL(valueChanged(
int)), SIGNAL(
contentsChanged()));
 
  297     mEndAnyTimeCheckBox = 
new CheckBox(i18nc(
"@option:check", 
"Any time"), mRangeButtonBox);
 
  298     mEndAnyTimeCheckBox->setFixedSize(mEndAnyTimeCheckBox->sizeHint());
 
  300     mEndAnyTimeCheckBox->setWhatsThis(i18nc(
"@info:whatsthis", 
"Stop repeating the alarm after your first login on or after the specified end date"));
 
  301     connect(mEndAnyTimeCheckBox, SIGNAL(toggled(
bool)), SLOT(slotAnyTimeToggled(
bool)));
 
  302     connect(mEndAnyTimeCheckBox, SIGNAL(toggled(
bool)), SIGNAL(
contentsChanged()));
 
  303     hlayout->addWidget(mEndDateButton);
 
  304     hlayout->addSpacing(KDialog::spacingHint());
 
  305     hlayout->addWidget(mEndDateEdit);
 
  306     hlayout->addWidget(mEndTimeEdit);
 
  307     hlayout->addWidget(mEndAnyTimeCheckBox);
 
  308     hlayout->addStretch();
 
  309     size = size.expandedTo(mEndDateButton->sizeHint());
 
  312     mRepeatCountButton->setFixedSize(size);
 
  313     mEndDateButton->setFixedSize(size);
 
  318     mExceptionGroup = 
new QGroupBox(i18nc(
"@title:group", 
"Exceptions"), 
this);
 
  319     topLayout->addWidget(mExceptionGroup);
 
  320     topLayout->setStretchFactor(mExceptionGroup, 2);
 
  321     hlayout = 
new QHBoxLayout(mExceptionGroup);
 
  322     hlayout->setMargin(KDialog::marginHint());
 
  323     hlayout->setSpacing(KDialog::spacingHint());
 
  324     vlayout = 
new QVBoxLayout();
 
  325     vlayout->setMargin(0);
 
  326     hlayout->addLayout(vlayout);
 
  328     mExceptionDateList = 
new ListWidget(mExceptionGroup);
 
  329     mExceptionDateList->setWhatsThis(i18nc(
"@info:whatsthis", 
"The list of exceptions, i.e. dates/times excluded from the recurrence"));
 
  330     connect(mExceptionDateList, SIGNAL(currentRowChanged(
int)), SLOT(enableExceptionButtons()));
 
  331     vlayout->addWidget(mExceptionDateList);
 
  335         mExceptionDateEdit     = 0;
 
  336         mChangeExceptionButton = 0;
 
  337         mDeleteExceptionButton = 0;
 
  341         vlayout = 
new QVBoxLayout();
 
  342         vlayout->setMargin(0);
 
  343         hlayout->addLayout(vlayout);
 
  344         mExceptionDateEdit = 
new KDateComboBox(mExceptionGroup);
 
  345         mExceptionDateEdit->setOptions(mReadOnly ? KDateComboBox::Options(0) : KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker);
 
  346         mExceptionDateEdit->setDate(KDateTime::currentLocalDate());
 
  347         mExceptionDateEdit->setWhatsThis(i18nc(
"@info:whatsthis",
 
  348               "Enter a date to insert in the exceptions list. " 
  349               "Use in conjunction with the Add or Change button below."));
 
  350         vlayout->addWidget(mExceptionDateEdit, 0, Qt::AlignLeft);
 
  352         hlayout = 
new QHBoxLayout();
 
  353         hlayout->setMargin(0);
 
  354         vlayout->addLayout(hlayout);
 
  356         button->setWhatsThis(i18nc(
"@info:whatsthis", 
"Add the date entered above to the exceptions list"));
 
  357         connect(button, SIGNAL(clicked()), SLOT(addException()));
 
  358         hlayout->addWidget(button);
 
  360         mChangeExceptionButton = 
new QPushButton(i18nc(
"@action:button", 
"Change"), mExceptionGroup);
 
  361         mChangeExceptionButton->setWhatsThis(i18nc(
"@info:whatsthis",
 
  362               "Replace the currently highlighted item in the exceptions list with the date entered above"));
 
  363         connect(mChangeExceptionButton, SIGNAL(clicked()), SLOT(changeException()));
 
  364         hlayout->addWidget(mChangeExceptionButton);
 
  366         mDeleteExceptionButton = 
new QPushButton(i18nc(
"@action:button", 
"Delete"), mExceptionGroup);
 
  367         mDeleteExceptionButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Remove the currently highlighted item from the exceptions list"));
 
  368         connect(mDeleteExceptionButton, SIGNAL(clicked()), SLOT(deleteException()));
 
  369         hlayout->addWidget(mDeleteExceptionButton);
 
  372     vlayout->addStretch();
 
  374     mExcludeHolidays = 
new CheckBox(i18nc(
"@option:check", 
"Exclude holidays"), mExceptionGroup);
 
  376     mExcludeHolidays->setWhatsThis(i18nc(
"@info:whatsthis",
 
  377           "<para>Do not trigger the alarm on holidays.</para>" 
  378           "<para>You can specify your holiday region in the Configuration dialog.</para>"));
 
  379     connect(mExcludeHolidays, SIGNAL(toggled(
bool)), SIGNAL(
contentsChanged()));
 
  380     vlayout->addWidget(mExcludeHolidays);
 
  382     mWorkTimeOnly = 
new CheckBox(i18nc(
"@option:check", 
"Only during working time"), mExceptionGroup);
 
  384     mWorkTimeOnly->setWhatsThis(i18nc(
"@info:whatsthis",
 
  385           "<para>Only execute the alarm during working hours, on working days.</para>" 
  386           "<para>You can specify working days and hours in the Configuration dialog.</para>"));
 
  387     connect(mWorkTimeOnly, SIGNAL(toggled(
bool)), SIGNAL(
contentsChanged()));
 
  388     vlayout->addWidget(mWorkTimeOnly);
 
  390     topLayout->addStretch();
 
  391     mNoEmitTypeChanged = 
false;
 
  400         mExceptionGroup->show();
 
  402         mExceptionGroup->hide();
 
  412     if (mAtLoginButton->isChecked())
 
  414     const_cast<RecurrenceEdit*
>(
this)->mCurrStartDateTime = startDateTime;
 
  415     if (mEndDateButton->isChecked())
 
  419         bool noTime = !mEndTimeEdit->isEnabled();
 
  420         QDate endDate = mEndDateEdit->date();
 
  421         if (endDate < startDateTime.date())
 
  422             errWidget = mEndDateEdit;
 
  423         else if (!noTime  &&  QDateTime(endDate, mEndTimeEdit->
time()) < startDateTime.dateTime())
 
  424             errWidget = mEndTimeEdit;
 
  427             errorMessage = noTime
 
  428                          ? i18nc(
"@info", 
"End date is earlier than start date")
 
  429                          : i18nc(
"@info", 
"End date/time is earlier than start date/time");
 
  435     return mRule->
validate(errorMessage);
 
  441 void RecurrenceEdit::periodClicked(QAbstractButton* button)
 
  444     bool none     = (button == mNoneButton);
 
  445     bool atLogin  = (button == mAtLoginButton);
 
  446     bool subdaily = (button == mSubDailyButton);
 
  456         mEndDateButton->setChecked(
true);
 
  460         mRule = mSubDailyRule;
 
  463     else if (button == mDailyButton)
 
  466         mRuleButtonType = 
DAILY;
 
  469     else if (button == mWeeklyButton)
 
  475     else if (button == mMonthlyButton)
 
  477         mRule = mMonthlyRule;
 
  479         mMonthlyShown = 
true;
 
  481     else if (button == mYearlyButton)
 
  490     if (mRuleButtonType != oldType)
 
  492         mRuleStack->setCurrentWidget(mRule ? mRule : mNoRule);
 
  494             mRangeButtonBox->setEnabled(!none);
 
  495         mExceptionGroup->setEnabled(!(none || atLogin));
 
  496         mEndAnyTimeCheckBox->setEnabled(atLogin);
 
  499             mNoEndDateButton->setEnabled(!atLogin);
 
  500             mRepeatCountButton->setEnabled(!atLogin);
 
  503         mSubRepetition->setEnabled(!(none || atLogin));
 
  504         if (!mNoEmitTypeChanged)
 
  509 void RecurrenceEdit::slotAnyTimeToggled(
bool on)
 
  511     QAbstractButton* button = mRuleButtonGroup->checkedButton();
 
  512     mEndTimeEdit->setEnabled((button == mAtLoginButton && !on)
 
  513                          ||  (button == mSubDailyButton && mEndDateButton->isChecked()));
 
  519 void RecurrenceEdit::rangeTypeClicked()
 
  521     bool endDate = mEndDateButton->isChecked();
 
  522     mEndDateEdit->setEnabled(endDate);
 
  523     mEndTimeEdit->setEnabled(endDate
 
  524                              &&  ((mAtLoginButton->isChecked() && !mEndAnyTimeCheckBox->isChecked())
 
  525                                   ||  mSubDailyButton->isChecked()));
 
  526     bool repeatCount = mRepeatCountButton->isChecked();
 
  527     mRepeatCountEntry->setEnabled(repeatCount);
 
  528     mRepeatCountLabel->setEnabled(repeatCount);
 
  536         mRuleButtonGroup->checkedButton()->setFocus();
 
  560     switch (mRuleButtonType)
 
  570             maxDuration = 
event.longestRecurrenceInterval().asSeconds()/60 - reminderMinutes - 1;
 
  575     mSubRepetition->setEnabled(mRuleButtonType >= 
SUBDAILY && maxDuration);
 
  590 void RecurrenceEdit::repeatCountChanged(
int value)
 
  592     if (value > 0  &&  mRepeatCountEntry->minimum() == 0)
 
  593         mRepeatCountEntry->setMinimum(1);
 
  600 void RecurrenceEdit::addException()
 
  602     if (!mExceptionDateEdit  ||  !mExceptionDateEdit->date().isValid())
 
  604     QDate 
date = mExceptionDateEdit->date();
 
  605     DateList::Iterator it;
 
  608     for (it = mExceptionDates.begin();  it != mExceptionDates.end();  ++index, ++it)
 
  612             insert = (date != *it);
 
  618         mExceptionDates.insert(it, date);
 
  619         mExceptionDateList->insertItem(index, 
new QListWidgetItem(KGlobal::locale()->formatDate(date)));
 
  622     mExceptionDateList->setCurrentItem(mExceptionDateList->item(index));
 
  623     enableExceptionButtons();
 
  630 void RecurrenceEdit::changeException()
 
  632     if (!mExceptionDateEdit  ||  !mExceptionDateEdit->date().isValid())
 
  634     QListWidgetItem* item = mExceptionDateList->currentItem();
 
  635     if (item  &&  mExceptionDateList->isItemSelected(item))
 
  637         int index = mExceptionDateList->row(item);
 
  638         QDate olddate = mExceptionDates[index];
 
  639         QDate newdate = mExceptionDateEdit->date();
 
  640         if (newdate != olddate)
 
  642             mExceptionDates.removeAt(index);
 
  643             mExceptionDateList->takeItem(index);
 
  653 void RecurrenceEdit::deleteException()
 
  655     QListWidgetItem* item = mExceptionDateList->currentItem();
 
  656     if (item  &&  mExceptionDateList->isItemSelected(item))
 
  658         int index = mExceptionDateList->row(item);
 
  659         mExceptionDates.removeAt(index);
 
  660         mExceptionDateList->takeItem(index);
 
  662         enableExceptionButtons();
 
  670 void RecurrenceEdit::enableExceptionButtons()
 
  672     QListWidgetItem* item = mExceptionDateList->currentItem();
 
  674     if (mDeleteExceptionButton)
 
  675         mDeleteExceptionButton->setEnabled(enable);
 
  676     if (mChangeExceptionButton)
 
  677         mChangeExceptionButton->setEnabled(enable);
 
  680     mExceptionDateList->setFocusPolicy(mExceptionDateList->count() ? Qt::WheelFocus : Qt::NoFocus);
 
  690         setRuleDefaults(start);
 
  693             mEndDateEdit->setMinimumDate(today);
 
  694             if (mExceptionDateEdit)
 
  695                 mExceptionDateEdit->setMinimumDate(today);
 
  699             const QString startString = i18nc(
"@info", 
"Date cannot be earlier than start date");
 
  700             mEndDateEdit->setMinimumDate(start, startString);
 
  701             if (mExceptionDateEdit)
 
  702                 mExceptionDateEdit->setMinimumDate(start, startString);
 
  712     if (!mEndDateButton->isChecked())
 
  713         mEndDateEdit->setDate(end);
 
  718     KDateTime edt = end.toTimeSpec(mCurrStartDateTime.timeSpec());
 
  719     mEndDateEdit->setDate(edt.date());
 
  721     mEndTimeEdit->setEnabled(!end.isDateOnly());
 
  722     mEndAnyTimeCheckBox->setChecked(end.isDateOnly());
 
  727     if (mRuleButtonGroup->checkedButton() == mAtLoginButton  &&  mEndAnyTimeCheckBox->isChecked())
 
  728         return KDateTime(mEndDateEdit->date(), mCurrStartDateTime.timeSpec());
 
  729     return KDateTime(mEndDateEdit->date(), mEndTimeEdit->
time(), mCurrStartDateTime.timeSpec());
 
  737     mCurrStartDateTime = 
from;
 
  738     QDate fromDate = from.date();
 
  739     mNoEndDateButton->setChecked(
true);
 
  747     setRuleDefaults(fromDate);
 
  751     mEndDateEdit->setDate(fromDate);
 
  753     mNoEmitTypeChanged = 
true;
 
  757         case AT_LOGIN: button = mAtLoginButton;  
break;
 
  758         case ANNUAL:   button = mYearlyButton;   
break;
 
  759         case MONTHLY:  button = mMonthlyButton;  
break;
 
  760         case WEEKLY:   button = mWeeklyButton;   
break;
 
  761         case DAILY:    button = mDailyButton;    
break;
 
  762         case SUBDAILY: button = mSubDailyButton; 
break;
 
  764         default:       button = mNoneButton;     
break;
 
  766     button->setChecked(
true);
 
  767     mNoEmitTypeChanged = 
false;
 
  769     enableExceptionButtons();
 
  778 void RecurrenceEdit::setRuleDefaults(
const QDate& fromDate)
 
  780     int day       = fromDate.day();
 
  781     int dayOfWeek = fromDate.dayOfWeek();
 
  782     int month     = fromDate.month();
 
  786         mWeeklyRule->
setDay(dayOfWeek);
 
  799     mAtLoginButton->setChecked(
true);
 
  800     mEndDateButton->setChecked(
true);
 
  809     if (event.repeatAtLogin())
 
  811         mAtLoginButton->setChecked(
true);
 
  812         mEndDateButton->setChecked(
true);
 
  815     mNoneButton->setChecked(
true);
 
  816     KARecurrence* recurrence = 
event.recurrence();
 
  819     KARecurrence::Type rtype = recurrence->type();
 
  822         case KARecurrence::MINUTELY:
 
  823             mSubDailyButton->setChecked(
true);
 
  826         case KARecurrence::DAILY:
 
  828             mDailyButton->setChecked(
true);
 
  829             QBitArray rDays = recurrence->days();
 
  831             for (
int i = 0;  i < 7 && !
set;  ++i)
 
  832                 set = rDays.testBit(i);
 
  839         case KARecurrence::WEEKLY:
 
  841             mWeeklyButton->setChecked(
true);
 
  842             QBitArray rDays = recurrence->days();
 
  846         case KARecurrence::MONTHLY_POS:    
 
  849             int i = posns.first().pos();
 
  854                 mWeeklyButton->setChecked(
true);
 
  857                 for (
int i = 0, end = posns.count();  i < end;  ++i)
 
  860                         rDays.setBit(posns[i].day() - 1, 1);
 
  865             mMonthlyButton->setChecked(
true);
 
  869         case KARecurrence::MONTHLY_DAY:     
 
  871             mMonthlyButton->setChecked(
true);
 
  873             int day = (rmd.isEmpty()) ? event.mainDateTime().date().day() : rmd.first();
 
  877         case KARecurrence::ANNUAL_DATE:   
 
  878         case KARecurrence::ANNUAL_POS:     
 
  880             if (rtype == KARecurrence::ANNUAL_DATE)
 
  882                 mYearlyButton->setChecked(
true);
 
  883                 const QList<int> rmd = recurrence->monthDays();
 
  884                 int day = (rmd.isEmpty()) ? event.mainDateTime().date().day() : rmd.first();
 
  888             else if (rtype == KARecurrence::ANNUAL_POS)
 
  890                 mYearlyButton->setChecked(
true);
 
  892                 mYearlyRule->
setPosition(posns.first().pos(), posns.first().day());
 
  894             mYearlyRule->
setMonths(recurrence->yearMonths());
 
  904     KDateTime endtime = mCurrStartDateTime;
 
  905     int duration = recurrence->duration();
 
  907         mNoEndDateButton->setChecked(
true);
 
  910         mRepeatCountButton->setChecked(
true);
 
  911         mRepeatCountEntry->setValue(duration);
 
  915         mEndDateButton->setChecked(
true);
 
  916         endtime = recurrence->endDateTime();
 
  917         mEndTimeEdit->
setValue(endtime.time());
 
  919     mEndDateEdit->setDate(endtime.date());
 
  922     mExceptionDates = 
event.recurrence()->exDates();
 
  923     qSort(mExceptionDates);
 
  924     mExceptionDateList->clear();
 
  925     for (
int i = 0, iend = mExceptionDates.count();  i < iend;  ++i)
 
  926         new QListWidgetItem(KGlobal::locale()->formatDate(mExceptionDates[i]), mExceptionDateList);
 
  927     enableExceptionButtons();
 
  928     mExcludeHolidays->setChecked(event.holidaysExcluded());
 
  929     mWorkTimeOnly->setChecked(event.workTimeOnly());
 
  932     mSubRepetition->
set(event.repetition());
 
  950     if (mNoEndDateButton->isChecked())
 
  952     else if (mRepeatCountButton->isChecked())
 
  953         repeatCount = mRepeatCountEntry->value();
 
  957         endDate = mEndDateEdit->date();
 
  958         endTime = mEndTimeEdit->
time();
 
  962     event.startChanges();
 
  963     QAbstractButton* button = mRuleButtonGroup->checkedButton();
 
  964     event.setRepeatAtLogin(button == mAtLoginButton);
 
  965     int frequency = mRule ? mRule->
frequency() : 0;
 
  966     if (button == mSubDailyButton)
 
  968         KDateTime 
endDateTime(endDate, endTime, mCurrStartDateTime.timeSpec());
 
  969         event.setRecurMinutely(frequency, repeatCount, 
endDateTime);
 
  971     else if (button == mDailyButton)
 
  973         event.setRecurDaily(frequency, mDailyRule->
days(), repeatCount, endDate);
 
  975     else if (button == mWeeklyButton)
 
  977         event.setRecurWeekly(frequency, mWeeklyRule->
days(), repeatCount, endDate);
 
  979     else if (button == mMonthlyButton)
 
  984             KAEvent::MonthPos pos;
 
  985             pos.days.fill(
false);
 
  986             pos.days.setBit(mMonthlyRule->
dayOfWeek() - 1);
 
  987             pos.weeknum = mMonthlyRule->
week();
 
  988             QVector<KAEvent::MonthPos> poses(1, pos);
 
  989             event.setRecurMonthlyByPos(frequency, poses, repeatCount, endDate);
 
  994             int daynum = mMonthlyRule->
date();
 
  995             QVector<int> daynums(1, daynum);
 
  996             event.setRecurMonthlyByDate(frequency, daynums, repeatCount, endDate);
 
  999     else if (button == mYearlyButton)
 
 1001         QVector<int> months = mYearlyRule->
months();
 
 1005             KAEvent::MonthPos pos;
 
 1006             pos.days.fill(
false);
 
 1007             pos.days.setBit(mYearlyRule->
dayOfWeek() - 1);
 
 1008             pos.weeknum = mYearlyRule->
week();
 
 1009             QVector<KAEvent::MonthPos> poses(1, pos);
 
 1010             event.setRecurAnnualByPos(frequency, poses, months, repeatCount, endDate);
 
 1015             event.setRecurAnnualByDate(frequency, months, mYearlyRule->
date(),
 
 1016                                        mYearlyRule->
feb29Type(), repeatCount, endDate);
 
 1025     if (!event.recurs())
 
 1031         event.setFirstRecurrence();
 
 1035     event.setRepetition((mRuleButtonType < 
SUBDAILY) ? Repetition() : mSubRepetition->
repetition());
 
 1038     event.recurrence()->setExDates(mExceptionDates);
 
 1039     event.setWorkTimeOnly(mWorkTimeOnly->isChecked());
 
 1040     event.setExcludeHolidays(mExcludeHolidays->isChecked());
 
 1048 void RecurrenceEdit::saveState()
 
 1050     mSavedRuleButton = mRuleButtonGroup->checkedButton();
 
 1053     mSavedRangeButton = mRangeButtonGroup->checkedButton();
 
 1054     if (mSavedRangeButton == mRepeatCountButton)
 
 1055         mSavedRecurCount = mRepeatCountEntry->value();
 
 1056     else if (mSavedRangeButton == mEndDateButton)
 
 1058         mSavedEndDateTime = KDateTime(QDateTime(mEndDateEdit->date(), mEndTimeEdit->
time()), mCurrStartDateTime.timeSpec());
 
 1059         mSavedEndDateTime.setDateOnly(mEndAnyTimeCheckBox->isChecked());
 
 1061     mSavedExceptionDates = mExceptionDates;
 
 1062     mSavedWorkTimeOnly   = mWorkTimeOnly->isChecked();
 
 1063     mSavedExclHolidays   = mExcludeHolidays->isChecked();
 
 1064     mSavedRepetition     = mSubRepetition->
repetition();
 
 1072     if (mSavedRuleButton  != mRuleButtonGroup->checkedButton()
 
 1073     ||  mSavedRangeButton != mRangeButtonGroup->checkedButton()
 
 1076     if (mSavedRangeButton == mRepeatCountButton
 
 1077     &&  mSavedRecurCount  != mRepeatCountEntry->value())
 
 1079     if (mSavedRangeButton == mEndDateButton)
 
 1081         KDateTime edt(QDateTime(mEndDateEdit->date(), mEndTimeEdit->
time()), mCurrStartDateTime.timeSpec());
 
 1082         edt.setDateOnly(mEndAnyTimeCheckBox->isChecked());
 
 1083         if (mSavedEndDateTime != edt)
 
 1086     if (mSavedExceptionDates != mExceptionDates
 
 1087     ||  mSavedWorkTimeOnly   != mWorkTimeOnly->isChecked()
 
 1088     ||  mSavedExclHolidays   != mExcludeHolidays->isChecked()
 
 1089     ||  mSavedRepetition     != mSubRepetition->
repetition())
 
 1101 Rule::Rule(
const QString& freqText, 
const QString& freqWhatsThis, 
bool time, 
bool readOnly, 
QWidget* parent)
 
 1104     mLayout = 
new QVBoxLayout(
this);
 
 1105     mLayout->setMargin(0);
 
 1106     mLayout->setSpacing(KDialog::spacingHint());
 
 1108     freqBox->setMargin(0);
 
 1109     mLayout->addWidget(freqBox, 0, Qt::AlignLeft);
 
 1112     box->setSpacing(KDialog::spacingHint());
 
 1114     QLabel* label = 
new QLabel(i18nc(
"@label:spinbox", 
"Recur e&very"), box);
 
 1115     label->setFixedSize(label->sizeHint());
 
 1119         mSpinBox = mTimeSpinBox = 
new TimeSpinBox(1, 5999, box);
 
 1120         mTimeSpinBox->setFixedSize(mTimeSpinBox->
sizeHint());
 
 1126         mSpinBox = mIntSpinBox = 
new SpinBox(1, 999, box);
 
 1127         mIntSpinBox->setFixedSize(mIntSpinBox->sizeHint());
 
 1128         mIntSpinBox->setReadOnly(readOnly);
 
 1131     connect(mSpinBox, SIGNAL(valueChanged(
int)), SIGNAL(
changed()));
 
 1132     label->setBuddy(mSpinBox);
 
 1133     label = 
new QLabel(freqText, box);
 
 1134     label->setFixedSize(label->sizeHint());
 
 1135     box->setFixedSize(sizeHint());
 
 1136     box->setWhatsThis(freqWhatsThis);
 
 1139     freqBox->setFixedHeight(freqBox->sizeHint().height());
 
 1140     freqBox->setFocusProxy(mSpinBox);
 
 1146         return mIntSpinBox->value();
 
 1148         return mTimeSpinBox->
value();
 
 1155         mIntSpinBox->setValue(n);
 
 1173     return (mSavedFrequency != 
frequency());
 
 1183     : 
Rule(i18nc(
"@label Time units for user-entered numbers", 
"hours:minutes"),
 
 1184            i18nc(
"@info:whatsthis", 
"Enter the number of hours and minutes between repetitions of the alarm"),
 
 1185            true, readOnly, parent)
 
 1195                          bool readOnly, 
QWidget* parent)
 
 1196     : 
Rule(freqText, freqWhatsThis, false, readOnly, parent),
 
 1199     QGridLayout* grid = 
new QGridLayout();
 
 1201     grid->setRowStretch(0, 1);
 
 1202     layout()->addLayout(grid);
 
 1204     QLabel* label = 
new QLabel(i18nc(
"@label On: Tuesday", 
"O&n:"), 
this);
 
 1205     label->setFixedSize(label->sizeHint());
 
 1206     grid->addWidget(label, 0, 0, Qt::AlignRight | Qt::AlignTop);
 
 1207     grid->setColumnMinimumWidth(1, KDialog::spacingHint());
 
 1212     QGridLayout* dgrid = 
new QGridLayout(box);
 
 1213     dgrid->setMargin(0);
 
 1214     dgrid->setSpacing(KDialog::spacingHint());
 
 1215     const KCalendarSystem* calendar = KGlobal::locale()->calendar();
 
 1216     for (
int i = 0;  i < 7;  ++i)
 
 1219         mDayBox[i] = 
new CheckBox(calendar->weekDayName(day), box);
 
 1220         mDayBox[i]->setFixedSize(mDayBox[i]->sizeHint());
 
 1222         connect(mDayBox[i], SIGNAL(toggled(
bool)), SIGNAL(
changed()));
 
 1223         dgrid->addWidget(mDayBox[i], i%4, i/4, Qt::AlignLeft);
 
 1225     box->setFixedSize(box->sizeHint());
 
 1226     box->setWhatsThis(daysWhatsThis);
 
 1227     grid->addWidget(box, 0, 2, Qt::AlignLeft);
 
 1228     label->setBuddy(mDayBox[0]);
 
 1229     grid->setColumnStretch(3, 1);
 
 1239     for (
int i = 0;  i < 7;  ++i)
 
 1240         if (mDayBox[i]->isChecked())
 
 1250     for (
int i = 0;  i < 7;  ++i)
 
 1251         mDayBox[i]->setChecked(tick);
 
 1259     for (
int i = 0;  i < 7;  ++i)
 
 1262         mDayBox[i]->setChecked(x);
 
 1271     for (
int i = 0;  i < 7;  ++i)
 
 1272         mDayBox[i]->setChecked(
false);
 
 1273     if (dayOfWeek > 0  &&  dayOfWeek <= 7)
 
 1282     for (
int i = 0;  i < 7;  ++i)
 
 1283         if (mDayBox[i]->isChecked())
 
 1285     errorMessage = i18nc(
"@info", 
"No day selected");
 
 1295     mSavedDays = 
days();
 
 1304         ||  mSavedDays != 
days());
 
 1314     : 
DayWeekRule(i18nc(
"@label Time unit for user-entered number", 
"day(s)"),
 
 1315                   i18nc(
"@info:whatsthis", 
"Enter the number of days between repetitions of the alarm"),
 
 1316                   i18nc(
"@info:whatsthis", 
"Select the days of the week on which the alarm is allowed to occur"),
 
 1327     : 
DayWeekRule(i18nc(
"@label Time unit for user-entered number", 
"week(s)"),
 
 1328                   i18nc(
"@info:whatsthis", 
"Enter the number of weeks between repetitions of the alarm"),
 
 1329                   i18nc(
"@info:whatsthis", 
"Select the days of the week on which to repeat the alarm"),
 
 1340                              bool readOnly, 
QWidget* parent)
 
 1341     : 
Rule(freqText, freqWhatsThis, false, readOnly, parent),
 
 1342       mEveryWeek(allowEveryWeek)
 
 1349     box->setSpacing(KDialog::spacingHint());
 
 1350     layout()->addWidget(box);
 
 1352     mDayButton = 
new RadioButton(i18nc(
"@option:radio On day number in the month", 
"O&n day"), box);
 
 1353     mDayButton->setFixedSize(mDayButton->sizeHint());
 
 1356     mDayButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm on the selected day of the month"));
 
 1359     mDayCombo->setEditable(
false);
 
 1360     mDayCombo->setMaxVisibleItems(11);
 
 1361     for (
int i = 0;  i < 31;  ++i)
 
 1362         mDayCombo->addItem(QString::number(i + 1));
 
 1363     mDayCombo->addItem(i18nc(
"@item:inlistbox Last day of month", 
"Last"));
 
 1364     mDayCombo->setFixedSize(mDayCombo->sizeHint());
 
 1366     mDayCombo->setWhatsThis(i18nc(
"@info:whatsthis", 
"Select the day of the month on which to repeat the alarm"));
 
 1368     connect(mDayCombo, SIGNAL(activated(
int)), SLOT(slotDaySelected(
int)));
 
 1369     connect(mDayCombo, SIGNAL(currentIndexChanged(
int)), SIGNAL(
changed()));
 
 1371     box->setStretchFactor(
new QWidget(box), 1);    
 
 1372     box->setFixedHeight(box->sizeHint().height());
 
 1375     box = 
new KHBox(
this);
 
 1377     box->setSpacing(KDialog::spacingHint());
 
 1378     layout()->addWidget(box);
 
 1380     mPosButton = 
new RadioButton(i18nc(
"@option:radio On the 1st Tuesday", 
"On t&he"), box);
 
 1381     mPosButton->setFixedSize(mPosButton->sizeHint());
 
 1384     mPosButton->setWhatsThis(i18nc(
"@info:whatsthis", 
"Repeat the alarm on one day of the week, in the selected week of the month"));
 
 1387     mWeekCombo->setEditable(
false);
 
 1388     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"1st"));
 
 1389     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"2nd"));
 
 1390     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"3rd"));
 
 1391     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"4th"));
 
 1392     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"5th"));
 
 1393     mWeekCombo->addItem(i18nc(
"@item:inlistbox Last Monday in March", 
"Last"));
 
 1394     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"2nd Last"));
 
 1395     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"3rd Last"));
 
 1396     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"4th Last"));
 
 1397     mWeekCombo->addItem(i18nc(
"@item:inlistbox", 
"5th Last"));
 
 1400         mWeekCombo->addItem(i18nc(
"@item:inlistbox Every (Monday...) in month", 
"Every"));
 
 1401         mWeekCombo->setMaxVisibleItems(11);
 
 1403     mWeekCombo->setWhatsThis(i18nc(
"@info:whatsthis", 
"Select the week of the month in which to repeat the alarm"));
 
 1404     mWeekCombo->setFixedSize(mWeekCombo->sizeHint());
 
 1407     connect(mWeekCombo, SIGNAL(currentIndexChanged(
int)), SIGNAL(
changed()));
 
 1409     mDayOfWeekCombo = 
new ComboBox(box);
 
 1410     mDayOfWeekCombo->setEditable(
false);
 
 1411     const KCalendarSystem* calendar = KGlobal::locale()->calendar();
 
 1412     for (
int i = 0;  i < 7;  ++i)
 
 1415         mDayOfWeekCombo->addItem(calendar->weekDayName(day));
 
 1418     mDayOfWeekCombo->setWhatsThis(i18nc(
"@info:whatsthis", 
"Select the day of the week on which to repeat the alarm"));
 
 1419     connect(mDayOfWeekCombo, SIGNAL(currentIndexChanged(
int)), SIGNAL(
changed()));
 
 1421     box->setStretchFactor(
new QWidget(box), 1);    
 
 1422     box->setFixedHeight(box->sizeHint().height());
 
 1423     connect(mButtonGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(
clicked(QAbstractButton*)));
 
 1424     connect(mButtonGroup, SIGNAL(buttonSet(QAbstractButton*)), SIGNAL(
changed()));
 
 1429     return (mButtonGroup->checkedButton() == mDayButton) ? 
DATE : 
POS;
 
 1435         mDayButton->setChecked(
true);
 
 1437         mPosButton->setChecked(
true);
 
 1443     mDayCombo->setCurrentIndex(dayOfMonth);
 
 1444     mWeekCombo->setCurrentIndex(dayOfMonth / 7);
 
 1450     int daynum  = mDayCombo->currentIndex() + 1;
 
 1451     return (daynum <= 31) ? daynum : 31 - daynum;
 
 1456     int weeknum = mWeekCombo->currentIndex() + 1;
 
 1457     return (weeknum <= 5) ? weeknum : (weeknum == 11) ? 0 : 5 - weeknum;
 
 1467     mDayButton->setChecked(
true);;
 
 1468     mDayCombo->setCurrentIndex(dayOfMonth > 0 ? dayOfMonth - 1 : dayOfMonth < 0 ? 30 - dayOfMonth : 0);   
 
 1473     mPosButton->setChecked(
true);
 
 1474     mWeekCombo->setCurrentIndex((week > 0) ? week - 1 : (week < 0) ? 4 - week : mEveryWeek ? 10 : 0);
 
 1478 void MonthYearRule::enableSelection(DayPosType type)
 
 1480     bool date = (type == 
DATE);
 
 1481     mDayCombo->setEnabled(date);
 
 1482     mWeekCombo->setEnabled(!date);
 
 1483     mDayOfWeekCombo->setEnabled(!date);
 
 1488     enableSelection(button == mDayButton ? 
DATE : 
POS);
 
 1491 void MonthYearRule::slotDaySelected(
int index)
 
 1493     daySelected(index <= 30 ? index + 1 : 30 - index);
 
 1502     mSavedType = 
type();
 
 1503     if (mSavedType == 
DATE)
 
 1507         mSavedWeek    = 
week();
 
 1518     ||  mSavedType != 
type())
 
 1520     if (mSavedType == 
DATE)
 
 1522         if (mSavedDay != 
date())
 
 1527         if (mSavedWeek    != 
week()
 
 1541     : 
MonthYearRule(i18nc(
"@label Time unit for user-entered number", 
"month(s)"),
 
 1542            i18nc(
"@info:whatsthis", 
"Enter the number of months between repetitions of the alarm"),
 
 1543            false, readOnly, parent)
 
 1553     : 
MonthYearRule(i18nc(
"@label Time unit for user-entered number", 
"year(s)"),
 
 1554            i18nc(
"@info:whatsthis", 
"Enter the number of years between repetitions of the alarm"),
 
 1555            true, readOnly, parent)
 
 1558     QHBoxLayout* hlayout = 
new QHBoxLayout();
 
 1559     hlayout->setMargin(0);
 
 1560     layout()->addLayout(hlayout);
 
 1561     QLabel* label = 
new QLabel(i18nc(
"@label List of months to select", 
"Months:"), 
this);
 
 1562     label->setFixedSize(label->sizeHint());
 
 1563     hlayout->addWidget(label, 0, Qt::AlignLeft | Qt::AlignTop);
 
 1567     hlayout->addWidget(w, 1, Qt::AlignLeft);
 
 1568     QGridLayout* grid = 
new QGridLayout(w);
 
 1570     grid->setSpacing(KDialog::spacingHint());
 
 1571     const KCalendarSystem* calendar = KGlobal::locale()->calendar();
 
 1572     int year = KDateTime::currentLocalDate().year();
 
 1573     for (
int i = 0;  i < 12;  ++i)
 
 1575         mMonthBox[i] = 
new CheckBox(calendar->monthName(i + 1, year, KCalendarSystem::ShortName), w);
 
 1576         mMonthBox[i]->setFixedSize(mMonthBox[i]->sizeHint());
 
 1578         connect(mMonthBox[i], SIGNAL(toggled(
bool)), SIGNAL(
changed()));
 
 1579         grid->addWidget(mMonthBox[i], i%3, i/3, Qt::AlignLeft);
 
 1581     connect(mMonthBox[1], SIGNAL(toggled(
bool)), SLOT(enableFeb29()));
 
 1582     w->setFixedHeight(w->sizeHint().height());
 
 1583     w->setWhatsThis(i18nc(
"@info:whatsthis", 
"Select the months of the year in which to repeat the alarm"));
 
 1587     f29box->setMargin(0);
 
 1588     layout()->addWidget(f29box);
 
 1591     box->setSpacing(KDialog::spacingHint());
 
 1592     mFeb29Label = 
new QLabel(i18nc(
"@label:listbox", 
"February 2&9th alarm in non-leap years:"), box);
 
 1593     mFeb29Label->setFixedSize(mFeb29Label->sizeHint());
 
 1595     mFeb29Combo->setEditable(
false);
 
 1596     mFeb29Combo->addItem(i18nc(
"@item:inlistbox No date", 
"None"));
 
 1597     mFeb29Combo->addItem(i18nc(
"@item:inlistbox 1st March (short form)", 
"1 Mar"));
 
 1598     mFeb29Combo->addItem(i18nc(
"@item:inlistbox 28th February (short form)", 
"28 Feb"));
 
 1599     mFeb29Combo->setFixedSize(mFeb29Combo->sizeHint());
 
 1601     connect(mFeb29Combo, SIGNAL(currentIndexChanged(
int)), SIGNAL(
changed()));
 
 1602     mFeb29Label->setBuddy(mFeb29Combo);
 
 1603     box->setFixedSize(box->sizeHint());
 
 1604     box->setWhatsThis(i18nc(
"@info:whatsthis", 
"Select which date, if any, the February 29th alarm should trigger in non-leap years"));
 
 1606     f29box->setFixedHeight(f29box->sizeHint().height());
 
 1613     for (
int i = 0;  i < 12;  ++i)
 
 1614         mMonthBox[i]->setChecked(i == month);
 
 1626     for (
int i = 0;  i < 12;  ++i)
 
 1627         if (mMonthBox[i]->isChecked()  &&  mMonthBox[i]->isEnabled())
 
 1628             mnths.append(i + 1);
 
 1638     for (
int i = 0;  i < 12;  ++i)
 
 1640     for (
int i = 0, end = mnths.count();  i < end;  ++i)
 
 1641         checked[mnths[i] - 1] = 
true;
 
 1642     for (
int i = 0;  i < 12;  ++i)
 
 1643         mMonthBox[i]->setChecked(checked[i]);
 
 1652     if (mFeb29Combo->isEnabled())
 
 1654         switch (mFeb29Combo->currentIndex())
 
 1656             case 1:   
return KARecurrence::Feb29_Mar1;
 
 1657             case 2:   
return KARecurrence::Feb29_Feb28;
 
 1661     return KARecurrence::Feb29_None;
 
 1673         case KARecurrence::Feb29_None:  index = 0;  
break;
 
 1674         case KARecurrence::Feb29_Mar1:  index = 1;  
break;
 
 1675         case KARecurrence::Feb29_Feb28: index = 2;  
break;
 
 1677     mFeb29Combo->setCurrentIndex(index);
 
 1685     for (
int i = 0;  i < 12;  ++i)
 
 1686         if (mMonthBox[i]->isChecked()  &&  mMonthBox[i]->isEnabled())
 
 1688     errorMessage = i18nc(
"@info", 
"No month selected");
 
 1689     return mMonthBox[0];
 
 1708     mMonthBox[1]->setEnabled(day <= 29);  
 
 1709     bool enable = (day != 31);
 
 1710     mMonthBox[3]->setEnabled(enable);     
 
 1711     mMonthBox[5]->setEnabled(enable);     
 
 1712     mMonthBox[8]->setEnabled(enable);     
 
 1713     mMonthBox[10]->setEnabled(enable);    
 
 1721 void YearlyRule::enableFeb29()
 
 1723     bool enable = (
type() == 
DATE  &&  
date() == 29  &&  mMonthBox[1]->isChecked()  &&  mMonthBox[1]->isEnabled());
 
 1724     mFeb29Label->setEnabled(enable);
 
 1725     mFeb29Combo->setEnabled(enable);
 
 1744         ||  mSavedMonths    != 
months()
 
virtual void setReadOnly(bool readOnly)
 
virtual QWidget * validate(QString &errorMessage)
 
static QString i18n_combo_AtLogin()
 
DailyRule(bool readOnly, QWidget *parent)
 
virtual bool stateChanged() const 
 
virtual void setReadOnly(bool readOnly)
 
void updateEvent(KAEvent &, bool adjustStart)
Write recurrence settings into an event. 
 
virtual void clicked(QAbstractButton *)
 
void setStartDate(const QDate &, const QDate &today)
 
WeeklyRule(bool readOnly, QWidget *parent)
 
virtual bool stateChanged() const 
 
int localeDayInWeek_to_weekDay(int index)
 
virtual bool stateChanged() const 
 
DayWeekRule(const QString &freqText, const QString &freqWhatsThis, const QString &daysWhatsThis, bool readOnly, QWidget *parent)
 
YearlyRule(bool readOnly, QWidget *parent)
 
QVector< int > months() const 
 
virtual void daySelected(int)
 
virtual bool stateChanged() const 
 
static QString i18n_combo_NoRecur()
 
KDateTime endDateTime() const 
 
Rule(const QString &freqText, const QString &freqWhatsThis, bool time, bool readOnly, QWidget *parent)
 
void typeChanged(int recurType)
 
void setDefaultValues(int dayOfMonth, int dayOfWeek)
 
the KAlarm application object 
 
static QString i18n_combo_Daily()
 
RecurrenceEdit(bool readOnly, QWidget *parent=0)
 
virtual QSize sizeHint() const 
 
void showMoreOptions(bool)
 
virtual void setReadOnly(bool readOnly)
 
virtual void clicked(QAbstractButton *)
 
void setFeb29Type(KARecurrence::Feb29Type)
 
void setDefaultValues(int dayOfMonth, int dayOfWeek, int month)
 
Repetition subRepetition() const 
 
static QString i18n_combo_HourlyMinutely()
 
void setMonths(const QList< int > &months)
 
SubDailyRule(bool readOnly, QWidget *parent)
 
virtual void setFrequencyFocus()
 
void setDay(int dayOfWeek)
 
virtual void setReadOnly(bool readOnly)
 
static QString i18n_combo_Monthly()
 
bool stateChanged() const 
 
MonthlyRule(bool readOnly, QWidget *parent)
 
virtual void setValue(int minutes)
 
virtual QWidget * validate(QString &)
 
void setDefaults(const KDateTime &from)
Set widgets to default values. 
 
void activateSubRepetition()
 
virtual void setValue(int minutes)
 
void repeatNeedsInitialisation()
 
void setRepeatAtLogin()
Initialise with repeat-at-login selected, instead of calling set(). 
 
DayPosType buttonType(QAbstractButton *b) const 
 
QVBoxLayout * layout() const 
 
virtual QWidget * validate(QString &errorMessage)
 
int weekDay_to_localeDayInWeek(int weekDay)
 
virtual void daySelected(int day)
 
QWidget * checkData(const KDateTime &startDateTime, QString &errorMessage) const 
 
void setDefaultEndDate(const QDate &)
 
static QString shiftWhatsThis()
 
KARecurrence::Feb29Type feb29Type() const 
 
static QString i18n_combo_Yearly()
 
static QString i18n_combo_Weekly()
 
MonthYearRule(const QString &freqText, const QString &freqWhatsThis, bool allowEveryWeek, bool readOnly, QWidget *parent)
 
static RecurType defaultRecurPeriod()
Get Recurrence period. 
 
void setDate(int dayOfMonth)
 
void set(const KAEvent &)
Initialise according to a specified event. 
 
virtual void showEvent(QShowEvent *)
 
void setSubRepetition(int reminderMinutes, bool dateOnly)
 
void setEndDateTime(const KDateTime &)
 
void setPosition(int week, int dayOfWeek)