author | ulf69 <ulf69> | 2004-08-05 21:42:29 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-05 21:42:29 (UTC) |
commit | 6ee7d4f5119837f89ec534c8c5c73845d521e135 (patch) (unidiff) | |
tree | 265d25e37da63a00ae3302059c2c628efb57b570 /microkde/kdecore/kstandarddirs.cpp | |
parent | c3a704f5acda9cf9fee66e5c0b1b864f3b7dd852 (diff) | |
download | kdepimpi-6ee7d4f5119837f89ec534c8c5c73845d521e135.zip kdepimpi-6ee7d4f5119837f89ec534c8c5c73845d521e135.tar.gz kdepimpi-6ee7d4f5119837f89ec534c8c5c73845d521e135.tar.bz2 |
added tmp as a resourcetype. KDE handled tmp differently, but we do not need
the special handling. So i simply added it as standard resource type
Diffstat (limited to 'microkde/kdecore/kstandarddirs.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp index e1c78f6..75205d6 100644 --- a/microkde/kdecore/kstandarddirs.cpp +++ b/microkde/kdecore/kstandarddirs.cpp | |||
@@ -62,10 +62,10 @@ template class QDict<QStringList>; | |||
62 | 62 | ||
63 | #if 0 | 63 | #if 0 |
64 | #include <qtextedit.h> | 64 | #include <qtextedit.h> |
65 | void ddd( QString op ) | 65 | void ddd( QString op ) |
66 | { | 66 | { |
67 | static QTextEdit * dot = 0; | 67 | static QTextEdit * dot = 0; |
68 | if ( ! dot ) | 68 | if ( ! dot ) |
69 | dot = new QTextEdit(); | 69 | dot = new QTextEdit(); |
70 | 70 | ||
71 | dot->show(); | 71 | dot->show(); |
@@ -91,9 +91,9 @@ public: | |||
91 | 91 | ||
92 | static const char* const types[] = {"html", "icon", "apps", "sound", | 92 | static const char* const types[] = {"html", "icon", "apps", "sound", |
93 | "data", "locale", "services", "mime", | 93 | "data", "locale", "services", "mime", |
94 | "servicetypes", "config", "exe", | 94 | "servicetypes", "config", "exe", "tmp", |
95 | "wallpaper", "lib", "pixmap", "templates", | 95 | "wallpaper", "lib", "pixmap", "templates", |
96 | "module", "qtplugins", | 96 | "module", "qtplugins", |
97 | "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 }; | 97 | "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 }; |
98 | 98 | ||
99 | static int tokenize( QStringList& token, const QString& str, | 99 | static int tokenize( QStringList& token, const QString& str, |
@@ -358,7 +358,7 @@ QString KStandardDirs::findResourceDir( const char *type, | |||
358 | candidates.prepend( qApp->applicationDirPath () +"/"); | 358 | candidates.prepend( qApp->applicationDirPath () +"/"); |
359 | #endif | 359 | #endif |
360 | #endif | 360 | #endif |
361 | for (QStringList::ConstIterator it = candidates.begin(); it != candidates.end(); it++) | 361 | for (QStringList::ConstIterator it = candidates.begin(); it != candidates.end(); it++) |
362 | { | 362 | { |
363 | //qDebug("looking for dir %s - file %s", (*it).latin1(), filename.latin1()); | 363 | //qDebug("looking for dir %s - file %s", (*it).latin1(), filename.latin1()); |
364 | if (exists(*it + filename)) | 364 | if (exists(*it + filename)) |
@@ -368,7 +368,7 @@ QString KStandardDirs::findResourceDir( const char *type, | |||
368 | #ifndef NDEBUG | 368 | #ifndef NDEBUG |
369 | if(false && type != "locale") | 369 | if(false && type != "locale") |
370 | qDebug("KStdDirs::findResDir(): can't find %s ", filename.latin1()); | 370 | qDebug("KStdDirs::findResDir(): can't find %s ", filename.latin1()); |
371 | 371 | ||
372 | #endif | 372 | #endif |
373 | 373 | ||
374 | return QString::null; | 374 | return QString::null; |
@@ -381,15 +381,15 @@ bool KStandardDirs::exists(const QString &fullPath) | |||
381 | 381 | ||
382 | //US if (access(QFile::encodeName(fullPath), R_OK) == 0 && fullPathInfo.isReadable()) | 382 | //US if (access(QFile::encodeName(fullPath), R_OK) == 0 && fullPathInfo.isReadable()) |
383 | if (fullPathInfo.isReadable()) | 383 | if (fullPathInfo.isReadable()) |
384 | { | 384 | { |
385 | if (fullPath.at(fullPath.length() - 1) != '/') { | 385 | if (fullPath.at(fullPath.length() - 1) != '/') { |
386 | //US if (S_ISREG( buff.st_mode )) | 386 | //US if (S_ISREG( buff.st_mode )) |
387 | if (fullPathInfo.isFile()) | 387 | if (fullPathInfo.isFile()) |
388 | return true; | 388 | return true; |
389 | } | 389 | } |
390 | else { | 390 | else { |
391 | //US if (S_ISDIR( buff.st_mode )) | 391 | //US if (S_ISDIR( buff.st_mode )) |
392 | if (fullPathInfo.isDir()) | 392 | if (fullPathInfo.isDir()) |
393 | return true; | 393 | return true; |
394 | } | 394 | } |
395 | } | 395 | } |
@@ -408,7 +408,7 @@ static void lookupDirectory(const QString& path, const QString &relPart, | |||
408 | // We look for a set of files. | 408 | // We look for a set of files. |
409 | //US DIR *dp = opendir( QFile::encodeName(path)); | 409 | //US DIR *dp = opendir( QFile::encodeName(path)); |
410 | QDir dp(QFile::encodeName(path)); | 410 | QDir dp(QFile::encodeName(path)); |
411 | 411 | ||
412 | if (!dp.exists()) | 412 | if (!dp.exists()) |
413 | return; | 413 | return; |
414 | static int iii = 0; | 414 | static int iii = 0; |
@@ -426,16 +426,16 @@ static void lookupDirectory(const QString& path, const QString &relPart, | |||
426 | //US while( ( ep = readdir( dp ) ) != 0L ) | 426 | //US while( ( ep = readdir( dp ) ) != 0L ) |
427 | QStringList direntries = dp.entryList(); | 427 | QStringList direntries = dp.entryList(); |
428 | QStringList::Iterator it = direntries.begin(); | 428 | QStringList::Iterator it = direntries.begin(); |
429 | 429 | ||
430 | while ( it != list.end() ) // for each file... | 430 | while ( it != list.end() ) // for each file... |
431 | { | 431 | { |
432 | 432 | ||
433 | //US QString fn( QFile::decodeName(ep->d_name)); | 433 | //US QString fn( QFile::decodeName(ep->d_name)); |
434 | QString fn = (*it); // dp.entryList already decodes | 434 | QString fn = (*it); // dp.entryList already decodes |
435 | it++; | 435 | it++; |
436 | if ( fn.isNull() ) | 436 | if ( fn.isNull() ) |
437 | break; | 437 | break; |
438 | 438 | ||
439 | if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' ) | 439 | if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' ) |
440 | continue; | 440 | continue; |
441 | 441 | ||
@@ -449,13 +449,13 @@ static void lookupDirectory(const QString& path, const QString &relPart, | |||
449 | continue; // No match | 449 | continue; // No match |
450 | 450 | ||
451 | QString pathfn = path + fn; | 451 | QString pathfn = path + fn; |
452 | /*US | 452 | /*US |
453 | if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) { | 453 | if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) { |
454 | kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; | 454 | kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; |
455 | continue; // Couldn't stat (e.g. no read permissions) | 455 | continue; // Couldn't stat (e.g. no read permissions) |
456 | } | 456 | } |
457 | 457 | ||
458 | if ( recursive ) | 458 | if ( recursive ) |
459 | { | 459 | { |
460 | if ( S_ISDIR( buff.st_mode )) { | 460 | if ( S_ISDIR( buff.st_mode )) { |
461 | lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); | 461 | lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); |
@@ -468,15 +468,15 @@ static void lookupDirectory(const QString& path, const QString &relPart, | |||
468 | //US kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; | 468 | //US kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; |
469 | continue; // Couldn't stat (e.g. no read permissions) | 469 | continue; // Couldn't stat (e.g. no read permissions) |
470 | } | 470 | } |
471 | 471 | ||
472 | if ( recursive ) | 472 | if ( recursive ) |
473 | { | 473 | { |
474 | if ( pathfnInfo.isDir()) { | 474 | if ( pathfnInfo.isDir()) { |
475 | lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); | 475 | lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); |
476 | } | 476 | } |
477 | 477 | ||
478 | 478 | ||
479 | /*US | 479 | /*US |
480 | if (!regexp.exactMatch(fn)) | 480 | if (!regexp.exactMatch(fn)) |
481 | continue; // No match | 481 | continue; // No match |
482 | */ | 482 | */ |
@@ -510,7 +510,7 @@ static void lookupDirectory(const QString& path, const QString &relPart, | |||
510 | //US if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) | 510 | //US if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) |
511 | if ( pathfnInfo.isReadable() == false ) | 511 | if ( pathfnInfo.isReadable() == false ) |
512 | return; // File not found | 512 | return; // File not found |
513 | 513 | ||
514 | //US if ( S_ISREG( buff.st_mode)) | 514 | //US if ( S_ISREG( buff.st_mode)) |
515 | if ( pathfnInfo.isFile()) | 515 | if ( pathfnInfo.isFile()) |
516 | { | 516 | { |
@@ -556,8 +556,8 @@ static void lookupPrefix(const QString& prefix, const QString& relpath, | |||
556 | QRegExp pathExp(path, true, true); | 556 | QRegExp pathExp(path, true, true); |
557 | //USDIR *dp = opendir( QFile::encodeName(prefix) ); | 557 | //USDIR *dp = opendir( QFile::encodeName(prefix) ); |
558 | QDir dp(QFile::encodeName(prefix)); | 558 | QDir dp(QFile::encodeName(prefix)); |
559 | 559 | ||
560 | //USif (!dp) | 560 | //USif (!dp) |
561 | if (!dp.exists()) | 561 | if (!dp.exists()) |
562 | { | 562 | { |
563 | return; | 563 | return; |
@@ -571,13 +571,13 @@ static void lookupPrefix(const QString& prefix, const QString& relpath, | |||
571 | //USwhile( ( ep = readdir( dp ) ) != 0L ) | 571 | //USwhile( ( ep = readdir( dp ) ) != 0L ) |
572 | QStringList direntries = dp.entryList(); | 572 | QStringList direntries = dp.entryList(); |
573 | QStringList::Iterator it = direntries.begin(); | 573 | QStringList::Iterator it = direntries.begin(); |
574 | 574 | ||
575 | while ( it != list.end() ) // for each file... | 575 | while ( it != list.end() ) // for each file... |
576 | { | 576 | { |
577 | //US QString fn( QFile::decodeName(ep->d_name)); | 577 | //US QString fn( QFile::decodeName(ep->d_name)); |
578 | QString fn = (*it); // dp.entryList() already encodes the strings | 578 | QString fn = (*it); // dp.entryList() already encodes the strings |
579 | it++; | 579 | it++; |
580 | 580 | ||
581 | if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1) == '~') | 581 | if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1) == '~') |
582 | continue; | 582 | continue; |
583 | 583 | ||
@@ -602,7 +602,7 @@ static void lookupPrefix(const QString& prefix, const QString& relpath, | |||
602 | } | 602 | } |
603 | //US if ( S_ISDIR( buff.st_mode )) | 603 | //US if ( S_ISDIR( buff.st_mode )) |
604 | if ( fnInfo.isDir() ) | 604 | if ( fnInfo.isDir() ) |
605 | 605 | ||
606 | lookupPrefix(fn + '/', rest, rfn + '/', regexp, list, relList, recursive, uniq); | 606 | lookupPrefix(fn + '/', rest, rfn + '/', regexp, list, relList, recursive, uniq); |
607 | } | 607 | } |
608 | 608 | ||
@@ -671,7 +671,7 @@ KStandardDirs::findAllResources( const char *type, | |||
671 | return findAllResources(type, filter, recursive, uniq, relList); | 671 | return findAllResources(type, filter, recursive, uniq, relList); |
672 | } | 672 | } |
673 | 673 | ||
674 | QString | 674 | QString |
675 | KStandardDirs::realPath(const QString &dirname) | 675 | KStandardDirs::realPath(const QString &dirname) |
676 | { | 676 | { |
677 | #ifdef _WIN32_ | 677 | #ifdef _WIN32_ |
@@ -732,7 +732,7 @@ QStringList KStandardDirs::resourceDirs(const char *type) const | |||
732 | QStringList *candidates = dircache.find(type); | 732 | QStringList *candidates = dircache.find(type); |
733 | 733 | ||
734 | if (!candidates) { // filling cache | 734 | if (!candidates) { // filling cache |
735 | /*US | 735 | /*US |
736 | if (strcmp(type, "socket") == 0) | 736 | if (strcmp(type, "socket") == 0) |
737 | const_cast<KStandardDirs *>(this)->createSpecialResource(type); | 737 | const_cast<KStandardDirs *>(this)->createSpecialResource(type); |
738 | else if (strcmp(type, "tmp") == 0) | 738 | else if (strcmp(type, "tmp") == 0) |
@@ -768,7 +768,7 @@ QStringList KStandardDirs::resourceDirs(const char *type) const | |||
768 | prefixList = &(d->xdgconf_prefixes); | 768 | prefixList = &(d->xdgconf_prefixes); |
769 | else | 769 | else |
770 | prefixList = &prefixes; | 770 | prefixList = &prefixes; |
771 | 771 | ||
772 | for (QStringList::ConstIterator pit = prefixList->begin(); | 772 | for (QStringList::ConstIterator pit = prefixList->begin(); |
773 | pit != prefixList->end(); | 773 | pit != prefixList->end(); |
774 | pit++) | 774 | pit++) |
@@ -835,7 +835,7 @@ QString KStandardDirs::findExe( const QString& appname, | |||
835 | //US QString p = QString("%1/%2").arg(__KDE_BINDIR).arg(appname); | 835 | //US QString p = QString("%1/%2").arg(__KDE_BINDIR).arg(appname); |
836 | QString p = QString("%1/%2").arg(appname).arg(appname); | 836 | QString p = QString("%1/%2").arg(appname).arg(appname); |
837 | qDebug("KStandardDirs::findExe this is probably wrong"); | 837 | qDebug("KStandardDirs::findExe this is probably wrong"); |
838 | 838 | ||
839 | info.setFile( p ); | 839 | info.setFile( p ); |
840 | if( info.exists() && ( ignore || info.isExecutable() ) | 840 | if( info.exists() && ( ignore || info.isExecutable() ) |
841 | && ( info.isFile() || info.isSymLink() ) ) { | 841 | && ( info.isFile() || info.isSymLink() ) ) { |
@@ -1007,7 +1007,7 @@ QString KStandardDirs::saveLocation(const char *type, | |||
1007 | { | 1007 | { |
1008 | QStringList *dirs = relatives.find(type); | 1008 | QStringList *dirs = relatives.find(type); |
1009 | if (!dirs && ( | 1009 | if (!dirs && ( |
1010 | (strcmp(type, "socket") == 0) || | 1010 | (strcmp(type, "socket") == 0) || |
1011 | (strcmp(type, "tmp") == 0) || | 1011 | (strcmp(type, "tmp") == 0) || |
1012 | (strcmp(type, "cache") == 0) )) | 1012 | (strcmp(type, "cache") == 0) )) |
1013 | { | 1013 | { |
@@ -1030,17 +1030,17 @@ QString KStandardDirs::saveLocation(const char *type, | |||
1030 | qFatal("KStandardDirs: The resource type %s is not registered", type); | 1030 | qFatal("KStandardDirs: The resource type %s is not registered", type); |
1031 | pPath = new QString(realPath(dirs->last())); | 1031 | pPath = new QString(realPath(dirs->last())); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | savelocations.insert(type, pPath); | 1034 | savelocations.insert(type, pPath); |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | QString fullPath = *pPath + suffix; | 1037 | QString fullPath = *pPath + suffix; |
1038 | //US struct stat st; | 1038 | //US struct stat st; |
1039 | //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))) |
1040 | QFileInfo fullPathInfo(QFile::encodeName(fullPath)); | 1040 | QFileInfo fullPathInfo(QFile::encodeName(fullPath)); |
1041 | if (fullPathInfo.isReadable() || !fullPathInfo.isDir()) | 1041 | if (fullPathInfo.isReadable() || !fullPathInfo.isDir()) |
1042 | 1042 | ||
1043 | 1043 | ||
1044 | { | 1044 | { |
1045 | if(!create) { | 1045 | if(!create) { |
1046 | #ifndef NDEBUG | 1046 | #ifndef NDEBUG |
@@ -1135,13 +1135,13 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) | |||
1135 | // new code for WIN32 | 1135 | // new code for WIN32 |
1136 | QDir dirObj; | 1136 | QDir dirObj; |
1137 | 1137 | ||
1138 | 1138 | ||
1139 | // we want an absolute path | 1139 | // we want an absolute path |
1140 | #ifndef _WIN32_ | 1140 | #ifndef _WIN32_ |
1141 | if (dir.at(0) != '/') | 1141 | if (dir.at(0) != '/') |
1142 | return false; | 1142 | return false; |
1143 | #endif | 1143 | #endif |
1144 | 1144 | ||
1145 | QString target = dir; | 1145 | QString target = dir; |
1146 | uint len = target.length(); | 1146 | uint len = target.length(); |
1147 | #ifndef _WIN32_ | 1147 | #ifndef _WIN32_ |
@@ -1165,7 +1165,7 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) | |||
1165 | return true; | 1165 | return true; |
1166 | base += target.mid(i - 1, pos - i + 1); | 1166 | base += target.mid(i - 1, pos - i + 1); |
1167 | //QMessageBox::information( 0,"cap111", base, 1 ); | 1167 | //QMessageBox::information( 0,"cap111", base, 1 ); |
1168 | /*US | 1168 | /*US |
1169 | QCString baseEncoded = QFile::encodeName(base); | 1169 | QCString baseEncoded = QFile::encodeName(base); |
1170 | // bail out if we encountered a problem | 1170 | // bail out if we encountered a problem |
1171 | if (stat(baseEncoded, &st) != 0) | 1171 | if (stat(baseEncoded, &st) != 0) |
@@ -1174,15 +1174,15 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) | |||
1174 | // Or maybe a dangling symlink ? | 1174 | // Or maybe a dangling symlink ? |
1175 | if (lstat(baseEncoded, &st) == 0) | 1175 | if (lstat(baseEncoded, &st) == 0) |
1176 | (void)unlink(baseEncoded); // try removing | 1176 | (void)unlink(baseEncoded); // try removing |
1177 | 1177 | ||
1178 | 1178 | ||
1179 | if ( mkdir(baseEncoded, (mode_t) mode) != 0) { | 1179 | if ( mkdir(baseEncoded, (mode_t) mode) != 0) { |
1180 | perror("trying to create local folder"); | 1180 | perror("trying to create local folder"); |
1181 | return false; // Couldn't create it :-( | 1181 | return false; // Couldn't create it :-( |
1182 | } | 1182 | } |
1183 | } | 1183 | } |
1184 | */ | 1184 | */ |
1185 | 1185 | ||
1186 | if (dirObj.exists(base) == false) | 1186 | if (dirObj.exists(base) == false) |
1187 | { | 1187 | { |
1188 | //qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1()); | 1188 | //qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1()); |
@@ -1233,7 +1233,7 @@ void KStandardDirs::addKDEDefaults() | |||
1233 | } | 1233 | } |
1234 | } | 1234 | } |
1235 | //US kdedirList.append(KDEDIR); | 1235 | //US kdedirList.append(KDEDIR); |
1236 | //US for embedded, add qtopia dir as kdedir | 1236 | //US for embedded, add qtopia dir as kdedir |
1237 | 1237 | ||
1238 | #ifndef DESKTOP_VERSION | 1238 | #ifndef DESKTOP_VERSION |
1239 | kdedirList.append(readEnvPath("QPEDIR" )); | 1239 | kdedirList.append(readEnvPath("QPEDIR" )); |
@@ -1246,7 +1246,7 @@ void KStandardDirs::addKDEDefaults() | |||
1246 | #endif | 1246 | #endif |
1247 | 1247 | ||
1248 | QString localKdeDir; | 1248 | QString localKdeDir; |
1249 | 1249 | ||
1250 | //US if (getuid()) | 1250 | //US if (getuid()) |
1251 | if (true) | 1251 | if (true) |
1252 | { | 1252 | { |
@@ -1275,7 +1275,7 @@ void KStandardDirs::addKDEDefaults() | |||
1275 | { | 1275 | { |
1276 | //US struct passwd *pw = getpwuid(0); | 1276 | //US struct passwd *pw = getpwuid(0); |
1277 | //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/"; |
1278 | qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); | 1278 | qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | } | 1281 | } |
@@ -1283,7 +1283,7 @@ void KStandardDirs::addKDEDefaults() | |||
1283 | //US localKdeDir = appDir(); | 1283 | //US localKdeDir = appDir(); |
1284 | 1284 | ||
1285 | //US | 1285 | //US |
1286 | // qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); | 1286 | // qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); |
1287 | if (localKdeDir != "-/") | 1287 | if (localKdeDir != "-/") |
1288 | { | 1288 | { |
1289 | localKdeDir = KShell::tildeExpand(localKdeDir); | 1289 | localKdeDir = KShell::tildeExpand(localKdeDir); |
@@ -1328,7 +1328,7 @@ void KStandardDirs::addKDEDefaults() | |||
1328 | { | 1328 | { |
1329 | //US struct passwd *pw = getpwuid(0); | 1329 | //US struct passwd *pw = getpwuid(0); |
1330 | //US localXdgDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.config/"; | 1330 | //US localXdgDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.config/"; |
1331 | qDebug("KStandardDirs::addKDEDefaults: 2 has to be fixed"); | 1331 | qDebug("KStandardDirs::addKDEDefaults: 2 has to be fixed"); |
1332 | } | 1332 | } |
1333 | } | 1333 | } |
1334 | 1334 | ||
@@ -1360,7 +1360,7 @@ void KStandardDirs::addKDEDefaults() | |||
1360 | dir += '/'; | 1360 | dir += '/'; |
1361 | xdgdirList.append(dir+"share/"); | 1361 | xdgdirList.append(dir+"share/"); |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | xdgdirList.append("/usr/local/share/"); | 1364 | xdgdirList.append("/usr/local/share/"); |
1365 | xdgdirList.append("/usr/share/"); | 1365 | xdgdirList.append("/usr/share/"); |
1366 | } | 1366 | } |
@@ -1382,7 +1382,7 @@ void KStandardDirs::addKDEDefaults() | |||
1382 | { | 1382 | { |
1383 | //US struct passwd *pw = getpwuid(0); | 1383 | //US struct passwd *pw = getpwuid(0); |
1384 | //US localXdgDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.local/share/"; | 1384 | //US localXdgDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.local/share/"; |
1385 | qDebug("KStandardDirs::addKDEDefaults: 3 has to be fixed"); | 1385 | qDebug("KStandardDirs::addKDEDefaults: 3 has to be fixed"); |
1386 | } | 1386 | } |
1387 | } | 1387 | } |
1388 | 1388 | ||
@@ -1393,7 +1393,7 @@ void KStandardDirs::addKDEDefaults() | |||
1393 | it != xdgdirList.end(); it++) | 1393 | it != xdgdirList.end(); it++) |
1394 | { | 1394 | { |
1395 | QString dir = KShell::tildeExpand(*it); | 1395 | QString dir = KShell::tildeExpand(*it); |
1396 | 1396 | ||
1397 | addXdgDataPrefix(dir); | 1397 | addXdgDataPrefix(dir); |
1398 | } | 1398 | } |
1399 | // end XDG_DATA_XXX | 1399 | // end XDG_DATA_XXX |
@@ -1410,7 +1410,7 @@ void KStandardDirs::addKDEDefaults() | |||
1410 | 1410 | ||
1411 | void KStandardDirs::checkConfig() const | 1411 | void KStandardDirs::checkConfig() const |
1412 | { | 1412 | { |
1413 | /*US | 1413 | /*US |
1414 | if (!addedCustoms && KGlobal::_instance && KGlobal::_instance->_config) | 1414 | if (!addedCustoms && KGlobal::_instance && KGlobal::_instance->_config) |
1415 | const_cast<KStandardDirs*>(this)->addCustomized(KGlobal::_instance->_config); | 1415 | const_cast<KStandardDirs*>(this)->addCustomized(KGlobal::_instance->_config); |
1416 | */ | 1416 | */ |
@@ -1439,7 +1439,7 @@ bool KStandardDirs::addCustomized(KConfig *config) | |||
1439 | 1439 | ||
1440 | // iterating over all entries in the group Directories | 1440 | // iterating over all entries in the group Directories |
1441 | // to find entries that start with dir_$type | 1441 | // to find entries that start with dir_$type |
1442 | /*US | 1442 | /*US |
1443 | QMap<QString, QString> entries = config->entryMap("Directories"); | 1443 | QMap<QString, QString> entries = config->entryMap("Directories"); |
1444 | 1444 | ||
1445 | QMap<QString, QString>::ConstIterator it2; | 1445 | QMap<QString, QString>::ConstIterator it2; |
@@ -1501,13 +1501,13 @@ void KStandardDirs::setAppDir( const QString &appDir ) | |||
1501 | { | 1501 | { |
1502 | mAppDir = appDir; | 1502 | mAppDir = appDir; |
1503 | 1503 | ||
1504 | if ( mAppDir.right( 1 ) != "/" ) | 1504 | if ( mAppDir.right( 1 ) != "/" ) |
1505 | mAppDir += "/"; | 1505 | mAppDir += "/"; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | QString KStandardDirs::appDir() | 1508 | QString KStandardDirs::appDir() |
1509 | { | 1509 | { |
1510 | return mAppDir; | 1510 | return mAppDir; |
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | // just to make code more readable without macros | 1513 | // just to make code more readable without macros |
@@ -1523,7 +1523,7 @@ QString locateLocal( const char *type, | |||
1523 | { | 1523 | { |
1524 | 1524 | ||
1525 | QString path = locateLocal(type, filename, true /*US, inst*/); | 1525 | QString path = locateLocal(type, filename, true /*US, inst*/); |
1526 | 1526 | ||
1527 | 1527 | ||
1528 | /* | 1528 | /* |
1529 | static int ccc = 0; | 1529 | static int ccc = 0; |
@@ -1537,7 +1537,7 @@ QString locateLocal( const char *type, | |||
1537 | /*US why do we put all files into one directory. It is quit complicated. | 1537 | /*US why do we put all files into one directory. It is quit complicated. |
1538 | why not staying with the original directorystructure ? | 1538 | why not staying with the original directorystructure ? |
1539 | 1539 | ||
1540 | 1540 | ||
1541 | QString escapedFilename = filename; | 1541 | QString escapedFilename = filename; |
1542 | escapedFilename.replace( QRegExp( "/" ), "_" ); | 1542 | escapedFilename.replace( QRegExp( "/" ), "_" ); |
1543 | 1543 | ||
@@ -1547,7 +1547,7 @@ why not staying with the original directorystructure ? | |||
1547 | qDebug("locate: %s" , path.latin1()); | 1547 | qDebug("locate: %s" , path.latin1()); |
1548 | return path; | 1548 | return path; |
1549 | */ | 1549 | */ |
1550 | //US so my proposal is this: | 1550 | //US so my proposal is this: |
1551 | 1551 | ||
1552 | // QString escapedFilename = filename; | 1552 | // QString escapedFilename = filename; |
1553 | // escapedFilename.replace( QRegExp( "/" ), "_" ); | 1553 | // escapedFilename.replace( QRegExp( "/" ), "_" ); |
@@ -1558,24 +1558,24 @@ why not staying with the original directorystructure ? | |||
1558 | #else | 1558 | #else |
1559 | QString path = KStandardDirs::appDir() + type + "/" + filename; | 1559 | QString path = KStandardDirs::appDir() + type + "/" + filename; |
1560 | #endif | 1560 | #endif |
1561 | 1561 | ||
1562 | //US Create the containing dir if needed | 1562 | //US Create the containing dir if needed |
1563 | QFileInfo fi ( path ); | 1563 | QFileInfo fi ( path ); |
1564 | 1564 | ||
1565 | // QString dir=pathurl.directory(); | 1565 | // QString dir=pathurl.directory(); |
1566 | //QMessageBox::information( 0,"path", path, 1 ); | 1566 | //QMessageBox::information( 0,"path", path, 1 ); |
1567 | 1567 | ||
1568 | #ifdef _WIN32_ | 1568 | #ifdef _WIN32_ |
1569 | KStandardDirs::makeDir(path); | 1569 | KStandardDirs::makeDir(path); |
1570 | #else | 1570 | #else |
1571 | KStandardDirs::makeDir(fi.dirPath( true )); | 1571 | KStandardDirs::makeDir(fi.dirPath( true )); |
1572 | #endif | 1572 | #endif |
1573 | 1573 | ||
1574 | qDebug("locate22: %s" , path.latin1()); | 1574 | qDebug("locate22: %s" , path.latin1()); |
1575 | return path; | 1575 | return path; |
1576 | 1576 | ||
1577 | #endif | 1577 | #endif |
1578 | 1578 | ||
1579 | } | 1579 | } |
1580 | 1580 | ||
1581 | QString locateLocal( const char *type, | 1581 | QString locateLocal( const char *type, |
@@ -1600,7 +1600,7 @@ QString locateLocal( const char *type, | |||
1600 | /*US why do we put all files into one directory. It is quit complicated. | 1600 | /*US why do we put all files into one directory. It is quit complicated. |
1601 | why not staying with the original directorystructure ? | 1601 | why not staying with the original directorystructure ? |
1602 | 1602 | ||
1603 | 1603 | ||
1604 | QString escapedFilename = filename; | 1604 | QString escapedFilename = filename; |
1605 | escapedFilename.replace( QRegExp( "/" ), "_" ); | 1605 | escapedFilename.replace( QRegExp( "/" ), "_" ); |
1606 | 1606 | ||
@@ -1610,7 +1610,7 @@ why not staying with the original directorystructure ? | |||
1610 | qDebug("locate: %s" , path.latin1()); | 1610 | qDebug("locate: %s" , path.latin1()); |
1611 | return path; | 1611 | return path; |
1612 | */ | 1612 | */ |
1613 | //US so my proposal is this: | 1613 | //US so my proposal is this: |
1614 | 1614 | ||
1615 | // QString escapedFilename = filename; | 1615 | // QString escapedFilename = filename; |
1616 | // escapedFilename.replace( QRegExp( "/" ), "_" ); | 1616 | // escapedFilename.replace( QRegExp( "/" ), "_" ); |
@@ -1620,7 +1620,7 @@ why not staying with the original directorystructure ? | |||
1620 | #else | 1620 | #else |
1621 | QString path = KStandardDirs::appDir() + type + "/" + filename; | 1621 | QString path = KStandardDirs::appDir() + type + "/" + filename; |
1622 | #endif | 1622 | #endif |
1623 | 1623 | ||
1624 | //US Create the containing dir if needed | 1624 | //US Create the containing dir if needed |
1625 | KURL pathurl; | 1625 | KURL pathurl; |
1626 | pathurl.setPath(path); | 1626 | pathurl.setPath(path); |
@@ -1630,8 +1630,8 @@ why not staying with the original directorystructure ? | |||
1630 | KStandardDirs::makeDir(path); | 1630 | KStandardDirs::makeDir(path); |
1631 | #else | 1631 | #else |
1632 | KStandardDirs::makeDir(dir); | 1632 | KStandardDirs::makeDir(dir); |
1633 | #endif | 1633 | #endif |
1634 | 1634 | ||
1635 | return path; | 1635 | return path; |
1636 | #endif | 1636 | #endif |
1637 | } | 1637 | } |