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