summaryrefslogtreecommitdiffstats
path: root/src/common/global
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
commit0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch)
treeb95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/common/global
parentb79a2c28534cf09987eeeba3077fff9236df182a (diff)
downloadpiklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz
piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip
TQt4 port piklab
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/common/global')
-rw-r--r--src/common/global/about.cpp8
-rw-r--r--src/common/global/about.h2
-rw-r--r--src/common/global/generic_config.cpp86
-rw-r--r--src/common/global/generic_config.h62
-rw-r--r--src/common/global/global.h38
-rw-r--r--src/common/global/log.cpp34
-rw-r--r--src/common/global/log.h70
-rw-r--r--src/common/global/pfile.cpp28
-rw-r--r--src/common/global/pfile.h28
-rw-r--r--src/common/global/process.cpp54
-rw-r--r--src/common/global/process.h67
-rw-r--r--src/common/global/progress_monitor.cpp12
-rw-r--r--src/common/global/progress_monitor.h17
-rw-r--r--src/common/global/purl.cpp198
-rw-r--r--src/common/global/purl.h60
-rw-r--r--src/common/global/xml_data_file.cpp108
-rw-r--r--src/common/global/xml_data_file.h32
17 files changed, 441 insertions, 463 deletions
diff --git a/src/common/global/about.cpp b/src/common/global/about.cpp
index 33bfae9..ffda7db 100644
--- a/src/common/global/about.cpp
+++ b/src/common/global/about.cpp
@@ -8,7 +8,7 @@
***************************************************************************/
#include "about.h"
-#if defined(Q_WS_WIN)
+#if defined(TQ_WS_WIN)
# define SVN_REVISION "windows"
#else
# include "svn_revision/svn_revision.h"
@@ -59,10 +59,10 @@ void Piklab::init(KAboutData *about, int argc, char **argv, bool gui, const KCmd
KCmdLineArgs::init(argc, argv, about);
KCmdLineArgs::addCmdLineOptions(options);
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
- (void)new QApplication(argc, argv, QApplication::Tty);
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
+ (void)new TQApplication(argc, argv, TQApplication::Tty);
# else
- (void)new QCoreApplication(argc, argv);
+ (void)new TQCoreApplication(argc, argv);
# endif
#else
(void)new KApplication(gui, gui);
diff --git a/src/common/global/about.h b/src/common/global/about.h
index e20ee46..4d53914 100644
--- a/src/common/global/about.h
+++ b/src/common/global/about.h
@@ -14,7 +14,7 @@
namespace Piklab
{
//-----------------------------------------------------------------------------
-class OptionList : public QValueList<KCmdLineOptions>
+class OptionList : public TQValueList<KCmdLineOptions>
{
public:
OptionList() : _options(0) {}
diff --git a/src/common/global/generic_config.cpp b/src/common/global/generic_config.cpp
index 841233b..6ddf44c 100644
--- a/src/common/global/generic_config.cpp
+++ b/src/common/global/generic_config.cpp
@@ -11,12 +11,12 @@
#include "global.h"
#if defined(NO_KDE)
-# include <qsettings.h>
+# include <tqsettings.h>
class GenericConfigPrivate
{
public:
- GenericConfigPrivate(const QString &group) { _settings.beginGroup("/piklab/" + group); }
- QSettings _settings;
+ GenericConfigPrivate(const TQString &group) { _settings.beginGroup("/piklab/" + group); }
+ TQSettings _settings;
};
#else
# include <kapplication.h>
@@ -24,7 +24,7 @@ public:
class GenericConfigPrivate
{
public:
- GenericConfigPrivate(const QString &group) : _group(group) {}
+ GenericConfigPrivate(const TQString &group) : _group(group) {}
~GenericConfigPrivate() { kapp->config()->sync(); }
KConfig &config() {
KConfig *conf = kapp->config();
@@ -33,11 +33,11 @@ public:
}
private:
- QString _group;
+ TQString _group;
};
#endif
-GenericConfig::GenericConfig(const QString &group)
+GenericConfig::GenericConfig(const TQString &group)
: _group(group)
{
_d = new GenericConfigPrivate(group);
@@ -57,10 +57,10 @@ void GenericConfig::rollback()
#endif
}
-QString GenericConfig::readEntry(const QString &key, const QString &def) const
+TQString GenericConfig::readEntry(const TQString &key, const TQString &def) const
{
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
return _d->_settings.readEntry(key, def);
# else
return _d->_settings.value(key, def).toString();
@@ -69,10 +69,10 @@ QString GenericConfig::readEntry(const QString &key, const QString &def) const
return _d->config().readEntry(key, def);
#endif
}
-void GenericConfig::writeEntry(const QString &key, const QString &value)
+void GenericConfig::writeEntry(const TQString &key, const TQString &value)
{
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
_d->_settings.writeEntry(key, value);
# else
_d->_settings.setValue(key, value);
@@ -82,10 +82,10 @@ void GenericConfig::writeEntry(const QString &key, const QString &value)
#endif
}
-QStringList GenericConfig::readListEntry(const QString &key, const QStringList &defaultValues) const
+TQStringList GenericConfig::readListEntry(const TQString &key, const TQStringList &defaultValues) const
{
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
if ( _d->_settings.readEntry(key).isNull() ) return defaultValues;
return _d->_settings.readListEntry(key);
# else
@@ -96,10 +96,10 @@ QStringList GenericConfig::readListEntry(const QString &key, const QStringList &
return _d->config().readListEntry(key);
#endif
}
-void GenericConfig::writeEntry(const QString &key, const QStringList &value)
+void GenericConfig::writeEntry(const TQString &key, const TQStringList &value)
{
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
_d->_settings.writeEntry(key, value);
# else
_d->_settings.setValue(key, value);
@@ -109,12 +109,12 @@ void GenericConfig::writeEntry(const QString &key, const QStringList &value)
#endif
}
-QValueList<int> GenericConfig::readIntListEntry(const QString &key) const
+TQValueList<int> GenericConfig::readIntListEntry(const TQString &key) const
{
#if defined(NO_KDE)
- QValueList<int> ilist;
- QStringList list = readListEntry(key, QStringList());
- QStringList::const_iterator it;
+ TQValueList<int> ilist;
+ TQStringList list = readListEntry(key, TQStringList());
+ TQStringList::const_iterator it;
for (it=list.begin(); it!=list.end(); ++it) {
bool ok;
int v = (*it).toInt(&ok);
@@ -126,32 +126,32 @@ QValueList<int> GenericConfig::readIntListEntry(const QString &key) const
return _d->config().readIntListEntry(key);
#endif
}
-void GenericConfig::writeEntry(const QString &key, const QValueList<int> &value)
+void GenericConfig::writeEntry(const TQString &key, const TQValueList<int> &value)
{
#if defined(NO_KDE)
- QStringList list;
- QValueList<int>::const_iterator it;
- for (it=value.begin(); it!=value.end(); ++it) list.append(QString::number(*it));
+ TQStringList list;
+ TQValueList<int>::const_iterator it;
+ for (it=value.begin(); it!=value.end(); ++it) list.append(TQString::number(*it));
writeEntry(key, list);
#else
_d->config().writeEntry(key, value);
#endif
}
-QSize GenericConfig::readSizeEntry(const QString &key, const QSize *def) const
+TQSize GenericConfig::readSizeEntry(const TQString &key, const TQSize *def) const
{
#if defined(NO_KDE)
- QValueList<int> list = readIntListEntry(key);
+ TQValueList<int> list = readIntListEntry(key);
if ( list.count()!=2 ) return *def;
- return QSize(list[0], list[1]);
+ return TQSize(list[0], list[1]);
#else
return _d->config().readSizeEntry(key, def);
#endif
}
-void GenericConfig::writeEntry(const QString &key, const QSize &value)
+void GenericConfig::writeEntry(const TQString &key, const TQSize &value)
{
#if defined(NO_KDE)
- QValueList<int> ilist;
+ TQValueList<int> ilist;
ilist.append(value.width());
ilist.append(value.height());
writeEntry(key, ilist);
@@ -160,10 +160,10 @@ void GenericConfig::writeEntry(const QString &key, const QSize &value)
#endif
}
-bool GenericConfig::readBoolEntry(const QString &key, bool def) const
+bool GenericConfig::readBoolEntry(const TQString &key, bool def) const
{
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
return _d->_settings.readBoolEntry(key, def);
# else
return _d->_settings.value(key, def).toBool();
@@ -172,10 +172,10 @@ bool GenericConfig::readBoolEntry(const QString &key, bool def) const
return _d->config().readBoolEntry(key, def);
#endif
}
-void GenericConfig::writeEntry(const QString &key, bool value)
+void GenericConfig::writeEntry(const TQString &key, bool value)
{
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
_d->_settings.writeEntry(key, value);
# else
_d->_settings.setValue(key, value);
@@ -185,10 +185,10 @@ void GenericConfig::writeEntry(const QString &key, bool value)
#endif
}
-int GenericConfig::readIntEntry(const QString &key, int def) const
+int GenericConfig::readIntEntry(const TQString &key, int def) const
{
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
return _d->_settings.readNumEntry(key, def);
# else
return _d->_settings.value(key, def).toInt();
@@ -197,10 +197,10 @@ int GenericConfig::readIntEntry(const QString &key, int def) const
return _d->config().readNumEntry(key, def);
#endif
}
-void GenericConfig::writeEntry(const QString &key, int value)
+void GenericConfig::writeEntry(const TQString &key, int value)
{
#if defined(NO_KDE)
-# if QT_VERSION<0x040000
+# if [[[TQT_VERSION IS DEPRECATED]]]<0x040000
_d->_settings.writeEntry(key, value);
# else
_d->_settings.setValue(key, value);
@@ -210,7 +210,7 @@ void GenericConfig::writeEntry(const QString &key, int value)
#endif
}
-void GenericConfig::deleteGroup(const QString &group)
+void GenericConfig::deleteGroup(const TQString &group)
{
#if defined(NO_KDE)
Q_UNUSED(group);
@@ -220,22 +220,22 @@ void GenericConfig::deleteGroup(const QString &group)
#endif
}
-QVariant GenericConfig::readVariantEntry(const QString &key, const QVariant &defValue) const
+TQVariant GenericConfig::readVariantEntry(const TQString &key, const TQVariant &defValue) const
{
switch (defValue.type()) {
- case QVariant::Bool: return QVariant(readBoolEntry(key, defValue.toBool()), 0);
- case QVariant::UInt: return readUIntEntry(key, defValue.toUInt());
+ case TQVariant::Bool: return TQVariant(readBoolEntry(key, defValue.toBool()), 0);
+ case TQVariant::UInt: return readUIntEntry(key, defValue.toUInt());
default: break;
}
Q_ASSERT(false);
- return QVariant();
+ return TQVariant();
}
-void GenericConfig::writeEntry(const QString &key, const QVariant &v)
+void GenericConfig::writeEntry(const TQString &key, const TQVariant &v)
{
switch (v.type()) {
- case QVariant::Bool: writeEntry(key, v.toBool()); break;
- case QVariant::UInt: writeEntry(key, v.toUInt()); break;
+ case TQVariant::Bool: writeEntry(key, v.toBool()); break;
+ case TQVariant::UInt: writeEntry(key, v.toUInt()); break;
default: Q_ASSERT(false); break;
}
}
diff --git a/src/common/global/generic_config.h b/src/common/global/generic_config.h
index 70dfeaa..74002e5 100644
--- a/src/common/global/generic_config.h
+++ b/src/common/global/generic_config.h
@@ -9,8 +9,8 @@
#ifndef GENERIC_CONFIG_H
#define GENERIC_CONFIG_H
-#include <qvariant.h>
-#include <qsize.h>
+#include <tqvariant.h>
+#include <tqsize.h>
#include "global.h"
#include "common/common/misc.h"
@@ -20,50 +20,50 @@ class GenericConfigPrivate;
class GenericConfig
{
public:
- GenericConfig(const QString &group);
+ GenericConfig(const TQString &group);
~GenericConfig();
- QString group() const { return _group; }
+ TQString group() const { return _group; }
void rollback();
- QString readEntry(const QString &key, const QString &def = QString::null) const;
- void writeEntry(const QString &key, const QString &value);
- void writeEntry(const QString &key, const QCString &value) { writeEntry(key, QString(value)); }
- void writeEntry(const QString &key, const char *value) { writeEntry(key, QString(value)); }
- QStringList readListEntry(const QString &key, const QStringList &defaultValues) const;
- void writeEntry(const QString &key, const QStringList &value);
- QValueList<int> readIntListEntry(const QString &key) const;
- void writeEntry(const QString &key, const QValueList<int> &value);
- QSize readSizeEntry(const QString &key, const QSize *def = 0) const;
- void writeEntry(const QString &key, const QSize &value);
- bool readBoolEntry(const QString &key, bool def) const;
- void writeEntry(const QString &key, bool value);
- int readIntEntry(const QString &key, int def = 0) const;
- void writeEntry(const QString &key, int value);
- uint readUIntEntry(const QString &key, uint def = 0) const { return qMax(0, readIntEntry(key, def)); }
- void writeEntry(const QString &key, uint value) { writeEntry(key, int(value)); }
+ TQString readEntry(const TQString &key, const TQString &def = TQString()) const;
+ void writeEntry(const TQString &key, const TQString &value);
+ void writeEntry(const TQString &key, const TQCString &value) { writeEntry(key, TQString(value)); }
+ void writeEntry(const TQString &key, const char *value) { writeEntry(key, TQString(value)); }
+ TQStringList readListEntry(const TQString &key, const TQStringList &defaultValues) const;
+ void writeEntry(const TQString &key, const TQStringList &value);
+ TQValueList<int> readIntListEntry(const TQString &key) const;
+ void writeEntry(const TQString &key, const TQValueList<int> &value);
+ TQSize readSizeEntry(const TQString &key, const TQSize *def = 0) const;
+ void writeEntry(const TQString &key, const TQSize &value);
+ bool readBoolEntry(const TQString &key, bool def) const;
+ void writeEntry(const TQString &key, bool value);
+ int readIntEntry(const TQString &key, int def = 0) const;
+ void writeEntry(const TQString &key, int value);
+ uint readUIntEntry(const TQString &key, uint def = 0) const { return qMax(0, readIntEntry(key, def)); }
+ void writeEntry(const TQString &key, uint value) { writeEntry(key, int(value)); }
template <typename Enum>
- Enum readEnumEntry(const QString &key, Enum def = Enum::Nb_Types) const { return Enum::fromKey(readEntry(key, def.key())); }
+ Enum readEnumEntry(const TQString &key, Enum def = Enum::Nb_Types) const { return Enum::fromKey(readEntry(key, def.key())); }
template <typename Enum>
- void writeEnumEntry(const QString &key, Enum v) { writeEntry(key, v.key()); }
- QVariant readVariantEntry(const QString &key, const QVariant &defValue) const;
- void writeEntry(const QString &key, const QVariant &value);
+ void writeEnumEntry(const TQString &key, Enum v) { writeEntry(key, v.key()); }
+ TQVariant readVariantEntry(const TQString &key, const TQVariant &defValue) const;
+ void writeEntry(const TQString &key, const TQVariant &value);
- static void deleteGroup(const QString &group);
+ static void deleteGroup(const TQString &group);
struct ItemData {
const char *key, *label;
- QVariant defValue;
+ TQVariant defValue;
};
template <typename Type>
- QVariant readVariantEntry(Type type) const { return readVariantEntry(type.data().key, type.data().defValue); }
+ TQVariant readVariantEntry(Type type) const { return readVariantEntry(type.data().key, type.data().defValue); }
template <typename Type>
- void writeVariantEntry(Type type, const QVariant &value) {
+ void writeVariantEntry(Type type, const TQVariant &value) {
Q_ASSERT( value.type()==type.data().defValue.type() );
writeEntry(type.data().key, value);
}
private:
- QString _group;
+ TQString _group;
GenericConfigPrivate *_d;
};
@@ -72,11 +72,11 @@ private:
#define END_DECLARE_CONFIG(Type, group) \
END_DECLARE_ENUM(Type, GenericConfig::ItemData) \
- inline QVariant readConfigEntry(Type type) { \
+ inline TQVariant readConfigEntry(Type type) { \
GenericConfig config(group); \
return config.readVariantEntry<Type>(type); \
} \
- inline void writeConfigEntry(Type type, const QVariant &v) { \
+ inline void writeConfigEntry(Type type, const TQVariant &v) { \
GenericConfig config(group); \
config.writeVariantEntry<Type>(type, v); \
}
diff --git a/src/common/global/global.h b/src/common/global/global.h
index 72dab0e..9eb8979 100644
--- a/src/common/global/global.h
+++ b/src/common/global/global.h
@@ -9,37 +9,21 @@
#ifndef GLOBAL_H
#define GLOBAL_H
-#include <qglobal.h>
+#include <tqglobal.h>
-#if QT_VERSION<0x040000
-# include <qapplication.h>
-# include <qvaluelist.h>
-# include <qvaluevector.h>
-# include <qmemarray.h>
+# include <tqapplication.h>
+# include <tqvaluelist.h>
+# include <tqvaluevector.h>
+# include <tqmemarray.h>
# include "common/common/qflags.h"
-# define qMax QMAX
-# define qMin QMIN
-# include <qurl.h>
-# define Q3Url QUrl
-# include <qguardedptr.h>
-#else
-# include <qcoreapplication.h>
-# include <Qt3Support/Q3ValueList>
-# define QValueList Q3ValueList
-# include <Qt3Support/Q3ValueVector>
-# define QValueVector Q3ValueVector
-# include <Qt3Support/Q3MemArray>
-# define QMemArray Q3MemArray
-# define qHeapSort qSort
-# include <Qt3Support/Q3Url>
-# include <Qt3Support/Q3MimeSourceFactory>
-# define QMimeSourceFactory Q3MimeSourceFactory
-# include <qpointer.h>
-# define QGuardedPtr QPointer
-#endif
+# define qMax TQMAX
+# define qMin TQMIN
+# include <tqurl.h>
+# define Q3Url TQUrl
+# include <tqguardedptr.h>
#if defined(NO_KDE)
-# include "qt_config.h"
+# include "tqt_config.h"
# include "common/nokde/nokde_kurl.h"
# include "common/nokde/nokde_klocale.h"
# include "common/nokde/nokde_kaboutdata.h"
diff --git a/src/common/global/log.cpp b/src/common/global/log.cpp
index cf85303..1ab42d0 100644
--- a/src/common/global/log.cpp
+++ b/src/common/global/log.cpp
@@ -8,7 +8,7 @@
***************************************************************************/
#include "log.h"
-#include <qeventloop.h>
+#include <tqeventloop.h>
#include "global.h"
//-----------------------------------------------------------------------------
@@ -41,12 +41,12 @@ void Log::View::setDebugLevel(DebugLevel level)
_debugLevel = level;
}
-void Log::View::log(LineType type, const QString &text, Action action)
+void Log::View::log(LineType type, const TQString &text, Action action)
{
if ( _modes[type.type()]==Show ) doLog(type, text, action);
}
-void Log::View::log(DebugLevel level, const QString &text, Action action)
+void Log::View::log(DebugLevel level, const TQString &text, Action action)
{
Q_ASSERT( level!=DebugLevel::Quiet );
updateDebugLevel();
@@ -59,30 +59,30 @@ void Log::View::logUserAbort()
}
//-----------------------------------------------------------------------------
-void Log::StringView::sorry(const QString &message, const QString &details)
+void Log::StringView::sorry(const TQString &message, const TQString &details)
{
if ( details.isEmpty() ) _s += message;
else _s += message + ": " + details;
}
-bool Log::StringView::askContinue(const QString &message)
+bool Log::StringView::askContinue(const TQString &message)
{
log(LineType::Warning, message, Immediate);
return false; // always fail
}
//-----------------------------------------------------------------------------
-Log::Base::Base(Base *parent)
+Log::Base::Base(Base *tqparent)
: _parent(0), _data(0)
{
- setParent(parent);
+ setParent(tqparent);
}
-void Log::Base::setParent(Base *parent)
+void Log::Base::setParent(Base *tqparent)
{
delete _data;
- _parent = parent;
- _data = (parent ? 0 : new LogData);
+ _parent = tqparent;
+ _data = (tqparent ? 0 : new LogData);
}
Log::Base::~Base()
@@ -101,28 +101,28 @@ void Log::Base::logUserAbort()
if ( view() ) view()->logUserAbort();
}
-void Log::Base::log(LineType type, const QString &message, Action action)
+void Log::Base::log(LineType type, const TQString &message, Action action)
{
if ( type==LineType::Error ) setError(message);
if ( view() ) view()->log(type, message, action);
}
-void Log::Base::log(DebugLevel level, const QString &message, Action action)
+void Log::Base::log(DebugLevel level, const TQString &message, Action action)
{
if ( view() ) view()->log(level, message, action);
}
-void Log::Base::appendToLastLine(const QString &text)
+void Log::Base::appendToLastLine(const TQString &text)
{
if ( view() ) view()->appendToLastLine(text);
}
-void Log::Base::sorry(const QString &message, const QString &details)
+void Log::Base::sorry(const TQString &message, const TQString &details)
{
if ( view() ) view()->sorry(message, details);
}
-bool Log::Base::askContinue(const QString &message)
+bool Log::Base::askContinue(const TQString &message)
{
if ( view()==0 ) return false;
return view()->askContinue(message);
@@ -135,9 +135,9 @@ void Log::Base::clear()
}
//-----------------------------------------------------------------------------
-QString Log::KeyList::text() const
+TQString Log::KeyList::text() const
{
- QString text;
+ TQString text;
if ( !_title.isEmpty() ) text += _title + "\n";
uint nb = 0;
for (uint i=0; i<uint(_keys.count()); i++) nb = qMax(nb, uint(_keys[i].length()));
diff --git a/src/common/global/log.h b/src/common/global/log.h
index 7383d57..eff0b88 100644
--- a/src/common/global/log.h
+++ b/src/common/global/log.h
@@ -9,7 +9,7 @@
#ifndef LOG_H
#define LOG_H
-#include <qstringlist.h>
+#include <tqstringlist.h>
#include "common/common/key_enum.h"
@@ -34,11 +34,11 @@ class Generic
{
public:
virtual ~Generic() {}
- virtual void log(LineType type, const QString &text, Action action = Immediate) = 0;
- virtual void log(DebugLevel level, const QString &text, Action action = Immediate) = 0;
- virtual void appendToLastLine(const QString &text) = 0;
- virtual void sorry(const QString &message, const QString &details) = 0;
- virtual bool askContinue(const QString &message) = 0;
+ virtual void log(LineType type, const TQString &text, Action action = Immediate) = 0;
+ virtual void log(DebugLevel level, const TQString &text, Action action = Immediate) = 0;
+ virtual void appendToLastLine(const TQString &text) = 0;
+ virtual void sorry(const TQString &message, const TQString &details) = 0;
+ virtual bool askContinue(const TQString &message) = 0;
virtual void clear() = 0;
virtual void logUserAbort() = 0;
};
@@ -50,8 +50,8 @@ public:
ShowMode showMode(LineType type) const { return _modes[type.type()]; }
void setShowMode(LineType type, ShowMode mode) { _modes[type.type()] = mode; }
void setDebugLevel(DebugLevel level);
- virtual void log(LineType type, const QString &text, Action action = Immediate);
- virtual void log(DebugLevel level, const QString &text, Action action = Immediate);
+ virtual void log(LineType type, const TQString &text, Action action = Immediate);
+ virtual void log(DebugLevel level, const TQString &text, Action action = Immediate);
virtual void logUserAbort();
protected:
@@ -59,8 +59,8 @@ protected:
DebugLevel _debugLevel;
virtual void updateDebugLevel() {}
- virtual void doLog(LineType type, const QString &text, Action action) = 0;
- virtual void doLog(DebugLevel level, const QString &text, Action action) = 0;
+ virtual void doLog(LineType type, const TQString &text, Action action) = 0;
+ virtual void doLog(DebugLevel level, const TQString &text, Action action) = 0;
};
//-----------------------------------------------------------------------------
@@ -68,38 +68,38 @@ class StringView : public View
{
public:
StringView() {}
- QString string() const { return _s; }
- virtual void appendToLastLine(const QString &text) { _s += text; }
- virtual void clear() { _s = QString::null; }
- virtual void sorry(const QString &message, const QString &details);
- virtual bool askContinue(const QString &message);
+ TQString string() const { return _s; }
+ virtual void appendToLastLine(const TQString &text) { _s += text; }
+ virtual void clear() { _s = TQString(); }
+ virtual void sorry(const TQString &message, const TQString &details);
+ virtual bool askContinue(const TQString &message);
private:
- QString _s;
+ TQString _s;
- virtual void doLog(LineType, const QString &text, Action) { _s += text + "\n"; }
- virtual void doLog(DebugLevel, const QString &text, Action) { _s += text + "\n"; }
+ virtual void doLog(LineType, const TQString &text, Action) { _s += text + "\n"; }
+ virtual void doLog(DebugLevel, const TQString &text, Action) { _s += text + "\n"; }
};
//-----------------------------------------------------------------------------
class Base : public Generic
{
public:
- Base(Base *parent = 0);
+ Base(Base *tqparent = 0);
virtual ~Base();
- void setParent(Base *parent);
+ void setParent(Base *tqparent);
void setView(View *view);
View *view() { return logData()->view; }
- virtual void log(LineType type, const QString &message, Action action = Immediate);
- virtual void log(DebugLevel level, const QString &message, Action action = Immediate);
- virtual void appendToLastLine(const QString &text);
- void setError(const QString &error) { logData()->error = error; }
+ virtual void log(LineType type, const TQString &message, Action action = Immediate);
+ virtual void log(DebugLevel level, const TQString &message, Action action = Immediate);
+ virtual void appendToLastLine(const TQString &text);
+ void setError(const TQString &error) { logData()->error = error; }
virtual bool hasError() const { return !logData()->error.isNull(); }
- virtual QString error() const { return logData()->error; }
- virtual void resetError() { logData()->error = QString::null; }
- virtual void sorry(const QString &message, const QString &details = QString::null);
- virtual bool askContinue(const QString &message);
+ virtual TQString error() const { return logData()->error; }
+ virtual void resetError() { logData()->error = TQString(); }
+ virtual void sorry(const TQString &message, const TQString &details = TQString());
+ virtual bool askContinue(const TQString &message);
virtual void clear();
void logUserAbort();
@@ -108,7 +108,7 @@ protected:
class LogData {
public:
LogData() : view(0) {}
- QString error;
+ TQString error;
View *view;
};
LogData *_data;
@@ -118,15 +118,15 @@ protected:
class KeyList {
public:
- KeyList(const QString &title = QString::null) : _title(title) {}
- void setTitle(const QString &title) { _title = title; }
- void append(const QString &key, const QString &label) { _keys += key; _labels += label; }
- QString text() const;
+ KeyList(const TQString &title = TQString()) : _title(title) {}
+ void setTitle(const TQString &title) { _title = title; }
+ void append(const TQString &key, const TQString &label) { _keys += key; _labels += label; }
+ TQString text() const;
void display(Generic &log) const;
private:
- QString _title;
- QStringList _keys, _labels;
+ TQString _title;
+ TQStringList _keys, _labels;
};
} // namespace
diff --git a/src/common/global/pfile.cpp b/src/common/global/pfile.cpp
index 71cee16..66d7f4b 100644
--- a/src/common/global/pfile.cpp
+++ b/src/common/global/pfile.cpp
@@ -8,10 +8,10 @@
***************************************************************************/
#include "pfile.h"
-#include <qfile.h>
+#include <tqfile.h>
//-----------------------------------------------------------------------------
-PURL::FileBase::FileBase(Log::Generic &log, const QString &extension)
+PURL::FileBase::FileBase(Log::Generic &log, const TQString &extension)
: _tmp(0), _file(0), _stream(0), _extension(extension), _log(log)
{}
@@ -22,12 +22,12 @@ PURL::FileBase::~FileBase()
delete _tmp;
}
-const QFile *PURL::FileBase::qfile() const
+const TQFile *PURL::FileBase::qfile() const
{
return (_tmp ? _tmp->file() : _file);
}
-QFile *PURL::FileBase::qfile()
+TQFile *PURL::FileBase::qfile()
{
return (_tmp ? _tmp->file() : _file);
}
@@ -37,9 +37,9 @@ void PURL::FileBase::flush()
if ( qfile() ) qfile()->flush();
}
-QTextStream &PURL::FileBase::stream()
+TQTextStream &PURL::FileBase::stream()
{
- if ( _stream==0 ) _stream = new QTextStream(qfile());
+ if ( _stream==0 ) _stream = new TQTextStream(qfile());
return *_stream;
}
@@ -49,7 +49,7 @@ bool PURL::FileBase::hasError() const
return ( uint(qfile()->status())!=IO_Ok );
}
-QString PURL::FileBase::errorString() const
+TQString PURL::FileBase::errorString() const
{
if ( _error.isEmpty() ) {
if ( qfile()==0 ) return i18n("File not open.");
@@ -58,28 +58,28 @@ QString PURL::FileBase::errorString() const
return _error;
}
-QStringList PURL::FileBase::readLines()
+TQStringList PURL::FileBase::readLines()
{
- QStringList lines;
+ TQStringList lines;
for (;;) {
- QString s = stream().readLine();
+ TQString s = stream().readLine();
if ( s.isNull() ) break;
lines.append(s);
}
return lines;
}
-QByteArray PURL::FileBase::readAll()
+TQByteArray PURL::FileBase::readAll()
{
if ( qfile() ) return qfile()->readAll();
- return QByteArray();
+ return TQByteArray();
}
//-----------------------------------------------------------------------------
PURL::File::File(const Url &url, Log::Generic &log)
- : FileBase(log, QString::null), _url(url)
+ : FileBase(log, TQString()), _url(url)
{
- _file = new QFile;
+ _file = new TQFile;
}
void PURL::File::setUrl(const Url &url)
diff --git a/src/common/global/pfile.h b/src/common/global/pfile.h
index d0955e7..477d7c0 100644
--- a/src/common/global/pfile.h
+++ b/src/common/global/pfile.h
@@ -9,7 +9,7 @@
#ifndef PFILE_H
#define PFILE_H
-#include <qtextstream.h>
+#include <tqtextstream.h>
#include "purl.h"
namespace PURL
@@ -18,25 +18,25 @@ namespace PURL
class FileBase
{
public:
- FileBase(Log::Generic &log, const QString &extension);
+ FileBase(Log::Generic &log, const TQString &extension);
~FileBase();
- QFile *qfile();
- const QFile *qfile() const;
- QTextStream &stream();
- QString readText() { return stream().read(); }
- QString readLine() { return stream().readLine(); }
- QStringList readLines();
- QByteArray readAll();
- void appendText(const QString &text) { stream() << text; }
+ TQFile *qfile();
+ const TQFile *qfile() const;
+ TQTextStream &stream();
+ TQString readText() { return stream().read(); }
+ TQString readLine() { return stream().readLine(); }
+ TQStringList readLines();
+ TQByteArray readAll();
+ void appendText(const TQString &text) { stream() << text; }
void flush();
bool hasError() const;
- QString errorString() const;
+ TQString errorString() const;
protected:
KTempFile *_tmp;
- QFile *_file;
- QTextStream *_stream;
- QString _error, _extension;
+ TQFile *_file;
+ TQTextStream *_stream;
+ TQString _error, _extension;
Log::Generic &_log;
private: // disable copy constructor and operator =
diff --git a/src/common/global/process.cpp b/src/common/global/process.cpp
index 7659eea..1efe715 100644
--- a/src/common/global/process.cpp
+++ b/src/common/global/process.cpp
@@ -8,7 +8,7 @@
***************************************************************************/
#include "process.h"
-#include <qdatetime.h>
+#include <tqdatetime.h>
#if defined(NO_KDE)
# include "common/nokde/nokde_kprocess.h"
@@ -22,8 +22,8 @@
Process::State Process::runSynchronously(Base &process, RunActions actions, uint timeout)
{
Synchronous sync(timeout);
- QObject::connect(&process, SIGNAL(done(int)), &sync, SLOT(done()));
- QObject::connect(&process, SIGNAL(requestSynchronousStop()), &sync, SLOT(done()));
+ TQObject::connect(&process, TQT_SIGNAL(done(int)), &sync, TQT_SLOT(done()));
+ TQObject::connect(&process, TQT_SIGNAL(requestSynchronousStop()), &sync, TQT_SLOT(done()));
if ( (actions & Start) && !process.start(0) ) return process.state();
Q_ASSERT( process.isRunning() );
if ( !sync.enterLoop() ) process.timeoutSlot();
@@ -31,15 +31,15 @@ Process::State Process::runSynchronously(Base &process, RunActions actions, uint
}
//----------------------------------------------------------------------------
-Process::Base::Base(QObject *parent, const char *name)
- : QObject(parent, name), _state(Stopped)
+Process::Base::Base(TQObject *tqparent, const char *name)
+ : TQObject(tqparent, name), _state(Stopped)
{
_process = new KProcess(this);
- connect(_process, SIGNAL(processExited(KProcess *)), SLOT(exited()));
- connect(_process, SIGNAL(receivedStdout(KProcess *, char *, int)), SLOT(receivedStdout(KProcess*, char *, int)));
- connect(_process, SIGNAL(receivedStderr(KProcess *, char *, int)), SLOT(receivedStderr(KProcess*, char *, int)));
- _timer = new QTimer(this);
- connect(_timer, SIGNAL(timeout()), SLOT(timeoutSlot()));
+ connect(_process, TQT_SIGNAL(processExited(KProcess *)), TQT_SLOT(exited()));
+ connect(_process, TQT_SIGNAL(receivedStdout(KProcess *, char *, int)), TQT_SLOT(receivedStdout(KProcess*, char *, int)));
+ connect(_process, TQT_SIGNAL(receivedStderr(KProcess *, char *, int)), TQT_SLOT(receivedStderr(KProcess*, char *, int)));
+ _timer = new TQTimer(this);
+ connect(_timer, TQT_SIGNAL(timeout()), TQT_SLOT(timeoutSlot()));
}
Process::Base::~Base()
@@ -47,27 +47,27 @@ Process::Base::~Base()
_process->kill();
}
-QStringList Process::Base::arguments() const
+TQStringList Process::Base::arguments() const
{
- if ( _process==0 ) return QStringList();
+ if ( _process==0 ) return TQStringList();
#if defined(NO_KDE)
return _process->args();
#else
- QStringList list;
- const QValueList<QCString> &args = _process->args();
+ TQStringList list;
+ const TQValueList<TQCString> &args = _process->args();
for (uint i=0; i<args.count(); i++) list.append(args[i]);
return list;
#endif
}
-void Process::Base::setup(const QString &executable, const QStringList &options, bool withWine)
+void Process::Base::setup(const TQString &executable, const TQStringList &options, bool withWine)
{
_state = Stopped;
_timer->stop();
_process->clearArguments();
if (withWine) {
_process->setEnvironment("WINEDEBUG", "-all");
- *_process << QString("wine");
+ *_process << TQString("wine");
}
*_process << executable;
*_process << options;
@@ -77,8 +77,8 @@ bool Process::Base::start(uint timeout)
{
_state = Stopped;
_timer->stop();
- _stdout = QString::null;
- _stderr = QString::null;
+ _stdout = TQString();
+ _stderr = TQString();
#if defined(NO_KDE)
if ( !_process->start() ) {
#else
@@ -116,9 +116,9 @@ bool Process::Base::isRunning() const
return _process->isRunning();
}
-void Process::Base::writeToStdin(const QString &s)
+void Process::Base::writeToStdin(const TQString &s)
{
- QCString cs = s.latin1();
+ TQCString cs = s.latin1();
_process->writeStdin(cs.data(), cs.length());
}
@@ -137,7 +137,7 @@ void Process::Base::setUseShell(bool useShell)
_process->setUseShell(useShell);
}
-bool Process::Base::isFilteredLine(const QString &line)
+bool Process::Base::isFilteredLine(const TQString &line)
{
// "wine" returns all those "libGL warning" that mess up the output...
return line.startsWith("libGL warning");
@@ -146,13 +146,13 @@ bool Process::Base::isFilteredLine(const QString &line)
//----------------------------------------------------------------------------
void Process::StringOutput::receivedStdout(KProcess*, char *data, int len)
{
- _stdout += QString::fromLatin1(data, len);
+ _stdout += TQString::tqfromLatin1(data, len);
emit stdoutDataReceived();
}
void Process::StringOutput::receivedStderr(KProcess*, char *data, int len)
{
- _stderr += QString::fromLatin1(data, len);
+ _stderr += TQString::tqfromLatin1(data, len);
emit stderrDataReceived();
}
@@ -163,8 +163,8 @@ void Process::LineBase::receivedStdout(KProcess*, char *data, int len)
if ( data[i]=='\r' ) continue;
if ( data[i]=='\n' ) {
if ( !isFilteredLine(_stdout) ) addStdoutLine(_stdout);
- _stdout = QString::null;
- } else _stdout += QString::fromLatin1(data + i, 1);
+ _stdout = TQString();
+ } else _stdout += TQString::tqfromLatin1(data + i, 1);
}
if ( !_process->isRunning() && !isFilteredLine(_stdout) ) addStdoutLine(_stdout);
emit stdoutDataReceived();
@@ -176,8 +176,8 @@ void Process::LineBase::receivedStderr(KProcess*, char *data, int len)
if ( data[i]=='\r' ) continue;
if ( data[i]=='\n' ) {
if ( !isFilteredLine(_stderr) ) addStderrLine(_stderr);
- _stderr = QString::null;
- } else _stderr += QString::fromLatin1(data + i, 1);
+ _stderr = TQString();
+ } else _stderr += TQString::tqfromLatin1(data + i, 1);
}
if ( !_process->isRunning() && !isFilteredLine(_stderr) ) addStderrLine(_stderr);
emit stderrDataReceived();
diff --git a/src/common/global/process.h b/src/common/global/process.h
index 9c67149..d4e7db0 100644
--- a/src/common/global/process.h
+++ b/src/common/global/process.h
@@ -10,9 +10,9 @@
#define PROCESS_H
#include <signal.h>
-#include <qstringlist.h>
-#include <qobject.h>
-#include <qtimer.h>
+#include <tqstringlist.h>
+#include <tqobject.h>
+#include <tqtimer.h>
class KProcess;
#include "global.h"
@@ -23,24 +23,25 @@ namespace Process
enum State { Stopped, StartFailed, Running, Exited, Timedout };
class Base;
enum RunAction { NoRunAction = 0, Start = 1 };
-Q_DECLARE_FLAGS(RunActions, RunAction)
-Q_DECLARE_OPERATORS_FOR_FLAGS(RunActions)
+TQ_DECLARE_FLAGS(RunActions, RunAction)
+TQ_DECLARE_OPERATORS_FOR_FLAGS(RunActions)
extern State runSynchronously(Base &process, RunActions actions, uint timeout); // in ms (0 == no timeout)
//----------------------------------------------------------------------------
-class Base : public QObject
+class Base : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
- Base(QObject *parent, const char *name);
+ Base(TQObject *tqparent, const char *name);
virtual ~Base();
- void setup(const QString &executable, const QStringList &options, bool withWine);
- QStringList arguments() const;
+ void setup(const TQString &executable, const TQStringList &options, bool withWine);
+ TQStringList arguments() const;
void setWorkingDirectory(const PURL::Directory &dir);
void setUseShell(bool useShell);
virtual bool start(uint timeout); // in ms (0 == no timeout)
- QString prettyCommand() const { return arguments().join(" "); }
- void writeToStdin(const QString &s);
+ TQString prettyCommand() const { return arguments().join(" "); }
+ void writeToStdin(const TQString &s);
bool signal(int n);
bool isRunning() const;
State state() const { return _state; }
@@ -64,20 +65,21 @@ protected slots:
protected:
State _state;
KProcess *_process;
- QTimer *_timer;
- QString _stdout, _stderr;
+ TQTimer *_timer;
+ TQString _stdout, _stderr;
- static bool isFilteredLine(const QString &line);
+ static bool isFilteredLine(const TQString &line);
};
//----------------------------------------------------------------------------
class StringOutput : public Base
{
Q_OBJECT
+ TQ_OBJECT
public:
- StringOutput(QObject *parent = 0, const char *name = 0) : Base(parent, name) {}
- QString sout() const { return _stdout; }
- QString serr() const { return _stderr; }
+ StringOutput(TQObject *tqparent = 0, const char *name = 0) : Base(tqparent, name) {}
+ TQString sout() const { return _stdout; }
+ TQString serr() const { return _stderr; }
private slots:
virtual void receivedStdout(KProcess *, char *buffer, int len);
@@ -88,49 +90,52 @@ private slots:
class LineBase : public Base
{
Q_OBJECT
+ TQ_OBJECT
public:
- LineBase(QObject *parent = 0, const char *name = 0) : Base(parent, name) {}
+ LineBase(TQObject *tqparent = 0, const char *name = 0) : Base(tqparent, name) {}
private slots:
virtual void receivedStdout(KProcess *, char *buffer, int len);
virtual void receivedStderr(KProcess *, char *buffer, int len);
private:
- virtual void addStdoutLine(const QString &line) = 0;
- virtual void addStderrLine(const QString &line) = 0;
+ virtual void addStdoutLine(const TQString &line) = 0;
+ virtual void addStderrLine(const TQString &line) = 0;
};
//----------------------------------------------------------------------------
class LineOutput : public LineBase
{
Q_OBJECT
+ TQ_OBJECT
public:
- LineOutput(QObject *parent = 0, const char *name = 0) : LineBase(parent, name) {}
+ LineOutput(TQObject *tqparent = 0, const char *name = 0) : LineBase(tqparent, name) {}
virtual bool start(uint timeout);
- QStringList sout() const { return _stdoutLines; }
- QStringList serr() const { return _stderrLines; }
+ TQStringList sout() const { return _stdoutLines; }
+ TQStringList serr() const { return _stderrLines; }
protected:
- QStringList _stdoutLines, _stderrLines;
+ TQStringList _stdoutLines, _stderrLines;
- virtual void addStdoutLine(const QString &line) { _stdoutLines += line; }
- virtual void addStderrLine(const QString &line) { _stderrLines += line; }
+ virtual void addStdoutLine(const TQString &line) { _stdoutLines += line; }
+ virtual void addStderrLine(const TQString &line) { _stderrLines += line; }
};
//----------------------------------------------------------------------------
class LineSignal : public LineBase
{
Q_OBJECT
+ TQ_OBJECT
public:
- LineSignal(QObject *parent = 0, const char *name = 0) : LineBase(parent, name) {}
+ LineSignal(TQObject *tqparent = 0, const char *name = 0) : LineBase(tqparent, name) {}
signals:
- void logStdoutLine(const QString &line);
- void logStderrLine(const QString &line);
+ void logStdoutLine(const TQString &line);
+ void logStderrLine(const TQString &line);
private:
- virtual void addStdoutLine(const QString &line) { emit logStdoutLine(line); }
- virtual void addStderrLine(const QString &line) { emit logStderrLine(line); }
+ virtual void addStdoutLine(const TQString &line) { emit logStdoutLine(line); }
+ virtual void addStderrLine(const TQString &line) { emit logStderrLine(line); }
};
} // namespace
diff --git a/src/common/global/progress_monitor.cpp b/src/common/global/progress_monitor.cpp
index fcd0cec..f86d236 100644
--- a/src/common/global/progress_monitor.cpp
+++ b/src/common/global/progress_monitor.cpp
@@ -8,8 +8,8 @@
***************************************************************************/
#include "progress_monitor.h"
-ProgressMonitor::ProgressMonitor(QObject* parent)
- : QObject(parent, "progress_monitor")
+ProgressMonitor::ProgressMonitor(TQObject* tqparent)
+ : TQObject(tqparent, "progress_monitor")
{
_current = _tasks.end();
}
@@ -21,7 +21,7 @@ void ProgressMonitor::clear()
emit showProgress(false);
}
-void ProgressMonitor::appendTask(const QString &label, uint nbSteps)
+void ProgressMonitor::appendTask(const TQString &label, uint nbSteps)
{
Task task;
task.label = label;
@@ -30,7 +30,7 @@ void ProgressMonitor::appendTask(const QString &label, uint nbSteps)
_tasks.append(task);
}
-void ProgressMonitor::insertTask(const QString &label, uint nbSteps)
+void ProgressMonitor::insertTask(const TQString &label, uint nbSteps)
{
Task task;
task.label = label;
@@ -57,7 +57,7 @@ uint ProgressMonitor::nbDoneSteps() const
void ProgressMonitor::update()
{
- QString label = (_current==_tasks.end() ? QString::null : (*_current).label);
+ TQString label = (_current==_tasks.end() ? TQString() : (*_current).label);
emit setLabel(label);
emit setTotalProgress(nbSteps());
emit setProgress(nbDoneSteps());
@@ -79,6 +79,6 @@ void ProgressMonitor::addTaskProgress(uint nbSteps)
uint nb = (*_current).nbDoneSteps + nbSteps;
Q_ASSERT( nb<=(*_current).nbSteps );
if ( nb>(*_current).nbSteps ) qDebug("%s %i+%i > %i", (*_current).label.latin1(), (*_current).nbDoneSteps, nbSteps, (*_current).nbSteps);
- (*_current).nbDoneSteps = QMIN(nb, (*_current).nbSteps);
+ (*_current).nbDoneSteps = TQMIN(nb, (*_current).nbSteps);
update();
}
diff --git a/src/common/global/progress_monitor.h b/src/common/global/progress_monitor.h
index bb905f7..1cff202 100644
--- a/src/common/global/progress_monitor.h
+++ b/src/common/global/progress_monitor.h
@@ -11,14 +11,15 @@
#include "global.h"
-class ProgressMonitor : public QObject
+class ProgressMonitor : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
- ProgressMonitor(QObject *parent = 0);
+ ProgressMonitor(TQObject *tqparent = 0);
void clear();
- void appendTask(const QString &label, uint nbSteps);
- void insertTask(const QString &label, uint nbSteps);
+ void appendTask(const TQString &label, uint nbSteps);
+ void insertTask(const TQString &label, uint nbSteps);
void startNextTask();
void addTaskProgress(uint nbSteps);
uint nbSteps() const;
@@ -29,18 +30,18 @@ public slots:
signals:
void showProgress(bool show);
- void setLabel(const QString &label);
+ void setLabel(const TQString &label);
void setTotalProgress(uint nbSteps);
void setProgress(uint nbSteps);
private:
class Task {
public:
- QString label;
+ TQString label;
uint nbSteps, nbDoneSteps;
};
- QValueList<Task> _tasks;
- QValueList<Task>::iterator _current;
+ TQValueList<Task> _tasks;
+ TQValueList<Task>::iterator _current;
};
#endif
diff --git a/src/common/global/purl.cpp b/src/common/global/purl.cpp
index 6db2914..aeae543 100644
--- a/src/common/global/purl.cpp
+++ b/src/common/global/purl.cpp
@@ -8,14 +8,12 @@
***************************************************************************/
#include "purl.h"
-#include <qfileinfo.h>
-#include <qdatetime.h>
-#include <qdir.h>
-#include <qregexp.h>
-#include <qmap.h>
-#if QT_VERSION<0x040000
-# include <qnetwork.h>
-#endif
+#include <tqfileinfo.h>
+#include <tqdatetime.h>
+#include <tqdir.h>
+#include <tqregexp.h>
+#include <tqmap.h>
+# include <tqnetwork.h>
#include "common/common/synchronous.h"
#include "process.h"
@@ -27,38 +25,38 @@
#endif
//-----------------------------------------------------------------------------
-PURL::Http::Http(const QString &hostname)
- : QHttp(hostname)
+PURL::Http::Http(const TQString &hostname)
+ : TQHttp(hostname)
{
- connect(this, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
- SLOT(responseHeaderReceivedSlot(const QHttpResponseHeader &)));
+ connect(this, TQT_SIGNAL(responseHeaderReceived(const TQHttpResponseHeader &)),
+ TQT_SLOT(responseHeaderReceivedSlot(const TQHttpResponseHeader &)));
}
//-----------------------------------------------------------------------------
class PURL::Private
{
public:
- QString convertWindowsFilepath(const QString &filepath);
+ TQString convertWindowsFilepath(const TQString &filepath);
private:
- QMap<char, QString> _winDrives; // drive -> unix path
- QMap<QString, QString> _winPaths; // windows path -> unix path
-
- QString getWindowsDrivePath(char drive);
- bool checkCachedPath(QString &filepath) const;
- QString cachePath(const QString &origin, const QString &filepath);
- QString convertWindowsShortFilepath(const QString &filepath);
- QString findName(const QString &path, const QString &name);
- static QString findName(const QString &filepath);
+ TQMap<char, TQString> _winDrives; // drive -> unix path
+ TQMap<TQString, TQString> _winPaths; // windows path -> unix path
+
+ TQString getWindowsDrivePath(char drive);
+ bool checkCachedPath(TQString &filepath) const;
+ TQString cachePath(const TQString &origin, const TQString &filepath);
+ TQString convertWindowsShortFilepath(const TQString &filepath);
+ TQString findName(const TQString &path, const TQString &name);
+ static TQString findName(const TQString &filepath);
};
-QString PURL::Private::getWindowsDrivePath(char drive)
+TQString PURL::Private::getWindowsDrivePath(char drive)
{
#if defined(Q_OS_UNIX)
- if ( !_winDrives.contains(drive) ) {
- QStringList args;
+ if ( !_winDrives.tqcontains(drive) ) {
+ TQStringList args;
args += "-u";
- QString s;
+ TQString s;
s += drive;
args += s + ":\\";
::Process::StringOutput process;
@@ -66,71 +64,67 @@ QString PURL::Private::getWindowsDrivePath(char drive)
::Process::State state = ::Process::runSynchronously(process, ::Process::Start, 3000);
if ( state!=::Process::Exited ) qWarning("Error running \"winepath\" with \"%s\" (%i)", args.join(" ").latin1(), state);
s = process.sout() + process.serr();
- QDir dir(s.stripWhiteSpace());
+ TQDir dir(s.stripWhiteSpace());
_winDrives[drive] = dir.canonicalPath();
}
return _winDrives[drive];
#else
- return QString("%1:\\").arg(drive);
+ return TQString("%1:\\").tqarg(drive);
#endif
}
-bool PURL::Private::checkCachedPath(QString &filepath) const
+bool PURL::Private::checkCachedPath(TQString &filepath) const
{
- if ( !_winPaths.contains(filepath) ) return false;
+ if ( !_winPaths.tqcontains(filepath) ) return false;
filepath = _winPaths[filepath];
return true;
}
-QString PURL::Private::cachePath(const QString &origin, const QString &filepath)
+TQString PURL::Private::cachePath(const TQString &origin, const TQString &filepath)
{
_winPaths[origin] = filepath;
return filepath;
}
-QString PURL::Private::convertWindowsFilepath(const QString &filepath)
+TQString PURL::Private::convertWindowsFilepath(const TQString &filepath)
{
// appears to be an absolute windows path
if ( filepath[0]=='\\' ) {
- QString tmp = filepath;
+ TQString tmp = filepath;
if ( checkCachedPath(tmp) ) return tmp;
- return cachePath(filepath, convertWindowsShortFilepath(tmp.replace('\\', "/")));
+ return cachePath(filepath, convertWindowsShortFilepath(tmp.tqreplace('\\', "/")));
}
// appears to be a windows path with a drive
if ( (filepath.length()>=2 && filepath[0].isLetter() && filepath[1]==':') ) {
- QString tmp = filepath;
+ TQString tmp = filepath;
if ( checkCachedPath(tmp) ) return tmp;
-#if QT_VERSION<0x040000
- tmp = getWindowsDrivePath(filepath[0]) + tmp.mid(2).replace('\\', "/");
-#else
- tmp = getWindowsDrivePath(filepath[0].toLatin1()) + tmp.mid(2).replace('\\', "/");
-#endif
+ tmp = getWindowsDrivePath(filepath[0]) + tmp.mid(2).tqreplace('\\', "/");
return cachePath(filepath, convertWindowsShortFilepath(tmp));
}
return filepath;
}
-QString PURL::Private::findName(const QString &path, const QString &name)
+TQString PURL::Private::findName(const TQString &path, const TQString &name)
{
- QString filepath = path + '/' + name;
+ TQString filepath = path + '/' + name;
if ( checkCachedPath(filepath) ) return filepath;
return cachePath(filepath, findName(filepath));
}
-QString PURL::Private::findName(const QString &filepath)
+TQString PURL::Private::findName(const TQString &filepath)
{
- QFileInfo finfo(filepath);
+ TQFileInfo finfo(filepath);
if ( finfo.exists() || !finfo.dir().exists() ) return finfo.filePath();
- QStringList list = finfo.dir().entryList(QDir::All, QDir::Name);
+ TQStringList list = finfo.dir().entryList(TQDir::All, TQDir::Name);
// find if name is just in a different case
for (uint j=0; j<uint(list.count()); j++) {
if ( list[j].lower()!=finfo.fileName().lower() ) continue;
return finfo.dirPath() + '/' + list[j];
}
// find if name is a shorted filename
- QRegExp rexp("([^~]+)~(\\d+).*");
+ TQRegExp rexp("([^~]+)~(\\d+).*");
if ( !rexp.exactMatch(finfo.fileName()) ) return finfo.filePath();
- QString start = rexp.cap(1).lower();
+ TQString start = rexp.cap(1).lower();
uint index = rexp.cap(2).toUInt();
uint k = 0;
for (uint j = 0; j<uint(list.count()); j++) {
@@ -141,18 +135,18 @@ QString PURL::Private::findName(const QString &filepath)
return finfo.filePath();
}
-QString PURL::Private::convertWindowsShortFilepath(const QString &filepath)
+TQString PURL::Private::convertWindowsShortFilepath(const TQString &filepath)
{
- // apparently "winepath" cannot do that for us and it is a real pain too...
+ // aptqparently "winepath" cannot do that for us and it is a real pain too...
// we assume filepath is an absolute unix path
// first see if we know the dirpath
- QFileInfo finfo(filepath);
- QString path = finfo.dirPath();
+ TQFileInfo finfo(filepath);
+ TQString path = finfo.dirPath();
if ( checkCachedPath(path) ) return findName(path, finfo.fileName());
// otherwise go down the path
- QStringList names = QStringList::split('/', filepath);
- QString tmp;
+ TQStringList names = TQStringList::split('/', filepath);
+ TQString tmp;
for (uint i=0; i<uint(names.count()); i++)
tmp = findName(tmp, names[i]);
if ( filepath.endsWith("/") ) tmp += "/";
@@ -162,17 +156,17 @@ QString PURL::Private::convertWindowsShortFilepath(const QString &filepath)
//-----------------------------------------------------------------------------
PURL::Private *PURL::Base::_private = 0;
-PURL::Base::Base(const QString &filepath)
+PURL::Base::Base(const TQString &filepath)
: _relative(true)
{
if ( !filepath.isEmpty() ) {
if ( _private==0 ) _private = new Private;
#if defined(Q_OS_UNIX)
- QString tmp = _private->convertWindowsFilepath(filepath);
+ TQString tmp = _private->convertWindowsFilepath(filepath);
#else
- QString tmp = filepath;
+ TQString tmp = filepath;
#endif
- if ( tmp.startsWith("~") ) tmp = QDir::homeDirPath() + tmp.mid(1);
+ if ( tmp.startsWith("~") ) tmp = TQDir::homeDirPath() + tmp.mid(1);
_relative = Q3Url::isRelativeUrl(tmp);
#if defined(Q_OS_UNIX)
if ( !tmp.startsWith("/") ) tmp = '/' + tmp;
@@ -203,13 +197,13 @@ bool PURL::Base::operator ==(const Base &url) const
return _url==url._url;
}
-QString PURL::Base::path(SeparatorType type) const
+TQString PURL::Base::path(SeparatorType type) const
{
#if defined(NO_KDE)
- QString s = _url.dirPath();
+ TQString s = _url.dirPath();
if ( !s.isEmpty() && !s.endsWith("/") ) s += '/';
#else
- QString s = _url.directory(false, false);
+ TQString s = _url.directory(false, false);
#endif
if ( type==WindowsSeparator ) {
for (uint i=0; i<uint(s.length()); i++)
@@ -218,13 +212,13 @@ QString PURL::Base::path(SeparatorType type) const
return s;
}
-QString PURL::Base::unterminatedPath(SeparatorType type) const
+TQString PURL::Base::unterminatedPath(SeparatorType type) const
{
#if defined(NO_KDE)
- QString s = _url.dirPath();
+ TQString s = _url.dirPath();
if ( s.endsWith("/") ) s = s.mid(0, s.length()-1);
#else
- QString s = _url.directory(true, false);
+ TQString s = _url.directory(true, false);
#endif
if ( type==WindowsSeparator ) {
for (uint i=0; i<uint(s.length()); i++)
@@ -233,10 +227,10 @@ QString PURL::Base::unterminatedPath(SeparatorType type) const
return s;
}
-QString PURL::Base::pretty() const
+TQString PURL::Base::pretty() const
{
#if defined(NO_KDE)
- QString s = _url.toString();
+ TQString s = _url.toString();
if ( s.startsWith("://") ) return s.mid(3);
return s;
#else
@@ -256,26 +250,24 @@ bool PURL::Base::isInto(const Directory &dir) const
bool PURL::Base::httpUrlExists(bool *ok) const
{
-#if QT_VERSION<0x040000
qInitNetworkProtocols();
-#endif
if (ok) *ok = false;
Http http(_url.host());
Synchronous sync(500);
- QObject::connect(&http, SIGNAL(done(bool)), &sync, SLOT(done()));
- QFileInfo info(_url.fileName(false));
+ TQObject::connect(&http, TQT_SIGNAL(done(bool)), &sync, TQT_SLOT(done()));
+ TQFileInfo info(_url.fileName(false));
http.head(_url.path());
if ( !sync.enterLoop() ) return false; // timeout
- if ( http.error()!=QHttp::NoError ) return false;
+ if ( http.error()!=TQHttp::NoError ) return false;
if (ok ) *ok = true;
return ( http._header.statusCode()==200 );
}
-bool PURL::Base::exists(QDateTime *lastModified) const
+bool PURL::Base::exists(TQDateTime *lastModified) const
{
if ( isEmpty() ) return false;
if ( isLocal() ) {
- QFileInfo fi(_url.path());
+ TQFileInfo fi(_url.path());
if (lastModified) *lastModified = fi.lastModified();
return fi.exists();
}
@@ -283,13 +275,13 @@ bool PURL::Base::exists(QDateTime *lastModified) const
#if !defined(NO_KDE)
if (lastModified) {
KIO::UDSEntry uds;
- if ( !KIO::NetAccess::stat(_url, uds, qApp->mainWidget()) ) return false;
+ if ( !KIO::NetAccess::stat(_url, uds, tqApp->mainWidget()) ) return false;
KFileItem item(uds, _url);
lastModified->setTime_t(item.time(KIO::UDS_MODIFICATION_TIME));
return true;
} else {
// assume file exists if ioslave cannot tell...
- return KIO::NetAccess::exists(_url, true, qApp->mainWidget());
+ return KIO::NetAccess::exists(_url, true, tqApp->mainWidget());
}
#else
if (lastModified) lastModified->setTime_t(0);
@@ -299,62 +291,62 @@ bool PURL::Base::exists(QDateTime *lastModified) const
}
//----------------------------------------------------------------------------
-PURL::Url PURL::Url::fromPathOrUrl(const QString &s)
+PURL::Url PURL::Url::fromPathOrUrl(const TQString &s)
{
KURL kurl = KURL::fromPathOrURL(s);
if ( !kurl.protocol().isEmpty() && kurl.protocol()!="file" && kurl.protocol().length()!=1 ) return kurl;
return Url(s.startsWith("file://") ? s.mid(7) : s);
}
-PURL::Url::Url(const Directory &dir, const QString &filename, FileType type)
+PURL::Url::Url(const Directory &dir, const TQString &filename, FileType type)
: Base(dir.path() + '/' + addExtension(filename, type))
{}
-PURL::Url::Url(const Directory &dir, const QString &filepath)
+PURL::Url::Url(const Directory &dir, const TQString &filepath)
: Base(dir.path() + '/' + filepath)
{}
PURL::FileType PURL::Url::fileType() const
{
- QFileInfo info(filename());
+ TQFileInfo info(filename());
FOR_EACH(FileType, type)
for (uint i=0; type.data().extensions[i]; i++)
if ( info.extension(false).lower()==type.data().extensions[i] ) return type;
return Unknown;
}
-QString PURL::Url::basename() const
+TQString PURL::Url::basename() const
{
- QFileInfo info(_url.fileName(false));
+ TQFileInfo info(_url.fileName(false));
return info.baseName(true);
}
-QString PURL::Url::filename() const
+TQString PURL::Url::filename() const
{
- QFileInfo info(_url.fileName(false));
+ TQFileInfo info(_url.fileName(false));
return info.fileName();
}
-QString PURL::Url::filepath(SeparatorType type) const
+TQString PURL::Url::filepath(SeparatorType type) const
{
return path(type) + filename();
}
-PURL::Url PURL::Url::toExtension(const QString &extension) const
+PURL::Url PURL::Url::toExtension(const TQString &extension) const
{
- QFileInfo info(filename());
+ TQFileInfo info(filename());
return Url(directory().path() + info.baseName(true) + '.' + extension);
}
-PURL::Url PURL::Url::appendExtension(const QString &extension) const
+PURL::Url PURL::Url::appendExtension(const TQString &extension) const
{
- QFileInfo info(filename());
+ TQFileInfo info(filename());
return Url(directory().path() + info.fileName() + '.' + extension);
}
-QString PURL::Url::relativeTo(const Directory &dir, SeparatorType type) const
+TQString PURL::Url::relativeTo(const Directory &dir, SeparatorType type) const
{
- QString s = filepath(type);
+ TQString s = filepath(type);
if ( !isInto(dir) ) return s;
return s.right(s.length() - dir.path(type).length());
}
@@ -368,7 +360,7 @@ PURL::Url PURL::Url::toAbsolute(const Directory &dir) const
bool PURL::findExistingUrl(Url &url)
{
if ( url.exists() ) return true;
- QFileInfo info(url.filename());
+ TQFileInfo info(url.filename());
Url tmp = url.toExtension(info.extension(false).upper());
if ( !tmp.exists() ) {
tmp = url.toExtension(info.extension(false).lower());
@@ -388,35 +380,35 @@ PURL::UrlList::UrlList(const KURL::List &list)
#endif
//-----------------------------------------------------------------------------
-PURL::Directory::Directory(const QString &path)
- : Base(path.isEmpty() ? QString::null : path + '/')
+PURL::Directory::Directory(const TQString &path)
+ : Base(path.isEmpty() ? TQString() : path + '/')
{}
PURL::Directory PURL::Directory::up() const
{
- QDir dir(path());
+ TQDir dir(path());
dir.cdUp();
return PURL::Directory(dir.path());
}
-PURL::Directory PURL::Directory::down(const QString &subPath) const
+PURL::Directory PURL::Directory::down(const TQString &subPath) const
{
- Q_ASSERT( QDir::isRelativePath(subPath) );
- QDir dir(path());
+ Q_ASSERT( TQDir::isRelativePath(subPath) );
+ TQDir dir(path());
dir.cd(subPath);
return PURL::Directory(dir.path());
}
-QStringList PURL::Directory::files(const QString &filter) const
+TQStringList PURL::Directory::files(const TQString &filter) const
{
- QDir dir(path());
- return dir.entryList(filter, QDir::Files);
+ TQDir dir(path());
+ return dir.entryList(filter, TQDir::Files);
}
-PURL::Url PURL::Directory::findMatchingFilename(const QString &filename) const
+PURL::Url PURL::Directory::findMatchingFilename(const TQString &filename) const
{
- QDir dir(path());
- QStringList files = dir.entryList(QDir::Files);
+ TQDir dir(path());
+ TQStringList files = dir.entryList(TQDir::Files);
for (uint i=0; i<uint(files.count()); i++)
if ( files[i].lower()==filename.lower() ) return Url(*this, files[i]);
return Url(*this, filename);
@@ -424,5 +416,5 @@ PURL::Url PURL::Directory::findMatchingFilename(const QString &filename) const
PURL::Directory PURL::Directory::current()
{
- return QDir::currentDirPath();
+ return TQDir::currentDirPath();
}
diff --git a/src/common/global/purl.h b/src/common/global/purl.h
index 6cbf38b..a0ee295 100644
--- a/src/common/global/purl.h
+++ b/src/common/global/purl.h
@@ -10,27 +10,23 @@
#define PURL_H
#include "common/global/global.h"
-#if QT_VERSION<0x040000
-# include <qhttp.h>
-#else
-# include <QtNetwork/QHttp>
-# include <QDateTime>
-#endif
+# include <tqhttp.h>
#include "common/global/log.h"
#include "common/common/purl_base.h"
namespace PURL
{
//----------------------------------------------------------------------------
-class Http : public QHttp
+class Http : public TQHttp
{
Q_OBJECT
+ TQ_OBJECT
public:
- Http(const QString &hostname);
- QHttpResponseHeader _header;
+ Http(const TQString &hostname);
+ TQHttpResponseHeader _header;
private slots:
- void responseHeaderReceivedSlot(const QHttpResponseHeader &rh) { _header = rh; }
+ void responseHeaderReceivedSlot(const TQHttpResponseHeader &rh) { _header = rh; }
};
class Url;
@@ -43,21 +39,21 @@ enum SeparatorType { UnixSeparator, WindowsSeparator };
class Base
{
public:
- Base(const QString &filepath = QString::null);
+ Base(const TQString &filepath = TQString());
Base(const KURL &url);
bool operator <(const Base &url) const { return _url<url._url; }
bool operator ==(const Base &url) const;
bool operator !=(const Base &url) const { return !(_url==url._url); }
const KURL &kurl() const { return _url; }
- QString pretty() const;
+ TQString pretty() const;
bool isEmpty() const { return _url.isEmpty(); }
bool isLocal() const;
- QString path(SeparatorType type = UnixSeparator) const; // with ending '/' unless empty path
- QString unterminatedPath(SeparatorType type = UnixSeparator) const; // no ending '/'
+ TQString path(SeparatorType type = UnixSeparator) const; // with ending '/' unless empty path
+ TQString unterminatedPath(SeparatorType type = UnixSeparator) const; // no ending '/'
Directory directory() const;
bool isInto(const Directory &dir) const;
bool isRelative() const { return _relative; }
- bool exists(QDateTime *lastModified = 0) const;
+ bool exists(TQDateTime *lastModified = 0) const;
protected:
bool _relative;
@@ -75,42 +71,42 @@ public:
Url() {}
Url(const KURL &url) : Base(url) {}
// add correct extension if filename has no extension
- Url(const Directory &path, const QString &filename, FileType type);
- Url(const Directory &path, const QString &filepath);
- static Url fromPathOrUrl(const QString &s);
+ Url(const Directory &path, const TQString &filename, FileType type);
+ Url(const Directory &path, const TQString &filepath);
+ static Url fromPathOrUrl(const TQString &s);
Url toFileType(FileType type) const { return toExtension(type.data().extensions[0]); }
- Url toExtension(const QString &extension) const;
- Url appendExtension(const QString &extension) const;
+ Url toExtension(const TQString &extension) const;
+ Url appendExtension(const TQString &extension) const;
const FileType::Data &data() const { return fileType().data(); }
FileType fileType() const;
- QString basename() const; // filename without extension
- QString filename() const; // filename without path
- QString filepath(SeparatorType type = UnixSeparator) const; // filename with path
- QString relativeTo(const Directory &dir, SeparatorType type = UnixSeparator) const;
+ TQString basename() const; // filename without extension
+ TQString filename() const; // filename without path
+ TQString filepath(SeparatorType type = UnixSeparator) const; // filename with path
+ TQString relativeTo(const Directory &dir, SeparatorType type = UnixSeparator) const;
Url toAbsolute(const Directory &dir) const;
#if !defined(NO_KDE)
bool isDosFile() const;
bool create(Log::Generic &log) const; // do not overwrite
- bool write(const QString &text, Log::Generic &log) const;
+ bool write(const TQString &text, Log::Generic &log) const;
bool copyTo(const Url &destination, Log::Generic &log) const; // do not overwrite
bool del(Log::Generic &log) const;
#endif
private:
- Url(const QString &filepath) : Base(filepath) {}
+ Url(const TQString &filepath) : Base(filepath) {}
};
extern bool findExistingUrl(Url &url); // may transform extension's case if needed
//----------------------------------------------------------------------------
-class UrlList : public QValueList<Url>
+class UrlList : public TQValueList<Url>
{
public:
UrlList() {}
UrlList(const Url &url) { append(url); }
- UrlList(const QValueList<Url> &list) : QValueList<Url>(list) {}
+ UrlList(const TQValueList<Url> &list) : TQValueList<Url>(list) {}
#if !defined(NO_KDE)
UrlList(const KURL::List &list);
#endif
@@ -120,11 +116,11 @@ public:
class Directory : public Base
{
public:
- Directory(const QString &path = QString::null);
- QStringList files(const QString &filter) const;
- Url findMatchingFilename(const QString &filename) const;
+ Directory(const TQString &path = TQString());
+ TQStringList files(const TQString &filter) const;
+ Url findMatchingFilename(const TQString &filename) const;
Directory up() const;
- Directory down(const QString &path) const;
+ Directory down(const TQString &path) const;
static Directory current();
#if !defined(NO_KDE)
bool create(Log::Generic &log) const;
diff --git a/src/common/global/xml_data_file.cpp b/src/common/global/xml_data_file.cpp
index 2464b34..30d42cd 100644
--- a/src/common/global/xml_data_file.cpp
+++ b/src/common/global/xml_data_file.cpp
@@ -8,25 +8,25 @@
***************************************************************************/
#include "xml_data_file.h"
-#include <qfile.h>
-#include <qstringlist.h>
+#include <tqfile.h>
+#include <tqstringlist.h>
#include <ksimpleconfig.h>
#include <klocale.h>
#include "common/global/pfile.h"
-XmlDataFile::XmlDataFile(const PURL::Url &url, const QString &name)
+XmlDataFile::XmlDataFile(const PURL::Url &url, const TQString &name)
: _url(url), _name(name), _document(name)
{
- QDomElement root = _document.createElement(name);
+ TQDomElement root = _document.createElement(name);
_document.appendChild(root);
}
-bool XmlDataFile::load(QString &error)
+bool XmlDataFile::load(TQString &error)
{
Log::StringView sview;
PURL::File file(_url, sview);
if ( !file.openForRead() ) {
- error = i18n("Error opening file: %1").arg(sview.string());
+ error = i18n("Error opening file: %1").tqarg(sview.string());
return false;
}
if ( !_document.setContent(file.qfile(), false, &error) ) return false;
@@ -38,122 +38,122 @@ bool XmlDataFile::load(QString &error)
return true;
}
-bool XmlDataFile::save(QString &error) const
+bool XmlDataFile::save(TQString &error) const
{
Log::StringView sview;
PURL::File file(_url, sview);
bool ok = file.openForWrite();
if (ok) {
- QString s = _document.toString(2);
+ TQString s = _document.toString(2);
file.appendText(s);
ok = file.close();
}
- if ( !ok ) error = i18n("Error saving file: %1").arg(sview.string());
+ if ( !ok ) error = i18n("Error saving file: %1").tqarg(sview.string());
return ok;
}
-QDomElement XmlDataFile::findChildElement(QDomElement parent, const QString &name) const
+TQDomElement XmlDataFile::findChildElement(TQDomElement tqparent, const TQString &name) const
{
- QDomNodeList list = parent.elementsByTagName(name);
+ TQDomNodeList list = tqparent.elementsByTagName(name);
return list.item(0).toElement();
}
-QDomElement XmlDataFile::createChildElement(QDomElement parent, const QString &name)
+TQDomElement XmlDataFile::createChildElement(TQDomElement tqparent, const TQString &name)
{
- QDomNodeList list = parent.elementsByTagName(name);
+ TQDomNodeList list = tqparent.elementsByTagName(name);
if ( list.count()==0 ) {
- QDomElement element = _document.createElement(name);
- parent.appendChild(element);
+ TQDomElement element = _document.createElement(name);
+ tqparent.appendChild(element);
return element;
}
return list.item(0).toElement();
}
-void XmlDataFile::removeChilds(QDomNode parent) const
+void XmlDataFile::removeChilds(TQDomNode tqparent) const
{
- QDomNodeList list = parent.childNodes();
+ TQDomNodeList list = tqparent.childNodes();
for (uint i=0; i<list.count(); i++)
- parent.removeChild(list.item(i));
+ tqparent.removeChild(list.item(i));
}
-QString XmlDataFile::value(const QString &group, const QString &key, const QString &defValue) const
+TQString XmlDataFile::value(const TQString &group, const TQString &key, const TQString &defValue) const
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = findChildElement(root, group);
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = findChildElement(root, group);
if ( groupElement.isNull() ) return defValue;
- QDomElement element = findChildElement(groupElement, key);
+ TQDomElement element = findChildElement(groupElement, key);
if ( element.isNull() ) return defValue;
- QDomText text = element.firstChild().toText();
+ TQDomText text = element.firstChild().toText();
if ( text.isNull() ) return defValue;
return text.data();
}
-void XmlDataFile::setValue(const QString &group, const QString &key, const QString &value)
+void XmlDataFile::setValue(const TQString &group, const TQString &key, const TQString &value)
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = createChildElement(root, group);
- QDomElement element = createChildElement(groupElement, key);
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = createChildElement(root, group);
+ TQDomElement element = createChildElement(groupElement, key);
removeChilds(element);
- QDomText text = _document.createTextNode(value);
+ TQDomText text = _document.createTextNode(value);
element.appendChild(text);
}
-QStringList XmlDataFile::listValues(const QString &group, const QString &key, const QStringList &defaultValues) const
+TQStringList XmlDataFile::listValues(const TQString &group, const TQString &key, const TQStringList &defaultValues) const
{
- QStringList list;
- QDomElement root = _document.documentElement();
- QDomElement groupElement = findChildElement(root, group);
+ TQStringList list;
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = findChildElement(root, group);
if ( groupElement.isNull() ) return defaultValues;
- QDomElement element = findChildElement(groupElement, key);
+ TQDomElement element = findChildElement(groupElement, key);
if ( element.isNull() ) return defaultValues;
- QDomNodeList childs = element.childNodes();
+ TQDomNodeList childs = element.childNodes();
if ( childs.count()==1 ) { // legacy compatibility
- QDomText text = element.firstChild().toText();
+ TQDomText text = element.firstChild().toText();
if ( !text.isNull() ) return text.data();
}
for (uint i=0; i<childs.count(); i++) {
- QDomText text = childs.item(i).toElement().firstChild().toText();
+ TQDomText text = childs.item(i).toElement().firstChild().toText();
if ( text.isNull() ) continue;
list.append(text.data());
}
return list;
}
-void XmlDataFile::appendListValue(const QString &group, const QString &key, const QString &value)
+void XmlDataFile::appendListValue(const TQString &group, const TQString &key, const TQString &value)
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = createChildElement(root, group);
- QDomElement element = createChildElement(groupElement, key);
- QDomElement item = _document.createElement("item");
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = createChildElement(root, group);
+ TQDomElement element = createChildElement(groupElement, key);
+ TQDomElement item = _document.createElement("item");
element.appendChild(item);
- QDomText text = _document.createTextNode(value);
+ TQDomText text = _document.createTextNode(value);
item.appendChild(text);
}
-void XmlDataFile::removeListValue(const QString &group, const QString &key, const QString &value)
+void XmlDataFile::removeListValue(const TQString &group, const TQString &key, const TQString &value)
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = createChildElement(root, group);
- QDomElement element = createChildElement(groupElement, key);
- QDomNodeList list = element.childNodes();
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = createChildElement(root, group);
+ TQDomElement element = createChildElement(groupElement, key);
+ TQDomNodeList list = element.childNodes();
for (uint i=0; i<list.count(); i++) {
- QDomElement item = list.item(i).toElement();
- QDomText text = item.firstChild().toText();
+ TQDomElement item = list.item(i).toElement();
+ TQDomText text = item.firstChild().toText();
if ( text.isNull() || text.data()!=value ) continue;
element.removeChild(item);
break;
}
}
-void XmlDataFile::clearList(const QString &group, const QString &key)
+void XmlDataFile::clearList(const TQString &group, const TQString &key)
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = createChildElement(root, group);
- QDomElement element = createChildElement(groupElement, key);
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = createChildElement(root, group);
+ TQDomElement element = createChildElement(groupElement, key);
groupElement.removeChild(element);
}
-void XmlDataFile::setListValues(const QString &group, const QString &key, const QStringList &values)
+void XmlDataFile::setListValues(const TQString &group, const TQString &key, const TQStringList &values)
{
clearList(group, key);
for (uint i=0; i<values.count(); i++) appendListValue(group, key, values[i]);
diff --git a/src/common/global/xml_data_file.h b/src/common/global/xml_data_file.h
index dfcbc73..bae5d1f 100644
--- a/src/common/global/xml_data_file.h
+++ b/src/common/global/xml_data_file.h
@@ -9,37 +9,37 @@
#ifndef XML_DATA_FILE_H
#define XML_DATA_FILE_H
-#include <qdom.h>
+#include <tqdom.h>
#include "common/global/purl.h"
class XmlDataFile
{
public:
- XmlDataFile(const PURL::Url &url, const QString &name);
+ XmlDataFile(const PURL::Url &url, const TQString &name);
virtual ~XmlDataFile() {}
PURL::Url url() const { return _url; }
- virtual bool load(QString &error);
- bool save(QString &error) const;
+ virtual bool load(TQString &error);
+ bool save(TQString &error) const;
- QString value(const QString &group, const QString &key, const QString &defaultValue) const;
- void setValue(const QString &group, const QString &key, const QString &value);
- QStringList listValues(const QString &group, const QString &key, const QStringList &defaultValues) const;
- void setListValues(const QString &group, const QString &key, const QStringList &values);
- void appendListValue(const QString &group, const QString &key, const QString &value);
- void removeListValue(const QString &group, const QString &key, const QString &value);
- void clearList(const QString &group, const QString &key);
+ TQString value(const TQString &group, const TQString &key, const TQString &defaultValue) const;
+ void setValue(const TQString &group, const TQString &key, const TQString &value);
+ TQStringList listValues(const TQString &group, const TQString &key, const TQStringList &defaultValues) const;
+ void setListValues(const TQString &group, const TQString &key, const TQStringList &values);
+ void appendListValue(const TQString &group, const TQString &key, const TQString &value);
+ void removeListValue(const TQString &group, const TQString &key, const TQString &value);
+ void clearList(const TQString &group, const TQString &key);
protected:
PURL::Url _url;
private:
- QString _name;
- QDomDocument _document;
+ TQString _name;
+ TQDomDocument _document;
- QDomElement findChildElement(QDomElement element, const QString &tag) const;
- QDomElement createChildElement(QDomElement element, const QString &tag);
- void removeChilds(QDomNode node) const;
+ TQDomElement findChildElement(TQDomElement element, const TQString &tag) const;
+ TQDomElement createChildElement(TQDomElement element, const TQString &tag);
+ void removeChilds(TQDomNode node) const;
};
#endif