summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oglobal.cpp2
-rw-r--r--libopie2/opiecore/oprocess.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp
index 706ac6c..b7d59fc 100644
--- a/libopie2/opiecore/oglobal.cpp
+++ b/libopie2/opiecore/oglobal.cpp
@@ -323,49 +323,49 @@ QByteArray OGlobal::decodeBase64( const QByteArray& in) {
323} 323}
324 324
325bool OGlobal::isAppLnkFileName( const QString& str ) 325bool OGlobal::isAppLnkFileName( const QString& str )
326{ 326{
327 if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false; 327 if (str.isEmpty()||str.at(str.length()-1)==QDir::separator()) return false;
328 return str.startsWith(MimeType::appsFolderName()+QDir::separator()); 328 return str.startsWith(MimeType::appsFolderName()+QDir::separator());
329} 329}
330 330
331/* ToDo: 331/* ToDo:
332 * This fun should check the document-path value for the mounted media 332 * This fun should check the document-path value for the mounted media
333 * which has to be implemented later. this moment we just check for a 333 * which has to be implemented later. this moment we just check for a
334 * mounted media name. 334 * mounted media name.
335 */ 335 */
336bool OGlobal::isDocumentFileName( const QString& file ) 336bool OGlobal::isDocumentFileName( const QString& file )
337{ 337{
338 if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false; 338 if (file.isEmpty()||file.at(file.length()-1)==QDir::separator()) return false;
339 if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true; 339 if (file.startsWith(QPEApplication::documentDir()+QDir::separator())) return true;
340 StorageInfo si; 340 StorageInfo si;
341 QList< FileSystem > fl = si.fileSystems(); 341 QList< FileSystem > fl = si.fileSystems();
342 FileSystem*fs; 342 FileSystem*fs;
343 for (fs = fl.first();fs!=0;fs=fl.next()) { 343 for (fs = fl.first();fs!=0;fs=fl.next()) {
344 if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator())) 344 if (fs->isRemovable()&&file.startsWith(fs->name()+QDir::separator()))
345 return true; 345 return true;
346 } 346 }
347 if (file.startsWith(homeDirPath())+"/Documents/") return true; 347 if (file.startsWith(homeDirPath()+"/Documents/")) return true;
348 return false; 348 return false;
349} 349}
350 350
351QString OGlobal::tempDirPath() 351QString OGlobal::tempDirPath()
352{ 352{
353 static QString defstring="/tmp"; 353 static QString defstring="/tmp";
354 char * tmpp = 0; 354 char * tmpp = 0;
355 if ( (tmpp=getenv("TEMP"))) { 355 if ( (tmpp=getenv("TEMP"))) {
356 return tmpp; 356 return tmpp;
357 } 357 }
358 return defstring; 358 return defstring;
359} 359}
360 360
361QString OGlobal::homeDirPath() 361QString OGlobal::homeDirPath()
362{ 362{
363 char * tmpp = getenv("HOME"); 363 char * tmpp = getenv("HOME");
364 return (tmpp?tmpp:"/"); 364 return (tmpp?tmpp:"/");
365} 365}
366 366
367bool OGlobal::weekStartsOnMonday() 367bool OGlobal::weekStartsOnMonday()
368{ 368{
369 OConfig*conf=OGlobal::qpe_config(); 369 OConfig*conf=OGlobal::qpe_config();
370 if (!conf)return false; 370 if (!conf)return false;
371 conf->setGroup("Time"); 371 conf->setGroup("Time");
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp
index b3f9724..56f9883 100644
--- a/libopie2/opiecore/oprocess.cpp
+++ b/libopie2/opiecore/oprocess.cpp
@@ -907,45 +907,45 @@ bool OProcess::isExecutable( const QCString &filename )
907 ( S_ISFIFO( fileinfo.st_mode ) ) || 907 ( S_ISFIFO( fileinfo.st_mode ) ) ||
908 ( S_ISDIR( fileinfo.st_mode ) ) ) 908 ( S_ISDIR( fileinfo.st_mode ) ) )
909 { 909 {
910 return false; 910 return false;
911 } 911 }
912 912
913 // CC: now check for permission to execute the file 913 // CC: now check for permission to execute the file
914 if ( access( filename.data(), X_OK ) != 0 ) 914 if ( access( filename.data(), X_OK ) != 0 )
915 return false; 915 return false;
916 916
917 // CC: we've passed all the tests... 917 // CC: we've passed all the tests...
918 return true; 918 return true;
919} 919}
920 920
921int OProcess::processPID( const QString& process ) 921int OProcess::processPID( const QString& process )
922{ 922{
923 QString line; 923 QString line;
924 QDir d = QDir( "/proc" ); 924 QDir d = QDir( "/proc" );
925 QStringList dirs = d.entryList( QDir::Dirs ); 925 QStringList dirs = d.entryList( QDir::Dirs );
926 QStringList::Iterator it; 926 QStringList::Iterator it;
927 for ( it = dirs.begin(); it != dirs.end(); ++it ) 927 for ( it = dirs.begin(); it != dirs.end(); ++it )
928 { 928 {
929 //qDebug( "next entry: %s", (const char*) *it ); 929 //qDebug( "next entry: %s", (const char*) *it );
930 QFile file( "/proc/"+*it+"/cmdline" ); 930 QFile file( "/proc/"+*it+"/cmdline" );
931 file.open( IO_ReadOnly ); 931 if ( !file.open( IO_ReadOnly ) ) continue;
932 if ( !file.isOpen() ) continue; 932 if ( !file.isOpen() ) continue;
933 QTextStream t( &file ); 933 QTextStream t( &file );
934 line = t.readLine(); 934 line = t.readLine();
935 //qDebug( "cmdline = %s", (const char*) line ); 935 //qDebug( "cmdline = %s", (const char*) line );
936 if ( line.contains( process ) ) break; //FIXME: That may find also other process, if the name is not long enough ;) 936 if ( line.contains( process ) ) break; //FIXME: That may find also other process, if the name is not long enough ;)
937 } 937 }
938 if ( line.contains( process ) ) 938 if ( line.contains( process ) )
939 { 939 {
940 //qDebug( "found process id #%d", (*it).toInt() ); 940 //qDebug( "found process id #%d", (*it).toInt() );
941 return (*it).toInt(); 941 return (*it).toInt();
942 } 942 }
943 else 943 else
944 { 944 {
945 //qDebug( "process '%s' not found", (const char*) process ); 945 //qDebug( "process '%s' not found", (const char*) process );
946 return 0; 946 return 0;
947 } 947 }
948} 948}
949 949
950} 950}
951} 951}