summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/oglobal.cpp
Unidiff
Diffstat (limited to 'libopie2/opiecore/oglobal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oglobal.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp
index 1aa206e..ea02058 100644
--- a/libopie2/opiecore/oglobal.cpp
+++ b/libopie2/opiecore/oglobal.cpp
@@ -29,24 +29,26 @@
29 29
30#include <opie2/oglobal.h> 30#include <opie2/oglobal.h>
31 31
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qdir.h> 33#include <qdir.h>
34#include <qpe/mimetype.h> 34#include <qpe/mimetype.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37 37
38#include <unistd.h> 38#include <unistd.h>
39#include <sys/types.h> 39#include <sys/types.h>
40 40
41using namespace Opie::Core;
42
41static const char Base64EncMap[64] = 43static const char Base64EncMap[64] =
42{ 44{
43 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 45 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
44 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 46 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
45 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 47 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
46 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 48 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
47 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 49 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
48 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 50 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
49 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33, 51 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
50 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F 52 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F
51}; 53};
52 54
@@ -303,36 +305,36 @@ QByteArray OGlobal::decodeBase64( const QByteArray& in) {
303 if (++didx < len ) 305 if (++didx < len )
304 out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017)); 306 out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
305 307
306 // Resize the output buffer 308 // Resize the output buffer
307 if ( len == 0 || len < out.size() ) 309 if ( len == 0 || len < out.size() )
308 out.resize(len); 310 out.resize(len);
309 311
310 return out; 312 return out;
311} 313}
312 314
313bool OGlobal::isAppLnkFileName( const QString& str ) 315bool OGlobal::isAppLnkFileName( const QString& str )
314{ 316{
315 if (str.length()==0||str.at(str.length()-1)==QDir::separator()) return false; 317 if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false;
316 return str.startsWith(MimeType::appsFolderName()+QDir::separator()); 318 return str.startsWith(MimeType::appsFolderName()+QDir::separator());
317} 319}
318 320
319/* ToDo: 321/* ToDo:
320 * This fun should check the document-path value for the mounted media 322 * This fun should check the document-path value for the mounted media
321 * which has to be implemented later. this moment we just check for a 323 * which has to be implemented later. this moment we just check for a
322 * mounted media name. 324 * mounted media name.
323 */ 325 */
324bool OGlobal::isDocumentFileName( const QString& file ) 326bool OGlobal::isDocumentFileName( const QString& file )
325{ 327{
326 if (file.length()==0||file.at(file.length()-1)==QDir::separator()) return false; 328 if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false;
327 if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true; 329 if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true;
328 StorageInfo si; 330 StorageInfo si;
329 QList< FileSystem > fl = si.fileSystems(); 331 QList< FileSystem > fl = si.fileSystems();
330 FileSystem*fs; 332 FileSystem*fs;
331 for (fs = fl.first();fs!=0;fs=fl.next()) { 333 for (fs = fl.first();fs!=0;fs=fl.next()) {
332 if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator())) 334 if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator()))
333 return true; 335 return true;
334 } 336 }
335 if (file.startsWith(homeDirPath())+"/Documents/") return true; 337 if (file.startsWith(homeDirPath())+"/Documents/") return true;
336 return false; 338 return false;
337} 339}
338 340