View Single Post
Posts: 1,313 | Thanked: 2,978 times | Joined on Jun 2011 @ Finland
#1095
I have tried getting Alarm action to work. It mostly works, but I haven't gotten the Snooze functionality to work as intended. I would like both users and developers input on this, if you want to help you can try the version available here: http://talk.maemo.org/showpost.php?p...postcount=1022

I need two kinds of opinions/suggestinos:
- Developers: Any ideas how to fix it?
- Users: Is it too broken to be included, or would you rather live with this version than not having it at all?

The alarm works well otherwise, except for the Snooze functionality. When you press Snooze, the alarm is displayed again in few seconds. I am trying to get it displayed after 10 minutes like the default - but I haven't been able to get it to work.

I'd be okay with disabling the Snooze button altogether, but unfortunately that doesn't seem to work either.

Developers: here is the code that I've tried, any ideas?

Code:
void
HarmattanPlatformUtil::scheduleAlarm(const QString &title, int alarmInSeconds) {
    // Mostly copied from example given by Cristi Boian here: http://www.cristiboian.com/2012/05/setting-alarms-in-harmattan-nokia-n9.html
    IFDEBUG(qDebug() << "HarmattanPlatformUtil::scheduleAlarm title"
            << title << "alarmInSeconds" << alarmInSeconds);

    Maemo::Timed::Event event;
    event.setAttribute("APPLICATION", "ProfileMatic");
    event.setAttribute("TITLE", title);
    event.setAttribute("PLUGIN", "libclockalarm");
    event.setBootFlag();
    event.setAlarmFlag();
    event.setReminderFlag();
    // Try to hide the snooze button - does not work
    event.hideSnoozeButton1();
    // Hard code snooze for 10 minutes - does not work
    event.setTimeoutSnooze(10 * 60);
    // set the alarm in given amount of seconds from now - at least this seems to work
    event.setTicker(QDateTime::currentDateTime().toTime_t() + alarmInSeconds);

    // timed interface setup
    Maemo::Timed::Interface timedIface;
    if(!timedIface.isValid()) {
       IFDEBUG(qDebug() << "HarmattanPlatformUtil::scheduleAlarm Invalid timed interface:" << timedIface.lastError());
       return;
    }
    // add the event
    QDBusReply<uint> reply = timedIface.add_event_sync(event);
    if(!reply.isValid()) {
       IFDEBUG(qDebug() << "HarmattanPlatformUtil::scheduleAlarm Adding event failed:" << reply.error().message());
       return;
    }
    IFDEBUG(qDebug() << "HarmattanPlatformUtil::scheduleAlarm Added event with cookie" << reply.value());
}
__________________
My N9/N950 projects:
 

The Following 2 Users Say Thank You to ajalkane For This Useful Post: