summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--microkde/kdecore/klibloader.cpp6
-rw-r--r--microkde/kdecore/kstandarddirs.cpp21
3 files changed, 24 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 620581b..6eb89e7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,67 +1,67 @@
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
11DEL_FILE = rm -f 11DEL_FILE = rm -f
12CHK_DIR_EXISTS= test -d 12CHK_DIR_EXISTS= test -d
13MKDIR = mkdir -p 13MKDIR = mkdir -p
14INSTALL_FILE= 14INSTALL_FILE=
15INSTALL_DIR = 15INSTALL_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
27first: all 27first: all
28 28
29all: Makefile $(SUBTARGETS) 29all: Makefile $(SUBTARGETS)
30 30
31libical/$(MAKEFILE): 31libical/$(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)
34sub-libical: libical/$(MAKEFILE) FORCE 34sub-libical: libical/$(MAKEFILE) FORCE
35 cd libical && $(MAKE) -f $(MAKEFILE) 35 cd libical && $(MAKE) -f $(MAKEFILE)
36 36
37libkcal/$(MAKEFILE): 37libkcal/$(MAKEFILE):
38 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" 38 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
39 cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 39 cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
40sub-libkcal: libkcal/$(MAKEFILE) FORCE 40sub-libkcal: libkcal/$(MAKEFILE) FORCE
41 cd libkcal && $(MAKE) -f $(MAKEFILE) 41 cd libkcal && $(MAKE) -f $(MAKEFILE)
42 42
43microkde/$(MAKEFILE): 43microkde/$(MAKEFILE):
44 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" 44 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
45 cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 45 cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
46sub-microkde: microkde/$(MAKEFILE) FORCE 46sub-microkde: microkde/$(MAKEFILE) FORCE
47 cd microkde && $(MAKE) -f $(MAKEFILE) 47 cd microkde && $(MAKE) -f $(MAKEFILE)
48 48
49libkdepim/$(MAKEFILE): 49libkdepim/$(MAKEFILE):
50 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim" 50 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
51 cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 51 cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
52sub-libkdepim: libkdepim/$(MAKEFILE) FORCE 52sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
53 cd libkdepim && $(MAKE) -f $(MAKEFILE) 53 cd libkdepim && $(MAKE) -f $(MAKEFILE)
54 54
55kabc/$(MAKEFILE): 55kabc/$(MAKEFILE):
56 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc" 56 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
57 cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 57 cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
58sub-kabc: kabc/$(MAKEFILE) FORCE 58sub-kabc: kabc/$(MAKEFILE) FORCE
59 cd kabc && $(MAKE) -f $(MAKEFILE) 59 cd kabc && $(MAKE) -f $(MAKEFILE)
60 60
61korganizer/$(MAKEFILE): 61korganizer/$(MAKEFILE):
62 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer" 62 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
63 cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 63 cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
64sub-korganizer: korganizer/$(MAKEFILE) FORCE 64sub-korganizer: korganizer/$(MAKEFILE) FORCE
65 cd korganizer && $(MAKE) -f $(MAKEFILE) 65 cd korganizer && $(MAKE) -f $(MAKEFILE)
66 66
67kaddressbook/$(MAKEFILE): 67kaddressbook/$(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
@@ -335,151 +335,157 @@ KLibLoader::KLibLoader( QObject* parent, const char* name )
335{ 335{
336 s_self = this; 336 s_self = this;
337 d = new KLibLoaderPrivate; 337 d = new KLibLoaderPrivate;
338//US lt_dlinit(); 338//US lt_dlinit();
339 d->unload_mode = KLibLoaderPrivate::UNKNOWN; 339 d->unload_mode = KLibLoaderPrivate::UNKNOWN;
340 if (getenv("KDE_NOUNLOAD") != 0) 340 if (getenv("KDE_NOUNLOAD") != 0)
341 d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD; 341 d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD;
342 else if (getenv("KDE_DOUNLOAD") != 0) 342 else if (getenv("KDE_DOUNLOAD") != 0)
343 d->unload_mode = KLibLoaderPrivate::UNLOAD; 343 d->unload_mode = KLibLoaderPrivate::UNLOAD;
344 d->loaded_stack.setAutoDelete( true ); 344 d->loaded_stack.setAutoDelete( true );
345} 345}
346 346
347KLibLoader::~KLibLoader() 347KLibLoader::~KLibLoader()
348{ 348{
349// kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; 349// kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl;
350 350
351 QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); 351 QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
352 for (; it.current(); ++it ) 352 for (; it.current(); ++it )
353 { 353 {
354 kdDebug(150) << "The KLibLoader contains the library " << it.current()->name 354 kdDebug(150) << "The KLibLoader contains the library " << it.current()->name
355 << " (" << it.current()->lib << ")" << endl; 355 << " (" << it.current()->lib << ")" << endl;
356 d->pending_close.append(it.current()); 356 d->pending_close.append(it.current());
357 } 357 }
358 358
359 close_pending(0); 359 close_pending(0);
360 360
361 delete d; 361 delete d;
362} 362}
363 363
364//static 364//static
365QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ ) 365QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ )
366{ 366{
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
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 )
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++;
454 return wrap->lib; 460 return wrap->lib;
455 } 461 }
456 462
457 /* Test if this library was loaded at some time, but got 463 /* Test if this library was loaded at some time, but got
458 unloaded meanwhile, whithout being dlclose()'ed. */ 464 unloaded meanwhile, whithout being dlclose()'ed. */
459 QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack); 465 QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
460 for (; it.current(); ++it) { 466 for (; it.current(); ++it) {
461 if (it.current()->name == name) 467 if (it.current()->name == name)
462 wrap = it.current(); 468 wrap = it.current();
463 } 469 }
464 470
465 if (wrap) { 471 if (wrap) {
466 d->pending_close.removeRef(wrap); 472 d->pending_close.removeRef(wrap);
467 if (!wrap->lib) { 473 if (!wrap->lib) {
468 /* This lib only was in loaded_stack, but not in m_libs. */ 474 /* This lib only was in loaded_stack, but not in m_libs. */
469 wrap->lib = new KLibrary( name, wrap->filename, wrap->handle ); 475 wrap->lib = new KLibrary( name, wrap->filename, wrap->handle );
470 } 476 }
471 wrap->ref_count++; 477 wrap->ref_count++;
472 } else { 478 } else {
473 QString libfile = findLibrary( name ); 479 QString libfile = findLibrary( name );
474 if ( libfile.isEmpty() ) 480 if ( libfile.isEmpty() )
475 return 0; 481 return 0;
476#ifdef DESKTOP_VERSION 482#ifdef DESKTOP_VERSION
477 QLibrary *qlib = new QLibrary( libfile.latin1() ); 483 QLibrary *qlib = new QLibrary( libfile.latin1() );
478#else 484#else
479 QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately ); 485 QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately );
480#endif 486#endif
481 487
482//US lt_dlhandle handle = lt_dlopen( libfile.latin1() ); 488//US lt_dlhandle handle = lt_dlopen( libfile.latin1() );
483//US if ( !handle ) 489//US if ( !handle )
484 if ( !qlib ) 490 if ( !qlib )
485 { 491 {
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
@@ -1,108 +1,110 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org> 2 Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
3 Copyright (C) 1999 Stephan Kulow <coolo@kde.org> 3 Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
4 Copyright (C) 1999 Waldo Bastian <bastian@kde.org> 4 Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation. 8 License version 2 as published by the Free Software Foundation.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
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
69 dot->show(); 71 dot->show();
70 72
71 dot->append( op ); 73 dot->append( op );
72 74
73} 75}
74#endif 76#endif
75class KStandardDirs::KStandardDirsPrivate 77class KStandardDirs::KStandardDirsPrivate
76{ 78{
77public: 79public:
78 KStandardDirsPrivate() 80 KStandardDirsPrivate()
79 : restrictionsActive(false), 81 : restrictionsActive(false),
80 dataRestrictionActive(false) 82 dataRestrictionActive(false)
81 { } 83 { }
82 84
83 bool restrictionsActive; 85 bool restrictionsActive;
84 bool dataRestrictionActive; 86 bool dataRestrictionActive;
85 QAsciiDict<bool> restrictions; 87 QAsciiDict<bool> restrictions;
86 QStringList xdgdata_prefixes; 88 QStringList xdgdata_prefixes;
87 QStringList xdgconf_prefixes; 89 QStringList xdgconf_prefixes;
88}; 90};
89 91
90static const char* const types[] = {"html", "icon", "apps", "sound", 92static const char* const types[] = {"html", "icon", "apps", "sound",
91 "data", "locale", "services", "mime", 93 "data", "locale", "services", "mime",
92 "servicetypes", "config", "exe", 94 "servicetypes", "config", "exe",
93 "wallpaper", "lib", "pixmap", "templates", 95 "wallpaper", "lib", "pixmap", "templates",
94 "module", "qtplugins", 96 "module", "qtplugins",
95 "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 }; 97 "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 };
96 98
97static int tokenize( QStringList& token, const QString& str, 99static int tokenize( QStringList& token, const QString& str,
98 const QString& delim ); 100 const QString& delim );
99 101
100KStandardDirs::KStandardDirs( ) : addedCustoms(false) 102KStandardDirs::KStandardDirs( ) : addedCustoms(false)
101{ 103{
102 d = new KStandardDirsPrivate; 104 d = new KStandardDirsPrivate;
103 dircache.setAutoDelete(true); 105 dircache.setAutoDelete(true);
104 relatives.setAutoDelete(true); 106 relatives.setAutoDelete(true);
105 absolutes.setAutoDelete(true); 107 absolutes.setAutoDelete(true);
106 savelocations.setAutoDelete(true); 108 savelocations.setAutoDelete(true);
107 addKDEDefaults(); 109 addKDEDefaults();
108} 110}
@@ -288,138 +290,146 @@ static Q_UINT32 updateHash(const QString &file, Q_UINT32 hash)
288*/ 290*/
289/*US 291/*US
290Q_UINT32 KStandardDirs::calcResourceHash( const char *type, 292Q_UINT32 KStandardDirs::calcResourceHash( const char *type,
291 const QString& filename, bool deep) const 293 const QString& filename, bool deep) const
292{ 294{
293 Q_UINT32 hash = 0; 295 Q_UINT32 hash = 0;
294 296
295 if (filename.at(0) == '/') 297 if (filename.at(0) == '/')
296 { 298 {
297 // absolute dirs are absolute dirs, right? :-/ 299 // absolute dirs are absolute dirs, right? :-/
298 return updateHash(filename, hash); 300 return updateHash(filename, hash);
299 } 301 }
300 if (d && d->restrictionsActive && (strcmp(type, "data")==0)) 302 if (d && d->restrictionsActive && (strcmp(type, "data")==0))
301 applyDataRestrictions(filename); 303 applyDataRestrictions(filename);
302 QStringList candidates = resourceDirs(type); 304 QStringList candidates = resourceDirs(type);
303 QString fullPath; 305 QString fullPath;
304 306
305 for (QStringList::ConstIterator it = candidates.begin(); 307 for (QStringList::ConstIterator it = candidates.begin();
306 it != candidates.end(); it++) 308 it != candidates.end(); it++)
307 { 309 {
308 hash = updateHash(*it + filename, hash); 310 hash = updateHash(*it + filename, hash);
309 if (!deep && hash) 311 if (!deep && hash)
310 return hash; 312 return hash;
311 } 313 }
312 return hash; 314 return hash;
313} 315}
314*/ 316*/
315 317
316QStringList KStandardDirs::findDirs( const char *type, 318QStringList KStandardDirs::findDirs( const char *type,
317 const QString& reldir ) const 319 const QString& reldir ) const
318{ 320{
319 QStringList list; 321 QStringList list;
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
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 }
386 return false; 396 return false;
387} 397}
388 398
389static void lookupDirectory(const QString& path, const QString &relPart, 399static void lookupDirectory(const QString& path, const QString &relPart,
390 const QRegExp &regexp, 400 const QRegExp &regexp,
391 QStringList& list, 401 QStringList& list,
392 QStringList& relList, 402 QStringList& relList,
393 bool recursive, bool uniq) 403 bool recursive, bool uniq)
394{ 404{
395 QString pattern = regexp.pattern(); 405 QString pattern = regexp.pattern();
396 if (recursive || pattern.contains('?') || pattern.contains('*')) 406 if (recursive || pattern.contains('?') || pattern.contains('*'))
397 { 407 {
398 // We look for a set of files. 408 // We look for a set of files.
399//US DIR *dp = opendir( QFile::encodeName(path)); 409//US DIR *dp = opendir( QFile::encodeName(path));
400 QDir dp(QFile::encodeName(path)); 410 QDir dp(QFile::encodeName(path));
401 411
402 if (!dp.exists()) 412 if (!dp.exists())
403 return; 413 return;
404 static int iii = 0; 414 static int iii = 0;
405 ++iii; 415 ++iii;
406 if ( iii == 5 ) 416 if ( iii == 5 )
407 abort(); 417 abort();
408 assert(path.at(path.length() - 1) == '/'); 418 assert(path.at(path.length() - 1) == '/');
409 419
410//US struct dirent *ep; 420//US struct dirent *ep;
411//US struct stat buff; 421//US struct stat buff;
412 422
413 QString _dot("."); 423 QString _dot(".");
414 QString _dotdot(".."); 424 QString _dotdot("..");
415 425
416//US while( ( ep = readdir( dp ) ) != 0L ) 426//US while( ( ep = readdir( dp ) ) != 0L )
417 QStringList direntries = dp.entryList(); 427 QStringList direntries = dp.entryList();
418 QStringList::Iterator it = direntries.begin(); 428 QStringList::Iterator it = direntries.begin();
419 429
420 while ( it != list.end() ) // for each file... 430 while ( it != list.end() ) // for each file...
421 { 431 {
422 432
423//US QString fn( QFile::decodeName(ep->d_name)); 433//US QString fn( QFile::decodeName(ep->d_name));
424 QString fn = (*it); // dp.entryList already decodes 434 QString fn = (*it); // dp.entryList already decodes
425 it++; 435 it++;
@@ -908,131 +918,131 @@ int KStandardDirs::findAllExe( QStringList& list, const QString& appname,
908 } 918 }
909 919
910 return list.count(); 920 return list.count();
911} 921}
912*/ 922*/
913 923
914static int tokenize( QStringList& tokens, const QString& str, 924static int tokenize( QStringList& tokens, const QString& str,
915 const QString& delim ) 925 const QString& delim )
916{ 926{
917 int len = str.length(); 927 int len = str.length();
918 QString token = ""; 928 QString token = "";
919 929
920 for( int index = 0; index < len; index++) 930 for( int index = 0; index < len; index++)
921 { 931 {
922 if ( delim.find( str[ index ] ) >= 0 ) 932 if ( delim.find( str[ index ] ) >= 0 )
923 { 933 {
924 tokens.append( token ); 934 tokens.append( token );
925 token = ""; 935 token = "";
926 } 936 }
927 else 937 else
928 { 938 {
929 token += str[ index ]; 939 token += str[ index ];
930 } 940 }
931 } 941 }
932 if ( token.length() > 0 ) 942 if ( token.length() > 0 )
933 { 943 {
934 tokens.append( token ); 944 tokens.append( token );
935 } 945 }
936 946
937 return tokens.count(); 947 return tokens.count();
938} 948}
939 949
940QString KStandardDirs::kde_default(const char *type) { 950QString 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
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);
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 }
1007 if (dirs) 1017 if (dirs)
1008 { 1018 {
1009 // Check for existance of typed directory + suffix 1019 // Check for existance of typed directory + suffix
1010 if (strncmp(type, "xdgdata-", 8) == 0) 1020 if (strncmp(type, "xdgdata-", 8) == 0)
1011 pPath = new QString(realPath(localxdgdatadir() + dirs->last())); 1021 pPath = new QString(realPath(localxdgdatadir() + dirs->last()));
1012 else if (strncmp(type, "xdgconf-", 8) == 0) 1022 else if (strncmp(type, "xdgconf-", 8) == 0)
1013 pPath = new QString(realPath(localxdgconfdir() + dirs->last())); 1023 pPath = new QString(realPath(localxdgconfdir() + dirs->last()));
1014 else 1024 else
1015 pPath = new QString(realPath(localkdedir() + dirs->last())); 1025 pPath = new QString(realPath(localkdedir() + dirs->last()));
1016 } 1026 }
1017 else { 1027 else {
1018 dirs = absolutes.find(type); 1028 dirs = absolutes.find(type);
1019 if (!dirs) 1029 if (!dirs)
1020 qFatal("KStandardDirs: The resource type %s is not registered", type); 1030 qFatal("KStandardDirs: The resource type %s is not registered", type);
1021 pPath = new QString(realPath(dirs->last())); 1031 pPath = new QString(realPath(dirs->last()));
1022 } 1032 }
1023 1033
1024 savelocations.insert(type, pPath); 1034 savelocations.insert(type, pPath);
1025 } 1035 }
1026 1036
1027 QString fullPath = *pPath + suffix; 1037 QString fullPath = *pPath + suffix;
1028//US struct stat st; 1038//US struct stat st;
1029//US if (stat(QFile::encodeName(fullPath), &st) != 0 || !(S_ISDIR(st.st_mode))) 1039//US if (stat(QFile::encodeName(fullPath), &st) != 0 || !(S_ISDIR(st.st_mode)))
1030 QFileInfo fullPathInfo(QFile::encodeName(fullPath)); 1040 QFileInfo fullPathInfo(QFile::encodeName(fullPath));
1031 if (fullPathInfo.isReadable() || !fullPathInfo.isDir()) 1041 if (fullPathInfo.isReadable() || !fullPathInfo.isDir())
1032 1042
1033 1043
1034 { 1044 {
1035 if(!create) { 1045 if(!create) {
1036#ifndef NDEBUG 1046#ifndef NDEBUG
1037 qDebug("save location %s doesn't exist", fullPath.latin1()); 1047 qDebug("save location %s doesn't exist", fullPath.latin1());
1038#endif 1048#endif
@@ -1163,129 +1173,132 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode)
1163 // Directory does not exist.... 1173 // Directory does not exist....
1164 // Or maybe a dangling symlink ? 1174 // Or maybe a dangling symlink ?
1165 if (lstat(baseEncoded, &st) == 0) 1175 if (lstat(baseEncoded, &st) == 0)
1166 (void)unlink(baseEncoded); // try removing 1176 (void)unlink(baseEncoded); // try removing
1167 1177
1168 1178
1169 if ( mkdir(baseEncoded, (mode_t) mode) != 0) { 1179 if ( mkdir(baseEncoded, (mode_t) mode) != 0) {
1170 perror("trying to create local folder"); 1180 perror("trying to create local folder");
1171 return false; // Couldn't create it :-( 1181 return false; // Couldn't create it :-(
1172 } 1182 }
1173 } 1183 }
1174*/ 1184*/
1175 1185
1176 if (dirObj.exists(base) == false) 1186 if (dirObj.exists(base) == false)
1177 { 1187 {
1178 //qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1()); 1188 //qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1());
1179 if (dirObj.mkdir(base) != true) 1189 if (dirObj.mkdir(base) != true)
1180 { 1190 {
1181 qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1()); 1191 qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1());
1182 return false; 1192 return false;
1183 } 1193 }
1184 } 1194 }
1185 1195
1186 i = pos + 1; 1196 i = pos + 1;
1187 } 1197 }
1188 return true; 1198 return true;
1189 1199
1190} 1200}
1191 1201
1192static QString readEnvPath(const char *env) 1202static QString readEnvPath(const char *env)
1193{ 1203{
1194#ifdef _WIN32_ 1204#ifdef _WIN32_
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
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
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 += '/';
1260 } 1273 }
1261 else 1274 else
1262 { 1275 {
1263//US struct passwd *pw = getpwuid(0); 1276//US struct passwd *pw = getpwuid(0);
1264//US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/"; 1277//US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/";
1265 qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); 1278 qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed");
1266 } 1279 }
1267 1280
1268 } 1281 }
1269 1282
1270//US localKdeDir = appDir(); 1283//US localKdeDir = appDir();
1271 1284
1272//US 1285//US
1273// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); 1286// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1());
1274 if (localKdeDir != "-/") 1287 if (localKdeDir != "-/")
1275 { 1288 {
1276 localKdeDir = KShell::tildeExpand(localKdeDir); 1289 localKdeDir = KShell::tildeExpand(localKdeDir);
1277 addPrefix(localKdeDir); 1290 addPrefix(localKdeDir);
1278 } 1291 }
1279 1292
1280 for (QStringList::ConstIterator it = kdedirList.begin(); 1293 for (QStringList::ConstIterator it = kdedirList.begin();
1281 it != kdedirList.end(); it++) 1294 it != kdedirList.end(); it++)
1282 { 1295 {
1283 QString dir = KShell::tildeExpand(*it); 1296 QString dir = KShell::tildeExpand(*it);
1284 addPrefix(dir); 1297 addPrefix(dir);
1285 } 1298 }
1286 // end KDEDIRS 1299 // end KDEDIRS
1287 1300
1288 // begin XDG_CONFIG_XXX 1301 // begin XDG_CONFIG_XXX
1289 QStringList xdgdirList; 1302 QStringList xdgdirList;
1290 QString xdgdirs = readEnvPath("XDG_CONFIG_DIRS"); 1303 QString xdgdirs = readEnvPath("XDG_CONFIG_DIRS");
1291 if (!xdgdirs.isEmpty()) 1304 if (!xdgdirs.isEmpty())