contentstorage/caclient/stub/inc/caclientproxy.h
changeset 87 9d806967057c
parent 85 7feec50967db
child 92 782e3408c2ab
equal deleted inserted replaced
86:e492551a0d54 87:9d806967057c
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11  *
    11  *
    12  * Contributors:
    12  * Contributors:
    13  *
    13  *
    14  * Description: 
    14  * Description:
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 #ifndef CACLIENTPROXY_H
    18 #ifndef CACLIENTPROXY_H
    19 #define CACLIENTPROXY_H
    19 #define CACLIENTPROXY_H
    36 public:
    36 public:
    37 
    37 
    38     /**
    38     /**
    39      * Insert into group type.
    39      * Insert into group type.
    40      */
    40      */
    41     enum InsertType
    41     enum InsertType {
    42     {
       
    43         AfterTheLastEntry = -1,
    42         AfterTheLastEntry = -1,
    44         BeforeTheFirstEntry = 0
    43         BeforeTheFirstEntry = 0
    45     };
    44     };
    46 
    45 
    47     /**
    46     /**
    69      * Method for adding entries.
    68      * Method for adding entries.
    70      * @param entryToAdd entry.
    69      * @param entryToAdd entry.
    71      * @param targetEntry entry.
    70      * @param targetEntry entry.
    72      * @return error code.
    71      * @return error code.
    73      */
    72      */
    74     ErrorCode addData(const CaEntry& entryToAdd,
    73     ErrorCode addData(const CaEntry &entryToAdd,
    75         CaEntry& targetEntry);
    74                       CaEntry &targetEntry);
    76 
    75 
    77     /**
    76     /**
    78      * Method for removing entries.
    77      * Method for removing entries.
    79      * @param entryIdList list of ids.
    78      * @param entryIdList list of ids.
    80      * @return error code.
    79      * @return error code.
    87      * @param entryIdList list of ids.
    86      * @param entryIdList list of ids.
    88      * @param beforeEntryId id of item before which the items are inserted.
    87      * @param beforeEntryId id of item before which the items are inserted.
    89      * @return error code.
    88      * @return error code.
    90      */
    89      */
    91     ErrorCode insertEntriesIntoGroup(int groupId,
    90     ErrorCode insertEntriesIntoGroup(int groupId,
    92         const QList<int> &entryIdList, int beforeEntryId);
    91                                      const QList<int> &entryIdList, int beforeEntryId);
    93 
    92 
    94     /**
    93     /**
    95      * Remove entries from group.
    94      * Remove entries from group.
    96      * @param groupId group id.
    95      * @param groupId group id.
    97      * @param entryIdList list of ids.
    96      * @param entryIdList list of ids.
    98      * @param calledDirectly true if the function was called directly (not
    97      * @param calledDirectly true if the function was called directly (not
    99      * from insertEntriesIntoGroup).
    98      * from insertEntriesIntoGroup).
   100      * @return error code.
    99      * @return error code.
   101      */
   100      */
   102     ErrorCode removeEntriesFromGroup(int groupId,
   101     ErrorCode removeEntriesFromGroup(int groupId,
   103         const QList<int> &entryIdList,
   102                                      const QList<int> &entryIdList,
   104         bool calledDirectly = true);
   103                                      bool calledDirectly = true);
   105 
   104 
   106     /**
   105     /**
   107      * Method for fetching entries.
   106      * Method for fetching entries.
   108      *
   107      *
   109      * @param entryIdList list of input ids.
   108      * @param entryIdList list of input ids.
   110      * @param sourceList List of results.
   109      * @param sourceList List of results.
   111      * @return error code
   110      * @return error code
   112      */
   111      */
   113     ErrorCode getData(const QList<int>& entryIdList, QList<CaEntry*>& sourceList);
   112     ErrorCode getData(const QList<int>& entryIdList, QList<CaEntry *>& sourceList);
   114 
   113 
   115     /**
   114     /**
   116      * Method for fetching entries.
   115      * Method for fetching entries.
   117      *
   116      *
   118      * @param query query.
   117      * @param query query.
   119      * @param sourceList List of results.
   118      * @param sourceList List of results.
   120      * @return error code
   119      * @return error code
   121      */
   120      */
   122     ErrorCode getData(const CaQuery &query, QList<CaEntry*>& sourceList);
   121     ErrorCode getData(const CaQuery &query, QList<CaEntry *>& sourceList);
   123 
   122 
   124     /**
   123     /**
   125      * Method for fetching entries.
   124      * Method for fetching entries.
   126      *
   125      *
   127      * @param query query.
   126      * @param query query.
   128      * @param sourceIdList List of results (ids).
   127      * @param sourceIdList List of results (ids).
   129      * @return error code
   128      * @return error code
   130      */
   129      */
   131     ErrorCode getEntryIds(const CaQuery &query,
   130     ErrorCode getEntryIds(const CaQuery &query,
   132         QList<int>& sourceIdList);
   131                           QList<int>& sourceIdList);
   133 
   132 
   134     /**
   133     /**
   135      * Method for executing command
   134      * Method for executing command
   136      *
   135      *
   137      * @param entry entry on wchich command will be executed
   136      * @param entry entry on wchich command will be executed
   138      * @param command command to execute
   137      * @param command command to execute
   139      * @return error code
   138      * @return error code
   140      */
   139      */
   141     ErrorCode executeCommand(const CaEntry& entry,
   140     ErrorCode executeCommand(const CaEntry &entry,
   142         const QString& command);
   141                              const QString &command);
   143 
   142 
   144     /**
   143     /**
   145      * Method for touching entry.
   144      * Method for touching entry.
   146      *
   145      *
   147      * @param entry entry to touch
   146      * @param entry entry to touch
   148      * @return error code
   147      * @return error code
   149      */
   148      */
   150     ErrorCode touch(const CaEntry& entry);
   149     ErrorCode touch(const CaEntry &entry);
   151     
   150 
   152     /**
   151     /**
   153      * Method for custom sort.
   152      * Method for custom sort.
   154      * @param entryIdList list of ids.
   153      * @param entryIdList list of ids.
   155      * @param groupId Group id. 
   154      * @param groupId Group id.
   156      * @return error code.
   155      * @return error code.
   157      */
   156      */
   158     ErrorCode customSort(const QList<int> &entryIdList, int groupId);
   157     ErrorCode customSort(const QList<int> &entryIdList, int groupId);
   159 
   158 
   160     /**
   159     /**
   161      * Generate a list of parent ids of the given entries.
   160      * Generate a list of parent ids of the given entries.
   162      * @param entryIds a list of entries.
   161      * @param entryIds a list of entries.
   163      * @param parentIds a list of parent ids.
   162      * @param parentIds a list of parent ids.
   164      * @return true if the operation is successful.
   163      * @return true if the operation is successful.
   165      */
   164      */
   166     bool GetParentsIds( const QList<int> &entryIds,
   165     bool GetParentsIds(const QList<int> &entryIds,
   167         QList<int> &parentIds);
   166                        QList<int> &parentIds);
   168 
   167 
   169 private:
   168 private:
   170     bool hsWidgetExists(int uid);
   169     bool hsWidgetExists(int uid);
   171     void addWidgetEntry(const HsWidgetToken &widgetToken);
   170     void addWidgetEntry(const HsWidgetToken &widgetToken);
   172     
   171 
   173     void modifyQueryForSortOrder(QString& queryString,
   172     void modifyQueryForSortOrder(QString &queryString,
   174         const CaQuery &query, bool parent) const;
   173                                  const CaQuery &query, bool parent) const;
   175     bool setIconInDb(CaEntry* entryClone) const;
   174     bool setIconInDb(CaEntry *entryClone) const;
   176     bool setEntryInDb(CaEntry* entryClone) const;
   175     bool setEntryInDb(CaEntry *entryClone) const;
   177     bool setAttributesInDb(CaEntry* entryClone) const;
   176     bool setAttributesInDb(CaEntry *entryClone) const;
   178     void CreateGetParentsIdsQuery(
   177     void CreateGetParentsIdsQuery(
   179         const QList<int> &entryIds,
   178         const QList<int> &entryIds,
   180         const QList<int> &parentIds,
   179         const QList<int> &parentIds,
   181         QString &query);
   180         QString &query);
   182         
   181 
   183 private:
   182 private:
   184     QString mWidgetRegistryPath;
   183     QString mWidgetRegistryPath;
   185 };
   184 };
   186 
   185 
   187 #endif // CACLIENTPROXY_H
   186 #endif // CACLIENTPROXY_H