diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kdnssd/ioslave | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-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 'kdnssd/ioslave')
-rw-r--r-- | kdnssd/ioslave/dnssd.cpp | 62 | ||||
-rw-r--r-- | kdnssd/ioslave/dnssd.h | 30 |
2 files changed, 46 insertions, 46 deletions
diff --git a/kdnssd/ioslave/dnssd.cpp b/kdnssd/ioslave/dnssd.cpp index b039298a..6508a13a 100644 --- a/kdnssd/ioslave/dnssd.cpp +++ b/kdnssd/ioslave/dnssd.cpp @@ -18,10 +18,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qcstring.h> -#include <qsocket.h> -#include <qdatetime.h> -#include <qbitarray.h> +#include <tqcstring.h> +#include <tqsocket.h> +#include <tqdatetime.h> +#include <tqbitarray.h> #include <stdlib.h> #include <math.h> @@ -43,9 +43,9 @@ #include <klocale.h> #include <kurl.h> #include <ksock.h> -#include <qmap.h> +#include <tqmap.h> #include <kapplication.h> -#include <qeventloop.h> +#include <tqeventloop.h> #include <dnssd/domainbrowser.h> #include <krun.h> @@ -60,7 +60,7 @@ static const KCmdLineOptions options[] = KCmdLineLastOption }; -ZeroConfProtocol::ZeroConfProtocol(const QCString& protocol, const QCString &pool_socket, const QCString &app_socket) +ZeroConfProtocol::ZeroConfProtocol(const TQCString& protocol, const TQCString &pool_socket, const TQCString &app_socket) : SlaveBase(protocol, pool_socket, app_socket), browser(0),toResolve(0), configData(0) {} @@ -79,11 +79,11 @@ void ZeroConfProtocol::get(const KURL& url ) { resolveAndRedirect(url,true); mimeType("text/html"); - QString reply= "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; + TQString reply= "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"; reply+="</head>\n<body>\n<h2>"+i18n("Requested service has been launched in separate window."); reply+="</h2>\n</body></html>"; data(reply.utf8()); - data(QByteArray()); + data(TQByteArray()); finished(); break; } @@ -102,9 +102,9 @@ void ZeroConfProtocol::mimetype(const KURL& url ) UrlType ZeroConfProtocol::checkURL(const KURL& url) { if (url.path()=="/") return RootDir; - QString service, type, domain; + TQString service, type, domain; dissect(url,service,type,domain); - const QString& proto = type.section('.',1,-1); + const TQString& proto = type.section('.',1,-1); if (type[0]!='_' || (proto!="_udp" && proto!="_tcp")) return Invalid; if (service.isEmpty()) return ServiceDir; if (!domain.isEmpty()) { @@ -118,7 +118,7 @@ UrlType ZeroConfProtocol::checkURL(const KURL& url) // URL zeroconf://domain/_http._tcp/some%20service // URL invitation://host:port/_http._tcp/some%20service?u=username&root=directory -void ZeroConfProtocol::dissect(const KURL& url,QString& name,QString& type,QString& domain) +void ZeroConfProtocol::dissect(const KURL& url,TQString& name,TQString& type,TQString& domain) { type = url.path().section("/",1,1); domain = url.host(); @@ -159,7 +159,7 @@ void ZeroConfProtocol::stat(const KURL& url) break; case HelperProtocol: { - QString name,type,domain; + TQString name,type,domain; dissect(url,name,type,domain); buildServiceEntry(entry,name,type,domain); statEntry(entry); @@ -170,15 +170,15 @@ void ZeroConfProtocol::stat(const KURL& url) error(ERR_MALFORMED_URL,i18n("invalid URL")); } } -QString ZeroConfProtocol::getAttribute(const QString& name) +TQString ZeroConfProtocol::getAttribute(const TQString& name) { - QString entry = configData->readEntry(name); - return (entry.isNull()) ? QString::null : toResolve->textData()[entry]; + TQString entry = configData->readEntry(name); + return (entry.isNull()) ? TQString::null : toResolve->textData()[entry]; } void ZeroConfProtocol::resolveAndRedirect(const KURL& url, bool useKRun) { - QString name,type,domain; + TQString name,type,domain; dissect(url,name,type,domain); if (url.protocol()=="invitation") { delete toResolve; @@ -216,7 +216,7 @@ void ZeroConfProtocol::resolveAndRedirect(const KURL& url, bool useKRun) } } -bool ZeroConfProtocol::setConfig(const QString& type) +bool ZeroConfProtocol::setConfig(const TQString& type) { kdDebug() << "Setting config for " << type << endl; if (configData) @@ -233,7 +233,7 @@ bool ZeroConfProtocol::setConfig(const QString& type) return (configData->readEntry("Type")==type); } -inline void buildAtom(UDSEntry& entry,UDSAtomTypes type, const QString& data) +inline void buildAtom(UDSEntry& entry,UDSAtomTypes type, const TQString& data) { UDSAtom atom; atom.m_uds=type; @@ -249,7 +249,7 @@ inline void buildAtom(UDSEntry& entry,UDSAtomTypes type, long data) } -void ZeroConfProtocol::buildDirEntry(UDSEntry& entry,const QString& name,const QString& type, const QString& host) +void ZeroConfProtocol::buildDirEntry(UDSEntry& entry,const TQString& name,const TQString& type, const TQString& host) { entry.clear(); buildAtom(entry,UDS_NAME,name); @@ -259,23 +259,23 @@ void ZeroConfProtocol::buildDirEntry(UDSEntry& entry,const QString& name,const Q buildAtom(entry,UDS_MIME_TYPE,"inode/directory"); if (!type.isNull()) buildAtom(entry,UDS_URL,"zeroconf:/"+((!host.isNull()) ? "/"+host+"/" : "" )+type+"/"); } -QString ZeroConfProtocol::getProtocol(const QString& type) +TQString ZeroConfProtocol::getProtocol(const TQString& type) { setConfig(type); return configData->readEntry("Protocol",type.section(".",0,0).mid(1)); } -void ZeroConfProtocol::buildServiceEntry(UDSEntry& entry,const QString& name,const QString& type,const QString& domain) +void ZeroConfProtocol::buildServiceEntry(UDSEntry& entry,const TQString& name,const TQString& type,const TQString& domain) { setConfig(type); entry.clear(); buildAtom(entry,UDS_NAME,name); buildAtom(entry,UDS_ACCESS,0666); - QString icon=configData->readEntry("Icon",KProtocolInfo::icon(getProtocol(type))); + TQString icon=configData->readEntry("Icon",KProtocolInfo::icon(getProtocol(type))); if (!icon.isNull()) buildAtom(entry,UDS_ICON_NAME,icon); KURL protourl; protourl.setProtocol(getProtocol(type)); - QString encname = "zeroconf://" + domain +"/" +type+ "/" + name; + TQString encname = "zeroconf://" + domain +"/" +type+ "/" + name; if (KProtocolInfo::supportsListing(protourl)) { buildAtom(entry,UDS_FILE_TYPE,S_IFDIR); encname+="/"; @@ -294,15 +294,15 @@ void ZeroConfProtocol::listDir(const KURL& url ) if (allDomains=url.host().isEmpty()) browser = new ServiceBrowser(ServiceBrowser::AllServices); else browser = new ServiceBrowser(ServiceBrowser::AllServices,url.host()); - connect(browser,SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)), - this,SLOT(newType(DNSSD::RemoteService::Ptr))); + connect(browser,TQT_SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)), + this,TQT_SLOT(newType(DNSSD::RemoteService::Ptr))); break; case ServiceDir: if (url.host().isEmpty()) browser = new ServiceBrowser(url.path(-1).section("/",1,-1)); else browser = new ServiceBrowser(url.path(-1).section("/",1,-1),url.host()); - connect(browser,SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)), - this,SLOT(newService(DNSSD::RemoteService::Ptr))); + connect(browser,TQT_SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)), + this,TQT_SLOT(newService(DNSSD::RemoteService::Ptr))); break; case Service: resolveAndRedirect(url); @@ -311,7 +311,7 @@ void ZeroConfProtocol::listDir(const KURL& url ) error(ERR_MALFORMED_URL,i18n("invalid URL")); return; } - connect(browser,SIGNAL(finished()),this,SLOT(allReported())); + connect(browser,TQT_SIGNAL(finished()),this,TQT_SLOT(allReported())); browser->startBrowse(); kapp->eventLoop()->enterLoop(); } @@ -332,9 +332,9 @@ void ZeroConfProtocol::newType(DNSSD::RemoteService::Ptr srv) UDSEntry entry; kdDebug() << "Got new entry " << srv->type() << endl; if (!setConfig(srv->type())) return; - QString name = configData->readEntry("Name"); + TQString name = configData->readEntry("Name"); if (!name.isNull()) { - buildDirEntry(entry,name,srv->type(), (allDomains) ? QString::null : + buildDirEntry(entry,name,srv->type(), (allDomains) ? TQString::null : browser->browsedDomains()->domains()[0]); listEntry(entry,false); } diff --git a/kdnssd/ioslave/dnssd.h b/kdnssd/ioslave/dnssd.h index 1dc1dc05..8aaa90a8 100644 --- a/kdnssd/ioslave/dnssd.h +++ b/kdnssd/ioslave/dnssd.h @@ -21,16 +21,16 @@ #ifndef _dnssd_H_ #define _dnssd_H_ -#include <qstring.h> -#include <qcstring.h> -#include <qobject.h> +#include <tqstring.h> +#include <tqcstring.h> +#include <tqobject.h> #include <kurl.h> #include <kio/global.h> #include <kio/slavebase.h> #include <dnssd/servicebrowser.h> #include <dnssd/remoteservice.h> -#include <qstringlist.h> +#include <tqstringlist.h> class QCString; @@ -39,11 +39,11 @@ using namespace DNSSD; enum UrlType { RootDir, ServiceDir, Service, HelperProtocol, Invalid }; -class ZeroConfProtocol : public QObject, public KIO::SlaveBase +class ZeroConfProtocol : public TQObject, public KIO::SlaveBase { Q_OBJECT public: - ZeroConfProtocol(const QCString& protocol, const QCString &pool_socket, const QCString &app_socket); + ZeroConfProtocol(const TQCString& protocol, const TQCString &pool_socket, const TQCString &app_socket); ~ZeroConfProtocol(); virtual void get(const KURL& url); virtual void mimetype(const KURL& url); @@ -51,26 +51,26 @@ public: virtual void listDir(const KURL& url ); private: // Create UDSEntry for zeroconf:/ or zeroconf:/type/ paths - void buildDirEntry(UDSEntry& entry,const QString& name,const QString& type=QString::null, - const QString& host=QString::null); + void buildDirEntry(UDSEntry& entry,const TQString& name,const TQString& type=TQString::null, + const TQString& host=TQString::null); // Create UDSEntry for single services: dnssd:/type/service - void buildServiceEntry(UDSEntry& entry,const QString& name,const QString& type, - const QString& domain); + void buildServiceEntry(UDSEntry& entry,const TQString& name,const TQString& type, + const TQString& domain); // Returns root dir, service dir, service or invalid UrlType checkURL(const KURL& url); // extract name, type and domain from URL - void dissect(const KURL& url,QString& name,QString& type,QString& domain); + void dissect(const KURL& url,TQString& name,TQString& type,TQString& domain); // resolve given service and redirect() to it or use KRun on it (used for helper protocols) void resolveAndRedirect(const KURL& url, bool useKRun = false); bool dnssdOK(); - QString getAttribute(const QString& name); - QString getProtocol(const QString& type); + TQString getAttribute(const TQString& name); + TQString getProtocol(const TQString& type); // try to load config file for given service type (or just return if already loaded) - bool setConfig(const QString& type); + bool setConfig(const TQString& type); ServiceBrowser* browser; // service types merged from all domains - to avoid duplicates - QStringList mergedtypes; + TQStringList mergedtypes; // last resolved or still being resolved services - acts as one-entry cache RemoteService *toResolve; // Config file for service - also acts as one-entry cache |