~ubuntu-sdk-team/ubuntu-ui-toolkit/locDemo

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/plugin/ucalarm.cpp

  • Committer: Christian Dywan
  • Date: 2014-05-19 13:11:32 UTC
  • mfrom: (1041.2.19 staging)
  • Revision ID: christian.dywan@canonical.com-20140519131132-8syc77nqqotvb744
MergeĀ lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/staging

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
        return result;
178
178
    }
179
179
 
 
180
    // fix lp:1319401 - dayOfWeek omitted if set to other than AutoDetect
 
181
    int dayOfWeek = rawData.date.date().dayOfWeek();
 
182
    if (!isDaySet(dayOfWeek, rawData.days)) {
 
183
        // dayOfWeek has been set by the user, adjust the date to it
 
184
        int nextOccurrence = nextDayOfWeek(rawData.days, dayOfWeek);
 
185
        if (nextOccurrence < dayOfWeek) {
 
186
             // the starting date should be moved to the next week's occurrence
 
187
            rawData.date = rawData.date.addDays(7 - dayOfWeek + nextOccurrence);
 
188
        } else {
 
189
            // the starting date is still this week
 
190
            rawData.date = rawData.date.addDays(nextOccurrence - dayOfWeek);
 
191
        }
 
192
        rawData.changes |= AlarmData::Date;
 
193
    }
 
194
 
180
195
    // start date should be later then the current date/time
181
196
    if (rawData.date <= AlarmData::normalizeDate(QDateTime::currentDateTime())) {
182
197
        return UCAlarm::EarlyDate;
370
385
    d->rawData.date = AlarmData::normalizeDate(date);
371
386
    d->rawData.changes |= AlarmData::Date;
372
387
    Q_EMIT dateChanged();
373
 
    if (d->rawData.type == UCAlarm::OneTime) {
374
 
        // adjust dayOfWeek as well
375
 
        setDaysOfWeek(UCAlarm::AutoDetect);
376
 
    }
377
388
}
378
389
 
379
390
/*!