author | zautrix <zautrix> | 2004-07-07 13:35:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-07 13:35:48 (UTC) |
commit | 5030b0bd32b1e526f28ce0339d4b4854492393ae (patch) (unidiff) | |
tree | 0a4bfd70d51f0d9d791511ca536c463d68df8af9 /microkde | |
parent | 56721aac86c9ae5253abac8962474c8d1a7e648a (diff) | |
download | kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.zip kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.tar.gz kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.tar.bz2 |
made plugins finding on desktop
-rw-r--r-- | microkde/kdecore/klibloader.cpp | 6 | ||||
-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 21 |
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 | |||
@@ -387,47 +387,53 @@ QString KLibLoader::findLibrary( const char * name/*US , const KInstance * insta | |||
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 | ||
426 | KLibrary* KLibLoader::globalLibrary( const char *name ) | 432 | KLibrary* KLibLoader::globalLibrary( const char *name ) |
427 | { | 433 | { |
428 | KLibrary *tmp; | 434 | KLibrary *tmp; |
429 | /*US | 435 | /*US |
430 | int olt_dlopen_flag = lt_dlopen_flag; | 436 | int 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 " |
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 | |||
@@ -33,24 +33,26 @@ | |||
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 |
56 | QString KStandardDirs::mAppDir = QString::null; | 58 | QString KStandardDirs::mAppDir = QString::null; |
@@ -340,34 +342,42 @@ QString KStandardDirs::findResourceDir( const char *type, | |||
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 | ||
367 | bool KStandardDirs::exists(const QString &fullPath) | 377 | bool 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()) |
@@ -960,27 +970,27 @@ QString KStandardDirs::kde_default(const char *type) { | |||
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 | ||
@@ -1215,25 +1225,28 @@ void KStandardDirs::addKDEDefaults() | |||
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 | { |