homescreensrv_plat/contentstorage_api/caservice.h
changeset 85 7feec50967db
child 87 9d806967057c
equal deleted inserted replaced
4:1a2a00e78665 85:7feec50967db
       
     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     CaEntry * getEntry(int entryId) const;
       
    48     QList<CaEntry *> getEntries(const QList<int> &entryIdList) const;
       
    49     QList<CaEntry *> getEntries(const CaQuery &query) const;
       
    50     QList<int> getEntryIds(const CaQuery &query) const;
       
    51 
       
    52     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<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<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<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<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<CaEntry *> &entryList) const;
       
    94 
       
    95     bool executeCommand(int entryId, const QString &command = "open") const;
       
    96     bool executeCommand(const CaEntry &entry, const QString &command =
       
    97         "open") const;
       
    98 
       
    99     CaNotifier * createNotifier(const CaNotifierFilter &filter) const;
       
   100 
       
   101     bool customSort(int groupId, QList<int> &entryIdList) const;
       
   102 
       
   103     ErrorCode lastError() const;
       
   104 
       
   105     signals:
       
   106 
       
   107     void entryChanged(int entryId, ChangeType changeType);
       
   108     void entryChanged(const CaEntry &entry, ChangeType changeType);
       
   109     void entryTouched(int id);
       
   110     void groupContentChanged(int groupId);
       
   111 
       
   112 private:
       
   113 
       
   114     /**
       
   115      * Pointer to a private implementation.
       
   116      */
       
   117     CaServicePrivate * const m_d;
       
   118 
       
   119     /**
       
   120      * The static pointer to the instance of CaService.
       
   121      */
       
   122     static QWeakPointer<CaService> m_instance;
       
   123 
       
   124     friend class CaServicePrivate;
       
   125     friend class QtSharedPointer::ExternalRefCount<CaService>;
       
   126 
       
   127     Q_DISABLE_COPY(CaService)
       
   128 
       
   129 };
       
   130 
       
   131 
       
   132 #endif // CASERVICE_H