diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
commit | 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch) | |
tree | 073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /dcoprss | |
parent | 3467e6464beac3a162839bf7078e22e3a74d73e7 (diff) | |
download | tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip |
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dcoprss')
-rw-r--r-- | dcoprss/cache.cpp | 12 | ||||
-rw-r--r-- | dcoprss/cache.h | 8 | ||||
-rw-r--r-- | dcoprss/document.cpp | 14 | ||||
-rw-r--r-- | dcoprss/feedbrowser.cpp | 20 | ||||
-rw-r--r-- | dcoprss/feedbrowser.h | 11 | ||||
-rw-r--r-- | dcoprss/query.cpp | 6 | ||||
-rw-r--r-- | dcoprss/query.h | 12 | ||||
-rw-r--r-- | dcoprss/rssnewsfeed.h | 72 | ||||
-rw-r--r-- | dcoprss/service.cpp | 2 | ||||
-rw-r--r-- | dcoprss/service.h | 3 | ||||
-rw-r--r-- | dcoprss/xmlrpciface.cpp | 12 | ||||
-rw-r--r-- | dcoprss/xmlrpciface.h | 12 |
12 files changed, 115 insertions, 69 deletions
diff --git a/dcoprss/cache.cpp b/dcoprss/cache.cpp index c4a566aa..1e7d260c 100644 --- a/dcoprss/cache.cpp +++ b/dcoprss/cache.cpp @@ -35,7 +35,7 @@ bool CacheEntry::isValid() const { // Cache entries get invalid after on hour. One shouldn't hardcode this // but for now it'll do. - return m_timeStamp.secsTo( TQDateTime::currentDateTime() ) < 3600; + return m_timeStamp.secsTo( TQDateTime::tqcurrentDateTime() ) < 3600; } Cache *Cache::m_instance = 0; @@ -51,8 +51,8 @@ TQString Cache::getCacheKey( const TQString &server, const TQString &method, const TQValueList<TQVariant> &args ) { TQString key; - key = server + TQString::fromLatin1( "__" ); - key += method + TQString::fromLatin1( "__" ); + key = server + TQString::tqfromLatin1( "__" ); + key += method + TQString::tqfromLatin1( "__" ); TQValueList<TQVariant>::ConstIterator it = args.begin(); TQValueList<TQVariant>::ConstIterator end = args.end(); for ( ; it != end; ++it ) @@ -108,16 +108,16 @@ void Cache::save() void Cache::touch( const TQString &key ) { - CacheEntry *entry = find( key ); + CacheEntry *entry = tqfind( key ); if ( !entry ) return; - entry->m_timeStamp = TQDateTime::currentDateTime(); + entry->m_timeStamp = TQDateTime::tqcurrentDateTime(); } void Cache::insert( const TQString &key, const KXMLRPC::Query::Result &result ) { CacheEntry *entry = new CacheEntry; - entry->m_timeStamp = TQDateTime::currentDateTime(); + entry->m_timeStamp = TQDateTime::tqcurrentDateTime(); entry->m_result = result; TQDict<CacheEntry>::insert( key, entry ); } diff --git a/dcoprss/cache.h b/dcoprss/cache.h index 3bf73e12..f17a11f3 100644 --- a/dcoprss/cache.h +++ b/dcoprss/cache.h @@ -74,12 +74,16 @@ class Cache : public TQDict<CacheEntry> inline TQDataStream &operator<<( TQDataStream &s, const CacheEntry &e ) { - return s << e.timeStamp() << e.result(); + s << e.timeStamp(); + s << e.result(); + return s; } inline TQDataStream &operator>>( TQDataStream &s, CacheEntry &e ) { - return s >> e.m_timeStamp >> e.m_result; + s >> e.m_timeStamp; + s >> e.m_result; + return s; } #endif // CACHE_H diff --git a/dcoprss/document.cpp b/dcoprss/document.cpp index fb5cd904..64c68d6e 100644 --- a/dcoprss/document.cpp +++ b/dcoprss/document.cpp @@ -29,7 +29,7 @@ RSSDocument::RSSDocument(const TQString& url) : m_pix = TQPixmap(); m_isLoading = false; m_maxAge = 60; - m_Timeout = TQDateTime::currentDateTime(); + m_Timeout = TQDateTime::tqcurrentDateTime(); m_state.clear(); } @@ -40,7 +40,7 @@ RSSDocument::~RSSDocument() delete m_Doc; } -void RSSDocument::loadingComplete(Loader *ldr, Document doc, Status stat) +void RSSDocument::loadingComplete(Loader *ldr, Document doc, tqStatus stat) { @@ -129,7 +129,7 @@ TQDateTime RSSDocument::lastBuildDate() if( m_Doc != 0L) return m_Doc->lastBuildDate(); else - return TQDateTime::currentDateTime(); + return TQDateTime::tqcurrentDateTime(); } TQDateTime RSSDocument::pubDate() @@ -137,7 +137,7 @@ TQDateTime RSSDocument::pubDate() if( m_Doc != 0L) return m_Doc->pubDate(); else - return TQDateTime::currentDateTime(); + return TQDateTime::tqcurrentDateTime(); } TQString RSSDocument::copyright() @@ -243,14 +243,14 @@ bool RSSDocument::pixmapValid() void RSSDocument::refresh() { kdDebug() << "Mod time " << m_Timeout.toString() << endl; - kdDebug() << "Current time " << TQDateTime::currentDateTime().toString() << endl; + kdDebug() << "Current time " << TQDateTime::tqcurrentDateTime().toString() << endl; - if(!m_isLoading && (TQDateTime::currentDateTime() >= m_Timeout)) + if(!m_isLoading && (TQDateTime::tqcurrentDateTime() >= m_Timeout)) { kdDebug() << "Document going to refresh" << endl; m_isLoading = true; Loader *loader = Loader::create(this, - TQT_SLOT(loadingComplete(Loader *, Document, Status))); + TQT_SLOT(loadingComplete(Loader *, Document, tqStatus))); loader->loadFrom(KURL( m_Url ), new FileRetriever()); documentUpdating(DCOPRef(this)); } diff --git a/dcoprss/feedbrowser.cpp b/dcoprss/feedbrowser.cpp index eae10f63..fd18c0ef 100644 --- a/dcoprss/feedbrowser.cpp +++ b/dcoprss/feedbrowser.cpp @@ -13,15 +13,15 @@ #include <tqdatastream.h> #include <tqvbox.h> -CategoryItem::CategoryItem( KListView *parent, const TQString &category ) - : KListViewItem( parent ), +CategoryItem::CategoryItem( KListView *tqparent, const TQString &category ) + : KListViewItem( tqparent ), m_category( category ) { init(); } -CategoryItem::CategoryItem( KListViewItem *parent, const TQString &category ) - : KListViewItem( parent ), +CategoryItem::CategoryItem( KListViewItem *tqparent, const TQString &category ) + : KListViewItem( tqparent ), m_category( category ) { init(); @@ -32,7 +32,7 @@ void CategoryItem::init() m_populated = false; m_dcopIface = 0; - setText( 0, m_category.mid( m_category.findRev( '/' ) + 1 ).replace( '_', ' ' ) ); + setText( 0, m_category.mid( m_category.tqfindRev( '/' ) + 1 ).tqreplace( '_', ' ' ) ); } void CategoryItem::setOpen( bool open ) @@ -66,8 +66,8 @@ void CategoryItem::gotCategories( const TQStringList &categories ) KListViewItem::setOpen( true ); } -DCOPRSSIface::DCOPRSSIface( TQObject *parent, const char *name ) : - TQObject( parent, name ), DCOPObject( "FeedBrowser" ) +DCOPRSSIface::DCOPRSSIface( TQObject *tqparent, const char *name ) : + TQObject( tqparent, name ), DCOPObject( "FeedBrowser" ) { connectDCOPSignal( "rssservice", "RSSQuery", "gotCategories(TQStringList)", "slotGotCategories(TQStringList)", false ); @@ -87,11 +87,11 @@ void DCOPRSSIface::slotGotCategories( const TQStringList &categories ) emit gotCategories( categories ); } -FeedBrowserDlg::FeedBrowserDlg( TQWidget *parent, const char *name ) - : KDialogBase( parent, name, true, i18n( "DCOPRSS Feed Browser" ), +FeedBrowserDlg::FeedBrowserDlg( TQWidget *tqparent, const char *name ) + : KDialogBase( tqparent, name, true, i18n( "DCOPRSS Feed Browser" ), Close, Close, true ) { - m_dcopIface = new DCOPRSSIface( this, "m_dcopIface" ); + m_dcopIface = new DCOPRSSIface( TQT_TQOBJECT(this), "m_dcopIface" ); connect( m_dcopIface, TQT_SIGNAL( gotCategories( const TQStringList & ) ), this, TQT_SLOT( gotTopCategories( const TQStringList & ) ) ); diff --git a/dcoprss/feedbrowser.h b/dcoprss/feedbrowser.h index 9b8ce86f..88d24ea8 100644 --- a/dcoprss/feedbrowser.h +++ b/dcoprss/feedbrowser.h @@ -10,8 +10,9 @@ class DCOPRSSIface : public TQObject, public DCOPObject { K_DCOP Q_OBJECT +// TQ_OBJECT public: - DCOPRSSIface( TQObject *parent, const char *name = 0 ); + DCOPRSSIface( TQObject *tqparent, const char *name = 0 ); k_dcop: void slotGotCategories( const TQStringList &categories ); @@ -26,9 +27,10 @@ class DCOPRSSIface : public TQObject, public DCOPObject class CategoryItem : public TQObject, public KListViewItem { Q_OBJECT +// TQ_OBJECT public: - CategoryItem( KListView *parent, const TQString &category ); - CategoryItem( KListViewItem *parent, const TQString &category ); + CategoryItem( KListView *tqparent, const TQString &category ); + CategoryItem( KListViewItem *tqparent, const TQString &category ); virtual void setOpen( bool open ); @@ -47,9 +49,10 @@ class CategoryItem : public TQObject, public KListViewItem class FeedBrowserDlg : public KDialogBase { Q_OBJECT +// TQ_OBJECT friend class CategoryItem; public: - FeedBrowserDlg( TQWidget *parent, const char *name = 0 ); + FeedBrowserDlg( TQWidget *tqparent, const char *name = 0 ); private slots: void itemSelected( TQListViewItem *item ); diff --git a/dcoprss/query.cpp b/dcoprss/query.cpp index 9c324890..0c6dd2f5 100644 --- a/dcoprss/query.cpp +++ b/dcoprss/query.cpp @@ -58,7 +58,7 @@ void QueryService::cachedCall( const TQString &method, const TQString cacheKey = Cache::getCacheKey( m_xmlrpcServer->url().url(), method, args ); - CacheEntry *cacheEntry = Cache::self().find( cacheKey ); + CacheEntry *cacheEntry = Cache::self().tqfind( cacheKey ); if ( cacheEntry != 0 && cacheEntry->isValid() ) { kdDebug() << "Using cached result." << endl; SlotCaller::call( this, slot, cacheEntry->result() ); @@ -74,7 +74,7 @@ void QueryService::updateCache( const KXMLRPC::Query::Result &result ) result.method(), result.args() ); - CacheEntry *cacheEntry = Cache::self().find( cacheKey ); + CacheEntry *cacheEntry = Cache::self().tqfind( cacheKey ); if ( cacheEntry == 0 ) { kdDebug() << "Inserting returned result into cache." << endl; Cache::self().insert( cacheKey, result ); @@ -113,7 +113,7 @@ void QueryService::getCategories( const TQString &category ) kdDebug() << "QueryService::getCategories()" << endl; if ( category == "Top" ) { - cachedCall( "syndic8.GetCategoryRoots", Server::toVariantList( TQString::fromLatin1( "DMOZ" ) ), + cachedCall( "syndic8.GetCategoryRoots", Server::toVariantList( TQString::tqfromLatin1( "DMOZ" ) ), TQT_SLOT( slotGotCategories( const KXMLRPC::Query::Result & ) ) ); } else { TQStringList args; diff --git a/dcoprss/query.h b/dcoprss/query.h index dbaf5093..dcc50653 100644 --- a/dcoprss/query.h +++ b/dcoprss/query.h @@ -1,6 +1,6 @@ /* $Id$ */ -#ifndef _QUERY_SERVICE -#define _QUERY_SERVICE +#ifndef _TQUERY_SERVICE +#define _TQUERY_SERVICE /*************************************************************************** query.h - A query interface to select RSS feeds. @@ -32,12 +32,14 @@ class RSSService; /** - * Helper class which just calls the slot given it's QObject/const char* + * Helper class which just calls the slot given it's TQObject/const char* * representation. */ -class SlotCaller : public QObject +class SlotCaller : public TQObject { Q_OBJECT +// TQ_OBJECT + public: static void call( TQObject *object, const char *slot, const KXMLRPC::Query::Result &value ); @@ -53,6 +55,8 @@ class QueryService : public TQObject, public DCOPObject { K_DCOP Q_OBJECT +// TQ_OBJECT + public: QueryService( RSSService *service ); diff --git a/dcoprss/rssnewsfeed.h b/dcoprss/rssnewsfeed.h index ee300655..0741ac2b 100644 --- a/dcoprss/rssnewsfeed.h +++ b/dcoprss/rssnewsfeed.h @@ -82,31 +82,63 @@ class RSSNewsFeed inline TQDataStream &operator<<( TQDataStream &stream, const RSSNewsFeed &feed ) { - return stream << feed.m_id << feed.m_name << feed.m_description - << feed.m_origin << feed.m_languageCode << feed.m_status - << feed.m_version << feed.m_homePage << feed.m_sourceFile - << feed.m_imageUrl << feed.m_webmaster << feed.m_publisher - << feed.m_creator << feed.m_dateCreated << feed.m_dateApproved - << feed.m_dateXmlChanged << feed.m_fetchable << feed.m_views - << feed.m_headlinesPerDay << feed.m_headlinesRank - << feed.m_toolkit << feed.m_toolkitVersion - << feed.m_pollingInterval << feed.m_lastPoll - << feed.m_categories; + stream << feed.m_id; + stream << feed.m_name; + stream << feed.m_description; + stream << feed.m_origin; + stream << feed.m_languageCode; + stream << feed.m_status; + stream << feed.m_version; + stream << feed.m_homePage; + stream << feed.m_sourceFile; + stream << feed.m_imageUrl; + stream << feed.m_webmaster; + stream << feed.m_publisher; + stream << feed.m_creator; + stream << feed.m_dateCreated; + stream << feed.m_dateApproved; + stream << feed.m_dateXmlChanged; + stream << feed.m_fetchable; + stream << feed.m_views; + stream << feed.m_headlinesPerDay; + stream << feed.m_headlinesRank; + stream << feed.m_toolkit; + stream << feed.m_toolkitVersion; + stream << feed.m_pollingInterval; + stream << feed.m_lastPoll; + stream << feed.m_categories; + + return stream; } inline TQDataStream &operator>>( TQDataStream &stream, RSSNewsFeed &feed ) { int i; - stream >> feed.m_id >> feed.m_name >> feed.m_description - >> feed.m_origin >> feed.m_languageCode >> feed.m_status - >> feed.m_version >> feed.m_homePage >> feed.m_sourceFile - >> feed.m_imageUrl >> feed.m_webmaster >> feed.m_publisher - >> feed.m_creator >> feed.m_dateCreated >> feed.m_dateApproved - >> feed.m_dateXmlChanged >> i >> feed.m_views - >> feed.m_headlinesPerDay >> feed.m_headlinesRank - >> feed.m_toolkit >> feed.m_toolkitVersion - >> feed.m_pollingInterval >> feed.m_lastPoll - >> feed.m_categories; + stream >> feed.m_id; + stream >> feed.m_name; + stream >> feed.m_description; + stream >> feed.m_origin; + stream >> feed.m_languageCode; + stream >> feed.m_status; + stream >> feed.m_version; + stream >> feed.m_homePage; + stream >> feed.m_sourceFile; + stream >> feed.m_imageUrl; + stream >> feed.m_webmaster; + stream >> feed.m_publisher; + stream >> feed.m_creator; + stream >> feed.m_dateCreated; + stream >> feed.m_dateApproved; + stream >> feed.m_dateXmlChanged; + stream >> i; + stream >> feed.m_views; + stream >> feed.m_headlinesPerDay; + stream >> feed.m_headlinesRank; + stream >> feed.m_toolkit; + stream >> feed.m_toolkitVersion; + stream >> feed.m_pollingInterval; + stream >> feed.m_lastPoll; + stream >> feed.m_categories; feed.m_fetchable = i != 0; return stream; } diff --git a/dcoprss/service.cpp b/dcoprss/service.cpp index 54e987b2..ec6b62c4 100644 --- a/dcoprss/service.cpp +++ b/dcoprss/service.cpp @@ -45,7 +45,7 @@ TQStringList RSSService::list() DCOPRef RSSService::add(TQString id) { - if(m_list.find(id) == 0L) { // add a new one only if we need to + if(m_list.tqfind(id) == 0L) { // add a new one only if we need to m_list.insert(id, new RSSDocument(id)); added(id); saveLinks(); diff --git a/dcoprss/service.h b/dcoprss/service.h index 64a3589e..502d13c1 100644 --- a/dcoprss/service.h +++ b/dcoprss/service.h @@ -109,6 +109,7 @@ class RSSService : public DCOPObject class RSSDocument : public TQObject, public DCOPObject { Q_OBJECT +// TQ_OBJECT K_DCOP private: @@ -123,7 +124,7 @@ class RSSDocument : public TQObject, public DCOPObject private slots: void pixmapLoaded(const TQPixmap&); - void loadingComplete(Loader *, Document, Status); + void loadingComplete(Loader *, Document, tqStatus); public: RSSDocument(const TQString& url); diff --git a/dcoprss/xmlrpciface.cpp b/dcoprss/xmlrpciface.cpp index 64259bbb..a70053d0 100644 --- a/dcoprss/xmlrpciface.cpp +++ b/dcoprss/xmlrpciface.cpp @@ -33,9 +33,9 @@ using namespace KXMLRPC; -Query *Query::create( TQObject *parent, const char *name ) +Query *Query::create( TQObject *tqparent, const char *name ) { - return new Query( parent, name ); + return new Query( tqparent, name ); } void Query::call( const TQString &server, const TQString &method, @@ -255,7 +255,7 @@ TQVariant Query::demarshal( const TQDomElement &elem ) else return TQVariant( false ); } else if ( typeName == "base64" ) - return TQVariant( KCodecs::base64Decode( typeElement.text().latin1() ) ); + return TQVariant( KCodecs::base64Decode( TQCString(typeElement.text().latin1() )) ); else if ( typeName == "datetime" || typeName == "datetime.iso8601" ) return TQVariant( TQDateTime::fromString( typeElement.text(), Qt::ISODate ) ); else if ( typeName == "array" ) { @@ -282,7 +282,7 @@ TQVariant Query::demarshal( const TQDomElement &elem ) return TQVariant(); } -Query::Query( TQObject *parent, const char *name ) : TQObject( parent, name ) +Query::Query( TQObject *tqparent, const char *name ) : TQObject( tqparent, name ) { } @@ -352,8 +352,8 @@ TQValueList<TQVariant> Server::toVariantList( const TQStringList &arg ) return args; } -Server::Server( const KURL &url, TQObject *parent, const char *name ) - : TQObject( parent, name ) +Server::Server( const KURL &url, TQObject *tqparent, const char *name ) + : TQObject( tqparent, name ) { if ( url.isValid() ) m_url = url; diff --git a/dcoprss/xmlrpciface.h b/dcoprss/xmlrpciface.h index 4dc975a9..e100ade1 100644 --- a/dcoprss/xmlrpciface.h +++ b/dcoprss/xmlrpciface.h @@ -47,9 +47,10 @@ namespace KXMLRPC class QueryResult; class Server; - class Query : public QObject + class Query : public TQObject { Q_OBJECT + TQ_OBJECT public: class Result { @@ -76,7 +77,7 @@ namespace KXMLRPC TQValueList<TQVariant> m_args; }; - static Query *create( TQObject *parent = 0, const char *name = 0 ); + static Query *create( TQObject *tqparent = 0, const char *name = 0 ); static TQString marshal( const TQVariant &v ); static TQVariant demarshal( const TQDomElement &e ); @@ -104,7 +105,7 @@ namespace KXMLRPC TQString markupCall( const TQString &method, const TQValueList<TQVariant> &args ) const; - Query( TQObject *parent = 0, const char *name = 0 ); + Query( TQObject *tqparent = 0, const char *name = 0 ); TQBuffer m_buffer; TQString m_server; @@ -112,12 +113,13 @@ namespace KXMLRPC TQValueList<TQVariant> m_args; }; - class Server : public QObject + class Server : public TQObject { Q_OBJECT + TQ_OBJECT public: Server( const KURL &url = KURL(), - TQObject *parent = 0, const char *name = 0 ); + TQObject *tqparent = 0, const char *name = 0 ); const KURL &url() const { return m_url; } void setUrl( const KURL &url ); |