summaryrefslogtreecommitdiffstats
path: root/kdecore/kstandarddirs.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-13 08:32:36 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-13 08:32:36 +0000
commitf7e71d47719ab6094cf4a9fafffa5ea351973522 (patch)
tree30834aa632d442019e14f88685001d94657d060b /kdecore/kstandarddirs.cpp
parentb31cfd9a1ee986fe2ae9a693f3afd7f171dd897c (diff)
downloadtdelibs-f7e71d47719ab6094cf4a9fafffa5ea351973522.tar.gz
tdelibs-f7e71d47719ab6094cf4a9fafffa5ea351973522.zip
Initial conversion for TQt for Qt4 3.4.0 TP2
This will also compile with TQt for Qt3, and should not cause any problems with dependent modules such as kdebase. If it does then it needs to be fixed! git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1214149 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/kstandarddirs.cpp')
-rw-r--r--kdecore/kstandarddirs.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/kdecore/kstandarddirs.cpp b/kdecore/kstandarddirs.cpp
index f8b7bd307..91a178a53 100644
--- a/kdecore/kstandarddirs.cpp
+++ b/kdecore/kstandarddirs.cpp
@@ -144,7 +144,7 @@ bool KStandardDirs::isRestrictedResource(const char *type, const TQString& relPa
void KStandardDirs::applyDataRestrictions(const TQString &relPath) const
{
TQString key;
- int i = relPath.find(QChar('/'));
+ int i = relPath.tqfind(QChar('/'));
if (i != -1)
key = "data_"+relPath.left(i);
else
@@ -159,7 +159,7 @@ TQStringList KStandardDirs::allTypes() const
{
TQStringList list;
for (int i = 0; types[i] != 0; ++i)
- list.append(TQString::fromLatin1(types[i]));
+ list.append(TQString::tqfromLatin1(types[i]));
return list;
}
@@ -192,7 +192,7 @@ void KStandardDirs::addPrefix( const TQString& _dir, bool priority )
if (dir.at(dir.length() - 1) != QChar('/'))
dir += QChar('/');
- if (!prefixes.contains(dir)) {
+ if (!prefixes.tqcontains(dir)) {
priorityAdd(prefixes, dir, priority);
dircache.clear();
}
@@ -212,7 +212,7 @@ void KStandardDirs::addXdgConfigPrefix( const TQString& _dir, bool priority )
if (dir.at(dir.length() - 1) != QChar('/'))
dir += QChar('/');
- if (!d->xdgconf_prefixes.contains(dir)) {
+ if (!d->xdgconf_prefixes.tqcontains(dir)) {
priorityAdd(d->xdgconf_prefixes, dir, priority);
dircache.clear();
}
@@ -232,7 +232,7 @@ void KStandardDirs::addXdgDataPrefix( const TQString& _dir, bool priority )
if (dir.at(dir.length() - 1) != QChar('/'))
dir += QChar('/');
- if (!d->xdgdata_prefixes.contains(dir)) {
+ if (!d->xdgdata_prefixes.tqcontains(dir)) {
priorityAdd(d->xdgdata_prefixes, dir, priority);
dircache.clear();
}
@@ -265,7 +265,7 @@ bool KStandardDirs::addResourceType( const char *type,
if (relativename.isEmpty())
return false;
- TQStringList *rels = relatives.find(type);
+ TQStringList *rels = relatives.tqfind(type);
if (!rels) {
rels = new TQStringList();
relatives.insert(type, rels);
@@ -273,7 +273,7 @@ bool KStandardDirs::addResourceType( const char *type,
TQString copy = relativename;
if (copy.at(copy.length() - 1) != QChar('/'))
copy += QChar('/');
- if (!rels->contains(copy)) {
+ if (!rels->tqcontains(copy)) {
if (priority)
rels->prepend(copy);
else
@@ -295,7 +295,7 @@ bool KStandardDirs::addResourceDir( const char *type,
const TQString& absdir,
bool priority)
{
- TQStringList *paths = absolutes.find(type);
+ TQStringList *paths = absolutes.tqfind(type);
if (!paths) {
paths = new TQStringList();
absolutes.insert(type, paths);
@@ -304,7 +304,7 @@ bool KStandardDirs::addResourceDir( const char *type,
if (copy.at(copy.length() - 1) != QChar('/'))
copy += QChar('/');
- if (!paths->contains(copy)) {
+ if (!paths->tqcontains(copy)) {
if (priority)
paths->prepend(copy);
else
@@ -337,7 +337,7 @@ for (TQStringList::ConstIterator pit = prefixes.begin();
else return dir + filename;
}
-static Q_UINT32 updateHash(const TQString &file, Q_UINT32 hash)
+static TQ_UINT32 updateHash(const TQString &file, TQ_UINT32 hash)
{
TQCString cFile = TQFile::encodeName(file);
KDE_struct_stat buff;
@@ -345,15 +345,15 @@ static Q_UINT32 updateHash(const TQString &file, Q_UINT32 hash)
(KDE_stat( cFile, &buff ) == 0) &&
(S_ISREG( buff.st_mode )))
{
- hash = hash + (Q_UINT32) buff.st_ctime;
+ hash = hash + (TQ_UINT32) buff.st_ctime;
}
return hash;
}
-Q_UINT32 KStandardDirs::calcResourceHash( const char *type,
+TQ_UINT32 KStandardDirs::calcResourceHash( const char *type,
const TQString& filename, bool deep) const
{
- Q_UINT32 hash = 0;
+ TQ_UINT32 hash = 0;
if (!TQDir::isRelativePath(filename))
{
@@ -492,7 +492,7 @@ static void lookupDirectory(const TQString& path, const TQString &relPart,
while( ( ep = readdir( dp ) ) != 0L )
{
TQString fn( TQFile::decodeName(ep->d_name));
- if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == QChar('~').latin1())
+ if (fn == _dot || fn == _dotdot || TQChar(fn.at(fn.length() - 1)).latin1() == TQChar('~').latin1())
continue;
if (!recursive && !regexp.exactMatch(fn))
@@ -512,7 +512,7 @@ static void lookupDirectory(const TQString& path, const TQString &relPart,
}
if ( S_ISREG( buff.st_mode))
{
- if (!unique || !relList.contains(relPart + fn))
+ if (!unique || !relList.tqcontains(relPart + fn))
{
list.append( pathfn );
relList.append( relPart + fn );
@@ -531,7 +531,7 @@ static void lookupDirectory(const TQString& path, const TQString &relPart,
return; // File not found
if ( S_ISREG( buff.st_mode))
{
- if (!unique || !relList.contains(relPart + fn))
+ if (!unique || !relList.tqcontains(relPart + fn))
{
list.append( pathfn );
relList.append( relPart + fn );
@@ -557,7 +557,7 @@ static void lookupPrefix(const TQString& prefix, const TQString& relpath,
if (relpath.length())
{
- int slash = relpath.find(QChar('/'));
+ int slash = relpath.tqfind(QChar('/'));
if (slash < 0)
rest = relpath.left(relpath.length() - 1);
else {
@@ -629,7 +629,7 @@ KStandardDirs::findAllResources( const char *type,
if (filter.length())
{
- int slash = filter.findRev('/');
+ int slash = filter.tqfindRev('/');
if (slash < 0)
filterFile = filter;
else {
@@ -682,7 +682,7 @@ KStandardDirs::findAllResources( const char *type,
return findAllResources(type, filter, recursive, unique, relList);
}
-QString
+TQString
KStandardDirs::realPath(const TQString &dirname)
{
char realpath_buffer[MAXPATHLEN + 1];
@@ -692,7 +692,7 @@ KStandardDirs::realPath(const TQString &dirname)
if (realpath( TQFile::encodeName(dirname).data(), realpath_buffer) != 0) {
// success, use result from realpath
int len = strlen(realpath_buffer);
- realpath_buffer[len] = QChar('/');
+ realpath_buffer[len] = TQChar('/');
realpath_buffer[len+1] = 0;
return TQFile::decodeName(realpath_buffer);
}
@@ -700,7 +700,7 @@ KStandardDirs::realPath(const TQString &dirname)
return dirname;
}
-QString
+TQString
KStandardDirs::realFilePath(const TQString &filename)
{
char realpath_buffer[MAXPATHLEN + 1];
@@ -762,9 +762,9 @@ void KStandardDirs::createSpecialResource(const char *type)
#else //UNIX
if (relink)
{
- TQString srv = findExe(TQString::fromLatin1("lnusertemp"), kfsstnd_defaultbindir());
+ TQString srv = findExe(TQString::tqfromLatin1("lnusertemp"), kfsstnd_defaultbindir());
if (srv.isEmpty())
- srv = findExe(TQString::fromLatin1("lnusertemp"));
+ srv = findExe(TQString::tqfromLatin1("lnusertemp"));
if (!srv.isEmpty())
{
system(TQFile::encodeName(srv)+" "+type);
@@ -774,7 +774,7 @@ void KStandardDirs::createSpecialResource(const char *type)
if (result > 0)
{
link[result] = 0;
- if (link[0] == QChar('/').latin1())
+ if (link[0] == TQChar('/').latin1())
dir = TQFile::decodeName(link);
else
dir = TQDir::cleanDirPath(dir+TQFile::decodeName(link));
@@ -785,7 +785,7 @@ void KStandardDirs::createSpecialResource(const char *type)
TQStringList KStandardDirs::resourceDirs(const char *type) const
{
- TQStringList *candidates = dircache.find(type);
+ TQStringList *candidates = dircache.tqfind(type);
if (!candidates) { // filling cache
if (strcmp(type, "socket") == 0)
@@ -812,7 +812,7 @@ TQStringList KStandardDirs::resourceDirs(const char *type) const
d->dataRestrictionActive = false; // Reset
}
- dirs = relatives.find(type);
+ dirs = relatives.tqfind(type);
if (dirs)
{
bool local = true;
@@ -834,7 +834,7 @@ TQStringList KStandardDirs::resourceDirs(const char *type) const
testdir.setPath(path);
if (local && restrictionActive)
continue;
- if ((local || testdir.exists()) && !candidates->contains(path))
+ if ((local || testdir.exists()) && !candidates->tqcontains(path))
candidates->append(path);
}
// UGLY HACK - Chris CHeney
@@ -844,7 +844,7 @@ TQStringList KStandardDirs::resourceDirs(const char *type) const
local = false;
}
}
- dirs = absolutes.find(type);
+ dirs = absolutes.tqfind(type);
if (dirs)
for (TQStringList::ConstIterator it = dirs->begin();
it != dirs->end(); ++it)
@@ -853,7 +853,7 @@ TQStringList KStandardDirs::resourceDirs(const char *type) const
if (testdir.exists())
{
TQString filename = realPath(*it);
- if (!candidates->contains(filename))
+ if (!candidates->tqcontains(filename))
candidates->append(filename);
}
}
@@ -897,7 +897,7 @@ TQStringList KStandardDirs::systemPaths( const TQString& pstr )
if ( p[ 0 ] == QChar('~') )
{
- int len = p.find( QChar('/') );
+ int len = p.tqfind( QChar('/') );
if ( len == -1 )
len = p.length();
if ( len == 1 )
@@ -931,7 +931,7 @@ TQString KStandardDirs::findExe( const TQString& appname,
TQFileInfo info;
// absolute or relative path given
- if (real_appname.find(TQDir::separator()) >= 0)
+ if (real_appname.tqfind(TQDir::separator()) >= 0)
{
info.setFile( real_appname );
if( info.exists() && ( ignore || info.isExecutable() )
@@ -1006,7 +1006,7 @@ static int tokenize( TQStringList& tokens, const TQString& str,
for( int index = 0; index < len; index++)
{
- if ( delim.find( str[ index ] ) >= 0 )
+ if ( delim.tqfind( str[ index ] ) >= 0 )
{
tokens.append( token );
token = "";
@@ -1093,17 +1093,17 @@ TQString KStandardDirs::saveLocation(const char *type,
{
checkConfig();
- TQString *pPath = savelocations.find(type);
+ TQString *pPath = savelocations.tqfind(type);
if (!pPath)
{
- TQStringList *dirs = relatives.find(type);
+ TQStringList *dirs = relatives.tqfind(type);
if (!dirs && (
(strcmp(type, "socket") == 0) ||
(strcmp(type, "tmp") == 0) ||
(strcmp(type, "cache") == 0) ))
{
(void) resourceDirs(type); // Generate socket|tmp|cache resource.
- dirs = relatives.find(type); // Search again.
+ dirs = relatives.tqfind(type); // Search again.
}
if (dirs)
{
@@ -1116,7 +1116,7 @@ TQString KStandardDirs::saveLocation(const char *type,
pPath = new TQString(realPath(localkdedir() + dirs->last()));
}
else {
- dirs = absolutes.find(type);
+ dirs = absolutes.tqfind(type);
if (!dirs)
qFatal("KStandardDirs: The resource type %s is not registered", type);
pPath = new TQString(realPath(dirs->last()));
@@ -1147,7 +1147,7 @@ TQString KStandardDirs::saveLocation(const char *type,
TQString KStandardDirs::relativeLocation(const char *type, const TQString &absPath)
{
TQString fullPath = absPath;
- int i = absPath.findRev('/');
+ int i = absPath.tqfindRev('/');
if (i != -1)
{
fullPath = realPath(absPath.left(i+1))+absPath.mid(i+1); // Normalize
@@ -1185,7 +1185,7 @@ bool KStandardDirs::makeDir(const TQString& dir, int mode)
while( i < len )
{
KDE_struct_stat st;
- int pos = target.find(QChar('/'), i);
+ int pos = target.tqfind(QChar('/'), i);
base += target.mid(i - 1, pos - i + 1);
TQCString baseEncoded = TQFile::encodeName(base);
// bail out if we encountered a problem
@@ -1229,17 +1229,17 @@ static TQString executablePrefix()
if (length == -1)
return TQString::null;
- path_buffer[length] = QChar('\0');
+ path_buffer[length] = TQChar('\0');
TQString path = TQFile::decodeName(path_buffer);
if(path.isEmpty())
return TQString::null;
- int pos = path.findRev('/'); // Skip filename
+ int pos = path.tqfindRev('/'); // Skip filename
if(pos <= 0)
return TQString::null;
- pos = path.findRev(QChar('/'), pos - 1); // Skip last directory
+ pos = path.tqfindRev(TQChar('/'), pos - 1); // Skip last directory
if(pos <= 0)
return TQString::null;
@@ -1272,11 +1272,11 @@ TQString KStandardDirs::kfsstnd_defaultbindir()
if (!s->defaultbindir.isEmpty())
return s->defaultbindir;
#ifdef Q_WS_WIN
- s->defaultbindir = kfsstnd_defaultprefix() + TQString::fromLatin1("/bin");
+ s->defaultbindir = kfsstnd_defaultprefix() + TQString::tqfromLatin1("/bin");
#else //UNIX
s->defaultbindir = __KDE_BINDIR;
if (s->defaultbindir.isEmpty())
- s->defaultbindir = kfsstnd_defaultprefix() + TQString::fromLatin1("/bin");
+ s->defaultbindir = kfsstnd_defaultprefix() + TQString::tqfromLatin1("/bin");
#endif
if (s->defaultbindir.isEmpty())
kdWarning() << "KStandardDirs::kfsstnd_defaultbindir(): default binary KDE dir not found!" << endl;
@@ -1543,21 +1543,21 @@ bool KStandardDirs::addCustomized(KConfig *config)
addedCustoms = true;
// reading the prefixes in
- TQString group = TQString::fromLatin1("Directories");
+ TQString group = TQString::tqfromLatin1("Directories");
config->setGroup(group);
TQString kioskAdmin = config->readEntry("kioskAdmin");
if (!kioskAdmin.isEmpty() && !kde_kiosk_admin)
{
- int i = kioskAdmin.find(':');
+ int i = kioskAdmin.tqfind(':');
TQString user = kioskAdmin.left(i);
TQString host = kioskAdmin.mid(i+1);
KUser thisUser;
char hostname[ 256 ];
- hostname[ 0 ] = QChar('\0');
+ hostname[ 0 ] = TQChar('\0');
if (!gethostname( hostname, 255 ))
- hostname[sizeof(hostname)-1] = QChar('\0');
+ hostname[sizeof(hostname)-1] = TQChar('\0');
if ((user == thisUser.loginName()) &&
(host.isEmpty() || (host == hostname)))
@@ -1623,7 +1623,7 @@ bool KStandardDirs::addCustomized(KConfig *config)
if (profiles.isEmpty())
break;
profile = profiles.back();
- group = TQString::fromLatin1("Directories-%1").arg(profile);
+ group = TQString::tqfromLatin1("Directories-%1").arg(profile);
profiles.pop_back();
priority = true;
}
@@ -1694,7 +1694,7 @@ TQString locateLocal( const char *type,
{
// try to find slashes. If there are some, we have to
// create the subdir first
- int slash = filename.findRev('/')+1;
+ int slash = filename.tqfindRev('/')+1;
if (!slash) // only one filename
return inst->dirs()->saveLocation(type, TQString::null, createDir) + filename;