contentstorage/caclient/src/canotifier.cpp
author hgs
Tue, 23 Mar 2010 23:17:02 +0200
changeset 85 7feec50967db
child 87 9d806967057c
permissions -rw-r--r--
201003_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
 * All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
 * Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
 * Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
 * Description: canotifier.cpp
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#include "canotifier.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#include "canotifier_p.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
#include "canotifierfilter.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
#include "caclientnotifierproxy.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
 \class CaNotifier.
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
 \brief This class describes notifier.
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
 \example
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
 It's example how client can be notified about changes on data specified by client's filter
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
 \code
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
 // example Client class which wants to be notified about changes
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
 class Client: public QObject
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
 {
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
 Q_OBJECT
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
 ...
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
 public slots:
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
 updateModelForEntryChanged(int,ChangeType);
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
 updateModelForEntryChanged(const CaEntry &,ChangeType);
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
 updateModelForEntryTouched(int);
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
 updateModelForgroupContentChanged(int);
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
 ...
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
 };
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
 \endcode
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
 \code
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
 // example code showed how to register for notifications
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
 Client * client;
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
 ...
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
 QSharedPointer<CaService> service = CaService::instance();
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
 CaNotifierFilter notifierFilter();
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
 CaNotifier * notifier = service->createNotifier(notifierfilter);
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
 // Connections cause that notifier is registered to server distributed
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
 // notifications while data changes.
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
 if( notifier )
7feec50967db 201003_02
hgs
parents:
diff changeset
    58
 {
7feec50967db 201003_02
hgs
parents:
diff changeset
    59
 connect( notifier, SIGNAL(entryChanged(int,ChangeType)),
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
 client, SLOT(updateModelForEntryChanged(int,ChangeType)) );
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
 connect( notifier, SIGNAL(entryChanged(CaEntry,ChangeType)),
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
 client, SLOT(updateModelForEntryChanged(CaEntry,ChangeType)) );
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
 connect( notifier, SIGNAL(entryTouched(int)),
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
 client, SLOT(updateModelForEntryTouched(int)) );
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
 connect( notifier, SIGNAL(groupContentChanged(int)),
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
 client, SLOT(updateModelForgroupContentChanged(int)) );
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
 }
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
 ...
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
 // creation new entry causes sent notification to the client
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
 CaEntry entry;
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
 entry.setText( "Text" );
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
 entry.setTypeName( "TypeName" );
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
 CaEntry * newEntry = service->createEntry( entry );
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
 ...
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
 \endcode
7feec50967db 201003_02
hgs
parents:
diff changeset
    76
7feec50967db 201003_02
hgs
parents:
diff changeset
    77
 \code
7feec50967db 201003_02
hgs
parents:
diff changeset
    78
 // here client is being get notifications new entry was created
7feec50967db 201003_02
hgs
parents:
diff changeset
    79
 ...
7feec50967db 201003_02
hgs
parents:
diff changeset
    80
 Client::updateModelForEntryChanged(int entryId ,ChangeType changeType)
7feec50967db 201003_02
hgs
parents:
diff changeset
    81
 {
7feec50967db 201003_02
hgs
parents:
diff changeset
    82
 ...
7feec50967db 201003_02
hgs
parents:
diff changeset
    83
 changeType == AddChangeType;
7feec50967db 201003_02
hgs
parents:
diff changeset
    84
 ...
7feec50967db 201003_02
hgs
parents:
diff changeset
    85
 }
7feec50967db 201003_02
hgs
parents:
diff changeset
    86
7feec50967db 201003_02
hgs
parents:
diff changeset
    87
 \endcode
7feec50967db 201003_02
hgs
parents:
diff changeset
    88
7feec50967db 201003_02
hgs
parents:
diff changeset
    89
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    90
7feec50967db 201003_02
hgs
parents:
diff changeset
    91
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
    92
 Constructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
    93
 \param entryPrivate pointer to private implementation.
7feec50967db 201003_02
hgs
parents:
diff changeset
    94
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    95
CaNotifier::CaNotifier(CaNotifierPrivate * const notifierPrivate) :
7feec50967db 201003_02
hgs
parents:
diff changeset
    96
    QObject(0), m_d(notifierPrivate)
7feec50967db 201003_02
hgs
parents:
diff changeset
    97
{
7feec50967db 201003_02
hgs
parents:
diff changeset
    98
    m_d->m_q = this;
7feec50967db 201003_02
hgs
parents:
diff changeset
    99
    m_d->makeConnect();
7feec50967db 201003_02
hgs
parents:
diff changeset
   100
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   101
7feec50967db 201003_02
hgs
parents:
diff changeset
   102
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   103
 Destructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
   104
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
   105
CaNotifier::~CaNotifier()
7feec50967db 201003_02
hgs
parents:
diff changeset
   106
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   107
    m_d->makeDisconnect();
7feec50967db 201003_02
hgs
parents:
diff changeset
   108
    delete m_d;
7feec50967db 201003_02
hgs
parents:
diff changeset
   109
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   110
7feec50967db 201003_02
hgs
parents:
diff changeset
   111
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   112
    This method is called when something has been
7feec50967db 201003_02
hgs
parents:
diff changeset
   113
    connected to signal in this object.
7feec50967db 201003_02
hgs
parents:
diff changeset
   114
    \param signal which is used to register an appropriate notifier.
7feec50967db 201003_02
hgs
parents:
diff changeset
   115
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
   116
void CaNotifier::connectNotify(const char *signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   117
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   118
    qDebug("CaNotifier::connectNotify");
7feec50967db 201003_02
hgs
parents:
diff changeset
   119
    qDebug("\tsignal: %s", signal);
7feec50967db 201003_02
hgs
parents:
diff changeset
   120
    if (QLatin1String(signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   121
        == SIGNAL(entryChanged(int,ChangeType))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   122
         // signal is entryChanged(int, ChangeType)
7feec50967db 201003_02
hgs
parents:
diff changeset
   123
        if (receivers(SIGNAL(entryChanged(int,ChangeType))) == 1) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   124
            m_d->registerNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   125
                CaNotifierPrivate::EntryChangedWithIdNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   126
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   127
     }
7feec50967db 201003_02
hgs
parents:
diff changeset
   128
    else if (QLatin1String(signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   129
        == SIGNAL(entryChanged(CaEntry,ChangeType))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   130
        // signal is entryChanged(const CaEntry &, ChangeType)
7feec50967db 201003_02
hgs
parents:
diff changeset
   131
        if (receivers(SIGNAL(entryChanged(const CaEntry &,ChangeType))) == 1) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   132
            m_d->registerNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   133
                CaNotifierPrivate::EntryChangedWithEntryNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   134
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   135
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   136
    else if (QLatin1String(signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   137
        == SIGNAL(entryTouched(int))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   138
        // signal is entryTouched(int)
7feec50967db 201003_02
hgs
parents:
diff changeset
   139
        if (receivers(SIGNAL(entryTouched(int)))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   140
            m_d->registerNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   141
                CaNotifierPrivate::EntryTouchedNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   142
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   143
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   144
    else if (QLatin1String(signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   145
        == SIGNAL(groupContentChanged(int))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   146
        // signal is groupContentChanged(int)
7feec50967db 201003_02
hgs
parents:
diff changeset
   147
        if (receivers(SIGNAL(groupContentChanged(int)))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   148
            m_d->registerNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   149
                CaNotifierPrivate::GroupContentChangedNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   150
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   151
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   152
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   153
7feec50967db 201003_02
hgs
parents:
diff changeset
   154
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   155
    This method is called when something has been
7feec50967db 201003_02
hgs
parents:
diff changeset
   156
    disconnected from signal in this object.
7feec50967db 201003_02
hgs
parents:
diff changeset
   157
    \param signal which is used to unregister an appropriate notifier.
7feec50967db 201003_02
hgs
parents:
diff changeset
   158
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
   159
void CaNotifier::disconnectNotify(const char *signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   160
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   161
    qDebug("CaNotifier::disconnectNotify");
7feec50967db 201003_02
hgs
parents:
diff changeset
   162
    qDebug("\tsignal: %s", signal);
7feec50967db 201003_02
hgs
parents:
diff changeset
   163
    if (QLatin1String(signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   164
        == SIGNAL(entryChanged(int,ChangeType))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   165
         // signal is entryChanged(int, ChangeType)
7feec50967db 201003_02
hgs
parents:
diff changeset
   166
        if(receivers(SIGNAL(entryChanged(int,ChangeType)))==0) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   167
            m_d->unregisterNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   168
                CaNotifierPrivate::EntryChangedWithIdNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   169
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   170
     }
7feec50967db 201003_02
hgs
parents:
diff changeset
   171
    else if (QLatin1String(signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   172
        == SIGNAL(entryChanged(CaEntry,ChangeType))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   173
        // signal is entryChanged(const CaEntry &, ChangeType)
7feec50967db 201003_02
hgs
parents:
diff changeset
   174
        if (receivers(SIGNAL(entryChanged(const CaEntry &,ChangeType)))==0) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   175
            m_d->unregisterNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   176
                CaNotifierPrivate::EntryChangedWithEntryNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   177
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   178
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   179
    else if (QLatin1String(signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   180
        == SIGNAL(entryTouched(int))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   181
        // signal is entryTouched(int)
7feec50967db 201003_02
hgs
parents:
diff changeset
   182
        if (receivers(SIGNAL(entryTouched(int))) == 0) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   183
            m_d->unregisterNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   184
                CaNotifierPrivate::EntryTouchedNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   185
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   186
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   187
    else if (QLatin1String(signal)
7feec50967db 201003_02
hgs
parents:
diff changeset
   188
        == SIGNAL(groupContentChanged(int))) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   189
        // signal is groupContentChanged(int)
7feec50967db 201003_02
hgs
parents:
diff changeset
   190
        if (receivers(SIGNAL(groupContentChanged(int))) == 0) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   191
            m_d->unregisterNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   192
                CaNotifierPrivate::GroupContentChangedNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   193
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   194
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   195
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   196
7feec50967db 201003_02
hgs
parents:
diff changeset
   197
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   198
 Constructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
   199
 \param notifierFilter descrbies entries to observe.
7feec50967db 201003_02
hgs
parents:
diff changeset
   200
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
   201
CaNotifierPrivate::CaNotifierPrivate(
7feec50967db 201003_02
hgs
parents:
diff changeset
   202
    const CaNotifierFilter &notifierFilter) :
7feec50967db 201003_02
hgs
parents:
diff changeset
   203
    m_q(NULL),
7feec50967db 201003_02
hgs
parents:
diff changeset
   204
    mNotifierFilter(NULL),
7feec50967db 201003_02
hgs
parents:
diff changeset
   205
    mNotifierProxy(NULL)
7feec50967db 201003_02
hgs
parents:
diff changeset
   206
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   207
        mNotifierFilter = new CaNotifierFilter(notifierFilter);
7feec50967db 201003_02
hgs
parents:
diff changeset
   208
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   209
7feec50967db 201003_02
hgs
parents:
diff changeset
   210
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   211
 Destructor.
7feec50967db 201003_02
hgs
parents:
diff changeset
   212
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
   213
CaNotifierPrivate::~CaNotifierPrivate()
7feec50967db 201003_02
hgs
parents:
diff changeset
   214
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   215
    if (mNotifierProxy) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   216
        mNotifierProxy->unregisterNotifier(*mNotifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
   217
            EntryChangedWithIdNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   218
        mNotifierProxy->unregisterNotifier(*mNotifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
   219
            EntryChangedWithEntryNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   220
        mNotifierProxy->unregisterNotifier(*mNotifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
   221
            EntryTouchedNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   222
        mNotifierProxy->unregisterNotifier(*mNotifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
   223
            GroupContentChangedNotifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   224
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   225
    delete mNotifierFilter;
7feec50967db 201003_02
hgs
parents:
diff changeset
   226
    delete mNotifierProxy;
7feec50967db 201003_02
hgs
parents:
diff changeset
   227
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   228
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   229
 Registers notifier
7feec50967db 201003_02
hgs
parents:
diff changeset
   230
 \param notifierType type of notifier to register (class of events to listen)
7feec50967db 201003_02
hgs
parents:
diff changeset
   231
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
   232
int CaNotifierPrivate::registerNotifier(NotifierType notifierType)
7feec50967db 201003_02
hgs
parents:
diff changeset
   233
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   234
    if (mNotifierProxy) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   235
        return mNotifierProxy->registerNotifier(
7feec50967db 201003_02
hgs
parents:
diff changeset
   236
            mNotifierFilter,
7feec50967db 201003_02
hgs
parents:
diff changeset
   237
            notifierType,
7feec50967db 201003_02
hgs
parents:
diff changeset
   238
            mNotifierProxy);
7feec50967db 201003_02
hgs
parents:
diff changeset
   239
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   240
    return 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
   241
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   242
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   243
 Unregisters notifier
7feec50967db 201003_02
hgs
parents:
diff changeset
   244
 \param notifierType type of notifier event type to unregister
7feec50967db 201003_02
hgs
parents:
diff changeset
   245
     (class of events to listen)
7feec50967db 201003_02
hgs
parents:
diff changeset
   246
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
   247
void CaNotifierPrivate::unregisterNotifier(NotifierType notifierType)
7feec50967db 201003_02
hgs
parents:
diff changeset
   248
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   249
    if (mNotifierProxy) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   250
        mNotifierProxy->unregisterNotifier(*mNotifierFilter, notifierType);
7feec50967db 201003_02
hgs
parents:
diff changeset
   251
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   252
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   253
7feec50967db 201003_02
hgs
parents:
diff changeset
   254
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   255
 Connects this Notifier
7feec50967db 201003_02
hgs
parents:
diff changeset
   256
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
   257
void CaNotifierPrivate::makeConnect()
7feec50967db 201003_02
hgs
parents:
diff changeset
   258
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   259
    if (m_q) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   260
        if (!mNotifierProxy) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   261
            mNotifierProxy = new CaClientNotifierProxy();
7feec50967db 201003_02
hgs
parents:
diff changeset
   262
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
   263
        m_q->connect(mNotifierProxy,
7feec50967db 201003_02
hgs
parents:
diff changeset
   264
            SIGNAL(signalEntryChanged(int,ChangeType)),
7feec50967db 201003_02
hgs
parents:
diff changeset
   265
            m_q,
7feec50967db 201003_02
hgs
parents:
diff changeset
   266
            SIGNAL(entryChanged(int,ChangeType)));
7feec50967db 201003_02
hgs
parents:
diff changeset
   267
        m_q->connect(mNotifierProxy,
7feec50967db 201003_02
hgs
parents:
diff changeset
   268
            SIGNAL(signalEntryChanged(const CaEntry &,ChangeType)),
7feec50967db 201003_02
hgs
parents:
diff changeset
   269
            m_q,
7feec50967db 201003_02
hgs
parents:
diff changeset
   270
            SIGNAL(entryChanged(const CaEntry &,ChangeType)));
7feec50967db 201003_02
hgs
parents:
diff changeset
   271
        m_q->connect(mNotifierProxy,
7feec50967db 201003_02
hgs
parents:
diff changeset
   272
            SIGNAL(signalEntryTouched(int)),
7feec50967db 201003_02
hgs
parents:
diff changeset
   273
            m_q,
7feec50967db 201003_02
hgs
parents:
diff changeset
   274
            SIGNAL(entryTouched(int)));
7feec50967db 201003_02
hgs
parents:
diff changeset
   275
        m_q->connect(mNotifierProxy,
7feec50967db 201003_02
hgs
parents:
diff changeset
   276
            SIGNAL(signalGroupContentChanged(int)),
7feec50967db 201003_02
hgs
parents:
diff changeset
   277
            m_q,
7feec50967db 201003_02
hgs
parents:
diff changeset
   278
            SIGNAL(groupContentChanged(int)));
7feec50967db 201003_02
hgs
parents:
diff changeset
   279
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   280
}
7feec50967db 201003_02
hgs
parents:
diff changeset
   281
/*!
7feec50967db 201003_02
hgs
parents:
diff changeset
   282
 Disconnects this Notifier
7feec50967db 201003_02
hgs
parents:
diff changeset
   283
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
   284
void CaNotifierPrivate::makeDisconnect()
7feec50967db 201003_02
hgs
parents:
diff changeset
   285
{
7feec50967db 201003_02
hgs
parents:
diff changeset
   286
    if (m_q && mNotifierProxy) {
7feec50967db 201003_02
hgs
parents:
diff changeset
   287
        m_q->disconnect(mNotifierProxy,
7feec50967db 201003_02
hgs
parents:
diff changeset
   288
            SIGNAL(signalEntryChanged(int,ChangeType)),
7feec50967db 201003_02
hgs
parents:
diff changeset
   289
            m_q,
7feec50967db 201003_02
hgs
parents:
diff changeset
   290
            SIGNAL(entryChanged(int,ChangeType)));
7feec50967db 201003_02
hgs
parents:
diff changeset
   291
        m_q->disconnect(mNotifierProxy,
7feec50967db 201003_02
hgs
parents:
diff changeset
   292
            SIGNAL( signalEntryChanged(const CaEntry &,ChangeType)),
7feec50967db 201003_02
hgs
parents:
diff changeset
   293
            m_q,
7feec50967db 201003_02
hgs
parents:
diff changeset
   294
            SIGNAL(entryChanged(const CaEntry &,ChangeType)));
7feec50967db 201003_02
hgs
parents:
diff changeset
   295
        m_q->disconnect(mNotifierProxy,
7feec50967db 201003_02
hgs
parents:
diff changeset
   296
            SIGNAL(signalEntryTouched(int)),
7feec50967db 201003_02
hgs
parents:
diff changeset
   297
            m_q,
7feec50967db 201003_02
hgs
parents:
diff changeset
   298
            SIGNAL(entryTouched(int)));
7feec50967db 201003_02
hgs
parents:
diff changeset
   299
        m_q->disconnect(mNotifierProxy,
7feec50967db 201003_02
hgs
parents:
diff changeset
   300
            SIGNAL(signalGroupContentChanged(int)),
7feec50967db 201003_02
hgs
parents:
diff changeset
   301
            m_q,
7feec50967db 201003_02
hgs
parents:
diff changeset
   302
            SIGNAL(groupContentChanged(int)));
7feec50967db 201003_02
hgs
parents:
diff changeset
   303
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
   304
}