contentstorage/caclient/stub/src/caclientnotifierproxy.cpp
changeset 60 f62f87b200ec
child 73 4bc7b118b3df
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     1 /*
       
     2  * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  */
       
    17 
       
    18 #include <QDebug>
       
    19 #include <QMutexLocker>
       
    20 
       
    21 #include "caclientnotifierproxy.h"
       
    22 #include "caentry.h"
       
    23 #include "caobjectadapter.h"
       
    24 #include "canotifiers.h"
       
    25 
       
    26 //----------------------------------------------------------------------------
       
    27 //
       
    28 //----------------------------------------------------------------------------
       
    29 CaClientNotifierProxy::CaClientNotifierProxy(QObject *parent) :
       
    30     QObject(parent)
       
    31 {
       
    32 }
       
    33 //----------------------------------------------------------------------------
       
    34 //
       
    35 //----------------------------------------------------------------------------
       
    36 CaClientNotifierProxy::~CaClientNotifierProxy()
       
    37 {
       
    38 }
       
    39 
       
    40 //----------------------------------------------------------------------------
       
    41 //
       
    42 //----------------------------------------------------------------------------
       
    43 void CaClientNotifierProxy::entryChanged(int entryId,
       
    44         ChangeType changeType) const
       
    45 {
       
    46     qDebug() << "CaClientProxy::entryChanged entryId:"
       
    47              << entryId << "changeType:" << changeType;
       
    48     emit signalEntryChanged(entryId, changeType);
       
    49 }
       
    50 
       
    51 //----------------------------------------------------------------------------
       
    52 //
       
    53 //----------------------------------------------------------------------------
       
    54 void CaClientNotifierProxy::entryChanged(const CaEntry &entry,
       
    55         ChangeType changeType) const
       
    56 {
       
    57     qDebug() << "CaClientProxy::entryChanged changeType:" << changeType;
       
    58     CaEntry *caEntry = new CaEntry(entry);
       
    59     emit signalEntryChanged(*caEntry, changeType);
       
    60 }
       
    61 
       
    62 //----------------------------------------------------------------------------
       
    63 //
       
    64 //----------------------------------------------------------------------------
       
    65 void CaClientNotifierProxy::entryTouched(int id) const
       
    66 {
       
    67     qDebug() << "CaClientProxy::entryTouched id:" << id;
       
    68     emit signalEntryTouched(id);
       
    69 }
       
    70 
       
    71 //----------------------------------------------------------------------------
       
    72 //
       
    73 //----------------------------------------------------------------------------
       
    74 void CaClientNotifierProxy::groupContentChanged(int groupId) const
       
    75 {
       
    76     qDebug() << "CaClientProxy::groupContentChanged groupId:" << groupId;
       
    77     emit signalGroupContentChanged(groupId);
       
    78 }
       
    79 
       
    80 //----------------------------------------------------------------------------
       
    81 //
       
    82 //----------------------------------------------------------------------------
       
    83 int CaClientNotifierProxy::registerNotifier(
       
    84     const CaNotifierFilter *notifierFilter,
       
    85     CaNotifierPrivate::NotifierType notifierType,
       
    86     const CaClientNotifierProxy *notifierProxy)
       
    87 {
       
    88     qDebug() << "CaClientProxy::registerNotifier notifierType:"
       
    89              << notifierType;
       
    90     QMutexLocker locker(&mMutex);
       
    91     return CaNotifiers::addNotifier(notifierFilter, notifierType, notifierProxy);
       
    92 }
       
    93 
       
    94 //----------------------------------------------------------------------------
       
    95 //
       
    96 //----------------------------------------------------------------------------
       
    97 void CaClientNotifierProxy::unregisterNotifier(
       
    98     const CaNotifierFilter &notifierFilter,
       
    99     CaNotifierPrivate::NotifierType notifierType)
       
   100 {
       
   101     qDebug() << "CaClientProxy::unregisterNotifier notifierType:"
       
   102              << notifierType;
       
   103     QMutexLocker locker(&mMutex);
       
   104     CaNotifiers::removeNotifier(&notifierFilter, notifierType);
       
   105 }
       
   106