-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp index 4ab1a68..d5bfefd 100644 --- a/microkde/kdecore/kstandarddirs.cpp +++ b/microkde/kdecore/kstandarddirs.cpp | |||
@@ -1262,97 +1262,102 @@ void KStandardDirs::addKDEDefaults() | |||
1262 | QString execPrefix(__KDE_EXECPREFIX); | 1262 | QString execPrefix(__KDE_EXECPREFIX); |
1263 | if (execPrefix!="NONE") | 1263 | if (execPrefix!="NONE") |
1264 | kdedirList.append(execPrefix); | 1264 | kdedirList.append(execPrefix); |
1265 | #endif | 1265 | #endif |
1266 | 1266 | ||
1267 | QString localKdeDir; | 1267 | QString localKdeDir; |
1268 | 1268 | ||
1269 | //US if (getuid()) | 1269 | //US if (getuid()) |
1270 | if (true) | 1270 | if (true) |
1271 | { | 1271 | { |
1272 | localKdeDir = readEnvPath("MICROKDEHOME"); | 1272 | localKdeDir = readEnvPath("MICROKDEHOME"); |
1273 | if (!localKdeDir.isEmpty()) | 1273 | if (!localKdeDir.isEmpty()) |
1274 | { | 1274 | { |
1275 | #ifdef _WIN32_ | 1275 | #ifdef _WIN32_ |
1276 | if (localKdeDir.at(localKdeDir.length()-1) != '\\') | 1276 | if (localKdeDir.at(localKdeDir.length()-1) != '\\') |
1277 | localKdeDir += '\\'; | 1277 | localKdeDir += '\\'; |
1278 | #else | 1278 | #else |
1279 | if (localKdeDir.at(localKdeDir.length()-1) != '/') | 1279 | if (localKdeDir.at(localKdeDir.length()-1) != '/') |
1280 | localKdeDir += '/'; | 1280 | localKdeDir += '/'; |
1281 | #endif | 1281 | #endif |
1282 | //QMessageBox::information( 0,"localKdeDir",localKdeDir, 1 ); | 1282 | //QMessageBox::information( 0,"localKdeDir",localKdeDir, 1 ); |
1283 | } | 1283 | } |
1284 | else | 1284 | else |
1285 | { | 1285 | { |
1286 | QString confFile; | 1286 | QString confFile; |
1287 | #ifdef DESKTOP_VERSION | 1287 | #ifdef DESKTOP_VERSION |
1288 | confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; | 1288 | confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; |
1289 | QFileInfo fi ( confFile ); | 1289 | QFileInfo fi ( confFile ); |
1290 | if ( !fi.exists() ) | 1290 | if ( !fi.exists() ) |
1291 | confFile = QDir::homeDirPath() + "/.microkdehome"; | 1291 | confFile = QDir::homeDirPath() + "/.microkdehome"; |
1292 | else | 1292 | else |
1293 | qDebug("Loading path info from " + confFile ); | 1293 | qDebug("Loading path info from " + confFile ); |
1294 | 1294 | ||
1295 | #else | 1295 | #else |
1296 | confFile = QDir::homeDirPath() + "/.microkdehome"; | 1296 | confFile = QDir::homeDirPath() + "/.microkdehome"; |
1297 | #endif | 1297 | #endif |
1298 | KConfig cfg ( confFile ); | 1298 | KConfig cfg ( confFile ); |
1299 | cfg.setGroup("Global"); | 1299 | cfg.setGroup("Global"); |
1300 | localKdeDir = cfg.readEntry( "MICROKDEHOME", QDir::homeDirPath() + "/kdepim/" ); | 1300 | localKdeDir = cfg.readEntry( "MICROKDEHOME", QDir::homeDirPath() + "/kdepim/" ); |
1301 | #ifdef DESKTOP_VERSION | 1301 | #ifdef DESKTOP_VERSION |
1302 | if ( localKdeDir.startsWith( "LOCAL:" ) ) { | 1302 | if ( localKdeDir.startsWith( "LOCAL:" ) ) { |
1303 | #ifdef _WIN32_ | 1303 | #ifdef _WIN32_ |
1304 | localKdeDir = qApp->applicationDirPath () + "\\"+ localKdeDir.mid( 6 ); | 1304 | localKdeDir = qApp->applicationDirPath () + "\\"+ localKdeDir.mid( 6 ); |
1305 | #else | 1305 | #else |
1306 | localKdeDir = qApp->applicationDirPath () + "/"+ localKdeDir.mid( 6 ); | 1306 | localKdeDir = qApp->applicationDirPath () + "/"+ localKdeDir.mid( 6 ); |
1307 | #endif | 1307 | #endif |
1308 | qDebug("Using local conf dir %s ",localKdeDir.latin1() ); | 1308 | qDebug("Using local conf dir %s ",localKdeDir.latin1() ); |
1309 | // <stdlib.h> | 1309 | // <stdlib.h> |
1310 | #ifdef _WIN32_ | ||
1311 | QString envSt = "LOCALMICROKDEHOME="+localKdeDir; | ||
1312 | _putenv( envSt.latin1()); | ||
1313 | #else | ||
1310 | setenv( "LOCALMICROKDEHOME", localKdeDir.latin1(), 1 ); | 1314 | setenv( "LOCALMICROKDEHOME", localKdeDir.latin1(), 1 ); |
1315 | #endif | ||
1311 | } | 1316 | } |
1312 | #endif | 1317 | #endif |
1313 | } | 1318 | } |
1314 | } | 1319 | } |
1315 | else | 1320 | else |
1316 | { | 1321 | { |
1317 | // We treat root different to prevent root messing up the | 1322 | // We treat root different to prevent root messing up the |
1318 | // file permissions in the users home directory. | 1323 | // file permissions in the users home directory. |
1319 | localKdeDir = readEnvPath("MICROKDEROOTHOME"); | 1324 | localKdeDir = readEnvPath("MICROKDEROOTHOME"); |
1320 | if (!localKdeDir.isEmpty()) | 1325 | if (!localKdeDir.isEmpty()) |
1321 | { | 1326 | { |
1322 | if (localKdeDir.at(localKdeDir.length()-1) != '/') | 1327 | if (localKdeDir.at(localKdeDir.length()-1) != '/') |
1323 | localKdeDir += '/'; | 1328 | localKdeDir += '/'; |
1324 | } | 1329 | } |
1325 | else | 1330 | else |
1326 | { | 1331 | { |
1327 | //US struct passwd *pw = getpwuid(0); | 1332 | //US struct passwd *pw = getpwuid(0); |
1328 | //US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/"; | 1333 | //US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/"; |
1329 | qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); | 1334 | qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); |
1330 | } | 1335 | } |
1331 | 1336 | ||
1332 | } | 1337 | } |
1333 | 1338 | ||
1334 | //US localKdeDir = appDir(); | 1339 | //US localKdeDir = appDir(); |
1335 | 1340 | ||
1336 | //US | 1341 | //US |
1337 | // qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); | 1342 | // qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); |
1338 | if (localKdeDir != "-/") | 1343 | if (localKdeDir != "-/") |
1339 | { | 1344 | { |
1340 | localKdeDir = KShell::tildeExpand(localKdeDir); | 1345 | localKdeDir = KShell::tildeExpand(localKdeDir); |
1341 | addPrefix(localKdeDir); | 1346 | addPrefix(localKdeDir); |
1342 | } | 1347 | } |
1343 | 1348 | ||
1344 | for (QStringList::ConstIterator it = kdedirList.begin(); | 1349 | for (QStringList::ConstIterator it = kdedirList.begin(); |
1345 | it != kdedirList.end(); it++) | 1350 | it != kdedirList.end(); it++) |
1346 | { | 1351 | { |
1347 | QString dir = KShell::tildeExpand(*it); | 1352 | QString dir = KShell::tildeExpand(*it); |
1348 | addPrefix(dir); | 1353 | addPrefix(dir); |
1349 | } | 1354 | } |
1350 | // end KDEDIRS | 1355 | // end KDEDIRS |
1351 | 1356 | ||
1352 | // begin XDG_CONFIG_XXX | 1357 | // begin XDG_CONFIG_XXX |
1353 | QStringList xdgdirList; | 1358 | QStringList xdgdirList; |
1354 | QString xdgdirs = readEnvPath("XDG_CONFIG_DIRS"); | 1359 | QString xdgdirs = readEnvPath("XDG_CONFIG_DIRS"); |
1355 | if (!xdgdirs.isEmpty()) | 1360 | if (!xdgdirs.isEmpty()) |
1356 | { | 1361 | { |
1357 | tokenize(xdgdirList, xdgdirs, ":"); | 1362 | tokenize(xdgdirList, xdgdirs, ":"); |
1358 | } | 1363 | } |