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 * |
|
15 * Description: |
|
16 * The header file of the data list model of file manager |
|
17 */ |
|
18 |
|
19 #ifndef FMDATALISTMODEL_H |
|
20 #define FMDATALISTMODEL_H |
|
21 |
|
22 #include "fmcommon.h" |
|
23 |
|
24 #include <QStringList> |
|
25 #include <QAbstractItemView> |
|
26 |
|
27 class FmDataListModel : public QAbstractListModel |
|
28 { |
|
29 Q_OBJECT |
|
30 public: |
|
31 FmDataListModel(QObject *parent = 0); |
|
32 |
|
33 /** |
|
34 * Return row count |
|
35 * @param parent ModelIndex |
|
36 * @return row count |
|
37 */ |
|
38 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
|
39 |
|
40 /** |
|
41 * Return data of designated role |
|
42 * @param index ModelIndex |
|
43 * @param role role of data, DisplayRole for show and UserRole for data |
|
44 * @return data |
|
45 */ |
|
46 QVariant data(const QModelIndex &index, int role) const; |
|
47 |
|
48 /** |
|
49 * Set data of designated role |
|
50 * @param index ModelIndex |
|
51 * @param role role of data, DisplayRole for show and UserRole for data |
|
52 * @return if operation succeed |
|
53 */ |
|
54 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole); |
|
55 |
|
56 /** |
|
57 * Get flags |
|
58 * @param index ModelIndex |
|
59 * @return flags |
|
60 */ |
|
61 Qt::ItemFlags flags(const QModelIndex &index) const; |
|
62 |
|
63 /** |
|
64 * Insert count rows into the model before the given row. |
|
65 * @param row the given row, |
|
66 * @param count count of rows |
|
67 * @param parent parent ModelIndex |
|
68 * @return if operation succeed |
|
69 */ |
|
70 bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); |
|
71 |
|
72 /** |
|
73 * Remove count rows from the model at the given row. |
|
74 * @param row the given row, |
|
75 * @param count count of rows |
|
76 * @param parent parent ModelIndex |
|
77 * @return if operation succeed |
|
78 */ |
|
79 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); |
|
80 |
|
81 private: |
|
82 QStringList mDisplayLst; |
|
83 QStringList mUserDataLst; |
|
84 }; |
|
85 |
|
86 #endif // FMDATALISTMODEL_H |
|