author | ulf69 <ulf69> | 2004-08-05 21:42:29 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-05 21:42:29 (UTC) |
commit | 6ee7d4f5119837f89ec534c8c5c73845d521e135 (patch) (side-by-side diff) | |
tree | 265d25e37da63a00ae3302059c2c628efb57b570 | |
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
-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 @@ -63,8 +63,8 @@ template class QDict<QStringList>; #if 0 #include <qtextedit.h> -void ddd( QString op ) +void ddd( QString op ) { static QTextEdit * dot = 0; - if ( ! dot ) + if ( ! dot ) dot = new QTextEdit(); @@ -92,7 +92,7 @@ public: static const char* const types[] = {"html", "icon", "apps", "sound", "data", "locale", "services", "mime", - "servicetypes", "config", "exe", - "wallpaper", "lib", "pixmap", "templates", - "module", "qtplugins", + "servicetypes", "config", "exe", "tmp", + "wallpaper", "lib", "pixmap", "templates", + "module", "qtplugins", "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 }; @@ -359,5 +359,5 @@ QString KStandardDirs::findResourceDir( const char *type, #endif #endif - for (QStringList::ConstIterator it = candidates.begin(); it != candidates.end(); it++) + for (QStringList::ConstIterator it = candidates.begin(); it != candidates.end(); it++) { //qDebug("looking for dir %s - file %s", (*it).latin1(), filename.latin1()); @@ -369,5 +369,5 @@ QString KStandardDirs::findResourceDir( const char *type, if(false && type != "locale") qDebug("KStdDirs::findResDir(): can't find %s ", filename.latin1()); - + #endif @@ -382,13 +382,13 @@ bool KStandardDirs::exists(const QString &fullPath) //US if (access(QFile::encodeName(fullPath), R_OK) == 0 && fullPathInfo.isReadable()) if (fullPathInfo.isReadable()) - { + { if (fullPath.at(fullPath.length() - 1) != '/') { //US if (S_ISREG( buff.st_mode )) if (fullPathInfo.isFile()) return true; - } + } else { -//US if (S_ISDIR( buff.st_mode )) - if (fullPathInfo.isDir()) +//US if (S_ISDIR( buff.st_mode )) + if (fullPathInfo.isDir()) return true; } @@ -409,5 +409,5 @@ static void lookupDirectory(const QString& path, const QString &relPart, //US DIR *dp = opendir( QFile::encodeName(path)); QDir dp(QFile::encodeName(path)); - + if (!dp.exists()) return; @@ -427,8 +427,8 @@ static void lookupDirectory(const QString& path, const QString &relPart, QStringList direntries = dp.entryList(); QStringList::Iterator it = direntries.begin(); - + while ( it != list.end() ) // for each file... { - + //US QString fn( QFile::decodeName(ep->d_name)); QString fn = (*it); // dp.entryList already decodes @@ -436,5 +436,5 @@ static void lookupDirectory(const QString& path, const QString &relPart, if ( fn.isNull() ) break; - + if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' ) continue; @@ -450,11 +450,11 @@ static void lookupDirectory(const QString& path, const QString &relPart, QString pathfn = path + fn; -/*US +/*US if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) { kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; continue; // Couldn't stat (e.g. no read permissions) } - - if ( recursive ) + + if ( recursive ) { if ( S_ISDIR( buff.st_mode )) { @@ -469,13 +469,13 @@ static void lookupDirectory(const QString& path, const QString &relPart, continue; // Couldn't stat (e.g. no read permissions) } - - if ( recursive ) + + if ( recursive ) { if ( pathfnInfo.isDir()) { lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); } - - -/*US + + +/*US if (!regexp.exactMatch(fn)) continue; // No match @@ -511,5 +511,5 @@ static void lookupDirectory(const QString& path, const QString &relPart, if ( pathfnInfo.isReadable() == false ) return; // File not found - + //US if ( S_ISREG( buff.st_mode)) if ( pathfnInfo.isFile()) @@ -557,6 +557,6 @@ static void lookupPrefix(const QString& prefix, const QString& relpath, //US DIR *dp = opendir( QFile::encodeName(prefix) ); QDir dp(QFile::encodeName(prefix)); - -//US if (!dp) + +//US if (!dp) if (!dp.exists()) { @@ -572,5 +572,5 @@ static void lookupPrefix(const QString& prefix, const QString& relpath, QStringList direntries = dp.entryList(); QStringList::Iterator it = direntries.begin(); - + while ( it != list.end() ) // for each file... { @@ -578,5 +578,5 @@ static void lookupPrefix(const QString& prefix, const QString& relpath, QString fn = (*it); // dp.entryList() already encodes the strings it++; - + if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1) == '~') continue; @@ -603,5 +603,5 @@ static void lookupPrefix(const QString& prefix, const QString& relpath, //US if ( S_ISDIR( buff.st_mode )) if ( fnInfo.isDir() ) - + lookupPrefix(fn + '/', rest, rfn + '/', regexp, list, relList, recursive, uniq); } @@ -672,5 +672,5 @@ KStandardDirs::findAllResources( const char *type, } -QString +QString KStandardDirs::realPath(const QString &dirname) { @@ -733,5 +733,5 @@ QStringList KStandardDirs::resourceDirs(const char *type) const if (!candidates) { // filling cache -/*US +/*US if (strcmp(type, "socket") == 0) const_cast<KStandardDirs *>(this)->createSpecialResource(type); @@ -769,5 +769,5 @@ QStringList KStandardDirs::resourceDirs(const char *type) const else prefixList = &prefixes; - + for (QStringList::ConstIterator pit = prefixList->begin(); pit != prefixList->end(); @@ -836,5 +836,5 @@ QString KStandardDirs::findExe( const QString& appname, QString p = QString("%1/%2").arg(appname).arg(appname); qDebug("KStandardDirs::findExe this is probably wrong"); - + info.setFile( p ); if( info.exists() && ( ignore || info.isExecutable() ) @@ -1008,5 +1008,5 @@ QString KStandardDirs::saveLocation(const char *type, QStringList *dirs = relatives.find(type); if (!dirs && ( - (strcmp(type, "socket") == 0) || + (strcmp(type, "socket") == 0) || (strcmp(type, "tmp") == 0) || (strcmp(type, "cache") == 0) )) @@ -1031,15 +1031,15 @@ QString KStandardDirs::saveLocation(const char *type, pPath = new QString(realPath(dirs->last())); } - + savelocations.insert(type, pPath); } - + QString fullPath = *pPath + suffix; //US struct stat st; -//US if (stat(QFile::encodeName(fullPath), &st) != 0 || !(S_ISDIR(st.st_mode))) +//US if (stat(QFile::encodeName(fullPath), &st) != 0 || !(S_ISDIR(st.st_mode))) QFileInfo fullPathInfo(QFile::encodeName(fullPath)); - if (fullPathInfo.isReadable() || !fullPathInfo.isDir()) - - + if (fullPathInfo.isReadable() || !fullPathInfo.isDir()) + + { if(!create) { @@ -1136,5 +1136,5 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) QDir dirObj; - + // we want an absolute path #ifndef _WIN32_ @@ -1142,5 +1142,5 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) return false; #endif - + QString target = dir; uint len = target.length(); @@ -1166,5 +1166,5 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) base += target.mid(i - 1, pos - i + 1); //QMessageBox::information( 0,"cap111", base, 1 ); -/*US +/*US QCString baseEncoded = QFile::encodeName(base); // bail out if we encountered a problem @@ -1175,5 +1175,5 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) if (lstat(baseEncoded, &st) == 0) (void)unlink(baseEncoded); // try removing - + if ( mkdir(baseEncoded, (mode_t) mode) != 0) { @@ -1182,6 +1182,6 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode) } } -*/ - +*/ + if (dirObj.exists(base) == false) { @@ -1234,5 +1234,5 @@ void KStandardDirs::addKDEDefaults() } //US kdedirList.append(KDEDIR); -//US for embedded, add qtopia dir as kdedir +//US for embedded, add qtopia dir as kdedir #ifndef DESKTOP_VERSION @@ -1247,5 +1247,5 @@ void KStandardDirs::addKDEDefaults() QString localKdeDir; - + //US if (getuid()) if (true) @@ -1276,5 +1276,5 @@ void KStandardDirs::addKDEDefaults() //US struct passwd *pw = getpwuid(0); //US localKdeDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.microkde/"; - qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); + qDebug("KStandardDirs::addKDEDefaults: 1 has to be fixed"); } @@ -1284,5 +1284,5 @@ void KStandardDirs::addKDEDefaults() //US -// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); +// qDebug("KStandardDirs::addKDEDefaults: localKdeDir=%s", localKdeDir.latin1()); if (localKdeDir != "-/") { @@ -1329,5 +1329,5 @@ void KStandardDirs::addKDEDefaults() //US struct passwd *pw = getpwuid(0); //US localXdgDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.config/"; - qDebug("KStandardDirs::addKDEDefaults: 2 has to be fixed"); + qDebug("KStandardDirs::addKDEDefaults: 2 has to be fixed"); } } @@ -1361,5 +1361,5 @@ void KStandardDirs::addKDEDefaults() xdgdirList.append(dir+"share/"); } - + xdgdirList.append("/usr/local/share/"); xdgdirList.append("/usr/share/"); @@ -1383,5 +1383,5 @@ void KStandardDirs::addKDEDefaults() //US struct passwd *pw = getpwuid(0); //US localXdgDir = QFile::decodeName((pw && pw->pw_dir) ? pw->pw_dir : "/root") + "/.local/share/"; - qDebug("KStandardDirs::addKDEDefaults: 3 has to be fixed"); + qDebug("KStandardDirs::addKDEDefaults: 3 has to be fixed"); } } @@ -1394,5 +1394,5 @@ void KStandardDirs::addKDEDefaults() { QString dir = KShell::tildeExpand(*it); - + addXdgDataPrefix(dir); } @@ -1411,5 +1411,5 @@ void KStandardDirs::addKDEDefaults() void KStandardDirs::checkConfig() const { -/*US +/*US if (!addedCustoms && KGlobal::_instance && KGlobal::_instance->_config) const_cast<KStandardDirs*>(this)->addCustomized(KGlobal::_instance->_config); @@ -1440,5 +1440,5 @@ bool KStandardDirs::addCustomized(KConfig *config) // iterating over all entries in the group Directories // to find entries that start with dir_$type -/*US +/*US QMap<QString, QString> entries = config->entryMap("Directories"); @@ -1502,11 +1502,11 @@ void KStandardDirs::setAppDir( const QString &appDir ) mAppDir = appDir; - if ( mAppDir.right( 1 ) != "/" ) + if ( mAppDir.right( 1 ) != "/" ) mAppDir += "/"; } QString KStandardDirs::appDir() -{ - return mAppDir; +{ + return mAppDir; } @@ -1524,5 +1524,5 @@ QString locateLocal( const char *type, QString path = locateLocal(type, filename, true /*US, inst*/); - + /* @@ -1538,5 +1538,5 @@ QString locateLocal( const char *type, why not staying with the original directorystructure ? - + QString escapedFilename = filename; escapedFilename.replace( QRegExp( "/" ), "_" ); @@ -1548,5 +1548,5 @@ why not staying with the original directorystructure ? return path; */ -//US so my proposal is this: +//US so my proposal is this: // QString escapedFilename = filename; @@ -1559,22 +1559,22 @@ why not staying with the original directorystructure ? QString path = KStandardDirs::appDir() + type + "/" + filename; #endif - + //US Create the containing dir if needed QFileInfo fi ( path ); - + // QString dir=pathurl.directory(); // QMessageBox::information( 0,"path", path, 1 ); - + #ifdef _WIN32_ KStandardDirs::makeDir(path); #else KStandardDirs::makeDir(fi.dirPath( true )); -#endif - +#endif + qDebug("locate22: %s" , path.latin1()); return path; #endif - + } @@ -1601,5 +1601,5 @@ QString locateLocal( const char *type, why not staying with the original directorystructure ? - + QString escapedFilename = filename; escapedFilename.replace( QRegExp( "/" ), "_" ); @@ -1611,5 +1611,5 @@ why not staying with the original directorystructure ? return path; */ -//US so my proposal is this: +//US so my proposal is this: // QString escapedFilename = filename; @@ -1621,5 +1621,5 @@ why not staying with the original directorystructure ? QString path = KStandardDirs::appDir() + type + "/" + filename; #endif - + //US Create the containing dir if needed KURL pathurl; @@ -1631,6 +1631,6 @@ why not staying with the original directorystructure ? #else KStandardDirs::makeDir(dir); -#endif - +#endif + return path; #endif |