|
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: |
|
15 * The source file of the operation param of file manager |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "fmoperationviewdetails.h" |
|
20 #include "fmdrivedetailstype.h" |
|
21 #include <QtAlgorithms> |
|
22 |
|
23 /* |
|
24 * Constructs one view drive details operation with |
|
25 * \a parent parent. |
|
26 * \a driverName the drive name. |
|
27 */ |
|
28 FmOperationDriveDetails::FmOperationDriveDetails( QObject *parent, const QString &driverName ) : |
|
29 FmOperationBase( parent, FmOperationService::EOperationTypeDriveDetails ), |
|
30 mDriverName( driverName ), mStop( 0 ) |
|
31 { |
|
32 } |
|
33 |
|
34 /* |
|
35 * Destructs the operation. |
|
36 */ |
|
37 FmOperationDriveDetails::~FmOperationDriveDetails() |
|
38 { |
|
39 qDeleteAll(mDetailsSizeList); |
|
40 } |
|
41 |
|
42 /* |
|
43 * Returns the drive name. |
|
44 */ |
|
45 QString FmOperationDriveDetails::driverName() |
|
46 { |
|
47 return mDriverName; |
|
48 } |
|
49 |
|
50 /* |
|
51 * reimp. |
|
52 */ |
|
53 void FmOperationDriveDetails::start( volatile bool *isStopped ) |
|
54 { |
|
55 mStop = isStopped; |
|
56 emit notifyWaiting( true ); |
|
57 //FmOperationDriveDetails *operationDriverDetails = static_cast<FmOperationDriveDetails*>( mOperationBase ); |
|
58 int ret = FmDriveDetailsContent::querySizeofContent( driverName(), detailsSizeList(), mStop ); |
|
59 if( ret == FmErrNone ) { |
|
60 emit notifyFinish(); |
|
61 } else { |
|
62 emit notifyError( ret, QString() ); |
|
63 } |
|
64 } |
|
65 |
|
66 /* |
|
67 * Returns detail items size list. |
|
68 */ |
|
69 QList<FmDriveDetailsSize*> &FmOperationDriveDetails::detailsSizeList() |
|
70 { |
|
71 return mDetailsSizeList; |
|
72 } |
|
73 |
|
74 /* |
|
75 * Constructs one view folder details operation with |
|
76 * \a parent parent. |
|
77 * \a driverName the drive name. |
|
78 */ |
|
79 FmOperationFolderDetails::FmOperationFolderDetails( QObject *parent, const QString &folderPath ) : |
|
80 FmOperationBase( parent, FmOperationService::EOperationTypeFolderDetails ), |
|
81 mFolderPath( folderPath ), |
|
82 mNumofSubFolders( 0 ), |
|
83 mNumofFiles( 0 ), |
|
84 mSizeofFolder( 0 ) |
|
85 |
|
86 { |
|
87 } |
|
88 |
|
89 /* |
|
90 * Destructs the operation. |
|
91 */ |
|
92 FmOperationFolderDetails::~FmOperationFolderDetails() |
|
93 { |
|
94 |
|
95 } |
|
96 |
|
97 /* |
|
98 * Returns the folder path. |
|
99 */ |
|
100 QString FmOperationFolderDetails::folderPath() |
|
101 { |
|
102 return mFolderPath; |
|
103 } |
|
104 |
|
105 /* |
|
106 * Returns the number of sub folders. |
|
107 */ |
|
108 int &FmOperationFolderDetails::numofSubFolders() |
|
109 { |
|
110 return mNumofSubFolders; |
|
111 } |
|
112 |
|
113 /* |
|
114 * Returns the number of files |
|
115 */ |
|
116 int &FmOperationFolderDetails::numofFiles() |
|
117 { |
|
118 return mNumofFiles; |
|
119 } |
|
120 |
|
121 /* |
|
122 * Returns the size of folder. |
|
123 */ |
|
124 quint64 &FmOperationFolderDetails::sizeofFolder() |
|
125 { |
|
126 return mSizeofFolder; |
|
127 } |
|
128 |
|
129 /* |
|
130 * Reimp. |
|
131 */ |
|
132 void FmOperationFolderDetails::start( volatile bool *isStopped ) |
|
133 { |
|
134 mStop = isStopped; |
|
135 emit notifyWaiting( true ); |
|
136 int ret = FmFolderDetails::getNumofSubfolders( folderPath(), numofSubFolders(), |
|
137 numofFiles(), sizeofFolder(), mStop ); |
|
138 if( ret == FmErrNone ) { |
|
139 emit notifyFinish(); |
|
140 } else { |
|
141 emit notifyError( ret, QString() ); |
|
142 } |
|
143 } |