summaryrefslogtreecommitdiffstats
path: root/krdc/kservicelocator.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /krdc/kservicelocator.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz
tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krdc/kservicelocator.cpp')
-rw-r--r--krdc/kservicelocator.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/krdc/kservicelocator.cpp b/krdc/kservicelocator.cpp
index df97016d..3b38ed9a 100644
--- a/krdc/kservicelocator.cpp
+++ b/krdc/kservicelocator.cpp
@@ -24,17 +24,17 @@
#include "kservicelocator.h"
#include <kdebug.h>
-#include <qregexp.h>
-#include <qapplication.h>
+#include <tqregexp.h>
+#include <tqapplication.h>
#ifdef HAVE_SLP
#include <slp.h>
-#include <qevent.h>
-#include <qthread.h>
+#include <tqevent.h>
+#include <tqthread.h>
#endif
-const QString KServiceLocator::DEFAULT_AUTHORITY = "";
-const QString KServiceLocator::ALL_AUTHORITIES = QString::null;
+const TQString KServiceLocator::DEFAULT_AUTHORITY = "";
+const TQString KServiceLocator::ALL_AUTHORITIES = TQString::null;
class AsyncThread;
@@ -43,20 +43,20 @@ public:
KServiceLocator *m_ksl;
bool m_opened;
volatile bool m_abort;
- QString m_lang;
+ TQString m_lang;
bool m_async;
bool ensureOpen();
KServiceLocatorPrivate(KServiceLocator *ksl,
- const QString &lang,
+ const TQString &lang,
bool async);
~KServiceLocatorPrivate();
#ifdef HAVE_SLP
SLPHandle m_handle;
AsyncThread *m_thread;
- QString m_operationServiceUrl; // for findAttributes()/foundAttributes()
+ TQString m_operationServiceUrl; // for findAttributes()/foundAttributes()
friend class FindSrvTypesThread;
friend class FindSrvsThread;
@@ -107,14 +107,14 @@ public:
#endif
};
-KServiceLocator::KServiceLocator(const QString &lang, bool async) :
- QObject(0, "KServiceLocator") {
+KServiceLocator::KServiceLocator(const TQString &lang, bool async) :
+ TQObject(0, "KServiceLocator") {
d = new KServiceLocatorPrivate(this, lang, async);
}
KServiceLocatorPrivate::KServiceLocatorPrivate(KServiceLocator *ksl,
- const QString &lang,
+ const TQString &lang,
bool async) :
m_ksl(ksl),
m_opened(false),
@@ -146,7 +146,7 @@ private:
bool m_success;
public:
LastSignalEvent(int type, bool s) :
- QCustomEvent(type),
+ TQCustomEvent(type),
m_success(s)
{};
int success() const { return m_success; };
@@ -156,28 +156,28 @@ const int FoundServiceTypesEventType = 45012;
class FoundServiceTypesEvent : public QCustomEvent
{
private:
- QString m_srvtypes;
+ TQString m_srvtypes;
public:
FoundServiceTypesEvent(const char *srvtypes) :
- QCustomEvent(FoundServiceTypesEventType),
+ TQCustomEvent(FoundServiceTypesEventType),
m_srvtypes(srvtypes)
{};
- QString srvtypes() const { return m_srvtypes; };
+ TQString srvtypes() const { return m_srvtypes; };
};
const int FoundServiceEventType = 45013;
class FoundServiceEvent : public QCustomEvent
{
private:
- QString m_srvUrl;
+ TQString m_srvUrl;
unsigned short m_lifetime;
public:
FoundServiceEvent(const char *srvUrl, unsigned short lifetime) :
- QCustomEvent(FoundServiceEventType),
+ TQCustomEvent(FoundServiceEventType),
m_srvUrl(srvUrl),
m_lifetime(lifetime)
{};
- QString srvUrl() const { return m_srvUrl; };
+ TQString srvUrl() const { return m_srvUrl; };
unsigned short lifetime() const { return m_lifetime; };
};
@@ -185,26 +185,26 @@ const int FoundAttributesEventType = 45014;
class FoundAttributesEvent : public QCustomEvent
{
private:
- QString m_attributes;
+ TQString m_attributes;
public:
FoundAttributesEvent(const char *attributes) :
- QCustomEvent(FoundAttributesEventType),
+ TQCustomEvent(FoundAttributesEventType),
m_attributes(attributes)
{};
- QString attributes() const { return m_attributes; };
+ TQString attributes() const { return m_attributes; };
};
const int FoundScopesEventType = 45015;
class FoundScopesEvent : public QCustomEvent
{
private:
- QString m_scopes;
+ TQString m_scopes;
public:
FoundScopesEvent(const char *scopes) :
- QCustomEvent(FoundScopesEventType),
+ TQCustomEvent(FoundScopesEventType),
m_scopes(scopes)
{};
- QString scopes() const { return m_scopes; };
+ TQString scopes() const { return m_scopes; };
};
@@ -226,13 +226,13 @@ SLPBoolean srvTypeCallbackAsync(SLPHandle,
void* cookie) {
KServiceLocatorPrivate *ksl = (KServiceLocatorPrivate*) cookie;
if ((errcode != SLP_OK) || ksl->m_abort) {
- QApplication::postEvent(ksl->m_ksl, new LastSignalEvent(LastServiceTypeSignalEventType,
+ TQApplication::postEvent(ksl->m_ksl, new LastSignalEvent(LastServiceTypeSignalEventType,
(errcode == SLP_OK) ||
(errcode == SLP_LAST_CALL) ||
ksl->m_abort));
return SLP_FALSE;
}
- QApplication::postEvent(ksl->m_ksl, new FoundServiceTypesEvent(srvtypes));
+ TQApplication::postEvent(ksl->m_ksl, new FoundServiceTypesEvent(srvtypes));
return SLP_TRUE;
}
@@ -251,13 +251,13 @@ SLPBoolean srvUrlCallbackAsync(SLPHandle,
void* cookie) {
KServiceLocatorPrivate *ksl = (KServiceLocatorPrivate*) cookie;
if ((errcode != SLP_OK) || ksl->m_abort) {
- QApplication::postEvent(ksl->m_ksl, new LastSignalEvent(LastServiceSignalEventType,
+ TQApplication::postEvent(ksl->m_ksl, new LastSignalEvent(LastServiceSignalEventType,
(errcode == SLP_OK) ||
(errcode == SLP_LAST_CALL) ||
ksl->m_abort));
return SLP_FALSE;
}
- QApplication::postEvent(ksl->m_ksl,
+ TQApplication::postEvent(ksl->m_ksl,
new FoundServiceEvent(srvurl, lifetime));
return SLP_TRUE;
}
@@ -275,14 +275,14 @@ SLPBoolean srvAttrCallbackAsync(SLPHandle,
void* cookie) {
KServiceLocatorPrivate *ksl = (KServiceLocatorPrivate*) cookie;
if ((errcode != SLP_OK) || ksl->m_abort) {
- QApplication::postEvent(ksl->m_ksl,
+ TQApplication::postEvent(ksl->m_ksl,
new LastSignalEvent(LastAttributesSignalEventType,
(errcode == SLP_OK) ||
(errcode == SLP_LAST_CALL) ||
ksl->m_abort));
return SLP_FALSE;
}
- QApplication::postEvent(ksl->m_ksl,
+ TQApplication::postEvent(ksl->m_ksl,
new FoundAttributesEvent(attrlist));
return SLP_TRUE;
}
@@ -293,7 +293,7 @@ SLPBoolean srvAttrCallbackAsync(SLPHandle,
/* Threads for async events */
/* ****** *** ****** *** ****** */
-class AsyncThread : public QThread {
+class AsyncThread : public TQThread {
protected:
SLPHandle m_handle;
KServiceLocatorPrivate *m_parent;
@@ -303,7 +303,7 @@ protected:
}
};
class FindSrvTypesThread : public AsyncThread {
- QString m_namingAuthority, m_scopeList;
+ TQString m_namingAuthority, m_scopeList;
public:
FindSrvTypesThread(SLPHandle handle,
KServiceLocatorPrivate *parent,
@@ -321,13 +321,13 @@ public:
srvTypeCallbackAsync,
m_parent);
if (e != SLP_OK)
- QApplication::postEvent(m_parent->m_ksl,
+ TQApplication::postEvent(m_parent->m_ksl,
new LastSignalEvent(LastServiceTypeSignalEventType,
false));
}
};
class FindSrvsThread : public AsyncThread {
- QString m_srvUrl, m_scopeList, m_filter;
+ TQString m_srvUrl, m_scopeList, m_filter;
public:
FindSrvsThread(SLPHandle handle,
KServiceLocatorPrivate *parent,
@@ -349,13 +349,13 @@ public:
srvUrlCallbackAsync,
m_parent);
if (e != SLP_OK)
- QApplication::postEvent(m_parent->m_ksl,
+ TQApplication::postEvent(m_parent->m_ksl,
new LastSignalEvent(LastServiceSignalEventType,
false));
}
};
class FindAttrsThread : public AsyncThread {
- QString m_srvUrl, m_scopeList, m_attrIds;
+ TQString m_srvUrl, m_scopeList, m_attrIds;
public:
FindAttrsThread(SLPHandle handle,
KServiceLocatorPrivate *parent,
@@ -376,7 +376,7 @@ public:
srvAttrCallbackAsync,
m_parent);
if (e != SLP_OK)
- QApplication::postEvent(m_parent->m_ksl,
+ TQApplication::postEvent(m_parent->m_ksl,
new LastSignalEvent(LastAttributesSignalEventType,
false));
}
@@ -393,14 +393,14 @@ public:
e = SLPFindScopes(m_handle, &_scopelist);
if (e != SLP_OK) {
- QApplication::postEvent(m_parent->m_ksl,
+ TQApplication::postEvent(m_parent->m_ksl,
new FoundScopesEvent(""));
return;
}
- QString scopeList(_scopelist);
+ TQString scopeList(_scopelist);
SLPFree(_scopelist);
- QApplication::postEvent(m_parent->m_ksl,
+ TQApplication::postEvent(m_parent->m_ksl,
new FoundScopesEvent(scopeList.latin1()));
}
};
@@ -442,8 +442,8 @@ bool KServiceLocatorPrivate::ensureOpen() {
return true;
}
-bool KServiceLocator::findServiceTypes(const QString &namingAuthority,
- const QString &scopeList) {
+bool KServiceLocator::findServiceTypes(const TQString &namingAuthority,
+ const TQString &scopeList) {
if (!d->ensureOpen())
return false;
if (d->m_thread)
@@ -469,9 +469,9 @@ bool KServiceLocator::findServiceTypes(const QString &namingAuthority,
}
}
-bool KServiceLocator::findServices(const QString &srvtype,
- const QString &filter,
- const QString &scopeList) {
+bool KServiceLocator::findServices(const TQString &srvtype,
+ const TQString &filter,
+ const TQString &scopeList) {
if (!d->ensureOpen())
return false;
if (d->m_thread)
@@ -499,8 +499,8 @@ bool KServiceLocator::findServices(const QString &srvtype,
}
}
-bool KServiceLocator::findAttributes(const QString &serviceUrl,
- const QString &attributeIds) {
+bool KServiceLocator::findAttributes(const TQString &serviceUrl,
+ const TQString &attributeIds) {
if (!d->ensureOpen())
return false;
if (d->m_thread)
@@ -544,7 +544,7 @@ bool KServiceLocator::findScopes() {
else {
SLPError e;
char *_scopelist;
- QStringList scopeList;
+ TQStringList scopeList;
e = SLPFindScopes(d->m_handle, &_scopelist);
if (e != SLP_OK)
return false;
@@ -593,7 +593,7 @@ SLPBoolean KServiceLocatorPrivate::handleAttrCallback(const char* attrlist,
}
-void KServiceLocator::customEvent(QCustomEvent *e) {
+void KServiceLocator::customEvent(TQCustomEvent *e) {
if ((e->type() >= MinLastSignalEventType) &&
(e->type() <= MaxLastSignalEventType)){
bool s = true;
@@ -633,13 +633,13 @@ void KServiceLocator::customEvent(QCustomEvent *e) {
}
}
-QString KServiceLocator::decodeAttributeValue(const QString &value) {
+TQString KServiceLocator::decodeAttributeValue(const TQString &value) {
char *n;
if (value.isNull())
return value;
if (SLPUnescape(value.latin1(), &n, SLP_TRUE) != SLP_OK)
- return QString::null;
- QString r(n);
+ return TQString::null;
+ TQString r(n);
SLPFree(n);
return r;
}
@@ -654,21 +654,21 @@ bool KServiceLocator::available() {
}
void KServiceLocator::abortOperation() {
}
-bool KServiceLocator::findServiceTypes(const QString &,const QString &) {
+bool KServiceLocator::findServiceTypes(const TQString &,const TQString &) {
return false;
}
-bool KServiceLocator::findServices(const QString &,const QString &,const QString &) {
+bool KServiceLocator::findServices(const TQString &,const TQString &,const TQString &) {
return false;
}
-bool KServiceLocator::findAttributes(const QString &,const QString &) {
+bool KServiceLocator::findAttributes(const TQString &,const TQString &) {
return false;
}
bool KServiceLocator::findScopes() {
return false;
}
-void KServiceLocator::customEvent(QCustomEvent *) {
+void KServiceLocator::customEvent(TQCustomEvent *) {
}
-QString KServiceLocator::decodeAttributeValue(const QString &value) {
+TQString KServiceLocator::decodeAttributeValue(const TQString &value) {
return value;
}
@@ -677,18 +677,18 @@ QString KServiceLocator::decodeAttributeValue(const QString &value) {
/*** Private emit-helpers ***/
-void KServiceLocator::emitFoundServiceTypes(QString serviceTypes) {
+void KServiceLocator::emitFoundServiceTypes(TQString serviceTypes) {
emit foundServiceTypes(serviceTypes);
}
-void KServiceLocator::emitFoundService(QString serviceUrl,
+void KServiceLocator::emitFoundService(TQString serviceUrl,
int lifetime) {
emit foundService(serviceUrl, lifetime);
}
-void KServiceLocator::emitFoundAttributes(QString serviceUrl,
- QString attributes) {
+void KServiceLocator::emitFoundAttributes(TQString serviceUrl,
+ TQString attributes) {
emit foundAttributes(serviceUrl, attributes);
}
-void KServiceLocator::emitFoundScopes(QStringList scopeList) {
+void KServiceLocator::emitFoundScopes(TQStringList scopeList) {
emit foundScopes(scopeList);
}
void KServiceLocator::emitLastServiceTypeSignal(bool success) {
@@ -705,9 +705,9 @@ void KServiceLocator::emitLastAttributesSignal(bool success) {
/*** Static helpers ***/
-void KServiceLocator::parseAttributeList(const QString &attributes,
- QMap<QString,QString> &attributeMap) {
- QRegExp r("\\((.*)=(.*)\\)");
+void KServiceLocator::parseAttributeList(const TQString &attributes,
+ TQMap<TQString,TQString> &attributeMap) {
+ TQRegExp r("\\((.*)=(.*)\\)");
r.setMinimal(true);
int pos = 0;
while (pos >= 0) {
@@ -719,16 +719,16 @@ void KServiceLocator::parseAttributeList(const QString &attributes,
}
}
-QStringList KServiceLocator::parseCommaList(const QString &list) {
- return QStringList::split(QChar(','), list);
+TQStringList KServiceLocator::parseCommaList(const TQString &list) {
+ return TQStringList::split(TQChar(','), list);
}
-QString KServiceLocator::createCommaList(const QStringList &values) {
+TQString KServiceLocator::createCommaList(const TQStringList &values) {
return values.join(",");
}
-QString KServiceLocator::escapeFilter(const QString &str) {
- QString f;
+TQString KServiceLocator::escapeFilter(const TQString &str) {
+ TQString f;
int s = str.length();
for (int i = 0; i < s; i++) {
char c = str[i];