author | hgs |
Thu, 30 Sep 2010 16:33:59 +0800 | |
changeset 47 | 12b82dc0e8db |
parent 40 | 4167eb56f30d |
permissions | -rw-r--r-- |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* Zhiqiang Yang <zhiqiang.yang@nokia.com> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* Description: |
40 | 16 |
* The source file of the file manager utilities on Symbian |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
*/ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include "fmutils.h" |
40 | 21 |
#include "fmcommon.h" |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include "fms60utils.h" |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
|
47 | 24 |
#include <COEMAIN.H> |
25 |
#include <eikenv.H> |
|
40 | 26 |
#include <apgcli.h> |
27 |
#include <sysutil.h> |
|
28 |
#include <f32file.h> |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include <coemain.h> |
40 | 30 |
#include <pathinfo.h> |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include <driveinfo.h> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include <e32property.h> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
#include <coreapplicationuisdomainpskeys.h> |
40 | 34 |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
#include <QDir> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
#include <QFile> |
40 | 37 |
#include <QRegExp> |
38 |
#include <QStringList> |
|
39 |
#include <QFileInfoList> |
|
25 | 40 |
|
40 | 41 |
#include <xqappmgr.h> |
42 |
#include <XQConversions> |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
#include <xqaiwrequest.h> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
|
40 | 45 |
#include <hbglobal.h> |
46 |
#include <hbdirectorynamelocalizer.h> |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
#define BURCONFIGFILE "z:/private/2002BCC0/burconfig.xml" |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
|
33 | 50 |
/*! |
40 | 51 |
query drive info and status for \a driveName |
52 |
return \a FmDriverInfo |
|
33 | 53 |
*/ |
40 | 54 |
FmDriverInfo FmUtils::queryDriverInfo( const QString &driveName ) |
33 | 55 |
{ |
40 | 56 |
if( driveName.isEmpty() ) { |
57 |
return FmDriverInfo( 0, 0, driveName, QString(), FmDriverInfo::EDriveNotPresent ); |
|
25 | 58 |
} |
47 | 59 |
// CCoeEnv *env = CCoeEnv::Static(); |
60 |
// RFs& fs = env->FsSession(); |
|
61 |
// make new fs so that this function can be called in thread |
|
62 |
RFs fs; |
|
63 |
fs.Connect(); |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
64 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
65 |
TVolumeInfo volumeInfo; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
66 |
TInt drive = 0; |
40 | 67 |
drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
68 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
69 |
quint32 state( 0 ); |
40 | 70 |
|
25 | 71 |
int volumeInfoErr( KErrNone ); |
72 |
int driveInfoErr( KErrNone ); |
|
73 |
int errorCode( KErrNone ); |
|
74 |
volumeInfoErr = fs.Volume( volumeInfo, drive ); |
|
75 |
errorCode = volumeInfoErr; |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
76 |
QString volumeName( (QChar*)( volumeInfo.iName.Des().Ptr() ), volumeInfo.iName.Length() ); |
25 | 77 |
|
78 |
TDriveInfo driveInfo; |
|
79 |
if( volumeInfoErr == KErrNone ) { |
|
80 |
driveInfo = volumeInfo.iDrive; |
|
81 |
} else { |
|
82 |
driveInfoErr = fs.Drive( driveInfo, drive ); |
|
83 |
if( driveInfoErr != KErrNone ) { |
|
84 |
errorCode = driveInfoErr; |
|
85 |
} |
|
86 |
} |
|
87 |
||
27 | 88 |
if( volumeInfoErr == KErrNone || driveInfoErr == KErrNone ) { |
25 | 89 |
//TDriveInfo driveInfo = volumeInfo.iDrive; |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
90 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
91 |
quint32 drvStatus( 0 ); |
25 | 92 |
int err = DriveInfo::GetDriveStatus( fs, drive, drvStatus ); |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
93 |
if( err == KErrNone ) { |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
94 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
95 |
if ( ( drvStatus & DriveInfo::EDriveInternal ) && |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
96 |
( drvStatus & DriveInfo::EDriveExternallyMountable ) ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
97 |
// Handle mass storage bits here |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
98 |
state |= FmDriverInfo::EDriveMassStorage | FmDriverInfo::EDriveRemovable; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
99 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
100 |
|
25 | 101 |
if ( drvStatus & DriveInfo::EDriveUsbMemory ) |
102 |
{ |
|
103 |
state |= FmDriverInfo::EDriveUsbMemory; |
|
104 |
} |
|
33 | 105 |
|
106 |
if ( drvStatus & DriveInfo::EDriveRemote ) |
|
107 |
{ |
|
108 |
state |= FmDriverInfo::EDriveRemote; |
|
109 |
} |
|
110 |
||
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
111 |
if ( drvStatus & DriveInfo::EDriveRom ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
112 |
state |= FmDriverInfo::EDriveRom; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
113 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
114 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
115 |
if ( drvStatus & DriveInfo::EDriveRam ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
116 |
state |= FmDriverInfo::EDriveRam; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
117 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
118 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
119 |
if ( driveInfo.iMediaAtt & KMediaAttFormattable ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
120 |
state |= FmDriverInfo::EDriveFormattable; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
121 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
122 |
if ( driveInfo.iMediaAtt & KMediaAttWriteProtected ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
123 |
state |= FmDriverInfo::EDriveWriteProtected; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
124 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
125 |
if ( driveInfo.iMediaAtt & KMediaAttHasPassword ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
126 |
state |= FmDriverInfo::EDrivePasswordProtected; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
127 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
128 |
if ( driveInfo.iMediaAtt & KMediaAttLocked ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
129 |
state |= FmDriverInfo::EDriveLocked; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
130 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
131 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
132 |
if ( driveInfo.iDriveAtt & KDriveAttRemovable ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
133 |
state |= FmDriverInfo::EDriveRemovable; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
134 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
135 |
if ( drvStatus & DriveInfo::EDriveSwEjectable ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
136 |
state |= FmDriverInfo::EDriveEjectable; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
137 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
138 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
139 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
140 |
if( driveInfo.iType == EMediaNotPresent ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
141 |
state |= FmDriverInfo::EDriveNotPresent; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
142 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
143 |
} |
25 | 144 |
// If memory card is not ready but type is present, |
145 |
// then check if it is reserved. |
|
146 |
if( err == KErrNone && volumeInfoErr == KErrNotReady && |
|
147 |
driveInfo.iType != EMediaNotPresent ) |
|
148 |
{ |
|
149 |
// Check USB file transfer state |
|
150 |
TInt prop( ECoreAppUIsUSBFileTransferUninitialized ); |
|
151 |
RProperty::Get( |
|
152 |
KPSUidCoreApplicationUIs, |
|
153 |
KCoreAppUIsUSBFileTransfer, prop ); |
|
154 |
if ( prop == ECoreAppUIsUSBFileTransferActive ) |
|
155 |
{ |
|
156 |
errorCode = KErrInUse; // Reserved for file transfer |
|
157 |
} |
|
158 |
} |
|
159 |
if( err!= KErrNone ) |
|
160 |
{ |
|
161 |
errorCode = err; |
|
162 |
} |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
163 |
} |
25 | 164 |
|
165 |
// handle error code |
|
166 |
// volumeInfoErr will occur while drive is lock,corrupted... |
|
167 |
// driveInfoErr can not be promoted for locked, corrupted drive. |
|
168 |
// so we can not use driveInfoErr to justify EDriveAvailable |
|
169 |
switch( errorCode ) |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
170 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
171 |
case KErrNone: |
25 | 172 |
// this drive could be used as it is not be locked, or corrupt. |
173 |
state |= FmDriverInfo::EDriveAvailable; |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
174 |
break; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
175 |
case KErrLocked: |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
176 |
state |= FmDriverInfo::EDriveLocked; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
177 |
break; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
178 |
case KErrCorrupt: |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
179 |
state |= FmDriverInfo::EDriveCorrupted; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
180 |
break; |
25 | 181 |
case KErrInUse: |
182 |
state |= FmDriverInfo::EDriveInUse; |
|
183 |
break; |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
184 |
default: // other errors |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
185 |
state |= FmDriverInfo::EDriveNotPresent; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
186 |
break; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
187 |
} |
40 | 188 |
QString logString ( "FmUtils::queryDriverInfo_" + driveName + |
25 | 189 |
"_volumeInfoErr:" + QString::number( volumeInfoErr ) + |
190 |
"_driveInfoErr:" + QString::number( driveInfoErr ) + |
|
191 |
"_errorCode:" + QString::number( errorCode ) + |
|
192 |
"_driveSatus:" + QString::number( state ) ); |
|
32 | 193 |
FM_LOG( logString ); |
47 | 194 |
fs.Close(); |
40 | 195 |
return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driveName, volumeName, state ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
|
40 | 198 |
/*! |
199 |
remove drive password for \a driveName |
|
200 |
\a Pwd is original password. |
|
201 |
*/ |
|
202 |
int FmUtils::removeDrivePwd( const QString &driveName, const QString &Pwd ) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
{ |
40 | 204 |
if( driveName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) { |
25 | 205 |
return FmErrWrongParam; |
206 |
} |
|
40 | 207 |
QString logString = "Drive name:" + driveName; |
32 | 208 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
logString = "Password:" + Pwd; |
32 | 210 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
CCoeEnv *env = CCoeEnv::Static(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
213 |
RFs& fs = env->FsSession(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
TInt drive = 0; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
|
40 | 217 |
drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
HBufC* password16 = XQConversions::qStringToS60Desc( Pwd ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
TMediaPassword password; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
TPtr ptrPassword16( password16->Des() ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
222 |
FmS60Utils::ConvertCharsToPwd( ptrPassword16, password ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
224 |
int err( fs.ClearPassword( drive, password ) ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
logString = "Drive:" + QString::number( drive ); |
32 | 227 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
228 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
229 |
logString = "Clear password error:" + QString::number( err ); |
32 | 230 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
|
33 | 232 |
delete password16; |
233 |
||
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
234 |
if( err == KErrNone ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
235 |
return FmErrNone; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
236 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
237 |
else if( err == KErrAccessDenied ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
238 |
return FmErrAccessDenied; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
239 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
240 |
else{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
241 |
return FmErrUnKnown; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
242 |
} |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
243 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
244 |
|
40 | 245 |
/*! |
246 |
Unlock drive \a driveName with provided password \a Pwd |
|
247 |
*/ |
|
248 |
int FmUtils::unlockDrive( const QString &driveName, const QString &Pwd ) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
249 |
{ |
40 | 250 |
if( driveName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) { |
25 | 251 |
return FmErrWrongParam; |
252 |
} |
|
40 | 253 |
QString logString = "Drive name:" + driveName; |
32 | 254 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
logString = "Password:" + Pwd; |
32 | 256 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
CCoeEnv *env = CCoeEnv::Static(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
259 |
RFs& fs = env->FsSession(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
TInt drive = 0; |
40 | 262 |
drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
HBufC* password16 = XQConversions::qStringToS60Desc( Pwd ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
TMediaPassword password; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
TPtr ptrPassword16( password16->Des() ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
FmS60Utils::ConvertCharsToPwd( ptrPassword16, password ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
int err( fs.UnlockDrive( drive, password, ETrue) ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
logString = "Drive:" + QString::number( drive ); |
32 | 272 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
logString = "Unlock drive error:" + QString::number( err ); |
32 | 274 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
|
33 | 276 |
delete password16; |
277 |
||
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
278 |
if( err == KErrNone ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
279 |
return FmErrNone; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
280 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
281 |
else if( err == KErrAccessDenied ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
282 |
return FmErrAccessDenied; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
283 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
284 |
else if( err == KErrAlreadyExists ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
285 |
return FmErrAlreadyExists; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
286 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
287 |
else if( err == KErrNotSupported ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
288 |
return FmErrNotSupported; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
289 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
290 |
else{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
291 |
return FmErrUnKnown; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
292 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
293 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
294 |
|
40 | 295 |
/*! |
296 |
Check if \a pwd is the right password for drive \a driveName |
|
297 |
*/ |
|
298 |
int FmUtils::checkDrivePwd( const QString &driveName, const QString &pwd ) |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
299 |
{ |
40 | 300 |
if( driveName.isEmpty() || pwd.length() > FmMaxLengthofDrivePassword ) { |
25 | 301 |
return FmErrWrongParam; |
302 |
} |
|
40 | 303 |
QString logString = "checkDrivePwd Drive name:" + driveName; |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
304 |
logString += " password:" + pwd; |
32 | 305 |
FM_LOG( logString ); |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
306 |
|
40 | 307 |
return setDrivePwd( driveName, pwd, pwd ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
|
40 | 310 |
/*! |
311 |
Set new password \a newPwd for drive \a driveName. \a oldPwd is old password |
|
312 |
*/ |
|
313 |
int FmUtils::setDrivePwd( const QString &driveName, const QString &oldPwd, const QString &newPwd) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
{ |
40 | 315 |
if( driveName.isEmpty() || |
33 | 316 |
oldPwd.length() > FmMaxLengthofDrivePassword || newPwd.length() > FmMaxLengthofDrivePassword ) { |
25 | 317 |
return FmErrWrongParam; |
318 |
} |
|
40 | 319 |
QString logString = "setDrivePwd Drive name:" + driveName ; |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
320 |
logString += " Old password:" + oldPwd; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
321 |
logString += " New password:" + newPwd; |
32 | 322 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
323 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
324 |
CCoeEnv *env = CCoeEnv::Static(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
325 |
RFs& fs = env->FsSession(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
326 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
327 |
TInt drive = 0; |
40 | 328 |
drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
329 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
330 |
HBufC* newPassword16 = XQConversions::qStringToS60Desc( newPwd); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
331 |
HBufC* oldPassword16 = XQConversions::qStringToS60Desc( oldPwd ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
332 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
333 |
TMediaPassword oldPassword; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
334 |
TMediaPassword newPassword; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
335 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
336 |
TPtr ptrNewPassword16( newPassword16->Des() ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
337 |
TPtr ptrOldPassword16( oldPassword16->Des() ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
338 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
339 |
FmS60Utils::ConvertCharsToPwd( ptrNewPassword16, newPassword ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
340 |
FmS60Utils::ConvertCharsToPwd( ptrOldPassword16, oldPassword ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
341 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
342 |
int err( fs.LockDrive( drive, oldPassword, newPassword, ETrue ) ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
344 |
logString = "Drive:" + QString::number( drive ); |
32 | 345 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
346 |
logString = "Password set error:" + QString::number( err ); |
32 | 347 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
|
33 | 349 |
delete newPassword16; |
350 |
delete oldPassword16; |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
351 |
if( err == KErrNone ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
352 |
return FmErrNone; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
353 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
354 |
else if( err == KErrNotSupported ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
355 |
return FmErrNotSupported; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
356 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
357 |
else{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
358 |
return FmErrUnKnown; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
359 |
} |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
360 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
361 |
|
40 | 362 |
/*! |
363 |
Set \a pwd as empty password |
|
364 |
*/ |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
void FmUtils::emptyPwd( QString &pwd ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
366 |
{ |
33 | 367 |
TBuf< FmMaxLengthofDrivePassword > nullPwd; |
368 |
nullPwd.FillZ( nullPwd.MaxLength() ); |
|
369 |
nullPwd.Zero(); |
|
370 |
pwd = XQConversions::s60DescToQString( nullPwd ); |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
371 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
372 |
|
40 | 373 |
/*! |
374 |
Set drive volume for drive \a driveName |
|
375 |
*/ |
|
376 |
int FmUtils::renameDrive( const QString &driveName, const QString &newVolumeName) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
377 |
{ |
40 | 378 |
if( driveName.isEmpty() ) { |
25 | 379 |
return FmErrWrongParam; |
380 |
} |
|
381 |
foreach( const QChar &ch, newVolumeName ) |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
382 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
383 |
bool a = ch.isSpace(); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
384 |
bool b = ch.isLetterOrNumber(); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
385 |
// If not alphadigit or space, return error |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
386 |
if( !ch.isLetterOrNumber() && !ch.isSpace() ) |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
387 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
388 |
return FmErrBadName; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
389 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
390 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
391 |
|
47 | 392 |
// CCoeEnv *env = CCoeEnv::Static(); |
393 |
// RFs& fs = env->FsSession(); |
|
394 |
// make new fs so that this function can be called in thread |
|
395 |
RFs fs; |
|
396 |
fs.Connect(); |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
397 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
398 |
TInt drive = 0; |
40 | 399 |
drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
400 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
401 |
TPtr newName ( ( XQConversions::qStringToS60Desc( newVolumeName ) )->Des() ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
402 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
int err( fs.SetVolumeLabel( newName, drive )); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
QString logString = "Rename error:" + QString::number( err ); |
32 | 406 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
407 |
|
47 | 408 |
fs.Close(); |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
409 |
if( err == KErrNone ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
410 |
return FmErrNone; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
411 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
412 |
else if( err == KErrNotReady ){ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
413 |
return FmErrNotReady; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
414 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
415 |
else{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
416 |
return FmErrUnKnown; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
417 |
} |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
419 |
|
40 | 420 |
/*! |
421 |
Eject drive \a driveName |
|
422 |
*/ |
|
423 |
int FmUtils::ejectDrive( const QString &driveName ) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
424 |
{ |
40 | 425 |
if( driveName.isEmpty() ) { |
25 | 426 |
return FmErrWrongParam; |
427 |
} |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
428 |
QString logString = "FmUtils::ejectDrive start"; |
32 | 429 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
430 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
431 |
TInt drive = 0; |
40 | 432 |
drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
433 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
434 |
const int KDriveShift = 16; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
435 |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
436 |
// Let SysAp handle eject |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
437 |
RProperty::Set( |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
438 |
KPSUidCoreApplicationUIs, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
439 |
KCoreAppUIsMmcRemovedWithoutEject, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
440 |
ECoreAppUIsEjectCommandUsedToDrive | ( drive << KDriveShift ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
441 |
); |
25 | 442 |
return FmErrNone; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
443 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
444 |
|
40 | 445 |
/*! |
446 |
Check if drive \a driveName is accessable for user |
|
447 |
*/ |
|
448 |
bool FmUtils::checkDriveAccessFilter( const QString &driveName ) |
|
449 |
{ |
|
450 |
if( driveName.isEmpty() ) { |
|
451 |
return false; |
|
452 |
} |
|
453 |
FmDriverInfo driveInfo = queryDriverInfo( driveName ); |
|
454 |
if( ( driveInfo.driveState()& FmDriverInfo::EDriveRam ) || |
|
455 |
( driveInfo.driveState()& FmDriverInfo::EDriveRom ) ) { |
|
456 |
return false; |
|
457 |
} |
|
458 |
return true; |
|
459 |
} |
|
460 |
||
461 |
/*! |
|
462 |
This function should be called to adjust path if user goto a drive. |
|
463 |
data folder will be append to C:\ becuase user could only view C:\data instead C:\ |
|
464 |
*/ |
|
465 |
QString FmUtils::checkDriveToFolderFilter( const QString &path ) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
466 |
{ |
40 | 467 |
QString checkedPath = fillPathWithSplash( path ); |
468 |
if( checkedPath.compare( Drive_C, Qt::CaseInsensitive ) == 0 ) { |
|
469 |
checkedPath += QString( "data" ) + QDir::separator(); |
|
470 |
return checkedPath; |
|
471 |
} |
|
472 |
return path; |
|
473 |
||
474 |
} |
|
475 |
||
476 |
/*! |
|
477 |
This function should be called to adjust path if user back to up level path. |
|
478 |
If user is at C:\data then path level should be returned as C:\ |
|
479 |
Becuase C:\data is root path for C drive |
|
480 |
*/ |
|
481 |
QString FmUtils::checkFolderToDriveFilter( const QString &path ) |
|
482 |
{ |
|
483 |
QString logString; |
|
484 |
logString = QString( "checkFolderToDriveFilter: " ) + path; |
|
485 |
FM_LOG( logString ); |
|
486 |
QString checkedPath = fillPathWithSplash( path ); |
|
487 |
||
488 |
logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath; |
|
489 |
FM_LOG( logString ); |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
490 |
|
40 | 491 |
if( checkedPath.compare( Folder_C_Data, Qt::CaseInsensitive ) == 0 ) { |
492 |
FM_LOG( QString( " change from c:/data/ to C:/" ) ); |
|
493 |
return Drive_C; |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
494 |
} |
40 | 495 |
return path; |
496 |
||
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
497 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
498 |
|
40 | 499 |
/*! |
500 |
Check if \a path is accessable for user |
|
501 |
*/ |
|
502 |
int FmUtils::isPathAccessabel( const QString &path ) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
503 |
{ |
40 | 504 |
// Used to check if path is accessable, very important feature |
505 |
// and will return filemanager error. |
|
506 |
FM_LOG( QString( "isPathAccessabel:" ) + path ); |
|
507 |
if( path.isEmpty() ) { |
|
508 |
return FmErrPathNotExist; |
|
509 |
} |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
510 |
|
40 | 511 |
// used to filter locked/ejected/corrupted drive |
512 |
// check if drive is available, no matter if it is a drive, a folder, or a file. |
|
513 |
if( !isDriveAvailable( path ) ) { |
|
514 |
FM_LOG( QString( "isPathAccessabel false: path is drive and not available" ) ); |
|
515 |
return FmErrDriveNotAvailable; |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
516 |
} |
40 | 517 |
|
518 |
QFileInfo fileInfo( path ); |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
519 |
|
40 | 520 |
if( fileInfo.absoluteFilePath().contains( Drive_C, Qt::CaseInsensitive ) && |
521 |
!fileInfo.absoluteFilePath().contains( Folder_C_Data, Qt::CaseInsensitive ) ) { |
|
522 |
FM_LOG( QString( "isPathAccessabel false: path contain C and not in data folder" ) ); |
|
523 |
return FmErrPathDenied; |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
524 |
} |
47 | 525 |
|
526 |
if( isSystemFolder( fileInfo.absoluteFilePath() ) ) { |
|
527 |
FM_LOG( QString( "isPathAccessabel false: path is system path that not accessable" ) ); |
|
528 |
return FmErrPathDenied; |
|
529 |
} |
|
530 |
||
40 | 531 |
if( !checkDriveAccessFilter( FmUtils::getDriveNameFromPath( fileInfo.absoluteFilePath() ) ) ){ |
532 |
return FmErrDriveDenied; |
|
533 |
} |
|
534 |
if( !fileInfo.exists() ) { |
|
535 |
FM_LOG( QString( "isPathAccessabel false: path not exist" ) ); |
|
536 |
return FmErrPathNotExist; |
|
537 |
} |
|
538 |
FM_LOG( QString( "isPathAccessabel FmErrNone" ) ); |
|
539 |
return FmErrNone; |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
540 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
541 |
|
40 | 542 |
/*! |
543 |
Check if drive related to \a path is available. |
|
544 |
This function should not check if path is available. Only responsible for checking drive |
|
545 |
When MMC is not inserted, also return false |
|
546 |
*/ |
|
547 |
bool FmUtils::isDriveAvailable( const QString &path ) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
548 |
{ |
40 | 549 |
FM_LOG( QString( "isDriveAvailable:" ) + path ); |
550 |
if( path.isEmpty() ) { |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
551 |
return false; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
552 |
} |
40 | 553 |
FmDriverInfo::DriveState driveState = queryDriverInfo( path ).driveState(); |
554 |
if( ( driveState & FmDriverInfo::EDriveAvailable ) ) { |
|
555 |
FM_LOG( QString( "isDriveAvailable true" ) ); |
|
556 |
return true; |
|
557 |
} |
|
558 |
FM_LOG( QString( "isDriveAvailable false" ) ); |
|
559 |
return false; |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
560 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
561 |
|
40 | 562 |
/*! |
563 |
Check if \a folderPath is default folder for system |
|
564 |
*/ |
|
565 |
bool FmUtils::isDefaultFolder( const QString &folderPath ) |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
566 |
{ |
40 | 567 |
HBufC *path = XQConversions::qStringToS60Desc( folderPath ); |
568 |
TPtrC desFolderPath( path->Des() ); |
|
569 |
||
570 |
bool ret( true ); |
|
571 |
TInt pathType( PathInfo::PathType( desFolderPath ) ); |
|
572 |
switch( pathType ){ |
|
573 |
case PathInfo::ENotSystemPath:{ |
|
574 |
QString locString( localize( folderPath ) ); |
|
575 |
if ( locString.isEmpty() ){ |
|
576 |
ret = false; |
|
577 |
break; |
|
578 |
} |
|
579 |
ret = true; |
|
580 |
break; |
|
581 |
} |
|
582 |
case PathInfo::EPhoneMemoryRootPath: // FALL THROUGH |
|
583 |
case PathInfo::EMemoryCardRootPath: // FALL THROUGH |
|
584 |
case PathInfo::ERomRootPath:{ |
|
585 |
ret = false; |
|
586 |
break; |
|
587 |
} |
|
588 |
// Accept other folders |
|
589 |
default:{ |
|
590 |
ret = true; |
|
591 |
break; |
|
592 |
} |
|
593 |
} |
|
594 |
delete path; |
|
595 |
return ret; |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
596 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
597 |
|
40 | 598 |
/*! |
599 |
Create system default folders for drive \a driveName. |
|
600 |
Default folders should be created after format a drive. |
|
601 |
*/ |
|
602 |
void FmUtils::createDefaultFolders( const QString &driveName ) |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
603 |
{ |
40 | 604 |
if( driveName.isEmpty() ) { |
25 | 605 |
return; |
606 |
} |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
607 |
int err; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
608 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
609 |
TInt drive = 0; |
40 | 610 |
drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
611 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
612 |
RFs fs; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
613 |
err = fs.Connect(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
614 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
615 |
if( err != KErrNone ){ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
616 |
return; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
617 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
618 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
619 |
quint32 drvStatus( 0 ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
620 |
err = DriveInfo::GetDriveStatus( fs, drive, drvStatus ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
621 |
if ( !( drvStatus & DriveInfo::EDriveUserVisible ) || |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
622 |
( drvStatus & ( DriveInfo::EDriveRemote | |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
623 |
DriveInfo::EDriveReadOnly | |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
624 |
DriveInfo::EDriveUsbMemory ) ) ){ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
625 |
return; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
626 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
627 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
628 |
TEntry entry; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
629 |
CDesCArray* array = PathInfo::GetListOfPathsLC( drive ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
630 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
631 |
TInt count( array->MdcaCount() ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
632 |
for ( TInt i( 0 ); i < count; ++i ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
633 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
634 |
TPtrC fullPath( array->MdcaPoint( i ) ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
635 |
TBool allow( ETrue ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
636 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
637 |
if ( drvStatus & DriveInfo::EDriveRemovable ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
638 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
639 |
// Filter few folder types from physically removable memory cards |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
640 |
TInt pathType( PathInfo::PathType( fullPath ) ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
641 |
switch( pathType ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
642 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
643 |
case PathInfo::EGamesPath: // FALL THROUGH |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
644 |
case PathInfo::EInstallsPath: // FALL THROUGH |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
645 |
case PathInfo::EGsmPicturesPath: // FALL THROUGH |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
646 |
case PathInfo::EMmsBackgroundImagesPath: // FALL THROUGH |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
647 |
case PathInfo::EPresenceLogosPath: |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
648 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
649 |
allow = EFalse; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
650 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
651 |
default: |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
652 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
653 |
break; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
654 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
655 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
656 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
657 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
658 |
if ( allow ){ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
659 |
fs.MkDirAll( fullPath ); // Ignore error |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
660 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
661 |
if ( fs.Entry( fullPath, entry ) == KErrNone ){ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
662 |
if( entry.IsHidden() ){ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
663 |
// If setting fails, File Manager can still go on |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
664 |
fs.SetEntry( |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
665 |
fullPath, entry.iModified, 0, KEntryAttHidden ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
666 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
667 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
668 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
669 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
670 |
CleanupStack::PopAndDestroy( array ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
671 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
672 |
|
33 | 673 |
/*! |
47 | 674 |
return localized file name by \a path, empty string returned for non-localized path. |
40 | 675 |
In Symbian system, default folders will be localized. |
47 | 676 |
So localize also can be used to check if a path is a default folder |
40 | 677 |
\sa isDefaultFolder |
33 | 678 |
*/ |
40 | 679 |
QString FmUtils::localize( const QString &path ) |
33 | 680 |
{ |
40 | 681 |
// HbDirectoryNameLocalizer can not recognize path with \ in the end |
682 |
QString locPath( removePathSplash( path ) ); |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
683 |
|
40 | 684 |
HbDirectoryNameLocalizer localizer; |
685 |
return localizer.translate( locPath ); |
|
27 | 686 |
} |
33 | 687 |
|
688 |
/*! |
|
689 |
set the \a desFile attributes as the same with \a srcFile |
|
690 |
*/ |
|
691 |
int FmUtils::setFileAttributes( const QString &srcFile, const QString &desFile ) |
|
692 |
{ |
|
693 |
RFs fsSession; |
|
694 |
User::LeaveIfError( fsSession.Connect() ); |
|
695 |
CleanupClosePushL( fsSession ); |
|
696 |
RFile64 src; |
|
697 |
RFile64 des; |
|
698 |
HBufC *buf1 = XQConversions::qStringToS60Desc( removePathSplash( formatPath( srcFile ) ) ); |
|
699 |
HBufC *buf2 = XQConversions::qStringToS60Desc( removePathSplash( formatPath( desFile ) ) ); |
|
700 |
User::LeaveIfError( src.Open( fsSession, *buf1, EFileRead | EFileShareReadersOnly ) ); |
|
701 |
User::LeaveIfError( des.Open( fsSession, *buf2, EFileWrite | EFileShareExclusive ) ); |
|
702 |
TTime mod; |
|
703 |
int err = src.Modified( mod );; |
|
704 |
if ( err == FmErrNone ) { |
|
705 |
err = des.SetModified( mod ); |
|
706 |
} |
|
707 |
TUint att( 0 ); |
|
708 |
if ( err == FmErrNone ) { |
|
709 |
err = src.Att( att ); |
|
710 |
} |
|
711 |
if ( err == FmErrNone ) { |
|
712 |
des.SetAtt( att, ( ~att ) & KEntryAttMaskSupported ); |
|
713 |
} |
|
714 |
src.Close(); |
|
715 |
des.Close(); |
|
716 |
fsSession.Close(); |
|
717 |
CleanupStack::PopAndDestroy(); // fsSession |
|
718 |
return err; |
|
719 |
} |
|
40 | 720 |
|
721 |
/*! |
|
722 |
judge whether there is enough space on \a targetDrive for \a size. |
|
723 |
return true if has, false if not. |
|
724 |
*/ |
|
725 |
bool FmUtils::hasEnoughSpace( const QString &targetDrive, qint64 size ) |
|
726 |
{ |
|
727 |
RFs fsSession; |
|
728 |
QT_TRAP_THROWING( fsSession.Connect() ); |
|
729 |
CleanupClosePushL( fsSession ); |
|
730 |
TInt dstDrv(0); |
|
731 |
HBufC* hbuf = XQConversions::qStringToS60Desc( targetDrive ); |
|
732 |
QT_TRAP_THROWING( RFs::CharToDrive( hbuf->operator [](0), dstDrv ) ); |
|
733 |
bool ret = !SysUtil::DiskSpaceBelowCriticalLevelL( &fsSession, size , dstDrv ); |
|
734 |
CleanupStack::PopAndDestroy(); // fsSession |
|
735 |
return ret; |
|
736 |
||
737 |
} |
|
738 |
||
739 |
/*! |
|
740 |
move one file insice the same drive, from \a source to \a target. |
|
741 |
return KErrNone if successful, otherwise one of the other system-wide error codes. |
|
742 |
*/ |
|
743 |
int FmUtils::moveInsideDrive( const QString &source, const QString &target ) |
|
744 |
{ |
|
745 |
RFs fsSession; |
|
746 |
QT_TRAP_THROWING( fsSession.Connect() ); |
|
747 |
CleanupClosePushL( fsSession ); |
|
748 |
HBufC* oldName = XQConversions::qStringToS60Desc( source ); |
|
749 |
HBufC* newName = XQConversions::qStringToS60Desc( target ); |
|
750 |
int ret = fsSession.Rename( *oldName, *newName ); |
|
751 |
CleanupStack::PopAndDestroy(); // fsSession |
|
752 |
return ret; |
|
753 |
} |
|
754 |
||
755 |
/*! |
|
756 |
Launch a file with associated application. |
|
757 |
*/ |
|
758 |
int FmUtils::launchFile( const QString &filePath ) |
|
759 |
||
760 |
{ |
|
761 |
QFile file( filePath ); |
|
762 |
if( !file.exists() ) { |
|
763 |
return false; |
|
764 |
} |
|
765 |
||
766 |
XQApplicationManager mAiwMgr; |
|
767 |
XQAiwRequest *request = mAiwMgr.create(file); |
|
768 |
if ( request == 0 ) { |
|
769 |
// No handlers for the URI |
|
770 |
return FmErrUnKnown; |
|
771 |
} |
|
772 |
||
773 |
// Set function parameters |
|
774 |
QList<QVariant> args; |
|
775 |
args << file.fileName(); |
|
776 |
request->setArguments(args); |
|
777 |
||
778 |
// Send the request |
|
779 |
bool res = request->send(); |
|
780 |
if (!res) |
|
781 |
{ |
|
782 |
// Request failed. |
|
783 |
int error = request->lastError(); |
|
784 |
||
785 |
delete request; |
|
786 |
return FmErrUnKnown; |
|
787 |
} |
|
788 |
||
789 |
delete request; |
|
790 |
return FmErrNone; |
|
791 |
} |
|
792 |
||
793 |
/*! |
|
794 |
return path for backup restore config file. |
|
795 |
Currently \a appPath is not used. |
|
796 |
*/ |
|
797 |
QString FmUtils::getBurConfigPath( QString appPath ) |
|
798 |
{ |
|
799 |
Q_UNUSED( appPath ); |
|
800 |
QString path( BURCONFIGFILE ); |
|
801 |
return path; |
|
802 |
} |
|
803 |
||
804 |
/*! |
|
805 |
return MetaData string for \a filePath |
|
806 |
*/ |
|
807 |
QString FmUtils::getFileType( const QString &filePath ) |
|
808 |
{ |
|
809 |
RApaLsSession apaSession; |
|
810 |
TDataType dataType; |
|
811 |
TUid appUid; |
|
812 |
||
813 |
TBuf<128> mimeTypeBuf; |
|
814 |
||
815 |
int err = apaSession.Connect(); |
|
816 |
||
817 |
if ( err == KErrNone ){ |
|
818 |
err = apaSession.AppForDocument( XQConversions::qStringToS60Desc( filePath )->Des(), |
|
819 |
appUid, dataType ); |
|
820 |
||
821 |
if( err == KErrNone ){ |
|
822 |
mimeTypeBuf.Copy(dataType.Des8()); |
|
823 |
} |
|
824 |
} |
|
825 |
||
826 |
apaSession.Close(); |
|
827 |
return XQConversions::s60DescToQString( mimeTypeBuf ); |
|
828 |
} |
|
829 |
||
830 |
/*! |
|
831 |
Check if drive \a driveName is drive C |
|
832 |
*/ |
|
833 |
bool FmUtils::isDriveC( const QString &driveName ) |
|
834 |
{ |
|
835 |
if( driveName.isEmpty() ) { |
|
836 |
return false; |
|
837 |
} |
|
838 |
TInt drive = 0; |
|
839 |
drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA; |
|
840 |
if( drive == EDriveC ){ |
|
841 |
return true; |
|
842 |
} |
|
843 |
else{ |
|
844 |
return false; |
|
845 |
} |
|
846 |
||
847 |
} |
|
848 |
||
849 |
/*! |
|
850 |
return max file name length |
|
851 |
*/ |
|
852 |
int FmUtils::getMaxFileNameLength() |
|
853 |
{ |
|
854 |
return KMaxFileName; |
|
855 |
} |
|
856 |
||
857 |
/*! |
|
858 |
Check if length of \a path is exceed max path length. |
|
859 |
*/ |
|
860 |
bool FmUtils::checkMaxPathLength( const QString& path ) |
|
861 |
{ |
|
862 |
if( path.length() > KMaxPath ) { |
|
863 |
return false; |
|
864 |
} |
|
865 |
return true; |
|
866 |
} |
|
47 | 867 |
|
868 |
/*! |
|
869 |
Set appliation as system mode if \a isSystem is true. |
|
870 |
Otherwise set application as non-system mode |
|
871 |
*/ |
|
872 |
void FmUtils::setSystem( bool isSystem ) |
|
873 |
{ |
|
874 |
CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
875 |
CEikonEnv* eikonEnv = (STATIC_CAST(CEikonEnv*,coeEnv)); |
|
876 |
if( isSystem ) { |
|
877 |
eikonEnv->SetSystem(ETrue); |
|
878 |
} else { |
|
879 |
eikonEnv->SetSystem(EFalse); |
|
880 |
} |
|
881 |
} |
|
882 |
||
883 |
/*! |
|
884 |
return drive name by \a drive |
|
885 |
*/ |
|
886 |
QString FmUtils::numberToDriveName( int drive ) |
|
887 |
{ |
|
888 |
QChar driveChar( drive - EDriveA + 'A' ); |
|
889 |
QString driveName = QString( driveChar ) + ':'; |
|
890 |
return driveName; |
|
891 |
} |