summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2004-07-07 13:35:48 (UTC)
committer zautrix <zautrix>2004-07-07 13:35:48 (UTC)
commit5030b0bd32b1e526f28ce0339d4b4854492393ae (patch) (unidiff)
tree0a4bfd70d51f0d9d791511ca536c463d68df8af9 /microkde
parent56721aac86c9ae5253abac8962474c8d1a7e648a (diff)
downloadkdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.zip
kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.tar.gz
kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.tar.bz2
made plugins finding on desktop
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/klibloader.cpp6
-rw-r--r--microkde/kdecore/kstandarddirs.cpp21
2 files changed, 23 insertions, 4 deletions
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp
index c091e05..9eee912 100644
--- a/microkde/kdecore/klibloader.cpp
+++ b/microkde/kdecore/klibloader.cpp
@@ -375,71 +375,77 @@ QString KLibLoader::findLibrary( const char * name/*US , const KInstance * insta
375/*US 375/*US
376 if (libname.find('.', pos) < 0) { 376 if (libname.find('.', pos) < 0) {
377 libname += ".la"; 377 libname += ".la";
378 } 378 }
379*/ 379*/
380//US in the microedition we work only with shared libraries. 380//US in the microedition we work only with shared libraries.
381 if (libname.find('.', pos) < 0) { 381 if (libname.find('.', pos) < 0) {
382 libname += ".so"; 382 libname += ".so";
383 } 383 }
384 384
385 // only look up the file if it is not an absolute filename 385 // only look up the file if it is not an absolute filename
386 // (mhk, 20000228) 386 // (mhk, 20000228)
387 QString libfile; 387 QString libfile;
388 if (libname[0] == '/') 388 if (libname[0] == '/')
389 libfile = libname; 389 libfile = libname;
390 else 390 else
391 { 391 {
392//US at this point the libname must exist as real filesname. No expansions will be made later 392//US at this point the libname must exist as real filesname. No expansions will be made later
393// in findResources. Because of that we prepend the lib prefix here to the name 393// in findResources. Because of that we prepend the lib prefix here to the name
394//US I add also the "lib" prefix. I do not how could this could have worked before without it? 394//US I add also the "lib" prefix. I do not how could this could have worked before without it?
395 libname.insert(pos, "lib"); 395 libname.insert(pos, "lib");
396 396
397 397
398//US libfile = instance->dirs()->findResource( "module", libname ); 398//US libfile = instance->dirs()->findResource( "module", libname );
399 //qDebug("libname = %s ",libname.data() );
399 libfile = KGlobal::dirs()->findResource( "module", libname ); 400 libfile = KGlobal::dirs()->findResource( "module", libname );
401 //qDebug("libfile = %s ",libfile.latin1() );
402
400 if ( libfile.isEmpty() ) 403 if ( libfile.isEmpty() )
401 { 404 {
402//US libfile = instance->dirs()->findResource( "lib", libname ); 405//US libfile = instance->dirs()->findResource( "lib", libname );
403 libfile = KGlobal::dirs()->findResource( "lib", libname ); 406 libfile = KGlobal::dirs()->findResource( "lib", libname );
407 //qDebug("libfile2 = %s ",libfile.latin1() );
404#ifndef NDEBUG 408#ifndef NDEBUG
405 if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules 409 if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules
406 kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl; 410 kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl;
407#endif 411#endif
408 } 412 }
409 if ( libfile.isEmpty() ) 413 if ( libfile.isEmpty() )
410 { 414 {
411#ifndef NDEBUG 415#ifndef NDEBUG
412 kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; 416 kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl;
413 self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname); 417 self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname);
414 418
415 qDebug("KLibLoader::library could not find library: %s", libname.data()); 419 qDebug("KLibLoader::library could not find library: %s", libname.data());
416#endif 420#endif
417 421
418 } 422 }
419 else 423 else
420 self()->d->errorMessage = QString::null; 424 self()->d->errorMessage = QString::null;
421 } 425 }
426
427 //qDebug("return libfile = %s ",libfile.latin1() );
422 return libfile; 428 return libfile;
423} 429}
424 430
425 431
426KLibrary* KLibLoader::globalLibrary( const char *name ) 432KLibrary* KLibLoader::globalLibrary( const char *name )
427{ 433{
428KLibrary *tmp; 434KLibrary *tmp;
429/*US 435/*US
430int olt_dlopen_flag = lt_dlopen_flag; 436int olt_dlopen_flag = lt_dlopen_flag;
431 437
432 lt_dlopen_flag |= LT_GLOBAL; 438 lt_dlopen_flag |= LT_GLOBAL;
433 kdDebug(150) << "Loading the next library global with flag " 439 kdDebug(150) << "Loading the next library global with flag "
434 << lt_dlopen_flag 440 << lt_dlopen_flag
435 << "." << endl; 441 << "." << endl;
436*/ 442*/
437 tmp = library(name); 443 tmp = library(name);
438/*US 444/*US
439 lt_dlopen_flag = olt_dlopen_flag; 445 lt_dlopen_flag = olt_dlopen_flag;
440*/ 446*/
441return tmp; 447return tmp;
442} 448}
443 449
444 450
445KLibrary* KLibLoader::library( const char *name ) 451KLibrary* KLibLoader::library( const char *name )
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index 7f51d78..e1c78f6 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -21,48 +21,50 @@
21/* 21/*
22 * Author: Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org> 22 * Author: Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
23 * Version:$Id$ 23 * Version:$Id$
24 * Generated:Thu Mar 5 16:05:28 EST 1998 24 * Generated:Thu Mar 5 16:05:28 EST 1998
25 */ 25 */
26 26
27//US #include "config.h" 27//US #include "config.h"
28 28
29#include <stdlib.h> 29#include <stdlib.h>
30#include <assert.h> 30#include <assert.h>
31//US#include <errno.h> 31//US#include <errno.h>
32//US #ifdef HAVE_SYS_STAT_H 32//US #ifdef HAVE_SYS_STAT_H
33//US #include <sys/stat.h> 33//US #include <sys/stat.h>
34//US #endif 34//US #endif
35//US#include <sys/types.h> 35//US#include <sys/types.h>
36//US#include <dirent.h> 36//US#include <dirent.h>
37//US#include <pwd.h> 37//US#include <pwd.h>
38 38
39#include <qregexp.h> 39#include <qregexp.h>
40#include <qasciidict.h> 40#include <qasciidict.h>
41#include <qdict.h> 41#include <qdict.h>
42#include <qdir.h> 42#include <qdir.h>
43#include <qfileinfo.h> 43#include <qfileinfo.h>
44#include <qstring.h> 44#include <qstring.h>
45#include <qapplication.h>
46
45#include <qstringlist.h> 47#include <qstringlist.h>
46 48
47#include "kstandarddirs.h" 49#include "kstandarddirs.h"
48#include "kconfig.h" 50#include "kconfig.h"
49#include "kdebug.h" 51#include "kdebug.h"
50//US #include "kinstance.h" 52//US #include "kinstance.h"
51#include "kshell.h" 53#include "kshell.h"
52//US#include <sys/param.h> 54//US#include <sys/param.h>
53//US#include <unistd.h> 55//US#include <unistd.h>
54 56
55//US 57//US
56QString KStandardDirs::mAppDir = QString::null; 58QString KStandardDirs::mAppDir = QString::null;
57 59
58 60
59template class QDict<QStringList>; 61template class QDict<QStringList>;
60 62
61#if 0 63#if 0
62#include <qtextedit.h> 64#include <qtextedit.h>
63void ddd( QString op ) 65void ddd( QString op )
64{ 66{
65 static QTextEdit * dot = 0; 67 static QTextEdit * dot = 0;
66 if ( ! dot ) 68 if ( ! dot )
67 dot = new QTextEdit(); 69 dot = new QTextEdit();
68 70
@@ -328,58 +330,66 @@ QStringList KStandardDirs::findDirs( const char *type,
328 for (QStringList::ConstIterator it = candidates.begin(); 330 for (QStringList::ConstIterator it = candidates.begin();
329 it != candidates.end(); it++) { 331 it != candidates.end(); it++) {
330 testdir.setPath(*it + reldir); 332 testdir.setPath(*it + reldir);
331 if (testdir.exists()) 333 if (testdir.exists())
332 list.append(testdir.absPath() + '/'); 334 list.append(testdir.absPath() + '/');
333 } 335 }
334 336
335 return list; 337 return list;
336} 338}
337 339
338QString KStandardDirs::findResourceDir( const char *type, 340QString KStandardDirs::findResourceDir( const char *type,
339 const QString& filename) const 341 const QString& filename) const
340{ 342{
341#ifndef NDEBUG 343#ifndef NDEBUG
342 if (filename.isEmpty()) { 344 if (filename.isEmpty()) {
343 kdWarning() << "filename for type " << type << " in KStandardDirs::findResourceDir is not supposed to be empty!!" << endl; 345 kdWarning() << "filename for type " << type << " in KStandardDirs::findResourceDir is not supposed to be empty!!" << endl;
344 return QString::null; 346 return QString::null;
345 } 347 }
346#endif 348#endif
347 349
348 if (d && d->restrictionsActive && (strcmp(type, "data")==0)) 350 if (d && d->restrictionsActive && (strcmp(type, "data")==0))
349 applyDataRestrictions(filename); 351 applyDataRestrictions(filename);
350 QStringList candidates = resourceDirs(type); 352 QStringList candidates = resourceDirs(type);
351 QString fullPath; 353 QString fullPath;
352 354#ifdef DESKTOP_VERSION
355#ifdef _WIN32_
356 candidates.prepend( qApp->applicationDirPath () +"\\");
357#else
358 candidates.prepend( qApp->applicationDirPath () +"/");
359#endif
360#endif
353 for (QStringList::ConstIterator it = candidates.begin(); it != candidates.end(); it++) 361 for (QStringList::ConstIterator it = candidates.begin(); it != candidates.end(); it++)
354 { 362 {
363 //qDebug("looking for dir %s - file %s", (*it).latin1(), filename.latin1());
355 if (exists(*it + filename)) 364 if (exists(*it + filename))
356 return *it; 365 return *it;
357 } 366 }
358 367
359#ifndef NDEBUG 368#ifndef NDEBUG
360 if(false && type != "locale") 369 if(false && type != "locale")
361 kdDebug() << "KStdDirs::findResDir(): can't find \"" << filename << "\" in type \"" << type << "\"." << endl; 370 qDebug("KStdDirs::findResDir(): can't find %s ", filename.latin1());
371
362#endif 372#endif
363 373
364 return QString::null; 374 return QString::null;
365} 375}
366 376
367bool KStandardDirs::exists(const QString &fullPath) 377bool KStandardDirs::exists(const QString &fullPath)
368{ 378{
369//US struct stat buff; 379//US struct stat buff;
370 QFileInfo fullPathInfo(QFile::encodeName(fullPath)); 380 QFileInfo fullPathInfo(QFile::encodeName(fullPath));
371 381
372//US if (access(QFile::encodeName(fullPath), R_OK) == 0 && fullPathInfo.isReadable()) 382//US if (access(QFile::encodeName(fullPath), R_OK) == 0 && fullPathInfo.isReadable())
373 if (fullPathInfo.isReadable()) 383 if (fullPathInfo.isReadable())
374 { 384 {
375 if (fullPath.at(fullPath.length() - 1) != '/') { 385 if (fullPath.at(fullPath.length() - 1) != '/') {
376 //US if (S_ISREG( buff.st_mode )) 386 //US if (S_ISREG( buff.st_mode ))
377 if (fullPathInfo.isFile()) 387 if (fullPathInfo.isFile())
378 return true; 388 return true;
379 } 389 }
380 else { 390 else {
381 //US if (S_ISDIR( buff.st_mode )) 391 //US if (S_ISDIR( buff.st_mode ))
382 if (fullPathInfo.isDir()) 392 if (fullPathInfo.isDir())
383 return true; 393 return true;
384 } 394 }
385 } 395 }
@@ -948,51 +958,51 @@ QString KStandardDirs::kde_default(const char *type) {
948 return "config/"; 958 return "config/";
949 if (!strcmp(type, "pixmap")) 959 if (!strcmp(type, "pixmap"))
950 return "share/pixmaps/"; 960 return "share/pixmaps/";
951 if (!strcmp(type, "apps")) 961 if (!strcmp(type, "apps"))
952 return "share/applnk/"; 962 return "share/applnk/";
953 if (!strcmp(type, "sound")) 963 if (!strcmp(type, "sound"))
954 return "share/sounds/"; 964 return "share/sounds/";
955 if (!strcmp(type, "locale")) 965 if (!strcmp(type, "locale"))
956 return "share/locale/"; 966 return "share/locale/";
957 if (!strcmp(type, "services")) 967 if (!strcmp(type, "services"))
958 return "share/services/"; 968 return "share/services/";
959 if (!strcmp(type, "servicetypes")) 969 if (!strcmp(type, "servicetypes"))
960 return "share/servicetypes/"; 970 return "share/servicetypes/";
961 if (!strcmp(type, "mime")) 971 if (!strcmp(type, "mime"))
962 return "share/mimelnk/"; 972 return "share/mimelnk/";
963 if (!strcmp(type, "cgi")) 973 if (!strcmp(type, "cgi"))
964 return "cgi-bin/"; 974 return "cgi-bin/";
965 if (!strcmp(type, "wallpaper")) 975 if (!strcmp(type, "wallpaper"))
966 return "share/wallpapers/"; 976 return "share/wallpapers/";
967 if (!strcmp(type, "templates")) 977 if (!strcmp(type, "templates"))
968 return "share/templates/"; 978 return "share/templates/";
969 if (!strcmp(type, "exe")) 979 if (!strcmp(type, "exe"))
970 return "bin/"; 980 return "bin/";
971 if (!strcmp(type, "lib")) 981 if (!strcmp(type, "lib"))
972 return "lib/"; 982 return "lib/";
973 if (!strcmp(type, "module")) 983 if (!strcmp(type, "module"))
974 return "lib/kde3/"; 984 return "lib/kde3/";
975 if (!strcmp(type, "qtplugins")) 985 if (!strcmp(type, "qtplugins"))
976 return "lib/kde3/plugins"; 986 return "lib/kde3/plugins";
977 if (!strcmp(type, "xdgdata-apps")) 987 if (!strcmp(type, "xdgdata-apps"))
978 return "applications/"; 988 return "applications/";
979 if (!strcmp(type, "xdgdata-dirs")) 989 if (!strcmp(type, "xdgdata-dirs"))
980 return "desktop-directories/"; 990 return "desktop-directories/";
981 if (!strcmp(type, "xdgconf-menu")) 991 if (!strcmp(type, "xdgconf-menu"))
982 return "menus/"; 992 return "menus/";
983 qFatal("unknown resource type %s", type); 993 qFatal("unknown resource type %s", type);
984 return QString::null; 994 return QString::null;
985} 995}
986 996
987QString KStandardDirs::saveLocation(const char *type, 997QString KStandardDirs::saveLocation(const char *type,
988 const QString& suffix, 998 const QString& suffix,
989 bool create) const 999 bool create) const
990{ 1000{
991 //qDebug("KStandardDirs::saveLocation called %s %s", type,suffix.latin1() ); 1001 //qDebug("KStandardDirs::saveLocation called %s %s", type,suffix.latin1() );
992 //return ""; 1002 //return "";
993 checkConfig(); 1003 checkConfig();
994 1004
995 QString *pPath = savelocations.find(type); 1005 QString *pPath = savelocations.find(type);
996 if (!pPath) 1006 if (!pPath)
997 { 1007 {
998 QStringList *dirs = relatives.find(type); 1008 QStringList *dirs = relatives.find(type);
@@ -1203,49 +1213,52 @@ static QString readEnvPath(const char *env)
1203 1213
1204void KStandardDirs::addKDEDefaults() 1214void KStandardDirs::addKDEDefaults()
1205{ 1215{
1206 //qDebug("ERROR: KStandardDirs::addKDEDefaults() called "); 1216 //qDebug("ERROR: KStandardDirs::addKDEDefaults() called ");
1207 //return; 1217 //return;
1208 QStringList kdedirList; 1218 QStringList kdedirList;
1209 1219
1210 // begin KDEDIRS 1220 // begin KDEDIRS
1211 QString kdedirs = readEnvPath("MICROKDEDIRS"); 1221 QString kdedirs = readEnvPath("MICROKDEDIRS");
1212 if (!kdedirs.isEmpty()) 1222 if (!kdedirs.isEmpty())
1213 { 1223 {
1214 tokenize(kdedirList, kdedirs, ":"); 1224 tokenize(kdedirList, kdedirs, ":");
1215 } 1225 }
1216 else 1226 else
1217 { 1227 {
1218 QString kdedir = readEnvPath("MICROKDEDIR"); 1228 QString kdedir = readEnvPath("MICROKDEDIR");
1219 if (!kdedir.isEmpty()) 1229 if (!kdedir.isEmpty())
1220 { 1230 {
1221 kdedir = KShell::tildeExpand(kdedir); 1231 kdedir = KShell::tildeExpand(kdedir);
1222 kdedirList.append(kdedir); 1232 kdedirList.append(kdedir);
1223 } 1233 }
1224 } 1234 }
1225//US kdedirList.append(KDEDIR); 1235//US kdedirList.append(KDEDIR);
1226//US for embedded, add qtopia dir as kdedir 1236//US for embedded, add qtopia dir as kdedir
1237
1238#ifndef DESKTOP_VERSION
1227 kdedirList.append(readEnvPath("QPEDIR" )); 1239 kdedirList.append(readEnvPath("QPEDIR" ));
1240#endif
1228 1241
1229#ifdef __KDE_EXECPREFIX 1242#ifdef __KDE_EXECPREFIX
1230 QString execPrefix(__KDE_EXECPREFIX); 1243 QString execPrefix(__KDE_EXECPREFIX);
1231 if (execPrefix!="NONE") 1244 if (execPrefix!="NONE")
1232 kdedirList.append(execPrefix); 1245 kdedirList.append(execPrefix);
1233#endif 1246#endif
1234 1247
1235 QString localKdeDir; 1248 QString localKdeDir;
1236 1249
1237//US if (getuid()) 1250//US if (getuid())
1238 if (true) 1251 if (true)
1239 { 1252 {
1240 localKdeDir = readEnvPath("MICROKDEHOME"); 1253 localKdeDir = readEnvPath("MICROKDEHOME");
1241 if (!localKdeDir.isEmpty()) 1254 if (!localKdeDir.isEmpty())
1242 { 1255 {
1243 if (localKdeDir.at(localKdeDir.length()-1) != '/') 1256 if (localKdeDir.at(localKdeDir.length()-1) != '/')
1244 localKdeDir += '/'; 1257 localKdeDir += '/';
1245 } 1258 }
1246 else 1259 else
1247 { 1260 {
1248 localKdeDir = QDir::homeDirPath() + "/kdepim/"; 1261 localKdeDir = QDir::homeDirPath() + "/kdepim/";
1249 } 1262 }
1250 } 1263 }
1251 else 1264 else