示例#1
0
void E2ServerInterface::updateAppointment()
{
    if(m_model->rowCount() == 0) {
        occurrenceText = "No meetings today";
    } else {
        QAppointment appointment;
        bool found = false;
        int secs = 0;
        for(int ii = 0; !found && ii < m_model->rowCount(); ++ii) {
            appointment = m_model->appointment(ii);
            occurrenceText = appointment.description();
            QOccurrence occurrence =
                appointment.nextOccurrence(QDate::currentDate());
            secs = QDateTime::currentDateTime().secsTo(occurrence.start());
            if(secs >= 0) {
                found = true;
            }
        }

        if(!found) {
            occurrenceText = "No meetings today";
        }
    }

    update();
}
示例#2
0
QDateTime QAppointmentIO::nextAlarm( const QAppointment &appointment)
{
    QDateTime now = QDateTime::currentDateTime();
    // -1 days to make room for timezone shift.
    QOccurrence o = appointment.nextOccurrence(now.date().addDays(-1));
    while (o.isValid()) {
        if (now <= o.alarmInCurrentTZ())
            return o.alarmInCurrentTZ();
        o = o.nextOccurrence();
    }
    return QDateTime();
}