Fixed KAlarm building warnings. Minor style patch up. Fixed possible error in treating deferred evens (see kalarm/alarmevent.cpp:1739).

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/21/head
Michele Calgaro 9 years ago
parent 74a91e1315
commit c036d97d35

@ -373,7 +373,7 @@ bool AlarmCalendar::reload()
*/
bool AlarmCalendar::saveCal(const TQString& newFile)
{
if (!mCalendar || !mOpen && newFile.isNull())
if (!mCalendar || (!mOpen && newFile.isNull()))
return false;
kdDebug(5950) << "AlarmCalendar::saveCal(\"" << newFile << "\", " << mType << ")\n";
@ -638,7 +638,7 @@ void AlarmCalendar::setPurgeDays(int days)
mPurgeDays = days;
if (mPurgeDays <= 0)
StartOfDayTimer::disconnect(this);
if (oldDays < 0 || days >= 0 && days < oldDays)
if (oldDays < 0 || (days >= 0 && days < oldDays))
{
// Alarms are now being kept for less long, so purge them
if (open())

@ -977,8 +977,8 @@ Event* KAEvent::event() const
*/
bool KAEvent::updateKCalEvent(Event& ev, bool checkUid, bool original, bool cancelCancelledDefer) const
{
if (checkUid && !mEventID.isEmpty() && mEventID != ev.uid()
|| !mAlarmCount && (!original || !mMainExpired))
if ((checkUid && !mEventID.isEmpty() && mEventID != ev.uid())
|| (!mAlarmCount && (!original || !mMainExpired)))
return false;
checkRecur(); // ensure recurrence/repetition data is consistent
@ -1089,7 +1089,7 @@ bool KAEvent::updateKCalEvent(Event& ev, bool checkUid, bool original, bool canc
}
// Add subsidiary alarms
if (mRepeatAtLogin || mArchiveRepeatAtLogin && original)
if (mRepeatAtLogin || (mArchiveRepeatAtLogin && original))
{
DateTime dtl;
if (mArchiveRepeatAtLogin)
@ -1107,7 +1107,7 @@ bool KAEvent::updateKCalEvent(Event& ev, bool checkUid, bool original, bool canc
ancillaryType = 1;
}
}
if (mReminderMinutes || mArchiveReminderMinutes && original)
if (mReminderMinutes || (mArchiveReminderMinutes && original))
{
int minutes = mReminderMinutes ? mReminderMinutes : mArchiveReminderMinutes;
initKCalAlarm(ev, -minutes * 60, TQStringList(mReminderOnceOnly ? REMINDER_ONCE_TYPE : REMINDER_TYPE));
@ -1117,7 +1117,7 @@ bool KAEvent::updateKCalEvent(Event& ev, bool checkUid, bool original, bool canc
ancillaryType = 2;
}
}
if (mDeferral > 0 || mDeferral == CANCEL_DEFERRAL && !cancelCancelledDefer)
if (mDeferral > 0 || (mDeferral == CANCEL_DEFERRAL && !cancelCancelledDefer))
{
DateTime nextDateTime = mNextMainDateTime;
if (mMainExpired)
@ -1736,7 +1736,7 @@ bool KAEvent::setDisplaying(const KAEvent& event, KAAlarm::Type alarmType, const
setUid(DISPLAYING);
mDisplaying = true;
mDisplayingTime = (alarmType == KAAlarm::AT_LOGIN_ALARM) ? repeatAtLoginTime : al.dateTime();
switch (al.type())
switch (al.subType())
{
case KAAlarm::AT_LOGIN__ALARM: mDisplayingFlags = REPEAT_AT_LOGIN; break;
case KAAlarm::REMINDER__ALARM: mDisplayingFlags = REMINDER; break;

@ -408,7 +408,7 @@ class KAEvent : public KAAlarmEventBase
bool enabled() const { return mEnabled; }
bool updated() const { return mUpdated; }
bool mainExpired() const { return mMainExpired; }
bool expired() const { return mDisplaying && mMainExpired || uidStatus(mEventID) == EXPIRED; }
bool expired() const { return (mDisplaying && mMainExpired) || uidStatus(mEventID) == EXPIRED; }
Status uidStatus() const { return uidStatus(mEventID); }
static Status uidStatus(const TQString& uid);
static TQString uid(const TQString& id, Status);

@ -466,7 +466,7 @@ void AlarmTimeWidget::slotTimer()
{
// The current date has reached or has passed the maximum date
if (now.date() > mMaxDateTime.date()
|| !mAnyTime && now.time() > mTimeEdit->maxTime())
|| (!mAnyTime && now.time() > mTimeEdit->maxTime()))
{
mPastMax = true;
emit pastMax();

@ -1052,8 +1052,8 @@ bool EditAlarmDlg::stateChanged() const
{
if (mSavedTemplateName != mTemplateName->text()
|| mSavedTemplateTimeType != mTemplateTimeGroup->selected()
|| mTemplateUseTime->isOn() && mSavedTemplateTime != mTemplateTime->time()
|| mTemplateUseTimeAfter->isOn() && mSavedTemplateAfterTime != mTemplateTimeAfter->value())
|| (mTemplateUseTime->isOn() && mSavedTemplateTime != mTemplateTime->time())
|| (mTemplateUseTimeAfter->isOn() && mSavedTemplateAfterTime != mTemplateTimeAfter->value()))
return true;
}
else
@ -1061,7 +1061,7 @@ bool EditAlarmDlg::stateChanged() const
return true;
if (mSavedTypeRadio != mActionGroup->selected()
|| mSavedLateCancel != mLateCancel->minutes()
|| mShowInKorganizer && mSavedShowInKorganizer != mShowInKorganizer->isChecked()
|| (mShowInKorganizer && mSavedShowInKorganizer != mShowInKorganizer->isChecked())
|| textFileCommandMessage != mSavedTextFileCommandMessage
|| mSavedRecurrenceType != mRecurrenceEdit->repeatType())
return true;
@ -1114,7 +1114,7 @@ bool EditAlarmDlg::stateChanged() const
TQStringList emailAttach;
for (int i = 0; i < mEmailAttachList->count(); ++i)
emailAttach += mEmailAttachList->text(i);
if (mEmailFromList && mSavedEmailFrom != mEmailFromList->currentIdentityName()
if ((mEmailFromList && mSavedEmailFrom != mEmailFromList->currentIdentityName())
|| mSavedEmailTo != mEmailToEdit->text()
|| mSavedEmailSubject != mEmailSubjectEdit->text()
|| mSavedEmailAttach != emailAttach
@ -1214,8 +1214,8 @@ void EditAlarmDlg::setEvent(KAEvent& event, const TQString& text, bool trial)
mRecurrenceEdit->updateEvent(event, !mTemplate);
TQDateTime now = TQDateTime::currentDateTime();
bool dateOnly = mAlarmDateTime.isDateOnly();
if (dateOnly && mAlarmDateTime.date() < now.date()
|| !dateOnly && mAlarmDateTime.rawDateTime() < now)
if ((dateOnly && mAlarmDateTime.date() < now.date())
|| (!dateOnly && mAlarmDateTime.rawDateTime() < now))
{
// A timed recurrence has an entered start date which has
// already expired, so we must adjust the next repetition.
@ -1390,16 +1390,16 @@ void EditAlarmDlg::slotOk()
}
TQDateTime now = TQDateTime::currentDateTime();
if (mAlarmDateTime.date() < now.date()
|| mAlarmDateTime.date() == now.date()
&& !mAlarmDateTime.isDateOnly() && mAlarmDateTime.time() < now.time())
|| (mAlarmDateTime.date() == now.date()
&& !mAlarmDateTime.isDateOnly() && mAlarmDateTime.time() < now.time()))
{
// A timed recurrence has an entered start date which
// has already expired, so we must adjust it.
KAEvent event;
getEvent(event); // this may adjust mAlarmDateTime
if (( mAlarmDateTime.date() < now.date()
|| mAlarmDateTime.date() == now.date()
&& !mAlarmDateTime.isDateOnly() && mAlarmDateTime.time() < now.time())
|| (mAlarmDateTime.date() == now.date()
&& !mAlarmDateTime.isDateOnly() && mAlarmDateTime.time() < now.time()))
&& event.nextOccurrence(now, mAlarmDateTime, KAEvent::ALLOW_FOR_REPETITION) == KAEvent::NO_OCCURRENCE)
{
KMessageBox::sorry(this, i18n("Recurrence has already expired"));
@ -1449,7 +1449,7 @@ void EditAlarmDlg::slotOk()
return;
}
if (recurEvent.repeatInterval() % 1440
&& (mTemplate && mTemplateAnyTime->isOn() || !mTemplate && mAlarmDateTime.isDateOnly()))
&& ((mTemplate && mTemplateAnyTime->isOn()) || (!mTemplate && mAlarmDateTime.isDateOnly())))
{
KMessageBox::sorry(this, i18n("For a repetition within the recurrence, its period must be in units of days or weeks for a date-only alarm"));
mRecurrenceEdit->activateSubRepetition(); // display the alarm repetition dialog again

@ -459,7 +459,7 @@ TQString EventListWhatsThisBase::text(const TQPoint& pt)
TQPoint viewportPt = mListView->viewport()->mapFrom(mListView, pt);
TQRect frame = mListView->header()->frameGeometry();
if (frame.contains(pt)
|| mListView->itemAt(TQPoint(mListView->itemMargin(), viewportPt.y())) && frame.contains(TQPoint(pt.x(), frame.y())))
|| (mListView->itemAt(TQPoint(mListView->itemMargin(), viewportPt.y())) && frame.contains(TQPoint(pt.x(), frame.y()))))
column = mListView->header()->sectionAt(pt.x());
return mListView->whatsThisText(column);
}

@ -298,8 +298,8 @@ void Find::findNext(bool forward, bool sort, bool checkEnd, bool fromCurrent)
last = true; // we've wrapped round and reached the starting alarm again
fromCurrent = false;
bool live = !event.expired();
if (live && !(mOptions & FIND_LIVE)
|| !live && !(mOptions & FIND_EXPIRED))
if ((live && !(mOptions & FIND_LIVE))
|| (!live && !(mOptions & FIND_EXPIRED)))
continue; // we're not searching this type of alarm
switch (event.action())
{

@ -64,7 +64,7 @@ bool resetDaemonQueued = false;
TQCString korganizerName = "korganizer";
TQString korgStartError;
#define KORG_DCOP_OBJECT "KOrganizerIface"
const char* KORG_DCOP_WINDOW = "KOrganizer MainWindow";
//const char* KORG_DCOP_WINDOW = "KOrganizer MainWindow"; // not used
const char* KMAIL_DCOP_WINDOW = "kmail-mainwindow#1";
bool sendToKOrganizer(const KAEvent&);

@ -229,7 +229,7 @@ bool KAlarmApp::restoreSession()
// Try to display the system tray icon if it is configured to be autostarted,
// or if we're in run-in-system-tray mode.
if (Preferences::autostartTrayIcon()
|| MainWindow::count() && wantRunInSystemTray())
|| (MainWindow::count() && wantRunInSystemTray()))
{
displayTrayIcon(true, trayParent);
// Occasionally for no obvious reason, the main main window is
@ -786,7 +786,7 @@ void KAlarmApp::quitIf(int exitCode, bool force)
return;
int mwcount = MainWindow::count();
MainWindow* mw = mwcount ? MainWindow::firstWindow() : 0;
if (mwcount > 1 || mwcount && (!mw->isHidden() || !mw->isTrayParent()))
if (mwcount > 1 || (mwcount && (!mw->isHidden() || !mw->isTrayParent())))
return;
// There are no windows left except perhaps a main window which is a hidden tray icon parent
if (mTrayWindow)
@ -1328,7 +1328,7 @@ bool KAlarmApp::handleEvent(const TQString& eventID, EventFunc function)
if (now >= limit)
{
if (type == KAEvent::LAST_RECURRENCE
|| type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event.recurs())
|| (type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event.recurs()))
cancel = true; // last occurrence (and there are no repetitions)
else
late = true;
@ -1360,7 +1360,7 @@ bool KAlarmApp::handleEvent(const TQString& eventID, EventFunc function)
if (next.dateTime().secsTo(now) > maxlate)
{
if (type == KAEvent::LAST_RECURRENCE
|| type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event.recurs())
|| (type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event.recurs()))
cancel = true; // last occurrence (and there are no repetitions)
else
late = true;
@ -1621,7 +1621,7 @@ void* KAlarmApp::execAlarm(KAEvent& event, const KAAlarm& alarm, bool reschedule
if (!event.enabled())
delete win; // event is disabled - close its window
else if (!win
|| !win->hasDefer() && !alarm.repeatAtLogin()
|| (!win->hasDefer() && !alarm.repeatAtLogin())
|| replaceReminder)
{
// Either there isn't already a message for this event,

@ -153,8 +153,8 @@ bool ADCalendar::eventHandled(const KCal::Event* event, const TQValueList<TQDate
if (alarmtimes[i].isValid()
&& (i >= oldCount // is it an additional alarm?
|| !it.data().alarmTimes[i].isValid() // or has it just become due?
|| it.data().alarmTimes[i].isValid() // or has it changed?
&& alarmtimes[i] != it.data().alarmTimes[i]))
|| (it.data().alarmTimes[i].isValid() // or has it changed?
&& alarmtimes[i] != it.data().alarmTimes[i])))
return false; // this alarm has changed
}
return true;

@ -449,7 +449,7 @@ void AlarmDaemon::checkAlarms(ADCalendar* cal)
}
}
if (!dt.isValid() || dt > now
|| dt1.isValid() && dt1 > dt) // already tested dt1 <= now
|| (dt1.isValid() && dt1 > dt)) // already tested dt1 <= now
dt = dt1;
}
alarmtimes.append(dt);

@ -110,8 +110,8 @@ bool KARecurrence::init(RecurrenceRule::PeriodType recurType, int freq, int coun
if (count < -1)
return false;
bool dateOnly = start.isDateOnly();
if (!count && (!dateOnly && !end.isValid()
|| dateOnly && !end.date().isValid()))
if (!count && ((!dateOnly && !end.isValid())
|| (dateOnly && !end.date().isValid())))
return false;
switch (recurType)
{
@ -134,8 +134,8 @@ bool KARecurrence::init(RecurrenceRule::PeriodType recurType, int freq, int coun
else
setEndDateTime(end);
TQDateTime startdt = start.dateTime();
if (recurType == RecurrenceRule::rYearly
&& feb29Type == FEB29_FEB28 || feb29Type == FEB29_MAR1)
if ((recurType == RecurrenceRule::rYearly
&& feb29Type == FEB29_FEB28) || feb29Type == FEB29_MAR1)
{
int year = startdt.date().year();
if (!TQDate::leapYear(year)
@ -257,7 +257,7 @@ void KARecurrence::fix()
{
// This is the second rule.
// Ensure that it can be combined with the first one.
if (day == days[0] || day == -1 && days[0] == 60
if (day == days[0] || (day == -1 && days[0] == 60)
|| rrule->frequency() != rrules[0]->frequency()
|| rrule->startDt() != rrules[0]->startDt())
break;

@ -73,7 +73,7 @@ class DateTime
/** Returns true if the date is null and, if it is a date-time value, the time is also null. */
bool isNull() const { return mDateTime.date().isNull() && (mDateOnly || mDateTime.time().isNull()); }
/** Returns true if the date is valid and, if it is a date-time value, the time is also valid. */
bool isValid() const { return mDateTime.date().isValid() && (mDateOnly || mTimeValid && mDateTime.time().isValid()); }
bool isValid() const { return mDateTime.date().isValid() && (mDateOnly || (mTimeValid && mDateTime.time().isValid())); }
/** Returns true if it is date-only value. */
bool isDateOnly() const { return mDateOnly; }
/** Sets the value to be either date-only or date-time.

@ -99,8 +99,8 @@ void LineEdit::dragEnterEvent(TQDragEnterEvent* e)
e->accept(false); // don't accept "text/calendar" objects
e->accept(TQTextDrag::canDecode(e)
|| KURLDrag::canDecode(e)
|| mType != Url && KPIM::MailListDrag::canDecode(e)
|| mType == Emails && KVCardDrag::canDecode(e));
|| (mType != Url && KPIM::MailListDrag::canDecode(e))
|| (mType == Emails && KVCardDrag::canDecode(e)));
}
void LineEdit::dropEvent(TQDropEvent* e)

@ -86,8 +86,8 @@ void ShellProcess::slotExited(TDEProcess* proc)
{
// Some shells report if the command couldn't be found, or is not executable
int status = proc->exitStatus();
if (mShellName == "bash" && (status == 126 || status == 127)
|| mShellName == "ksh" && status == 127)
if ((mShellName == "bash" && (status == 126 || status == 127))
|| (mShellName == "ksh" && status == 127))
{
kdWarning(5950) << "ShellProcess::slotExited(" << mCommand << ") " << mShellName << ": not found or not executable\n";
mStatus = NOT_FOUND;

@ -77,8 +77,7 @@ bool TimeEdit::isValid() const
void TimeEdit::setValid(bool valid)
{
bool oldValid = mSpinBox->isValid();
if (valid && !oldValid
|| !valid && oldValid)
if ((valid && !oldValid) || (!valid && oldValid))
{
mSpinBox->setValid(valid);
if (mAmPm)

@ -207,7 +207,7 @@ void TimePeriod::setMinutes(int mins, bool dateOnly, TimePeriod::Units defaultUn
else if (item > mMaxUnitShown)
item = mMaxUnitShown;
mUnitsCombo->setCurrentItem(item - mDateOnlyOffset);
if (dateOnly && !mDateOnlyOffset || !dateOnly && mDateOnlyOffset)
if ((dateOnly && !mDateOnlyOffset) || (!dateOnly && mDateOnlyOffset))
item = setDateOnly(mins, dateOnly, false);
}
showHourMin(item == HOURS_MINUTES && !mNoHourMinute);

@ -453,8 +453,8 @@ void RecurrenceEdit::periodClicked(int id)
void RecurrenceEdit::slotAnyTimeToggled(bool on)
{
TQButton* button = mRuleButtonGroup->selected();
mEndTimeEdit->setEnabled(button == mAtLoginButton && !on
|| button == mSubDailyButton && mEndDateButton->isChecked());
mEndTimeEdit->setEnabled((button == mAtLoginButton && !on)
|| (button == mSubDailyButton && mEndDateButton->isChecked()));
}
/******************************************************************************
@ -465,7 +465,7 @@ void RecurrenceEdit::rangeTypeClicked()
bool endDate = mEndDateButton->isOn();
mEndDateEdit->setEnabled(endDate);
mEndTimeEdit->setEnabled(endDate
&& (mAtLoginButton->isOn() && !mEndAnyTimeCheckBox->isChecked()
&& ((mAtLoginButton->isOn() && !mEndAnyTimeCheckBox->isChecked())
|| mSubDailyButton->isOn()));
bool repeatCount = mRepeatCountButton->isOn();
mRepeatCountEntry->setEnabled(repeatCount);
@ -1090,7 +1090,7 @@ bool RecurrenceEdit::stateChanged() const
{
if (mSavedRuleButton != mRuleButtonGroup->selected()
|| mSavedRangeButton != mRangeButtonGroup->selected()
|| mRule && mRule->stateChanged())
|| (mRule && mRule->stateChanged()))
return true;
if (mSavedRangeButton == mRepeatCountButton
&& mSavedRecurCount != mRepeatCountEntry->value())

@ -95,7 +95,7 @@ TrayWindow::TrayWindow(MainWindow* parent, const char* name)
// Replace the default handler for the Quit context menu item
const char* quitName = KStdAction::name(KStdAction::Quit);
actcol->remove(actcol->action(quitName));
actcol->accel()->remove(quitName);
actcol->tdeaccel()->remove(quitName);
KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(slotQuit()), actcol);
// Set icon to correspond with the alarms enabled menu status

Loading…
Cancel
Save