contentstorage/caclient/stub/inc/caclientnotifierproxy.h
changeset 73 4bc7b118b3df
parent 60 f62f87b200ec
equal deleted inserted replaced
66:32469d7d46ff 73:4bc7b118b3df
    25 #include "cadefs.h"
    25 #include "cadefs.h"
    26 #include "canotifier_p.h"
    26 #include "canotifier_p.h"
    27 
    27 
    28 class CaEntry;
    28 class CaEntry;
    29 class CaNotifierFilter;
    29 class CaNotifierFilter;
       
    30 class CaObserver;
    30 
    31 
    31 /**
       
    32  *  IDataObserver
       
    33  *
       
    34  */
       
    35 class IDataObserver
       
    36 {
       
    37 public:
       
    38     /**
       
    39      * Method invoked when entry is changed.
       
    40      * @param entryId entry id.
       
    41      * @param changeType change type.
       
    42      */
       
    43     virtual void entryChanged(int entryId,
       
    44                               ChangeType changeType) const = 0;
       
    45 
    32 
    46     /**
       
    47      * Method invoked when entry is changed.
       
    48      * @param entry entry.
       
    49      * @param changeType change type.
       
    50      */
       
    51     virtual void entryChanged(const CaEntry &entry,
       
    52                               ChangeType changeType) const = 0;
       
    53 
       
    54     /**
       
    55      * Method invoked when entry was changed.
       
    56      * @param entryId entry id.
       
    57      */
       
    58     virtual void entryTouched(int id) const = 0;
       
    59 
       
    60     /**
       
    61      * Method invoked when entry was changed.
       
    62      * @param groupId group id.
       
    63      */
       
    64     virtual void groupContentChanged(int groupId) const = 0;
       
    65 };
       
    66 
    33 
    67 
    34 
    68 class CACLIENT_EXPORT CaClientNotifierProxy: public QObject
    35 class CACLIENT_EXPORT CaClientNotifierProxy: public QObject
    69 {
    36 {
    70     Q_OBJECT
    37     Q_OBJECT
    81      * Destructor.
    48      * Destructor.
    82      */
    49      */
    83     ~CaClientNotifierProxy();
    50     ~CaClientNotifierProxy();
    84 
    51 
    85     /**
    52     /**
    86      * Method invoked when entry is changed.
       
    87      * @param entryId entry id.
       
    88      * @param changeType change type.
       
    89      */
       
    90     virtual void entryChanged(int entryId, ChangeType changeType) const;
       
    91 
       
    92     /**
       
    93      * Method invoked when entry is changed.
       
    94      * @param entry entry.
       
    95      * @param changeType change type.
       
    96      */
       
    97     virtual void entryChanged(const CaEntry &entry,
       
    98                               ChangeType changeType) const;
       
    99 
       
   100     /**
       
   101      * Method invoked when entry was changed.
       
   102      * @param entryId entry id.
       
   103      */
       
   104     virtual void entryTouched(int id) const;
       
   105 
       
   106     /**
       
   107      * Method invoked when entry was changed.
       
   108      * @param groupId group id.
       
   109      */
       
   110     virtual void groupContentChanged(int groupId) const;
       
   111 
       
   112     /**
       
   113      * Method for registering notifier
    53      * Method for registering notifier
   114      *
    54      *
   115      * @param notifierFilter notifierFilter used to register notifier.
    55      * @param notifierFilter notifierFilter used to register notifier.
   116      * @param notifierType type of notifier
    56      * @param notifierType type of notifier
   117      * @return error code
    57      * @return error code
   118      */
    58      */
   119     int registerNotifier(
    59     int registerNotifier(
   120         const CaNotifierFilter *notifierFilter,
    60         const CaNotifierFilter *notifierFilter,
   121         CaNotifierPrivate::NotifierType notifierType,
    61         CaNotifierPrivate::NotifierType notifierType,
   122         const CaClientNotifierProxy *notifierProxy);
    62         const CaObserver *observer);
   123 
    63 
   124     /**
    64     /**
   125      * Method for unregistering notifier.
    65      * Method for unregistering notifier.
   126      *
    66      *
   127      * @param notifierFilter notifierFilter used to unregister notifier.
    67      * @param notifierFilter notifierFilter used to unregister notifier.
   129      */
    69      */
   130     void unregisterNotifier(
    70     void unregisterNotifier(
   131         const CaNotifierFilter &notifierFilter,
    71         const CaNotifierFilter &notifierFilter,
   132         CaNotifierPrivate::NotifierType notifierType);
    72         CaNotifierPrivate::NotifierType notifierType);
   133 
    73 
   134 signals:
       
   135 
    74 
   136     void signalEntryChanged(int entryId, ChangeType changeType) const;
    75     /**
   137     void signalEntryChanged(const CaEntry &entry,
    76      * Reconnect all sessions when server was terminated
   138                             ChangeType changeType) const;
    77      *
   139     void signalEntryTouched(int id) const;
    78      */
   140     void signalGroupContentChanged(int groupId) const;
    79     void connectSessions();
   141 
    80 
   142 private:
    81 private:
   143 
       
   144     // Mutex to serialize registering/unregistering for notifications.
       
   145     QMutex mMutex;
       
   146 
    82 
   147     Q_DISABLE_COPY(CaClientNotifierProxy)
    83     Q_DISABLE_COPY(CaClientNotifierProxy)
   148 };
    84 };
   149 
    85 
   150 #endif //_CACLIENTNOTIFIERPROXY_H
    86 #endif //_CACLIENTNOTIFIERPROXY_H