37class SyncSchedulePrivate;
38class SyncScheduleTest;
40const QString SYNC_SCHEDULE_ENABLED_KEY_BOOL(
"scheduler/schedule_enabled");
41const QString SYNC_SCHEDULE_PEAK_ENABLED_KEY_BOOL(
"scheduler/schedule_peak_enabled");
42const QString SYNC_SCHEDULE_OFFPEAK_ENABLED_KEY_BOOL(
"scheduler/schedule_offpeak_enabled");
43const QString SYNC_SCHEDULE_PEAK_DAYS_KEY_INT (
"scheduler/schedule_peak_days");
44const QString SYNC_SCHEDULE_PEAK_START_TIME_KEY_INT (
"scheduler/schedule_peak_start_time");
45const QString SYNC_SCHEDULE_PEAK_END_TIME_KEY_INT (
"scheduler/schedule_peak_end_time");
46const QString SYNC_SCHEDULE_PEAK_SCHEDULE_KEY_INT (
"scheduler/schedule_peak");
47const QString SYNC_SCHEDULE_OFFPEAK_SCHEDULE_KEY_INT (
"scheduler/schedule_off_peak");
55 Q_PROPERTY(QTime time READ time)
56 Q_PROPERTY(Days days READ days)
57 Q_PROPERTY(
unsigned interval READ interval)
59 Q_PROPERTY(QTime rushBegin READ rushBegin)
60 Q_PROPERTY(QTime rushEnd READ rushEnd)
61 Q_PROPERTY(Days rushDays READ rushDays)
62 Q_PROPERTY(
unsigned rushInterval READ rushInterval)
63 Q_PROPERTY(
bool rushEnabled READ rushEnabled)
75 Q_DECLARE_FLAGS(Days, Day)
116 QDomElement
toXml(QDomDocument &aDoc)
const;
148 void setTime(
const QTime &aTime);
166 unsigned interval()
const;
194 bool rushEnabled()
const;
220 Days rushDays()
const;
232 QTime rushBegin()
const;
238 QTime rushEnd()
const;
245 void setRushTime(
const QTime &aBegin,
const QTime &aEnd);
251 unsigned rushInterval()
const;
270 QDateTime
nextSyncTime(
const QDateTime &aPrevSync)
const;
286 bool isSyncScheduled(
const QDateTime &aActualDateTime,
const QDateTime &aPreviousSyncTime = QDateTime())
const;
292#ifdef SYNCFW_UNIT_TESTS
293 friend class SyncScheduleTest;
Private implementation class for SyncSchedule.
Definition SyncSchedule_p.h:36
Class for handling sync schedule settings.
Definition SyncSchedule.h:53
QString toString() const
Exports the sync schedule to QString.
Definition SyncSchedule.cpp:162
bool operator==(const SyncSchedule &aRhs) const
Equal to operator.
Definition SyncSchedule.cpp:114
SyncSchedule()
Constructs an empty schedule.
Definition SyncSchedule.cpp:64
SyncSchedule & operator=(const SyncSchedule &aRhs)
Assignment operator.
Definition SyncSchedule.cpp:104
bool isSyncScheduled(const QDateTime &aActualDateTime, const QDateTime &aPreviousSyncTime=QDateTime()) const
Returns true if aDateTime is within a scheduled period.
Definition SyncSchedule.cpp:501
QDateTime scheduleConfiguredTime()
To get the scheduled config time.
Definition SyncSchedule.cpp:190
QDateTime nextRushSwitchTime(const QDateTime &aFromTime) const
Gets next time to switch rush/off-rush schedule intervals.
Definition SyncSchedule.cpp:477
void setTime(const QTime &aTime)
Sets the exact time for sync.
Definition SyncSchedule.cpp:200
void setScheduleEnabled(bool aEnabled)
Sets if normal schedule is to be obeyed.
Definition SyncSchedule.cpp:220
bool scheduleEnabled() const
Checks if normal schedule is obeyed.
Definition SyncSchedule.cpp:215
void setInterval(unsigned aInterval)
Sets sync interval in minutes.
Definition SyncSchedule.cpp:210
void setDays(Days aDays)
Sets the enabled week days.
Definition SyncSchedule.cpp:180
void setRushDays(Days aDays)
Sets days enabled for rush hours.
Definition SyncSchedule.cpp:250
void setScheduleConfiguredTime(const QDateTime &aDateTime)
Sets scheduled config time.
Definition SyncSchedule.cpp:185
bool inExternalSyncRushPeriod(const QDateTime &aDateTime) const
Checks if a given time is inside rush hour and if the sync is controlled by a external process.
Definition SyncSchedule.cpp:281
bool syncExternallyDuringRush() const
Checks if rush schedule is controlled by a external process.
Definition SyncSchedule.cpp:235
void setRushTime(const QTime &aBegin, const QTime &aEnd)
Sets begin and end times of rush hours.
Definition SyncSchedule.cpp:265
~SyncSchedule()
Destructor.
Definition SyncSchedule.cpp:98
void setSyncExternallyDuringRush(bool aEnabled)
Sets if rush schedule is controlled by a external process.
Definition SyncSchedule.cpp:240
void setRushInterval(unsigned aInterval)
Sets sync interval for rush hours.
Definition SyncSchedule.cpp:276
QDateTime nextSyncTime(const QDateTime &aPrevSync) const
Gets next sync time based on the sync schedule settings.
Definition SyncSchedule.cpp:291
QDomElement toXml(QDomDocument &aDoc) const
Exports the sync schedule to XML.
Definition SyncSchedule.cpp:138
void setRushEnabled(bool aEnabled)
Sets rush hour schedule is to be obeyed.
Definition SyncSchedule.cpp:230