summaryrefslogtreecommitdiffabout
path: root/microkde/kdecore/kstandarddirs.cpp
Unidiff
Diffstat (limited to 'microkde/kdecore/kstandarddirs.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/kstandarddirs.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index 1a1e027..7f51d78 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -1,94 +1,93 @@
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 <qstringlist.h> 45#include <qstringlist.h>
46#include <qpe/qpeapplication.h>
47 46
48#include "kstandarddirs.h" 47#include "kstandarddirs.h"
49#include "kconfig.h" 48#include "kconfig.h"
50#include "kdebug.h" 49#include "kdebug.h"
51//US #include "kinstance.h" 50//US #include "kinstance.h"
52#include "kshell.h" 51#include "kshell.h"
53//US#include <sys/param.h> 52//US#include <sys/param.h>
54//US#include <unistd.h> 53//US#include <unistd.h>
55 54
56//US 55//US
57QString KStandardDirs::mAppDir = QString::null; 56QString KStandardDirs::mAppDir = QString::null;
58 57
59 58
60template class QDict<QStringList>; 59template class QDict<QStringList>;
61 60
62#if 0 61#if 0
63#include <qtextedit.h> 62#include <qtextedit.h>
64void ddd( QString op ) 63void ddd( QString op )
65{ 64{
66 static QTextEdit * dot = 0; 65 static QTextEdit * dot = 0;
67 if ( ! dot ) 66 if ( ! dot )
68 dot = new QTextEdit(); 67 dot = new QTextEdit();
69 68
70 dot->show(); 69 dot->show();
71 70
72 dot->append( op ); 71 dot->append( op );
73 72
74} 73}
75#endif 74#endif
76class KStandardDirs::KStandardDirsPrivate 75class KStandardDirs::KStandardDirsPrivate
77{ 76{
78public: 77public:
79 KStandardDirsPrivate() 78 KStandardDirsPrivate()
80 : restrictionsActive(false), 79 : restrictionsActive(false),
81 dataRestrictionActive(false) 80 dataRestrictionActive(false)
82 { } 81 { }
83 82
84 bool restrictionsActive; 83 bool restrictionsActive;
85 bool dataRestrictionActive; 84 bool dataRestrictionActive;
86 QAsciiDict<bool> restrictions; 85 QAsciiDict<bool> restrictions;
87 QStringList xdgdata_prefixes; 86 QStringList xdgdata_prefixes;
88 QStringList xdgconf_prefixes; 87 QStringList xdgconf_prefixes;
89}; 88};
90 89
91static const char* const types[] = {"html", "icon", "apps", "sound", 90static const char* const types[] = {"html", "icon", "apps", "sound",
92 "data", "locale", "services", "mime", 91 "data", "locale", "services", "mime",
93 "servicetypes", "config", "exe", 92 "servicetypes", "config", "exe",
94 "wallpaper", "lib", "pixmap", "templates", 93 "wallpaper", "lib", "pixmap", "templates",
@@ -1180,97 +1179,97 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode)
1180 if (dirObj.mkdir(base) != true) 1179 if (dirObj.mkdir(base) != true)
1181 { 1180 {
1182 qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1()); 1181 qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1());
1183 return false; 1182 return false;
1184 } 1183 }
1185 } 1184 }
1186 1185
1187 i = pos + 1; 1186 i = pos + 1;
1188 } 1187 }
1189 return true; 1188 return true;
1190 1189
1191} 1190}
1192 1191
1193static QString readEnvPath(const char *env) 1192static QString readEnvPath(const char *env)
1194{ 1193{
1195#ifdef _WIN32_ 1194#ifdef _WIN32_
1196 return ""; 1195 return "";
1197#else 1196#else
1198 QCString c_path = getenv(env); 1197 QCString c_path = getenv(env);
1199 if (c_path.isEmpty()) 1198 if (c_path.isEmpty())
1200 return QString::null; 1199 return QString::null;
1201 return QFile::decodeName(c_path); 1200 return QFile::decodeName(c_path);
1202#endif 1201#endif
1203} 1202}
1204 1203
1205void KStandardDirs::addKDEDefaults() 1204void KStandardDirs::addKDEDefaults()
1206{ 1205{
1207 //qDebug("ERROR: KStandardDirs::addKDEDefaults() called "); 1206 //qDebug("ERROR: KStandardDirs::addKDEDefaults() called ");
1208 //return; 1207 //return;
1209 QStringList kdedirList; 1208 QStringList kdedirList;
1210 1209
1211 // begin KDEDIRS 1210 // begin KDEDIRS
1212 QString kdedirs = readEnvPath("MICROKDEDIRS"); 1211 QString kdedirs = readEnvPath("MICROKDEDIRS");
1213 if (!kdedirs.isEmpty()) 1212 if (!kdedirs.isEmpty())
1214 { 1213 {
1215 tokenize(kdedirList, kdedirs, ":"); 1214 tokenize(kdedirList, kdedirs, ":");
1216 } 1215 }
1217 else 1216 else
1218 { 1217 {
1219 QString kdedir = readEnvPath("MICROKDEDIR"); 1218 QString kdedir = readEnvPath("MICROKDEDIR");
1220 if (!kdedir.isEmpty()) 1219 if (!kdedir.isEmpty())
1221 { 1220 {
1222 kdedir = KShell::tildeExpand(kdedir); 1221 kdedir = KShell::tildeExpand(kdedir);
1223 kdedirList.append(kdedir); 1222 kdedirList.append(kdedir);
1224 } 1223 }
1225 } 1224 }
1226//US kdedirList.append(KDEDIR); 1225//US kdedirList.append(KDEDIR);
1227//US for embedded, add qtopia dir as kdedir 1226//US for embedded, add qtopia dir as kdedir
1228 kdedirList.append(QPEApplication::qpeDir()); 1227 kdedirList.append(readEnvPath("QPEDIR" ));
1229 1228
1230#ifdef __KDE_EXECPREFIX 1229#ifdef __KDE_EXECPREFIX
1231 QString execPrefix(__KDE_EXECPREFIX); 1230 QString execPrefix(__KDE_EXECPREFIX);
1232 if (execPrefix!="NONE") 1231 if (execPrefix!="NONE")
1233 kdedirList.append(execPrefix); 1232 kdedirList.append(execPrefix);
1234#endif 1233#endif
1235 1234
1236 QString localKdeDir; 1235 QString localKdeDir;
1237 1236
1238//US if (getuid()) 1237//US if (getuid())
1239 if (true) 1238 if (true)
1240 { 1239 {
1241 localKdeDir = readEnvPath("MICROKDEHOME"); 1240 localKdeDir = readEnvPath("MICROKDEHOME");
1242 if (!localKdeDir.isEmpty()) 1241 if (!localKdeDir.isEmpty())
1243 { 1242 {
1244 if (localKdeDir.at(localKdeDir.length()-1) != '/') 1243 if (localKdeDir.at(localKdeDir.length()-1) != '/')
1245 localKdeDir += '/'; 1244 localKdeDir += '/';
1246 } 1245 }
1247 else 1246 else
1248 { 1247 {
1249 localKdeDir = QDir::homeDirPath() + "/kdepim/"; 1248 localKdeDir = QDir::homeDirPath() + "/kdepim/";
1250 } 1249 }
1251 } 1250 }
1252 else 1251 else
1253 { 1252 {
1254 // We treat root different to prevent root messing up the 1253 // We treat root different to prevent root messing up the
1255 // file permissions in the users home directory. 1254 // file permissions in the users home directory.
1256 localKdeDir = readEnvPath("MICROKDEROOTHOME"); 1255 localKdeDir = readEnvPath("MICROKDEROOTHOME");
1257 if (!localKdeDir.isEmpty()) 1256 if (!localKdeDir.isEmpty())
1258 { 1257 {
1259 if (localKdeDir.at(localKdeDir.length()-1) != '/') 1258 if (localKdeDir.at(localKdeDir.length()-1) != '/')
1260 localKdeDir += '/'; 1259 localKdeDir += '/';
1261 } 1260 }
1262 else 1261 else
1263 { 1262 {
1264//US struct passwd *pw = getpwuid(0); 1263//US struct passwd *pw = getpwuid(0);
1265//US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/"; 1264//US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/";
1266 qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); 1265 qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed");
1267 } 1266 }
1268 1267
1269 } 1268 }
1270 1269
1271//US localKdeDir = appDir(); 1270//US localKdeDir = appDir();
1272 1271
1273//US 1272//US
1274// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); 1273// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1());
1275 if (localKdeDir != "-/") 1274 if (localKdeDir != "-/")
1276 { 1275 {