File kdepim-trinity-fix-kalarm-events-error.patch of Package kdepim3

From c036d97d35d25c4511d9569d40c1de07dab96bb6 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Fri, 07 Aug 2015 08:06:29 +0000
Subject: 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>
---
@@ -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;

diff --git a/kalarm/editdlg.cpp b/kalarm/editdlg.cpp
index 8e0cbde..ff35e91 100644
--- a/kalarm/editdlg.cpp
+++ b/kalarm/editdlg.cpp
@@ -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
 		QStringList 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 QString& text, bool trial)
 			mRecurrenceEdit->updateEvent(event, !mTemplate);
 			QDateTime now = QDateTime::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.
@@ -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
diff --git a/kalarm/eventlistviewbase.cpp b/kalarm/eventlistviewbase.cpp
index eea2f87..14a7afd 100644
--- a/kalarm/eventlistviewbase.cpp
+++ b/kalarm/eventlistviewbase.cpp
@@ -459,7 +459,7 @@ QString EventListWhatsThisBase::text(const QPoint& pt)
 	QPoint viewportPt = mListView->viewport()->mapFrom(mListView, pt);
 	QRect frame = mListView->header()->frameGeometry();
 	if (frame.contains(pt)
-	||  mListView->itemAt(QPoint(mListView->itemMargin(), viewportPt.y())) && frame.contains(QPoint(pt.x(), frame.y())))
+	||  (mListView->itemAt(QPoint(mListView->itemMargin(), viewportPt.y())) && frame.contains(QPoint(pt.x(), frame.y()))))
 		column = mListView->header()->sectionAt(pt.x());
 	return mListView->whatsThisText(column);
 }
diff --git a/kalarm/find.cpp b/kalarm/find.cpp
index 9a469e5..8e35cbe 100644
--- a/kalarm/find.cpp
+++ b/kalarm/find.cpp
@@ -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())
 		{
diff --git a/kalarm/functions.cpp b/kalarm/functions.cpp
index cd1f95d..b92e3f3 100644
--- a/kalarm/kalarmapp.cpp
+++ b/kalarm/kalarmapp.cpp
@@ -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 QString& 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 QString& 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,
diff --git a/kalarm/kalarmd/adcalendar.cpp b/kalarm/kalarmd/adcalendar.cpp
index a2cc483..b1033eb 100644
--- a/kalarm/kalarmd/adcalendar.cpp
+++ b/kalarm/kalarmd/adcalendar.cpp
@@ -153,8 +153,8 @@ bool ADCalendar::eventHandled(const KCal::Event* event, const QValueList<QDate
 		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;
diff --git a/kalarm/kalarmd/alarmdaemon.cpp b/kalarm/kalarmd/alarmdaemon.cpp
index 4af7f0d..3b7f745 100644
--- a/kalarm/kalarmd/alarmdaemon.cpp
+++ b/kalarm/kalarmd/alarmdaemon.cpp
@@ -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);
diff --git a/kalarm/karecurrence.cpp b/kalarm/karecurrence.cpp
index 8b7e906..b6051ca 100644
--- a/kalarm/karecurrence.cpp
+++ b/kalarm/karecurrence.cpp
@@ -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);
 	QDateTime 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 (!QDate::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;
diff --git a/kalarm/lib/datetime.h b/kalarm/lib/datetime.h
index bcfa434..d75aa94 100644
--- a/kalarm/lib/datetime.h
+++ b/kalarm/lib/datetime.h
@@ -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.
@@ -209,8 +209,8 @@ class DateTime
 	private:
 		static QTime mStartOfDay;
 		QDateTime    mDateTime;
-		bool         mDateOnly;
-		bool         mTimeValid;    // whether the time is potentially valid - applicable only if mDateOnly false
+		bool          mDateOnly;
+		bool          mTimeValid;    // whether the time is potentially valid - applicable only if mDateOnly false
 };
 
 /** Returns true if the two values are equal. */
diff --git a/kalarm/lib/lineedit.cpp b/kalarm/lib/lineedit.cpp
index 4e40e2c..f561540 100644
--- a/kalarm/lib/lineedit.cpp
+++ b/kalarm/lib/lineedit.cpp
@@ -99,8 +99,8 @@ void LineEdit::dragEnterEvent(QDragEnterEvent* e)
 		e->accept(false);   // don't accept "text/calendar" objects
 	e->accept(QTextDrag::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(QDropEvent* e)
diff --git a/kalarm/lib/shellprocess.cpp b/kalarm/lib/shellprocess.cpp
index c8ea891..1ed64df 100644
--- a/kalarm/lib/shellprocess.cpp
+++ b/kalarm/lib/shellprocess.cpp
@@ -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;
diff --git a/kalarm/lib/timeedit.cpp b/kalarm/lib/timeedit.cpp
index 51760fc..80713f2 100644
--- a/kalarm/lib/timeedit.cpp
+++ b/kalarm/lib/timeedit.cpp
@@ -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)
diff --git a/kalarm/lib/timeperiod.cpp b/kalarm/lib/timeperiod.cpp
index 7f37063..37c7870 100644
--- a/kalarm/lib/timeperiod.cpp
+++ b/kalarm/lib/timeperiod.cpp
@@ -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);
diff --git a/kalarm/recurrenceedit.cpp b/kalarm/recurrenceedit.cpp
index 1389f54..4a61ed6 100644
--- a/kalarm/recurrenceedit.cpp
+++ b/kalarm/recurrenceedit.cpp
@@ -453,8 +453,8 @@ void RecurrenceEdit::periodClicked(int id)
 void RecurrenceEdit::slotAnyTimeToggled(bool on)
 {
 	QButton* 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())
diff --git a/kalarm/traywindow.cpp b/kalarm/traywindow.cpp
index 7eb6d2a..93afa2e 100644
--
cgit v0.9.0.2-52-g1de3
openSUSE Build Service is sponsored by