diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:46:43 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:46:43 +0000 |
commit | ffe8a83e053396df448e9413828527613ca3bd46 (patch) | |
tree | a73d4169e02df4a50f9a12cb165fcd0ab5bac7c6 /kdecore/kdesktopfile.cpp | |
parent | 682bf3bfdcbcbb1fca85e8a36ed03e062e0555d5 (diff) | |
download | tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.tar.gz tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/kdesktopfile.cpp')
-rw-r--r-- | kdecore/kdesktopfile.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/kdecore/kdesktopfile.cpp b/kdecore/kdesktopfile.cpp index 0168803ea..915b73429 100644 --- a/kdecore/kdesktopfile.cpp +++ b/kdecore/kdesktopfile.cpp @@ -24,9 +24,9 @@ #include <stdlib.h> #include <unistd.h> -#include <qfile.h> -#include <qdir.h> -#include <qtextstream.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqtextstream.h> #include <kdebug.h> #include "kurl.h" @@ -38,9 +38,9 @@ #include "kdesktopfile.h" #include "kdesktopfile.moc" -KDesktopFile::KDesktopFile(const QString &fileName, bool bReadOnly, +KDesktopFile::KDesktopFile(const TQString &fileName, bool bReadOnly, const char * resType) - : KConfig(QString::fromLatin1(""), bReadOnly, false) + : KConfig(TQString::fromLatin1(""), bReadOnly, false) { // KConfigBackEnd will try to locate the filename that is provided // based on the resource type specified, _only_ if the filename @@ -56,19 +56,19 @@ KDesktopFile::~KDesktopFile() // no need to do anything } -QString KDesktopFile::locateLocal(const QString &path) +TQString KDesktopFile::locateLocal(const TQString &path) { - QString local; + TQString local; if (path.endsWith(".directory")) { local = path; - if (!QDir::isRelativePath(local)) + if (!TQDir::isRelativePath(local)) { // Relative wrt apps? local = KGlobal::dirs()->relativeLocation("apps", path); } - if (QDir::isRelativePath(local)) + if (TQDir::isRelativePath(local)) { local = ::locateLocal("apps", local); // Relative to apps } @@ -77,7 +77,7 @@ QString KDesktopFile::locateLocal(const QString &path) // XDG Desktop menu items come with absolute paths, we need to // extract their relative path and then build a local path. local = KGlobal::dirs()->relativeLocation("xdgdata-dirs", local); - if (!QDir::isRelativePath(local)) + if (!TQDir::isRelativePath(local)) { // Hm, that didn't work... // What now? Use filename only and hope for the best. @@ -88,7 +88,7 @@ QString KDesktopFile::locateLocal(const QString &path) } else { - if (QDir::isRelativePath(path)) + if (TQDir::isRelativePath(path)) { local = ::locateLocal("apps", path); // Relative to apps } @@ -97,7 +97,7 @@ QString KDesktopFile::locateLocal(const QString &path) // XDG Desktop menu items come with absolute paths, we need to // extract their relative path and then build a local path. local = KGlobal::dirs()->relativeLocation("xdgdata-apps", path); - if (!QDir::isRelativePath(local)) + if (!TQDir::isRelativePath(local)) { // What now? Use filename only and hope for the best. local = path.mid(path.findRev('/')+1); @@ -108,19 +108,19 @@ QString KDesktopFile::locateLocal(const QString &path) return local; } -bool KDesktopFile::isDesktopFile(const QString& path) +bool KDesktopFile::isDesktopFile(const TQString& path) { int len = path.length(); - if(len > 8 && path.right(8) == QString::fromLatin1(".desktop")) + if(len > 8 && path.right(8) == TQString::fromLatin1(".desktop")) return true; - else if(len > 7 && path.right(7) == QString::fromLatin1(".kdelnk")) + else if(len > 7 && path.right(7) == TQString::fromLatin1(".kdelnk")) return true; else return false; } -bool KDesktopFile::isAuthorizedDesktopFile(const QString& path) +bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path) { if (!kapp || kapp->authorize("run_desktop_files")) return true; @@ -128,15 +128,15 @@ bool KDesktopFile::isAuthorizedDesktopFile(const QString& path) if (path.isEmpty()) return false; // Empty paths are not ok. - if (QDir::isRelativePath(path)) + if (TQDir::isRelativePath(path)) return true; // Relative paths are ok. KStandardDirs *dirs = KGlobal::dirs(); - if (QDir::isRelativePath( dirs->relativeLocation("apps", path) )) + if (TQDir::isRelativePath( dirs->relativeLocation("apps", path) )) return true; - if (QDir::isRelativePath( dirs->relativeLocation("xdgdata-apps", path) )) + if (TQDir::isRelativePath( dirs->relativeLocation("xdgdata-apps", path) )) return true; - if (QDir::isRelativePath( dirs->relativeLocation("services", path) )) + if (TQDir::isRelativePath( dirs->relativeLocation("services", path) )) return true; if (dirs->relativeLocation("data", path).startsWith("kdesktop/Desktop")) return true; @@ -145,45 +145,45 @@ bool KDesktopFile::isAuthorizedDesktopFile(const QString& path) return false; } -QString KDesktopFile::readType() const +TQString KDesktopFile::readType() const { return readEntry("Type"); } -QString KDesktopFile::readIcon() const +TQString KDesktopFile::readIcon() const { return readEntry("Icon"); } -QString KDesktopFile::readName() const +TQString KDesktopFile::readName() const { return readEntry("Name"); } -QString KDesktopFile::readComment() const +TQString KDesktopFile::readComment() const { return readEntry("Comment"); } -QString KDesktopFile::readGenericName() const +TQString KDesktopFile::readGenericName() const { return readEntry("GenericName"); } -QString KDesktopFile::readPath() const +TQString KDesktopFile::readPath() const { return readPathEntry("Path"); } -QString KDesktopFile::readDevice() const +TQString KDesktopFile::readDevice() const { return readEntry("Dev"); } -QString KDesktopFile::readURL() const +TQString KDesktopFile::readURL() const { if (hasDeviceType()) { - QString device = readDevice(); + TQString device = readDevice(); KMountPoint::List mountPoints = KMountPoint::possibleMountPoints(); for(KMountPoint::List::ConstIterator it = mountPoints.begin(); @@ -197,10 +197,10 @@ QString KDesktopFile::readURL() const return u.url(); } } - return QString::null; + return TQString::null; } else { - QString url = readPathEntry("URL"); - if ( !url.isEmpty() && !QDir::isRelativePath(url) ) + TQString url = readPathEntry("URL"); + if ( !url.isEmpty() && !TQDir::isRelativePath(url) ) { // Handle absolute paths as such (i.e. we need to escape them) KURL u; @@ -211,61 +211,61 @@ QString KDesktopFile::readURL() const } } -QStringList KDesktopFile::readActions() const +TQStringList KDesktopFile::readActions() const { return readListEntry("Actions", ';'); } -void KDesktopFile::setActionGroup(const QString &group) +void KDesktopFile::setActionGroup(const TQString &group) { - setGroup(QString::fromLatin1("Desktop Action ") + group); + setGroup(TQString::fromLatin1("Desktop Action ") + group); } -bool KDesktopFile::hasActionGroup(const QString &group) const +bool KDesktopFile::hasActionGroup(const TQString &group) const { - return hasGroup(QString::fromLatin1("Desktop Action ") + group); + return hasGroup(TQString::fromLatin1("Desktop Action ") + group); } bool KDesktopFile::hasLinkType() const { - return readEntry("Type") == QString::fromLatin1("Link"); + return readEntry("Type") == TQString::fromLatin1("Link"); } bool KDesktopFile::hasApplicationType() const { - return readEntry("Type") == QString::fromLatin1("Application"); + return readEntry("Type") == TQString::fromLatin1("Application"); } bool KDesktopFile::hasMimeTypeType() const { - return readEntry("Type") == QString::fromLatin1("MimeType"); + return readEntry("Type") == TQString::fromLatin1("MimeType"); } bool KDesktopFile::hasDeviceType() const { - return readEntry("Type") == QString::fromLatin1("FSDev") || - readEntry("Type") == QString::fromLatin1("FSDevice"); + return readEntry("Type") == TQString::fromLatin1("FSDev") || + readEntry("Type") == TQString::fromLatin1("FSDevice"); } bool KDesktopFile::tryExec() const { // Test for TryExec and "X-KDE-AuthorizeAction" - QString te = readPathEntry("TryExec"); + TQString te = readPathEntry("TryExec"); if (!te.isEmpty()) { - if (!QDir::isRelativePath(te)) { - if (::access(QFile::encodeName(te), X_OK)) + if (!TQDir::isRelativePath(te)) { + if (::access(TQFile::encodeName(te), X_OK)) return false; } else { // !!! Sergey A. Sukiyazov <corwin@micom.don.ru> !!! // Environment PATH may contain filenames in 8bit locale cpecified // encoding (Like a filenames). - QStringList dirs = QStringList::split(':', QFile::decodeName(::getenv("PATH"))); - QStringList::Iterator it(dirs.begin()); + TQStringList dirs = TQStringList::split(':', TQFile::decodeName(::getenv("PATH"))); + TQStringList::Iterator it(dirs.begin()); bool match = false; for (; it != dirs.end(); ++it) { - QString fName = *it + "/" + te; - if (::access(QFile::encodeName(fName), X_OK) == 0) + TQString fName = *it + "/" + te; + if (::access(TQFile::encodeName(fName), X_OK) == 0) { match = true; break; @@ -276,10 +276,10 @@ bool KDesktopFile::tryExec() const return false; } } - QStringList list = readListEntry("X-KDE-AuthorizeAction"); + TQStringList list = readListEntry("X-KDE-AuthorizeAction"); if (kapp && !list.isEmpty()) { - for(QStringList::ConstIterator it = list.begin(); + for(TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { @@ -292,7 +292,7 @@ bool KDesktopFile::tryExec() const bool su = readBoolEntry("X-KDE-SubstituteUID"); if (su) { - QString user = readEntry("X-KDE-Username"); + TQString user = readEntry("X-KDE-Username"); if (user.isEmpty()) user = ::getenv("ADMIN_ACCOUNT"); if (user.isEmpty()) @@ -325,7 +325,7 @@ KDesktopFile::sortOrder() const void KDesktopFile::virtual_hook( int id, void* data ) { KConfig::virtual_hook( id, data ); } -QString KDesktopFile::readDocPath() const +TQString KDesktopFile::readDocPath() const { // Depreciated, remove in KDE4 or 5? // See: http://www.freedesktop.org/Standards/desktop-entry-spec @@ -335,9 +335,9 @@ QString KDesktopFile::readDocPath() const return readPathEntry( "X-DocPath" ); } -KDesktopFile* KDesktopFile::copyTo(const QString &file) const +KDesktopFile* KDesktopFile::copyTo(const TQString &file) const { - KDesktopFile *config = new KDesktopFile(QString::null, false); + KDesktopFile *config = new KDesktopFile(TQString::null, false); KConfig::copyTo(file, config); config->setDesktopGroup(); return config; |