contentstorage/caclient/inc/caitemmodel_p.h
changeset 60 f62f87b200ec
child 66 32469d7d46ff
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     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: caitemmodel_p.h
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CAITEMMODEL_P_H
       
    19 #define CAITEMMODEL_P_H
       
    20 
       
    21 // System includes
       
    22 #include <QObject>
       
    23 #include <QModelIndex>
       
    24 
       
    25 // User includes
       
    26 #include "caservice.h"
       
    27 #include "caquery.h"
       
    28 #include "caitemmodel.h"
       
    29 #include "caitemmodellist.h"
       
    30 #include "caclient_global.h"
       
    31 
       
    32 // Forward declarations
       
    33 class CaItemModel;
       
    34 CA_CLIENT_TEST_CLASS(TestCaClient)
       
    35 
       
    36 // Class declaration
       
    37 class CaItemModelPrivate: public QObject
       
    38 {
       
    39 
       
    40     Q_OBJECT
       
    41     CA_CLIENT_TEST_FRIEND_CLASS(TestCaClient)
       
    42 
       
    43 public:
       
    44 
       
    45     // Function declarations
       
    46     explicit CaItemModelPrivate(const CaQuery &query,
       
    47                                 CaItemModel *itemModelPublic);
       
    48     ~CaItemModelPrivate();
       
    49     int rowCount() const;
       
    50     QModelIndex index(int row);
       
    51     QVariant data(const QModelIndex &modelIndex, int role) const;
       
    52     void setAutoUpdate(bool autoUpdate);
       
    53     void setSort(SortAttribute sortAttribute, Qt::SortOrder sortOrder =
       
    54                      Qt::AscendingOrder);
       
    55     void setIconSize(const QSize &size);
       
    56     QSize getIconSize() const;
       
    57     QModelIndex root();
       
    58     CaEntry *entry(const QModelIndex &modelIndex) const;
       
    59     void setSecondLineVisibility(bool secondLineVisibility);
       
    60     bool secondLineVisibility() const;
       
    61     QVariant displayRole(const QModelIndex &modelIndex) const;
       
    62     void setParentId(int parentId);
       
    63     void setFlagsOn(const EntryFlags &onFlags);
       
    64     void setFlagsOff(const EntryFlags &offFlags);
       
    65     bool notifierExists() const;
       
    66 
       
    67 public slots:
       
    68 
       
    69     // Function declarations
       
    70     void updateModel();
       
    71 
       
    72 private:
       
    73 
       
    74     // Function declarations
       
    75     void updateParentEntry();
       
    76     void updateItemData(int id);
       
    77     void addItem(int id);
       
    78     void handleAddItems(QList<int> &itemsList);
       
    79     int itemRow(int id);
       
    80     void removeItem(int id);
       
    81     void removeItems(const QList<int> &itemsList);
       
    82     void updateLayout();
       
    83     void connectSlots();
       
    84     void disconnectSlots();
       
    85     void reconnectSlots();
       
    86 
       
    87 private slots:
       
    88 
       
    89     // Function declarations
       
    90     void updateModelItem(int id, ChangeType changeType);
       
    91     void updateModelContent(int id);
       
    92 
       
    93 private:
       
    94     // data
       
    95 
       
    96     CaItemModel *const m_q;
       
    97     CaEntry *mParentEntry;//own
       
    98     CaQuery mQuery;
       
    99     QSharedPointer<CaService> mService;
       
   100     CaItemModelList mEntries;
       
   101     CaNotifier *mNotifier;//own
       
   102     QSize mSize;
       
   103     bool mSecondLineVisibility;
       
   104 
       
   105 };
       
   106 
       
   107 #endif // CAITEMMODEL_P_H