author | hgs |
Fri, 23 Jul 2010 11:12:24 +0800 | |
changeset 32 | 39cf9ced4cc4 |
parent 27 | df183af6b92f |
child 33 | 328cf6fbe40c |
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: |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
* The source file of the file manager utilities on windows |
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 |
#include <windows.h> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include "fmutils.h" |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <QDir> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <QFileInfo> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <QDesktopServices> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <QUrl> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include <QVariant> |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
|
25 | 28 |
#include <hbglobal.h> |
29 |
||
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
#define BURCONFIGFILE "burconfig.xml" |
25 | 31 |
const int KMaxFileName=0x100; |
32 |
const int KMaxPath=0x100; |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
QString FmUtils::getDriveNameFromPath( const QString &path ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
if( path.length() <3 ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
return QString(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
return path.left( 3 ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
42 |
QString FmUtils::getDriveLetterFromPath( const QString &path ) |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
43 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
44 |
if( path.length() <3 ) { |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
45 |
return QString(); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
46 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
47 |
return path.left( 1 ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
48 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
49 |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
FmDriverInfo FmUtils::queryDriverInfo( const QString &driverName ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
quint64 size = 0; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
53 |
quint64 freeSize = 0; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
QString driver = driverName; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
driver.replace( '/', "\\" ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
if ( driver.right(1) != "\\" ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
driver.append( "\\" ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
GetDiskFreeSpaceEx( (LPCWSTR)driver.constData(), |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
(PULARGE_INTEGER)&freeSize, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
(PULARGE_INTEGER)&size, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
0 ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
TCHAR volumeName[MAX_PATH + 1] = { 0 }; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
GetVolumeInformation( (LPCWSTR)driver.constData(), |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
&volumeName[0], |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
MAX_PATH + 1, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
0, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
0, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
71 |
0, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
0, |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
0 ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
75 |
quint32 state( 0 ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
76 |
quint32 drvStatus = GetDriveType( (LPCWSTR)driver.constData() ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
77 |
if ( drvStatus == DRIVE_REMOVABLE ) { |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
78 |
state |= FmDriverInfo::EDriveRemovable; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
79 |
} |
25 | 80 |
#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_ |
81 |
if ( driverName.contains( Drive_D, Qt::CaseInsensitive ) ) { |
|
82 |
state |= FmDriverInfo::EDriveNotPresent; |
|
83 |
} |
|
84 |
#endif |
|
85 |
||
86 |
#ifdef _DEBUG_LOCKED_DRIVE_Z |
|
87 |
if ( driverName.contains( Drive_Z, Qt::CaseInsensitive ) ) { |
|
88 |
state |= FmDriverInfo::EDriveLocked; |
|
89 |
} |
|
90 |
#endif |
|
91 |
if( !(state&FmDriverInfo::EDriveNotPresent) && !(state&FmDriverInfo::EDriveLocked) && |
|
92 |
!(state&FmDriverInfo::EDriveCorrupted) ) { |
|
93 |
state |= FmDriverInfo::EDriveAvailable; |
|
94 |
} |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
95 |
return FmDriverInfo( size, freeSize, driverName, QString::fromWCharArray( &volumeName[0] ), state ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
96 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
97 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
QString FmUtils::formatStorageSize( quint64 size ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
if ( size < 1000 ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
return QString::number( size ) + " B"; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
} else if ( size < 1000 * 1000 ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
return QString::number( size / 1024.0, 'f', 2 ) + " KB"; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
} else if ( size < 1000 * 1000 * 1000 ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
105 |
return QString::number( size / (1024.0 * 1024.0), 'f', 1 ) + " MB"; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
106 |
} else { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB"; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
108 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
} |
25 | 110 |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
111 |
/* |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
quint32 FmUtils::getDriverState( const QString &driverName ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
quint32 state( 0 ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
QString driver = driverName; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
driver.replace( '/', "\\" ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
if ( driver.right(1) != "\\" ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
driver.append( "\\" ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
quint32 drvStatus = GetDriveType( (LPCWSTR)driver.constData() ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
125 |
if ( drvStatus == DRIVE_REMOVABLE ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
126 |
state |= FmDriverInfo::EDriveRemovable; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
127 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
128 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
129 |
return state; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
130 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
} |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
132 |
*/ |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
int FmUtils::removeDrivePwd( const QString &driverName, const QString &Pwd ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
Q_UNUSED( driverName ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
Q_UNUSED( Pwd ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
return 0; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
int FmUtils::unlockDrive( const QString &driverName, const QString &Pwd ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
Q_UNUSED( driverName ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
Q_UNUSED( Pwd ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
return 0; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
147 |
int FmUtils::checkDrivePwd( const QString &driverName, const QString &pwd) |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
148 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
149 |
Q_UNUSED( driverName ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
150 |
Q_UNUSED( pwd ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
151 |
return 0; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
152 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
153 |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
int FmUtils::setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
Q_UNUSED( driverName ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
157 |
Q_UNUSED( oldPwd ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
158 |
Q_UNUSED( newPwd ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
159 |
return 0; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
160 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
void FmUtils::emptyPwd( QString &pwd ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
Q_UNUSED( pwd ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
165 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
166 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
Q_UNUSED( driverName ); |
25 | 170 |
foreach( const QChar &ch, newVolumeName ) |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
171 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
172 |
// If not alphadigit or space, return error |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
173 |
if( !ch.isLetterOrNumber() && !ch.isSpace() ) |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
174 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
175 |
return FmErrBadName; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
176 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
177 |
} |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
return 0; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
|
25 | 181 |
int FmUtils::ejectDrive( const QString &driverName ) |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
Q_UNUSED( driverName ); |
25 | 184 |
return FmErrNone; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
QString FmUtils::getFileType( const QString &filePath ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
Q_UNUSED( filePath ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
return QString( "" ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
quint64 FmUtils::getDriveDetailsResult( const QString &folderPath, const QString &extension ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
194 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
Q_UNUSED( folderPath ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
Q_UNUSED( extension ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
return 0; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
198 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
bool FmUtils::isDriveC( const QString &driverName ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
{ |
25 | 202 |
if( driverName.contains(Drive_C,Qt::CaseInsensitive) ){ |
203 |
return true; |
|
204 |
} |
|
205 |
else{ |
|
206 |
return false; |
|
207 |
} |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
210 |
bool FmUtils::isDrive( const QString &path ) |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
211 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
212 |
bool ret( false ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
213 |
if( path.length() <= 3 && path.length() >=2 ) { |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
214 |
ret = true; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
215 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
216 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
217 |
return ret; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
218 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
219 |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
void FmUtils::createDefaultFolders( const QString &driverName ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
222 |
Q_UNUSED( driverName ); |
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 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
QString FmUtils::fillPathWithSplash( const QString &filePath ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
{ |
25 | 227 |
QString newFilePath; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
228 |
if( filePath.isEmpty() ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
229 |
return newFilePath; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
230 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
|
25 | 232 |
foreach( QChar ch, filePath ) { |
233 |
if( ch == QChar('\\') || ch == QChar('/') ) { |
|
234 |
newFilePath.append( QDir::separator() ); |
|
235 |
} else { |
|
236 |
newFilePath.append( ch ); |
|
237 |
} |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
} |
25 | 239 |
|
240 |
if( newFilePath.right( 1 )!= QDir::separator() ){ |
|
241 |
newFilePath.append( QDir::separator() ); |
|
242 |
} |
|
243 |
||
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
244 |
return newFilePath; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
245 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
246 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
247 |
QString FmUtils::removePathSplash( const QString &filePath ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
248 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
249 |
QString newFilePath( filePath ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
250 |
if( filePath.right( 1 ) == QChar( '/' ) || filePath.right(1) == QString( "\\" ) ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
newFilePath = filePath.left( filePath.length() - 1 ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
252 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
253 |
return newFilePath; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
|
25 | 256 |
bool FmUtils::checkDriveAccessFilter( const QString &driveName ) |
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 |
#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_ |
25 | 259 |
if( driveName.contains( Drive_D, Qt::CaseInsensitive ) || driveName.contains( Drive_Z, Qt::CaseInsensitive ) ) { |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
return false; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
#endif |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
return true; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
QString FmUtils::checkDriveToFolderFilter( const QString &path ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
QFileInfo fileInfo( path ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
if( !fileInfo.exists() ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
return QString(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
QString checkedPath = fillPathWithSplash( path ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
if( checkedPath.compare( QString( "C:/"), Qt::CaseInsensitive ) == 0 ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
checkedPath += QString( "data/" ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
QFileInfo fileInfo( checkedPath ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
278 |
if( !fileInfo.exists() ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
return QString(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
return checkedPath; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
282 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
283 |
#endif |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
284 |
return path; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
286 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
287 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
QString FmUtils::checkFolderToDriveFilter( const QString &path ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
290 |
#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
291 |
QString logString; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
292 |
logString = QString( "checkFolderToDriveFilter: " ) + path; |
32 | 293 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
294 |
QString checkedPath = fillPathWithSplash( path ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
295 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
296 |
logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath; |
32 | 297 |
FM_LOG( logString ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
298 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
299 |
if( checkedPath.compare( QString( "C:/data/"), Qt::CaseInsensitive ) == 0 ) { |
32 | 300 |
FM_LOG( QString( " change from c:/data/ to C:/" ) ); |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
301 |
return QString( "C:/" ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
302 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
303 |
#endif |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
304 |
return path; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
305 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
306 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
307 |
|
25 | 308 |
int FmUtils::isPathAccessabel( const QString &path ) |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
{ |
25 | 310 |
if(!isDriveAvailable( path ) ) { //used to filter locked drive |
311 |
return FmErrDriveNotAvailable; |
|
312 |
} |
|
313 |
||
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
QFileInfo fileInfo( path ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
315 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
317 |
if( fileInfo.absoluteFilePath().contains( QString( Drive_C ), Qt::CaseInsensitive ) && |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
!fileInfo.absoluteFilePath().contains( QString( Folder_C_Data ), Qt::CaseInsensitive ) ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
319 |
return false; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
320 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
321 |
if( fileInfo.absoluteFilePath().contains( QString( Drive_D ), Qt::CaseInsensitive ) ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
322 |
return false; |
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 |
if( fileInfo.absoluteFilePath().contains( QString( Drive_Z ), Qt::CaseInsensitive ) ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
325 |
return false; |
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 |
#endif |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
328 |
if( !fileInfo.exists() ) { |
25 | 329 |
return FmErrPathNotExist; |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
330 |
} |
25 | 331 |
return FmErrNone; |
14
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 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
334 |
bool FmUtils::isDriveAvailable( const QString &path ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
335 |
{ |
25 | 336 |
#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_ |
337 |
if(path.contains(Drive_D, Qt::CaseInsensitive)) |
|
338 |
return false; |
|
339 |
#endif |
|
340 |
#ifdef _DEBUG_LOCKED_DRIVE_Z |
|
341 |
if(path.contains(Drive_Z, Qt::CaseInsensitive)) |
|
342 |
return false; |
|
343 |
#endif |
|
344 |
return true; |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
345 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
346 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
QFileInfoList infoList = QDir::drives(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
350 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
351 |
foreach( QFileInfo fileInfo, infoList ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
352 |
QString driveName = fileInfo.absolutePath(); |
25 | 353 |
if( checkDriveAccessFilter( driveName ) ) { |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
354 |
if( !isHideUnAvailableDrive ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
355 |
driveList.append( driveName ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
356 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
357 |
else if ( isDriveAvailable( driveName ) ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
358 |
driveList.append( driveName ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
359 |
} |
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 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
362 |
return; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
363 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
364 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
366 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
367 |
QString ret; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
368 |
QString tempDriveName = fillPathWithSplash( driveName ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
|
25 | 370 |
QString checkedDriveName( removePathSplash( driveName ) ); |
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 |
FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
373 |
QString volumeName = driverInfo.volumeName(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
374 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
375 |
if( volumeName.isEmpty() && isFillWithDefaultVolume ){ |
25 | 376 |
FmDriverInfo::DriveState driveState = queryDriverInfo( tempDriveName ).driveState(); |
377 |
if( driveState & FmDriverInfo::EDriveAvailable ){ |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
378 |
if( driveState & FmDriverInfo::EDriveRemovable ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
379 |
if( driveState & FmDriverInfo::EDriveMassStorage ) { |
25 | 380 |
// Mass Storage |
381 |
ret = hbTrId( "txt_fmgr_dblist_1_mass_storage" ).arg( checkedDriveName ); |
|
382 |
} else if( driveState & FmDriverInfo::EDriveUsbMemory ) { |
|
383 |
// USB Memory |
|
384 |
ret = hbTrId( "txt_fmgr_dblist_1_usb_memory" ).arg( checkedDriveName ); |
|
385 |
} else{ |
|
386 |
// Memory Card |
|
387 |
ret = hbTrId( "txt_fmgr_dblist_1_memory_card" ).arg( checkedDriveName ); |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
388 |
} |
25 | 389 |
} else{ |
390 |
// phone memory |
|
391 |
ret = hbTrId( "txt_fmgr_dblist_1_device_memory" ).arg( checkedDriveName ); |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
392 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
393 |
} |
25 | 394 |
} else { |
395 |
ret = hbTrId( "txt_fmgr_dblist_1_2" ).arg( checkedDriveName ).arg( volumeName ); |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
396 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
397 |
return ret; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
398 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
399 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
400 |
int FmUtils::launchFile( const QString &filePath ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
401 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
402 |
if( QDesktopServices::openUrl( QUrl::fromLocalFile( filePath ) ) ) { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
return FmErrNone; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
} else { |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
return FmErrGeneral; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
406 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
407 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
408 |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
409 |
void FmUtils::sendFiles( QStringList &filePathList ) |
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
410 |
{ |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
411 |
|
14
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
412 |
} |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
413 |
|
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
414 |
QString FmUtils::getBurConfigPath( QString appPath ) |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
415 |
{ |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
416 |
QFileInfo fileInfo( appPath ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
417 |
QString testString = fileInfo.absolutePath(); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
QString path = fillPathWithSplash( fileInfo.absolutePath() ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
419 |
path = path + QString( "src/filemanager/" ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
420 |
path = path + QString( BURCONFIGFILE ); |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
421 |
return path; |
1957042d8c7e
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
422 |
} |
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
423 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
424 |
bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast ) |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
425 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
426 |
QString fst( fillPathWithSplash( pathFst ) ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
427 |
QString last( fillPathWithSplash( pathLast ) ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
428 |
if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) { |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
429 |
return true; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
430 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
431 |
return false; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
432 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
433 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
434 |
bool FmUtils::isDefaultFolder( const QString &folderPath ) |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
435 |
{ |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
436 |
Q_UNUSED( folderPath ); |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
437 |
return false; |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
438 |
} |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
439 |
|
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
440 |
QString FmUtils::formatPath( const QString &path ) |
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
441 |
{ |
25 | 442 |
QString formatPath; |
443 |
foreach( QChar ch, path ) { |
|
444 |
if( ch == QChar('\\') || ch == QChar('/') ) { |
|
445 |
formatPath.append( QDir::separator() ); |
|
446 |
} else { |
|
447 |
formatPath.append( ch ); |
|
448 |
} |
|
449 |
} |
|
450 |
||
451 |
if( formatPath.right( 1 ) != QDir::separator() ){ |
|
452 |
formatPath.append( QDir::separator() ); |
|
453 |
} |
|
454 |
return formatPath; |
|
455 |
} |
|
456 |
||
457 |
int FmUtils::getMaxFileNameLength() |
|
458 |
{ |
|
459 |
return KMaxFileName; |
|
460 |
} |
|
461 |
||
462 |
bool FmUtils::checkMaxPathLength( const QString& path ) |
|
463 |
{ |
|
464 |
if( path.length() > KMaxPath ) { |
|
465 |
return false; |
|
466 |
} |
|
467 |
return true; |
|
16
ada7962b4308
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
14
diff
changeset
|
468 |
} |
27 | 469 |
|
25 | 470 |
bool FmUtils::checkFolderFileName( const QString& name ) |
471 |
{ |
|
27 | 472 |
// trim space firest, because there may be some spaces after "." , it is also not valid |
473 |
// or there may only have spaces in name |
|
474 |
QString trimmedName( name.trimmed() ); |
|
475 |
if( trimmedName.isEmpty() ) { |
|
476 |
return false; |
|
477 |
} |
|
478 |
if( trimmedName.endsWith( QChar('.'), Qt::CaseInsensitive ) ) { |
|
25 | 479 |
return false; |
480 |
} |
|
27 | 481 |
if( trimmedName.contains( QChar('\\'), Qt::CaseInsensitive ) || |
482 |
trimmedName.contains( QChar('/'), Qt::CaseInsensitive ) || |
|
483 |
trimmedName.contains( QChar(':'), Qt::CaseInsensitive ) || |
|
484 |
trimmedName.contains( QChar('*'), Qt::CaseInsensitive ) || |
|
485 |
trimmedName.contains( QChar('?'), Qt::CaseInsensitive ) || |
|
486 |
trimmedName.contains( QChar('\"'), Qt::CaseInsensitive ) || |
|
487 |
trimmedName.contains( QChar('<'), Qt::CaseInsensitive ) || |
|
488 |
trimmedName.contains( QChar('>'), Qt::CaseInsensitive ) || |
|
489 |
trimmedName.contains( QChar('|'), Qt::CaseInsensitive ) ){ |
|
25 | 490 |
return false; |
491 |
} |
|
27 | 492 |
// use orignal name to exam max size of file name |
25 | 493 |
if( name.length() > KMaxFileName ) { |
494 |
return false; |
|
495 |
} |
|
496 |
return true; |
|
497 |
} |
|
498 |
||
27 | 499 |
bool FmUtils::checkNewFolderOrFile( const QString &fileName, const QString &path, QString &errString ) |
25 | 500 |
{ |
27 | 501 |
// first check if fileName is valid, then check if path length is valid, and check if file/foler is existed at last |
25 | 502 |
QFileInfo fileInfo( path ); |
503 |
bool ret( true ); |
|
27 | 504 |
if (!FmUtils::checkFolderFileName( fileName ) ) { |
25 | 505 |
errString = hbTrId( "Invalid file or folder name, try again!" ); |
506 |
ret = false; |
|
507 |
} else if( !FmUtils::checkMaxPathLength( path ) ) { |
|
508 |
errString = hbTrId( "the path you specified is too long, try again!" ); |
|
509 |
ret = false; |
|
510 |
} else if (fileInfo.exists()) { |
|
511 |
errString = hbTrId( "%1 already exist!" ).arg( fileInfo.fileName() ); |
|
512 |
ret = false; |
|
513 |
} |
|
514 |
return ret; |
|
515 |
} |
|
27 | 516 |
|
517 |
QString FmUtils::getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName ) |
|
518 |
{ |
|
519 |
FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName ); |
|
520 |
||
521 |
// do not add default volume for win32 version as this is only the dummy implememnt for debug on windows |
|
522 |
return driverInfo.volumeName(); |
|
523 |
} |
|
524 |