36 ** |
36 ** |
37 ** |
37 ** |
38 ** $QT_END_LICENSE$ |
38 ** $QT_END_LICENSE$ |
39 ** |
39 ** |
40 ****************************************************************************/ |
40 ****************************************************************************/ |
|
41 #ifndef QMOBILITYPLUGINSEARCH_H |
|
42 #define QMOBILITYPLUGINSEARCH_H |
|
43 |
41 #include <QApplication> |
44 #include <QApplication> |
42 #include <QStringList> |
45 #include <QStringList> |
|
46 #include <QDir> |
43 |
47 |
44 #if defined(Q_OS_SYMBIAN) |
48 #if defined(Q_OS_SYMBIAN) |
45 # include <f32file.h> |
49 # include <f32file.h> |
46 #endif |
50 #endif |
47 |
51 |
48 QTM_BEGIN_NAMESPACE |
52 QTM_BEGIN_NAMESPACE |
49 |
53 |
50 class DirChecker |
54 //class DirChecker |
51 { |
55 //{ |
52 public: |
56 //public: |
53 DirChecker(); |
57 // DirChecker(); |
54 ~DirChecker(); |
58 // ~DirChecker(); |
55 bool checkDir(const QDir& dir); |
59 // bool checkDir(const QDir& dir); |
56 |
60 |
57 private: |
61 //private: |
|
62 //#if defined(Q_OS_SYMBIAN) |
|
63 // RFs rfs; |
|
64 //#endif |
|
65 //}; |
|
66 |
|
67 //#if defined(Q_OS_SYMBIAN) |
|
68 //DirChecker::DirChecker() |
|
69 //{ |
|
70 // qt_symbian_throwIfError(rfs.Connect()); |
|
71 //} |
|
72 |
|
73 //bool DirChecker::checkDir(const QDir& dir) |
|
74 //{ |
|
75 // bool pathFound = false; |
|
76 // // In Symbian, going cdUp() in a c:/private/<uid3>/ will result in *platsec* error at fileserver (requires AllFiles capability) |
|
77 // // Also, trying to cd() to a nonexistent directory causes *platsec* error. This does not cause functional harm, but should |
|
78 // // nevertheless be changed to use native Symbian methods to avoid unnecessary platsec warnings (as per qpluginloader.cpp). |
|
79 // // Use native Symbian code to check for directory existence, because checking |
|
80 // // for files from under non-existent protected dir like E:/private/<uid> using |
|
81 // // QDir::exists causes platform security violations on most apps. |
|
82 // QString nativePath = QDir::toNativeSeparators(dir.absolutePath()); |
|
83 // TPtrC ptr = TPtrC16(static_cast<const TUint16*>(nativePath.utf16()), nativePath.length()); |
|
84 // TUint attributes; |
|
85 // TInt err = rfs.Att(ptr, attributes); |
|
86 // if (err == KErrNone) { |
|
87 // // yes, the directory exists. |
|
88 // pathFound = true; |
|
89 // } |
|
90 // return pathFound; |
|
91 //} |
|
92 |
|
93 //DirChecker::~DirChecker() |
|
94 //{ |
|
95 // rfs.Close(); |
|
96 //} |
|
97 //#else |
|
98 //DirChecker::DirChecker() |
|
99 //{ |
|
100 //} |
|
101 |
|
102 //DirChecker::~DirChecker() |
|
103 //{ |
|
104 //} |
|
105 |
|
106 //bool DirChecker::checkDir(const QDir &dir) |
|
107 //{ |
|
108 // return dir.exists(); |
|
109 //} |
|
110 //#endif |
|
111 |
58 #if defined(Q_OS_SYMBIAN) |
112 #if defined(Q_OS_SYMBIAN) |
59 RFs rfs; |
113 inline bool checkMobilityPluginsDir(const QDir &dir) |
60 #endif |
114 { |
61 }; |
115 RFs rfs; |
62 |
116 qt_symbian_throwIfError(rfs.Connect()); |
63 #if defined(Q_OS_SYMBIAN) |
117 bool pathFound = false; |
64 DirChecker::DirChecker() |
118 // In Symbian, going cdUp() in a c:/private/<uid3>/ will result in *platsec* error at fileserver (requires AllFiles capability) |
65 { |
119 // Also, trying to cd() to a nonexistent directory causes *platsec* error. This does not cause functional harm, but should |
66 qt_symbian_throwIfError(rfs.Connect()); |
120 // nevertheless be changed to use native Symbian methods to avoid unnecessary platsec warnings (as per qpluginloader.cpp). |
67 } |
121 // Use native Symbian code to check for directory existence, because checking |
68 |
122 // for files from under non-existent protected dir like E:/private/<uid> using |
69 bool DirChecker::checkDir(const QDir& dir) |
123 // QDir::exists causes platform security violations on most apps. |
70 { |
124 QString nativePath = QDir::toNativeSeparators(dir.absolutePath()); |
71 bool pathFound = false; |
125 TPtrC ptr = TPtrC16(static_cast<const TUint16*>(nativePath.utf16()), nativePath.length()); |
72 // In Symbian, going cdUp() in a c:/private/<uid3>/ will result in *platsec* error at fileserver (requires AllFiles capability) |
126 TUint attributes; |
73 // Also, trying to cd() to a nonexistent directory causes *platsec* error. This does not cause functional harm, but should |
127 TInt err = rfs.Att(ptr, attributes); |
74 // nevertheless be changed to use native Symbian methods to avoid unnecessary platsec warnings (as per qpluginloader.cpp). |
128 if (err == KErrNone) { |
75 // Use native Symbian code to check for directory existence, because checking |
129 // yes, the directory exists. |
76 // for files from under non-existent protected dir like E:/private/<uid> using |
130 pathFound = true; |
77 // QDir::exists causes platform security violations on most apps. |
131 } |
78 QString nativePath = QDir::toNativeSeparators(dir.absolutePath()); |
132 rfs.Close(); |
79 TPtrC ptr = TPtrC16(static_cast<const TUint16*>(nativePath.utf16()), nativePath.length()); |
133 return pathFound; |
80 TUint attributes; |
|
81 TInt err = rfs.Att(ptr, attributes); |
|
82 if (err == KErrNone) { |
|
83 // yes, the directory exists. |
|
84 pathFound = true; |
|
85 } |
134 } |
86 return pathFound; |
|
87 } |
|
88 |
|
89 DirChecker::~DirChecker() |
|
90 { |
|
91 rfs.Close(); |
|
92 } |
|
93 #else |
135 #else |
94 DirChecker::DirChecker() |
136 inline bool checkMobilityPluginsDir(const QDir &dir) |
95 { |
137 { |
96 } |
138 return dir.exists(); |
97 |
139 } |
98 DirChecker::~DirChecker() |
|
99 { |
|
100 } |
|
101 |
|
102 bool DirChecker::checkDir(const QDir &dir) |
|
103 { |
|
104 return dir.exists(); |
|
105 } |
|
106 #endif |
140 #endif |
107 |
141 |
108 inline QStringList mobilityPlugins(const QString plugintype) |
142 inline QStringList mobilityPlugins(const QString plugintype) |
109 { |
143 { |
110 #if !defined QT_NO_DEBUG |
144 #if !defined QT_NO_DEBUG |