|
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 restore settings of file manager |
|
17 */ |
|
18 |
|
19 #ifndef FMRESTORESETTINGS_H |
|
20 #define FMRESTORESETTINGS_H |
|
21 |
|
22 #include "fmbkupengine_global.h" |
|
23 |
|
24 #include <QDateTime> |
|
25 #include <QString> |
|
26 #include <QList> |
|
27 |
|
28 class FmBkupDrivesAndOperation; |
|
29 class FmBkupEngine; |
|
30 // CLASS DECLARATION |
|
31 /** |
|
32 * This class is used for storing restore info |
|
33 */ |
|
34 class FmRestoreInfo |
|
35 { |
|
36 public: |
|
37 FmRestoreInfo( const quint32 content, const QDateTime &dateTime, const QString &drive ) : |
|
38 mContent( content ), mDateTime ( dateTime ), mDrive ( drive ) |
|
39 { |
|
40 } |
|
41 ~FmRestoreInfo( void ) |
|
42 { |
|
43 } |
|
44 |
|
45 quint32 content() const |
|
46 { |
|
47 return mContent; |
|
48 } |
|
49 |
|
50 QDateTime dateTime() const |
|
51 { |
|
52 return mDateTime; |
|
53 } |
|
54 QString drive() const |
|
55 { |
|
56 return mDrive; |
|
57 } |
|
58 |
|
59 FmRestoreInfo( const FmRestoreInfo &other ) |
|
60 { |
|
61 mContent = other.mContent; |
|
62 mDateTime = other.mDateTime; |
|
63 mDrive = other.mDrive; |
|
64 } |
|
65 |
|
66 FmRestoreInfo &operator =( const FmRestoreInfo &other ) |
|
67 { |
|
68 if( this == &other ){ |
|
69 return *this; |
|
70 } |
|
71 |
|
72 mContent = other.mContent; |
|
73 mDateTime = other.mDateTime; |
|
74 mDrive = other.mDrive; |
|
75 return *this; |
|
76 } |
|
77 |
|
78 private: |
|
79 quint32 mContent; /// single content mask id |
|
80 QDateTime mDateTime; |
|
81 QString mDrive; |
|
82 }; |
|
83 |
|
84 // CLASS DECLARATION |
|
85 /** |
|
86 * This class is used for storing restore entry which used in restore view |
|
87 * Each row in restore view is a single entry |
|
88 */ |
|
89 class FmRestoreEntry |
|
90 { |
|
91 public: |
|
92 FmRestoreEntry( const QString& text, const FmRestoreInfo& info ) : |
|
93 mText( text ), mRestoreInfo( info ) |
|
94 { |
|
95 } |
|
96 ~FmRestoreEntry( void ) |
|
97 { |
|
98 } |
|
99 |
|
100 FmRestoreEntry( const FmRestoreEntry &other ) : mRestoreInfo( other.mRestoreInfo ), mText( other.mText ) |
|
101 { |
|
102 } |
|
103 |
|
104 FmRestoreEntry &operator =( const FmRestoreEntry &other ) |
|
105 { |
|
106 if( this == &other ){ |
|
107 return *this; |
|
108 } |
|
109 |
|
110 mText = other.mText; |
|
111 mRestoreInfo = other.mRestoreInfo; |
|
112 return *this; |
|
113 } |
|
114 |
|
115 QString text() const |
|
116 { |
|
117 return mText; |
|
118 } |
|
119 |
|
120 FmRestoreInfo restoreInfo() const |
|
121 { |
|
122 return mRestoreInfo; |
|
123 } |
|
124 |
|
125 private: |
|
126 QString mText; /// display text |
|
127 FmRestoreInfo mRestoreInfo; /// info |
|
128 }; |
|
129 |
|
130 // CLASS DECLARATION |
|
131 /** |
|
132 * This class is used for storing resore settings which used in restore view |
|
133 */ |
|
134 class FMBKUPENGINE_EXPORT FmRestoreSettings |
|
135 { |
|
136 public: |
|
137 |
|
138 public: |
|
139 explicit FmRestoreSettings( FmBkupEngine& ); |
|
140 ~FmRestoreSettings( void ); |
|
141 |
|
142 /* |
|
143 * load and refresh data to entry list |
|
144 */ |
|
145 void load( QList<FmBkupDrivesAndOperation* > drivesAndOperationList ); |
|
146 |
|
147 /** |
|
148 * get restore entry list, please invoke load() first. |
|
149 * @return restore entry list |
|
150 */ |
|
151 QList< FmRestoreEntry* > restoreEntryList(); |
|
152 |
|
153 void GetSelectionL( QList< FmRestoreInfo >& infoArray ) const; |
|
154 void SetSelection( const quint64& aSelection ); |
|
155 |
|
156 private: |
|
157 /** |
|
158 * create restore entry that will be used in restore view. |
|
159 */ |
|
160 FmRestoreEntry* CreateEntry( const FmRestoreInfo &info ); |
|
161 |
|
162 /** |
|
163 * delete memory in the entry list |
|
164 */ |
|
165 void resetAndDestoryRestoreEntry(); |
|
166 |
|
167 /* |
|
168 * refresh data to entry list |
|
169 */ |
|
170 void refreshList( QList<FmBkupDrivesAndOperation* > &drivesAndOperationList ); |
|
171 |
|
172 private: |
|
173 /** |
|
174 * Restore selection |
|
175 */ |
|
176 quint32 iSelection; |
|
177 |
|
178 /** |
|
179 * Restore setting list items |
|
180 */ |
|
181 QList< FmRestoreEntry* > mRestoreEntryList; |
|
182 |
|
183 FmBkupEngine& mEngine; |
|
184 }; |
|
185 |
|
186 #endif //FMRESTORESETTINGS_H |