homescreensrv_plat/contentstorage_api/caservice.h
changeset 125 26079c1bb561
parent 123 d1dadafc5584
child 126 efda7c0771b9
equal deleted inserted replaced
123:d1dadafc5584 125:26079c1bb561
     1 /*
       
     2  * Copyright (c) 2009 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: caservice.h
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CASERVICE_H
       
    19 #define CASERVICE_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QSharedPointer>
       
    23 
       
    24 #include <cadefs.h>
       
    25 
       
    26 #include "caclient_global.h"
       
    27 #include "canotifierfilter.h"
       
    28 
       
    29 class CaQuery;
       
    30 class CaEntry;
       
    31 class CaServicePrivate;
       
    32 class CaNotifier;
       
    33 
       
    34 class CACLIENT_EXPORT CaService: public QObject
       
    35 {
       
    36 
       
    37 Q_OBJECT
       
    38 
       
    39     explicit CaService(QObject *parent = 0);
       
    40 
       
    41     ~CaService();
       
    42 
       
    43 public:
       
    44 
       
    45     static QSharedPointer<CaService> instance();
       
    46 
       
    47     QSharedPointer<CaEntry> getEntry(int entryId) const;
       
    48     QList< QSharedPointer<CaEntry> > getEntries(const QList<int> &entryIdList) const;
       
    49     QList< QSharedPointer<CaEntry> > getEntries(const CaQuery &query) const;
       
    50     QList<int> getEntryIds(const CaQuery &query) const;
       
    51 
       
    52     QSharedPointer<CaEntry> createEntry(const CaEntry &entry) const;
       
    53 
       
    54     bool removeEntry(int entryId) const;
       
    55     bool removeEntry(const CaEntry &entry) const;
       
    56     bool removeEntries(const QList<int> &entryIdList) const;
       
    57     bool removeEntries(const QList< QSharedPointer<CaEntry> > &entryList) const;
       
    58 
       
    59     bool updateEntry(const CaEntry &entry) const;
       
    60     bool touch(const CaEntry &entry) const;
       
    61 
       
    62     bool insertEntryIntoGroup(int groupId, int entryId,
       
    63         int beforeEntryId) const;
       
    64     bool insertEntryIntoGroup(const CaEntry &group, const CaEntry &entry,
       
    65         int beforeEntryId) const;
       
    66     bool insertEntriesIntoGroup(int groupId, const QList<int> &entryIdList,
       
    67         int beforeEntryId) const;
       
    68     bool insertEntriesIntoGroup(const CaEntry &group,
       
    69         const QList< QSharedPointer<CaEntry> > &entryList, int beforeEntryId) const;
       
    70 
       
    71     bool removeEntryFromGroup(int groupId, int entryId) const;
       
    72     bool removeEntryFromGroup(const CaEntry &group,
       
    73         const CaEntry &entry) const;
       
    74     bool removeEntriesFromGroup(int groupId,
       
    75         const QList<int> &entryIdList) const;
       
    76     bool removeEntriesFromGroup(const CaEntry &group,
       
    77         const QList< QSharedPointer<CaEntry> > &entryList) const;
       
    78 
       
    79     bool appendEntryToGroup(int groupId, int entryId) const;
       
    80     bool appendEntryToGroup(const CaEntry &group,
       
    81         const CaEntry &entry) const;
       
    82     bool appendEntriesToGroup(int groupId,
       
    83         const QList<int> &entryIdList) const;
       
    84     bool appendEntriesToGroup(const CaEntry &group,
       
    85         const QList< QSharedPointer<CaEntry> > &entryList) const;
       
    86 
       
    87     bool prependEntryToGroup(int groupId, int entryId) const;
       
    88     bool prependEntryToGroup(const CaEntry &group,
       
    89         const CaEntry &entry) const;
       
    90     bool prependEntriesToGroup(int groupId,
       
    91         const QList<int> &entryIdList) const;
       
    92     bool prependEntriesToGroup(const CaEntry &group,
       
    93         const QList< QSharedPointer<CaEntry> > &entryList) const;
       
    94 
       
    95     int executeCommand(int entryId, const QString &command = 
       
    96         caCmdOpen, QObject* receiver = NULL, const char* member = NULL) const;
       
    97     int executeCommand(const CaEntry &entry, const QString &command =
       
    98         caCmdOpen, QObject* receiver = NULL, const char* member = NULL) const;
       
    99 
       
   100     CaNotifier * createNotifier(const CaNotifierFilter &filter) const;
       
   101 
       
   102     bool customSort(int groupId, QList<int> &entryIdList) const;
       
   103 
       
   104     ErrorCode lastError() const;
       
   105 
       
   106     signals:
       
   107 
       
   108     void entryChanged(int entryId, ChangeType changeType);
       
   109     void entryChanged(const CaEntry &entry, ChangeType changeType);
       
   110     void entryTouched(int id);
       
   111     void groupContentChanged(int groupId);
       
   112 
       
   113 private:
       
   114 
       
   115     /**
       
   116      * Pointer to a private implementation.
       
   117      */
       
   118     CaServicePrivate * const m_d;
       
   119 
       
   120     /**
       
   121      * The static pointer to the instance of CaService.
       
   122      */
       
   123     static QWeakPointer<CaService> m_instance;
       
   124 
       
   125     friend class CaServicePrivate;
       
   126     friend class QtSharedPointer::ExternalRefCount<CaService>;
       
   127 
       
   128     Q_DISABLE_COPY(CaService)
       
   129 
       
   130 };
       
   131 
       
   132 
       
   133 #endif // CASERVICE_H