summaryrefslogtreecommitdiff
path: root/libopie/pim/opimnotifymanager.cpp
blob: 49af757a3b4c450b7f8a97706d06cf8913ee6daf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "opimnotifymanager.h"

OPimNotifyManager::OPimNotifyManager( const Reminders& rem,  const Alarms& al)
    : m_rem( rem ), m_al( al )
{}
OPimNotifyManager::~OPimNotifyManager() {
}
/* use static_cast and type instead of dynamic... */
void OPimNotifyManager::add( const OPimNotify& noti) {
    if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
        const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
        m_rem.append( rem );
    }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
        const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
        m_al.append( al );
    }
}
void OPimNotifyManager::remove( const OPimNotify& noti) {
    if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
        const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
        m_rem.remove( rem );
    }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
        const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
        m_al.remove( al );
    }
}
void OPimNotifyManager::replace( const OPimNotify& noti) {
    if ( noti.type() == QString::fromLatin1("OPimReminder") ) {
        const OPimReminder& rem = static_cast<const OPimReminder&>(noti);
        m_rem.remove( rem );
        m_rem.append( rem );
    }else if ( noti.type() == QString::fromLatin1("OPimAlarm") ) {
        const OPimAlarm& al = static_cast<const OPimAlarm&>(noti);
        m_al.remove( al );
        m_al.append( al );
    }
}
OPimNotifyManager::Reminders OPimNotifyManager::reminders()const {
    return m_rem;
}
OPimNotifyManager::Alarms    OPimNotifyManager::alarms()const {
    return m_al;
}
void OPimNotifyManager::setAlarms( const Alarms& al) {
    m_al = al;
}
void OPimNotifyManager::setReminders( const Reminders& rem) {
    m_rem = rem;
}
/* FIXME!!! */
/**
 * The idea is to check if the provider for our service
 * is online
 * if it is we will use QCOP
 * if not the Factory to get the backend...
 * Qtopia1.6 services would be kewl to have here....
 */
void OPimNotifyManager::registerNotify( const OPimNotify& ) {

}
/* FIXME!!! */
/**
 * same as above...
 * Also implement Url model
 * have a MainWindow....
 */
void OPimNotifyManager::deregister( const OPimNotify& ) {

}
bool OPimNotifyManager::isEmpty()const {
    return ( m_rem.isEmpty() && m_al.isEmpty() );
}