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 | |
parent | 56721aac86c9ae5253abac8962474c8d1a7e648a (diff) | |
download | kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.zip kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.tar.gz kdepimpi-5030b0bd32b1e526f28ce0339d4b4854492393ae.tar.bz2 |
made plugins finding on desktop
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | microkde/kdecore/klibloader.cpp | 6 | ||||
-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 21 |
3 files changed, 24 insertions, 5 deletions
@@ -1,35 +1,35 @@ | |||
1 | ############################################################################# | 1 | ############################################################################# |
2 | # Makefile for building: kopi-desktop | 2 | # Makefile for building: kopi-desktop |
3 | # Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Jul 7 13:43:59 2004 | 3 | # Generated by qmake (1.07a) (Qt 3.3.2) on: Wed Jul 7 14:00:48 2004 |
4 | # Project: kopi-desktop.pro | 4 | # Project: kopi-desktop.pro |
5 | # Template: subdirs | 5 | # Template: subdirs |
6 | # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro | 6 | # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kopi-desktop.pro |
7 | ############################################################################# | 7 | ############################################################################# |
8 | 8 | ||
9 | MAKEFILE =Makefile | 9 | MAKEFILE =Makefile |
10 | QMAKE =qmake | 10 | QMAKE =qmake |
11 | DEL_FILE = rm -f | 11 | DEL_FILE = rm -f |
12 | CHK_DIR_EXISTS= test -d | 12 | CHK_DIR_EXISTS= test -d |
13 | MKDIR = mkdir -p | 13 | MKDIR = mkdir -p |
14 | INSTALL_FILE= | 14 | INSTALL_FILE= |
15 | INSTALL_DIR = | 15 | INSTALL_DIR = |
16 | SUBTARGETS = \ | 16 | SUBTARGETS = \ |
17 | sub-libical \ | 17 | sub-libical \ |
18 | sub-libkcal \ | 18 | sub-libkcal \ |
19 | sub-microkde \ | 19 | sub-microkde \ |
20 | sub-libkdepim \ | 20 | sub-libkdepim \ |
21 | sub-kabc \ | 21 | sub-kabc \ |
22 | sub-korganizer \ | 22 | sub-korganizer \ |
23 | sub-kaddressbook \ | 23 | sub-kaddressbook \ |
24 | sub-kabc-plugins-file \ | 24 | sub-kabc-plugins-file \ |
25 | sub-kabc-plugins-dir | 25 | sub-kabc-plugins-dir |
26 | 26 | ||
27 | first: all | 27 | first: all |
28 | 28 | ||
29 | all: Makefile $(SUBTARGETS) | 29 | all: Makefile $(SUBTARGETS) |
30 | 30 | ||
31 | libical/$(MAKEFILE): | 31 | libical/$(MAKEFILE): |
32 | @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" | 32 | @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" |
33 | cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) | 33 | cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) |
34 | sub-libical: libical/$(MAKEFILE) FORCE | 34 | sub-libical: libical/$(MAKEFILE) FORCE |
35 | cd libical && $(MAKE) -f $(MAKEFILE) | 35 | cd libical && $(MAKE) -f $(MAKEFILE) |
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 | |||
@@ -367,87 +367,93 @@ QString KLibLoader::findLibrary( const char * name/*US , const KInstance * insta | |||
367 | QCString libname( name ); | 367 | QCString libname( name ); |
368 | 368 | ||
369 | // only append ".la" if there is no extension | 369 | // only append ".la" if there is no extension |
370 | // this allows to load non-libtool libraries as well | 370 | // this allows to load non-libtool libraries as well |
371 | // (mhk, 20000228) | 371 | // (mhk, 20000228) |
372 | int pos = libname.findRev('/'); | 372 | int pos = libname.findRev('/'); |
373 | if (pos < 0) | 373 | if (pos < 0) |
374 | pos = 0; | 374 | pos = 0; |
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 | ||
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 " |
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 | */ |
441 | return tmp; | 447 | return tmp; |
442 | } | 448 | } |
443 | 449 | ||
444 | 450 | ||
445 | KLibrary* KLibLoader::library( const char *name ) | 451 | KLibrary* KLibLoader::library( const char *name ) |
446 | { | 452 | { |
447 | if (!name) | 453 | if (!name) |
448 | return 0; | 454 | return 0; |
449 | 455 | ||
450 | KLibWrapPrivate* wrap = m_libs[name]; | 456 | KLibWrapPrivate* wrap = m_libs[name]; |
451 | if (wrap) { | 457 | if (wrap) { |
452 | /* Nothing to do to load the library. */ | 458 | /* Nothing to do to load the library. */ |
453 | wrap->ref_count++; | 459 | wrap->ref_count++; |
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 | |||
@@ -13,64 +13,66 @@ | |||
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
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 |
56 | QString KStandardDirs::mAppDir = QString::null; | 58 | QString KStandardDirs::mAppDir = QString::null; |
57 | 59 | ||
58 | 60 | ||
59 | template class QDict<QStringList>; | 61 | template class QDict<QStringList>; |
60 | 62 | ||
61 | #if 0 | 63 | #if 0 |
62 | #include <qtextedit.h> | 64 | #include <qtextedit.h> |
63 | void ddd( QString op ) | 65 | void 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 | ||
69 | dot->show(); | 71 | dot->show(); |
70 | 72 | ||
71 | dot->append( op ); | 73 | dot->append( op ); |
72 | 74 | ||
73 | } | 75 | } |
74 | #endif | 76 | #endif |
75 | class KStandardDirs::KStandardDirsPrivate | 77 | class KStandardDirs::KStandardDirsPrivate |
76 | { | 78 | { |
@@ -320,74 +322,82 @@ QStringList KStandardDirs::findDirs( const char *type, | |||
320 | 322 | ||
321 | checkConfig(); | 323 | checkConfig(); |
322 | 324 | ||
323 | if (d && d->restrictionsActive && (strcmp(type, "data")==0)) | 325 | if (d && d->restrictionsActive && (strcmp(type, "data")==0)) |
324 | applyDataRestrictions(reldir); | 326 | applyDataRestrictions(reldir); |
325 | QStringList candidates = resourceDirs(type); | 327 | QStringList candidates = resourceDirs(type); |
326 | QDir testdir; | 328 | QDir testdir; |
327 | 329 | ||
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 | ||
338 | QString KStandardDirs::findResourceDir( const char *type, | 340 | QString 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 | ||
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()) |
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 | } |
386 | return false; | 396 | return false; |
387 | } | 397 | } |
388 | 398 | ||
389 | static void lookupDirectory(const QString& path, const QString &relPart, | 399 | static void lookupDirectory(const QString& path, const QString &relPart, |
390 | const QRegExp ®exp, | 400 | const QRegExp ®exp, |
391 | QStringList& list, | 401 | QStringList& list, |
392 | QStringList& relList, | 402 | QStringList& relList, |
393 | bool recursive, bool uniq) | 403 | bool recursive, bool uniq) |
@@ -940,67 +950,67 @@ static int tokenize( QStringList& tokens, const QString& str, | |||
940 | QString KStandardDirs::kde_default(const char *type) { | 950 | QString KStandardDirs::kde_default(const char *type) { |
941 | if (!strcmp(type, "data")) | 951 | if (!strcmp(type, "data")) |
942 | return "apps/"; | 952 | return "apps/"; |
943 | if (!strcmp(type, "html")) | 953 | if (!strcmp(type, "html")) |
944 | return "share/doc/HTML/"; | 954 | return "share/doc/HTML/"; |
945 | if (!strcmp(type, "icon")) | 955 | if (!strcmp(type, "icon")) |
946 | return "share/icons/"; | 956 | return "share/icons/"; |
947 | if (!strcmp(type, "config")) | 957 | if (!strcmp(type, "config")) |
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 | ||
987 | QString KStandardDirs::saveLocation(const char *type, | 997 | QString 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); |
999 | if (!dirs && ( | 1009 | if (!dirs && ( |
1000 | (strcmp(type, "socket") == 0) || | 1010 | (strcmp(type, "socket") == 0) || |
1001 | (strcmp(type, "tmp") == 0) || | 1011 | (strcmp(type, "tmp") == 0) || |
1002 | (strcmp(type, "cache") == 0) )) | 1012 | (strcmp(type, "cache") == 0) )) |
1003 | { | 1013 | { |
1004 | (void) resourceDirs(type); // Generate socket|tmp|cache resource. | 1014 | (void) resourceDirs(type); // Generate socket|tmp|cache resource. |
1005 | dirs = relatives.find(type); // Search again. | 1015 | dirs = relatives.find(type); // Search again. |
1006 | } | 1016 | } |
@@ -1195,65 +1205,68 @@ static QString readEnvPath(const char *env) | |||
1195 | return ""; | 1205 | return ""; |
1196 | #else | 1206 | #else |
1197 | QCString c_path = getenv(env); | 1207 | QCString c_path = getenv(env); |
1198 | if (c_path.isEmpty()) | 1208 | if (c_path.isEmpty()) |
1199 | return QString::null; | 1209 | return QString::null; |
1200 | return QFile::decodeName(c_path); | 1210 | return QFile::decodeName(c_path); |
1201 | #endif | 1211 | #endif |
1202 | } | 1212 | } |
1203 | 1213 | ||
1204 | void KStandardDirs::addKDEDefaults() | 1214 | void 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 |
1252 | { | 1265 | { |
1253 | // We treat root different to prevent root messing up the | 1266 | // We treat root different to prevent root messing up the |
1254 | // file permissions in the users home directory. | 1267 | // file permissions in the users home directory. |
1255 | localKdeDir = readEnvPath("MICROKDEROOTHOME"); | 1268 | localKdeDir = readEnvPath("MICROKDEROOTHOME"); |
1256 | if (!localKdeDir.isEmpty()) | 1269 | if (!localKdeDir.isEmpty()) |
1257 | { | 1270 | { |
1258 | if (localKdeDir.at(localKdeDir.length()-1) != '/') | 1271 | if (localKdeDir.at(localKdeDir.length()-1) != '/') |
1259 | localKdeDir += '/'; | 1272 | localKdeDir += '/'; |