contentstorage/caclient/s60/inc/caobjectadapter.h
author hgs
Wed, 24 Mar 2010 13:06:03 +0200
changeset 90 0e41c72311af
parent 89 1e87eb3b400f
child 92 782e3408c2ab
permissions -rw-r--r--
201011_02
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:
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 OBJECTADAPTER_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#define OBJECTADAPTER_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
// INCLUDES
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
// CLASS DECLARATION
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
#include <QList>
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
#include <cadefs.h>
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
#include "cainnernotifierfilter.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
#include "canotifier.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
#include "canotifier_p.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
#include "cainnerquery.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
class CaEntry;
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
class CaQuery;
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
class CaNotifierFilter;
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
class CCaInnerEntry;
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
class CCaInnerNotifierFilter;
86
hgs
parents: 85
diff changeset
    38
class HbIcon;
hgs
parents: 85
diff changeset
    39
class CFbsBitmap;
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
89
hgs
parents: 88
diff changeset
    41
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
/**
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
 *  CaObjectAdapter
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
class CaObjectAdapter
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
{
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
public:
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
    //Static convertion methods between Symbian and Qt objects
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
     * Converts entry to inner entry.
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
     * @param fromEntry entry to be converted
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
     * @param toEntry inner entry resulting from conversion
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
    static void convertL(
87
hgs
parents: 86
diff changeset
    58
        const CaEntry &fromEntry,
hgs
parents: 86
diff changeset
    59
        CCaInnerEntry &toEntry);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
     * Converts inner entry to entry.
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
     * @param fromEntry inner entry to be converted
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
     * @param toEntry entry resulting from conversino
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
     */
87
hgs
parents: 86
diff changeset
    66
    static void convert(const CCaInnerEntry &fromEntry,
hgs
parents: 86
diff changeset
    67
                        CaEntry &toEntry);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
     * Converts query to inner query.
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
     * @param fromQuery query to be converted
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
     * @param toQuery inner query resutling from conversion
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
    static void convertL(
87
hgs
parents: 86
diff changeset
    75
        const CaQuery &fromQuery,
hgs
parents: 86
diff changeset
    76
        CCaInnerQuery &toQuery);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    77
7feec50967db 201003_02
hgs
parents:
diff changeset
    78
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    79
     * Converts inner entry table to QList of pointers to entries.
7feec50967db 201003_02
hgs
parents:
diff changeset
    80
     * @param fromEntriesArray an array containing inner entries
7feec50967db 201003_02
hgs
parents:
diff changeset
    81
     * for conversion.
7feec50967db 201003_02
hgs
parents:
diff changeset
    82
     * @param toEntriesArray list of converted entries.
7feec50967db 201003_02
hgs
parents:
diff changeset
    83
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    84
    static void convertL(
7feec50967db 201003_02
hgs
parents:
diff changeset
    85
        const RPointerArray<CCaInnerEntry>& fromEntriesArray,
87
hgs
parents: 86
diff changeset
    86
        QList<CaEntry *>& toEntriesArray);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    87
7feec50967db 201003_02
hgs
parents:
diff changeset
    88
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    89
     * Converts QList of ids to RArray of TInts.
7feec50967db 201003_02
hgs
parents:
diff changeset
    90
     * @param fromEntryIdList list of entry id
7feec50967db 201003_02
hgs
parents:
diff changeset
    91
     * @param toEntryIdArray array of entry ids
7feec50967db 201003_02
hgs
parents:
diff changeset
    92
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
    93
    static void convertL(const QList<int> &fromEntryIdList,
87
hgs
parents: 86
diff changeset
    94
                         RArray<TInt>& toEntryIdArray);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
    95
7feec50967db 201003_02
hgs
parents:
diff changeset
    96
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
    97
     * Converts RArray of TInts to QList of ids.
7feec50967db 201003_02
hgs
parents:
diff changeset
    98
     * @param fromEntryIdList an array of entry ids.
7feec50967db 201003_02
hgs
parents:
diff changeset
    99
     * @param toEntryIdList resulgin list of entry ids.
7feec50967db 201003_02
hgs
parents:
diff changeset
   100
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   101
    static void convertL(const RArray<TInt>& fromEntryIdList,
87
hgs
parents: 86
diff changeset
   102
                         QList<int>& toEntryIdList);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   103
7feec50967db 201003_02
hgs
parents:
diff changeset
   104
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   105
     * Converts symbian error code to error code (used in QT code).
7feec50967db 201003_02
hgs
parents:
diff changeset
   106
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   107
    static ErrorCode convertErrorCode(
7feec50967db 201003_02
hgs
parents:
diff changeset
   108
        TInt internalErrorCode);
7feec50967db 201003_02
hgs
parents:
diff changeset
   109
7feec50967db 201003_02
hgs
parents:
diff changeset
   110
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   111
     * Creates icon.
7feec50967db 201003_02
hgs
parents:
diff changeset
   112
     * @param entry entry.
86
hgs
parents: 85
diff changeset
   113
     * @return HbIcon.
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   114
     */
87
hgs
parents: 86
diff changeset
   115
    static HbIcon makeIcon(const CaEntry &entry, const QSize &size);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   116
7feec50967db 201003_02
hgs
parents:
diff changeset
   117
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   118
     * Converts notifier type to inner notifier type.
7feec50967db 201003_02
hgs
parents:
diff changeset
   119
     * @param from notifier type.
7feec50967db 201003_02
hgs
parents:
diff changeset
   120
     * @param to resulting inner notifier type.
7feec50967db 201003_02
hgs
parents:
diff changeset
   121
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   122
    static void convert(
7feec50967db 201003_02
hgs
parents:
diff changeset
   123
        CaNotifierPrivate::NotifierType from,
87
hgs
parents: 86
diff changeset
   124
        CCaInnerNotifierFilter::TNotifierType &to);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   125
7feec50967db 201003_02
hgs
parents:
diff changeset
   126
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   127
     * Converts inner change type to change type.
7feec50967db 201003_02
hgs
parents:
diff changeset
   128
     * @param from inner change type.
7feec50967db 201003_02
hgs
parents:
diff changeset
   129
     * @param to resulting change type.
7feec50967db 201003_02
hgs
parents:
diff changeset
   130
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   131
    static void convert(
87
hgs
parents: 86
diff changeset
   132
        TChangeType src, ChangeType &dest);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   133
7feec50967db 201003_02
hgs
parents:
diff changeset
   134
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   135
     * Converts filter to inner filter.
7feec50967db 201003_02
hgs
parents:
diff changeset
   136
     * @param from notifier filter.
7feec50967db 201003_02
hgs
parents:
diff changeset
   137
     * @param to resulting notifier filter.
7feec50967db 201003_02
hgs
parents:
diff changeset
   138
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   139
    static void convertL(
7feec50967db 201003_02
hgs
parents:
diff changeset
   140
        const CaNotifierFilter &from,
7feec50967db 201003_02
hgs
parents:
diff changeset
   141
        CCaInnerNotifierFilter &to);
7feec50967db 201003_02
hgs
parents:
diff changeset
   142
7feec50967db 201003_02
hgs
parents:
diff changeset
   143
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   144
     * Set entry id.
7feec50967db 201003_02
hgs
parents:
diff changeset
   145
     * @param entry entry.
7feec50967db 201003_02
hgs
parents:
diff changeset
   146
     * @param id entry id.
7feec50967db 201003_02
hgs
parents:
diff changeset
   147
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   148
    static void setId(CaEntry &entry,
87
hgs
parents: 86
diff changeset
   149
                      int id);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   150
7feec50967db 201003_02
hgs
parents:
diff changeset
   151
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
   152
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   153
     * Creates icon. Leaving version.
7feec50967db 201003_02
hgs
parents:
diff changeset
   154
     * @param entry entry.
86
hgs
parents: 85
diff changeset
   155
     * @return HbIcon.
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   156
     */
87
hgs
parents: 86
diff changeset
   157
    static HbIcon makeIconL(const CaEntry &entry, const QSize &size);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   158
7feec50967db 201003_02
hgs
parents:
diff changeset
   159
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   160
     * Make bitmap copy, used to get rid of compression for extended bitmap
7feec50967db 201003_02
hgs
parents:
diff changeset
   161
     * @param input input bitmap.
7feec50967db 201003_02
hgs
parents:
diff changeset
   162
     * @return copied bitmap.
7feec50967db 201003_02
hgs
parents:
diff changeset
   163
     */
87
hgs
parents: 86
diff changeset
   164
    static CFbsBitmap *copyBitmapLC(CFbsBitmap *input);
85
7feec50967db 201003_02
hgs
parents:
diff changeset
   165
7feec50967db 201003_02
hgs
parents:
diff changeset
   166
    /**
7feec50967db 201003_02
hgs
parents:
diff changeset
   167
     * Maps a given sort subject and the order to be applied
7feec50967db 201003_02
hgs
parents:
diff changeset
   168
     * into a sort code used
7feec50967db 201003_02
hgs
parents:
diff changeset
   169
     * @param sortAttribute - what is to be sorted
7feec50967db 201003_02
hgs
parents:
diff changeset
   170
     * @param sortOrder - how it is to be sorted
7feec50967db 201003_02
hgs
parents:
diff changeset
   171
     * @return sort code corresponding to input parameters
7feec50967db 201003_02
hgs
parents:
diff changeset
   172
     */
7feec50967db 201003_02
hgs
parents:
diff changeset
   173
    static CCaInnerQuery::TSortAttribute getSortCode(
7feec50967db 201003_02
hgs
parents:
diff changeset
   174
        SortAttribute sortAttribute,
7feec50967db 201003_02
hgs
parents:
diff changeset
   175
        Qt::SortOrder sortOrder);
7feec50967db 201003_02
hgs
parents:
diff changeset
   176
7feec50967db 201003_02
hgs
parents:
diff changeset
   177
};
7feec50967db 201003_02
hgs
parents:
diff changeset
   178
7feec50967db 201003_02
hgs
parents:
diff changeset
   179
#endif // OBJECTADAPTER_H