summaryrefslogtreecommitdiffstats
path: root/src/gvcore/externaltoolmanager.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 21:04:57 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 21:04:57 +0000
commitbf7f88413be3831a9372d323d02fc0335b9f9188 (patch)
tree516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvcore/externaltoolmanager.cpp
parente238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff)
downloadgwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz
gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvcore/externaltoolmanager.cpp')
-rw-r--r--src/gvcore/externaltoolmanager.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/src/gvcore/externaltoolmanager.cpp b/src/gvcore/externaltoolmanager.cpp
index 9e6fc9e..3471bc0 100644
--- a/src/gvcore/externaltoolmanager.cpp
+++ b/src/gvcore/externaltoolmanager.cpp
@@ -21,8 +21,8 @@ Copyright 2000-2004 Aurélien Gâteau
// STL
#include <list>
-// Qt
-#include <qdir.h>
+// TQt
+#include <tqdir.h>
// KDE
#include <kdebug.h>
@@ -47,7 +47,7 @@ namespace Gwenview {
#endif
// Helper functions for createContextInternal
-inline bool mimeTypeMatches(const QString& candidate, const QString& reference) {
+inline bool mimeTypeMatches(const TQString& candidate, const TQString& reference) {
if (reference=="*") return true;
if (reference.right(1)=="*") {
@@ -57,15 +57,15 @@ inline bool mimeTypeMatches(const QString& candidate, const QString& reference)
}
}
-inline bool isSubSetOf(const QStringList& subSet, const QStringList& set) {
+inline bool isSubSetOf(const TQStringList& subSet, const TQStringList& set) {
// Simple implementation, might need some optimization
- QStringList::ConstIterator itSubSet=subSet.begin();
- QStringList::ConstIterator itSetBegin=set.begin();
- QStringList::ConstIterator itSetEnd=set.end();
+ TQStringList::ConstIterator itSubSet=subSet.begin();
+ TQStringList::ConstIterator itSetBegin=set.begin();
+ TQStringList::ConstIterator itSetEnd=set.end();
for (; itSubSet!=subSet.end(); ++itSubSet) {
bool matchFound=false;
- QStringList::ConstIterator itSet=itSetBegin;
+ TQStringList::ConstIterator itSet=itSetBegin;
for (; itSet!=itSetEnd; ++itSet) {
if (mimeTypeMatches(*itSubSet, *itSet)) {
matchFound=true;
@@ -81,9 +81,9 @@ inline bool isSubSetOf(const QStringList& subSet, const QStringList& set) {
struct ExternalToolManagerPrivate {
- QDict<KDesktopFile> mDesktopFiles;
- QPtrList<KService> mServices;
- QString mUserToolDir;
+ TQDict<KDesktopFile> mDesktopFiles;
+ TQPtrList<KService> mServices;
+ TQString mUserToolDir;
/**
* Helper function for createContextInternal
@@ -95,49 +95,49 @@ struct ExternalToolManagerPrivate {
}
ExternalToolContext* createContextInternal(
- QObject* parent, const KURL::List& urls, const QStringList& mimeTypes)
+ TQObject* tqparent, const KURL::List& urls, const TQStringList& mimeTypes)
{
bool onlyOneURL=urls.size()==1;
// Only add to selectionServices the services which can handle all the
// different mime types present in the selection
//
- // We use std::list instead of QValueList because it's not possible to
+ // We use std::list instead of TQValueList because it's not possible to
// pass a sort functor to qHeapSort
std::list<KService*> selectionServices;
- QPtrListIterator<KService> it(mServices);
+ TQPtrListIterator<KService> it(mServices);
for (; it.current(); ++it) {
KService* service=it.current();
if (!onlyOneURL && !service->allowMultipleFiles()) {
continue;
}
- QStringList serviceTypes=service->serviceTypes();
+ TQStringList serviceTypes=service->serviceTypes();
if (isSubSetOf(mimeTypes, serviceTypes)) {
selectionServices.push_back(service);
}
}
selectionServices.sort(compareKServicePtrByName);
- return new ExternalToolContext(parent, selectionServices, urls);
+ return new ExternalToolContext(tqparent, selectionServices, urls);
}
};
// Helper function for ctor
-void loadDesktopFiles(QDict<KDesktopFile>& dict, const QString& dirString) {
- QDir dir(dirString);
- QStringList list=dir.entryList("*.desktop");
- QStringList::ConstIterator it=list.begin();
+void loadDesktopFiles(TQDict<KDesktopFile>& dict, const TQString& dirString) {
+ TQDir dir(dirString);
+ TQStringList list=dir.entryList("*.desktop");
+ TQStringList::ConstIterator it=list.begin();
for (; it!=list.end(); ++it) {
KDesktopFile* df=new KDesktopFile( dir.filePath(*it) );
dict.insert(*it, df);
}
}
-inline QString addSlash(const QString& _str) {
- QString str(_str);
+inline TQString addSlash(const TQString& _str) {
+ TQString str(_str);
if (str.right(1)!="/") str.append('/');
return str;
}
@@ -151,12 +151,12 @@ ExternalToolManager::ExternalToolManager() {
Q_ASSERT(!d->mUserToolDir.isEmpty());
LOG("d->mUserToolDir:" << d->mUserToolDir);
- QStringList dirs=KGlobal::dirs()->findDirs("appdata", "tools");
+ TQStringList dirs=KGlobal::dirs()->findDirs("appdata", "tools");
LOG("dirs:" << dirs.join(","));
// Loading desktop files
- QDict<KDesktopFile> systemDesktopFiles;
- QStringList::ConstIterator it;
+ TQDict<KDesktopFile> systemDesktopFiles;
+ TQStringList::ConstIterator it;
for (it=dirs.begin(); it!=dirs.end(); ++it) {
if (addSlash(*it)==d->mUserToolDir) {
LOG("skipping " << *it);
@@ -165,18 +165,18 @@ ExternalToolManager::ExternalToolManager() {
LOG("loading system desktop files from " << *it);
loadDesktopFiles(systemDesktopFiles, *it);
}
- QDict<KDesktopFile> userDesktopFiles;
+ TQDict<KDesktopFile> userDesktopFiles;
loadDesktopFiles(userDesktopFiles, d->mUserToolDir);
// Merge system and user desktop files into our KDesktopFile dictionary
d->mDesktopFiles=systemDesktopFiles;
d->mDesktopFiles.setAutoDelete(true);
- QDictIterator<KDesktopFile> itDict(userDesktopFiles);
+ TQDictIterator<KDesktopFile> itDict(userDesktopFiles);
for (; itDict.current(); ++itDict) {
- QString name=itDict.currentKey();
+ TQString name=itDict.currentKey();
KDesktopFile* df=itDict.current();
- if (d->mDesktopFiles.find(name)) {
+ if (d->mDesktopFiles.tqfind(name)) {
d->mDesktopFiles.remove(name);
}
if (df->readBoolEntry("Hidden")) {
@@ -204,7 +204,7 @@ ExternalToolManager* ExternalToolManager::instance() {
void ExternalToolManager::updateServices() {
d->mServices.clear();
- QDictIterator<KDesktopFile> it(d->mDesktopFiles);
+ TQDictIterator<KDesktopFile> it(d->mDesktopFiles);
for (; it.current(); ++it) {
KDesktopFile* desktopFile=it.current();
// If sync() is not called, KService does not read up to date content
@@ -215,14 +215,14 @@ void ExternalToolManager::updateServices() {
}
-QDict<KDesktopFile>& ExternalToolManager::desktopFiles() const {
+TQDict<KDesktopFile>& ExternalToolManager::desktopFiles() const {
return d->mDesktopFiles;
}
void ExternalToolManager::hideDesktopFile(KDesktopFile* desktopFile) {
- QFileInfo fi(desktopFile->fileName());
- QString name=QString("%1.desktop").arg( fi.baseName(true) );
+ TQFileInfo fi(desktopFile->fileName());
+ TQString name=TQString("%1.desktop").tqarg( fi.baseName(true) );
d->mDesktopFiles.take(name);
if (desktopFile->isReadOnly()) {
@@ -237,57 +237,57 @@ void ExternalToolManager::hideDesktopFile(KDesktopFile* desktopFile) {
KDesktopFile* ExternalToolManager::editSystemDesktopFile(const KDesktopFile* desktopFile) {
Q_ASSERT(desktopFile);
- QFileInfo fi(desktopFile->fileName());
+ TQFileInfo fi(desktopFile->fileName());
- QString name=fi.baseName(true);
- d->mDesktopFiles.remove(QString("%1.desktop").arg(name));
+ TQString name=fi.baseName(true);
+ d->mDesktopFiles.remove(TQString("%1.desktop").tqarg(name));
return createUserDesktopFile(name);
}
-KDesktopFile* ExternalToolManager::createUserDesktopFile(const QString& name) {
+KDesktopFile* ExternalToolManager::createUserDesktopFile(const TQString& name) {
Q_ASSERT(!name.isEmpty());
KDesktopFile* desktopFile=new KDesktopFile(
d->mUserToolDir + "/" + name + ".desktop", false);
- d->mDesktopFiles.insert(QString("%1.desktop").arg(name), desktopFile);
+ d->mDesktopFiles.insert(TQString("%1.desktop").tqarg(name), desktopFile);
return desktopFile;
}
ExternalToolContext* ExternalToolManager::createContext(
- QObject* parent, const KFileItemList* items)
+ TQObject* tqparent, const KFileItemList* items)
{
KURL::List urls;
- QStringList mimeTypes;
+ TQStringList mimeTypes;
// Create our URL list and a list of the different mime types present in
// the selection
- QPtrListIterator<KFileItem> it(*items);
+ TQPtrListIterator<KFileItem> it(*items);
for (; it.current(); ++it) {
urls.append(it.current()->url());
- QString mimeType=it.current()->mimetype();
- if (!mimeTypes.contains(mimeType)) {
+ TQString mimeType=it.current()->mimetype();
+ if (!mimeTypes.tqcontains(mimeType)) {
mimeTypes.append(mimeType);
}
}
- return d->createContextInternal(parent, urls, mimeTypes);
+ return d->createContextInternal(tqparent, urls, mimeTypes);
}
ExternalToolContext* ExternalToolManager::createContext(
- QObject* parent, const KURL& url)
+ TQObject* tqparent, const KURL& url)
{
KURL::List urls;
- QStringList mimeTypes;
+ TQStringList mimeTypes;
urls.append(url);
- QString mimeType=KMimeType::findByURL(url, 0, url.isLocalFile(), true)->name();
+ TQString mimeType=KMimeType::findByURL(url, 0, url.isLocalFile(), true)->name();
mimeTypes.append(mimeType);
- return d->createContextInternal(parent, urls, mimeTypes);
+ return d->createContextInternal(tqparent, urls, mimeTypes);
}