summaryrefslogtreecommitdiffstats
path: root/akregator/src/feed.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /akregator/src/feed.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'akregator/src/feed.cpp')
-rw-r--r--akregator/src/feed.cpp162
1 files changed, 81 insertions, 81 deletions
diff --git a/akregator/src/feed.cpp b/akregator/src/feed.cpp
index c088654a2..f0574c31a 100644
--- a/akregator/src/feed.cpp
+++ b/akregator/src/feed.cpp
@@ -23,13 +23,13 @@
without including the source code for Qt in the source distribution.
*/
-#include <qtimer.h>
-#include <qdatetime.h>
-#include <qlistview.h>
-#include <qdom.h>
-#include <qmap.h>
-#include <qpixmap.h>
-#include <qvaluelist.h>
+#include <tqtimer.h>
+#include <tqdatetime.h>
+#include <tqlistview.h>
+#include <tqdom.h>
+#include <tqmap.h>
+#include <tqpixmap.h>
+#include <tqvaluelist.h>
#include <kurl.h>
#include <kdebug.h>
@@ -77,31 +77,31 @@ class Feed::FeedPrivate
bool articlesLoaded;
Backend::FeedStorage* archive;
- QString xmlUrl;
- QString htmlUrl;
- QString description;
+ TQString xmlUrl;
+ TQString htmlUrl;
+ TQString description;
/** list of feed articles */
- QMap<QString, Article> articles;
+ TQMap<TQString, Article> articles;
/** caches guids of tagged articles. key: tag, value: list of guids */
- QMap<QString, QStringList> taggedArticles;
+ TQMap<TQString, TQStringList> taggedArticles;
/** list of deleted articles. This contains **/
- QValueList<Article> deletedArticles;
+ TQValueList<Article> deletedArticles;
/** caches guids of deleted articles for notification */
- QValueList<Article> addedArticlesNotify;
- QValueList<Article> removedArticlesNotify;
- QValueList<Article> updatedArticlesNotify;
+ TQValueList<Article> addedArticlesNotify;
+ TQValueList<Article> removedArticlesNotify;
+ TQValueList<Article> updatedArticlesNotify;
- QPixmap imagePixmap;
+ TQPixmap imagePixmap;
RSS::Image image;
- QPixmap favicon;
+ TQPixmap favicon;
};
-QString Feed::archiveModeToString(ArchiveMode mode)
+TQString Feed::archiveModeToString(ArchiveMode mode)
{
switch (mode)
{
@@ -122,16 +122,16 @@ QString Feed::archiveModeToString(ArchiveMode mode)
return "globalDefault";
}
-Feed* Feed::fromOPML(QDomElement e)
+Feed* Feed::fromOPML(TQDomElement e)
{
Feed* feed = 0;
if( e.hasAttribute("xmlUrl") || e.hasAttribute("xmlurl") || e.hasAttribute("xmlURL") )
{
- QString title = e.hasAttribute("text") ? e.attribute("text") : e.attribute("title");
+ TQString title = e.hasAttribute("text") ? e.attribute("text") : e.attribute("title");
- QString xmlUrl = e.hasAttribute("xmlUrl") ? e.attribute("xmlUrl") : e.attribute("xmlurl");
+ TQString xmlUrl = e.hasAttribute("xmlUrl") ? e.attribute("xmlUrl") : e.attribute("xmlurl");
if (xmlUrl.isEmpty())
xmlUrl = e.attribute("xmlURL");
@@ -139,8 +139,8 @@ Feed* Feed::fromOPML(QDomElement e)
// "autoFetch" is used in 3.4
// Will be removed in KDE4
- QString htmlUrl = e.attribute("htmlUrl");
- QString description = e.attribute("description");
+ TQString htmlUrl = e.attribute("htmlUrl");
+ TQString description = e.attribute("description");
int fetchInterval = e.attribute("fetchInterval").toInt();
ArchiveMode archiveMode = stringToArchiveMode(e.attribute("archiveMode"));
int maxArticleAge = e.attribute("maxArticleAge").toUInt();
@@ -179,17 +179,17 @@ bool Feed::accept(TreeNodeVisitor* visitor)
return visitor->visitTreeNode(this);
}
-QStringList Feed::tags() const
+TQStringList Feed::tags() const
{
return d->archive->tags();
}
-Article Feed::findArticle(const QString& guid) const
+Article Feed::findArticle(const TQString& guid) const
{
return d->articles[guid];
}
-QValueList<Article> Feed::articles(const QString& tag)
+TQValueList<Article> Feed::articles(const TQString& tag)
{
if (!d->articlesLoaded)
loadArticles();
@@ -197,9 +197,9 @@ QValueList<Article> Feed::articles(const QString& tag)
return d->articles.values();
else
{
- QValueList<Article> tagged;
- QStringList guids = d->archive->articles(tag);
- for (QStringList::ConstIterator it = guids.begin(); it != guids.end(); ++it)
+ TQValueList<Article> tagged;
+ TQStringList guids = d->archive->articles(tag);
+ for (TQStringList::ConstIterator it = guids.begin(); it != guids.end(); ++it)
tagged += d->articles[*it];
return tagged;
@@ -208,7 +208,7 @@ QValueList<Article> Feed::articles(const QString& tag)
void Feed::loadImage()
{
- QString imageFileName = KGlobal::dirs()->saveLocation("cache", "akregator/Media/")
+ TQString imageFileName = KGlobal::dirs()->saveLocation("cache", "akregator/Media/")
+ Utils::fileNameForUrl(d->xmlUrl) +
".png";
d->imagePixmap.load(imageFileName, "PNG");
@@ -222,8 +222,8 @@ void Feed::loadArticles()
if (!d->archive)
d->archive = Backend::Storage::getInstance()->archiveFor(xmlUrl());
- QStringList list = d->archive->articles();
- for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
+ TQStringList list = d->archive->articles();
+ for ( TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
{
Article mya(*it, this);
d->articles[mya.guid()] = mya;
@@ -238,9 +238,9 @@ void Feed::loadArticles()
void Feed::recalcUnreadCount()
{
- QValueList<Article> tarticles = articles();
- QValueList<Article>::Iterator it;
- QValueList<Article>::Iterator en = tarticles.end();
+ TQValueList<Article> tarticles = articles();
+ TQValueList<Article>::Iterator it;
+ TQValueList<Article>::Iterator en = tarticles.end();
int oldUnread = d->archive->unread();
@@ -257,7 +257,7 @@ void Feed::recalcUnreadCount()
}
}
-Feed::ArchiveMode Feed::stringToArchiveMode(const QString& str)
+Feed::ArchiveMode Feed::stringToArchiveMode(const TQString& str)
{
if (str == "globalDefault")
return globalDefault;
@@ -344,38 +344,38 @@ bool Feed::loadLinkedWebsite() const
return d->loadLinkedWebsite;
}
-const QPixmap& Feed::favicon() const { return d->favicon; }
+const TQPixmap& Feed::favicon() const { return d->favicon; }
-const QPixmap& Feed::image() const { return d->imagePixmap; }
+const TQPixmap& Feed::image() const { return d->imagePixmap; }
-const QString& Feed::xmlUrl() const { return d->xmlUrl; }
+const TQString& Feed::xmlUrl() const { return d->xmlUrl; }
-void Feed::setXmlUrl(const QString& s) { d->xmlUrl = s; }
+void Feed::setXmlUrl(const TQString& s) { d->xmlUrl = s; }
-const QString& Feed::htmlUrl() const { return d->htmlUrl; }
+const TQString& Feed::htmlUrl() const { return d->htmlUrl; }
-void Feed::setHtmlUrl(const QString& s) { d->htmlUrl = s; }
+void Feed::setHtmlUrl(const TQString& s) { d->htmlUrl = s; }
-const QString& Feed::description() const { return d->description; }
+const TQString& Feed::description() const { return d->description; }
-void Feed::setDescription(const QString& s) { d->description = s; }
+void Feed::setDescription(const TQString& s) { d->description = s; }
bool Feed::fetchErrorOccurred() { return d->fetchError; }
bool Feed::isArticlesLoaded() const { return d->articlesLoaded; }
-QDomElement Feed::toOPML( QDomElement parent, QDomDocument document ) const
+TQDomElement Feed::toOPML( TQDomElement parent, TQDomDocument document ) const
{
- QDomElement el = document.createElement( "outline" );
+ TQDomElement el = document.createElement( "outline" );
el.setAttribute( "text", title() );
el.setAttribute( "title", title() );
el.setAttribute( "xmlUrl", d->xmlUrl );
el.setAttribute( "htmlUrl", d->htmlUrl );
- el.setAttribute( "id", QString::number(id()) );
+ el.setAttribute( "id", TQString::number(id()) );
el.setAttribute( "description", d->description );
el.setAttribute( "useCustomFetchInterval", (useCustomFetchInterval() ? "true" : "false") );
- el.setAttribute( "fetchInterval", QString::number(fetchInterval()) );
+ el.setAttribute( "fetchInterval", TQString::number(fetchInterval()) );
el.setAttribute( "archiveMode", archiveModeToString(d->archiveMode) );
el.setAttribute( "maxArticleAge", d->maxArticleAge );
el.setAttribute( "maxArticleNumber", d->maxArticleNumber );
@@ -397,9 +397,9 @@ void Feed::slotMarkAllArticlesAsRead()
if (unread() > 0)
{
setNotificationMode(false, true);
- QValueList<Article> tarticles = articles();
- QValueList<Article>::Iterator it;
- QValueList<Article>::Iterator en = tarticles.end();
+ TQValueList<Article> tarticles = articles();
+ TQValueList<Article>::Iterator it;
+ TQValueList<Article>::Iterator en = tarticles.end();
for (it = tarticles.begin(); it != en; ++it)
(*it).setStatus(Article::Read);
@@ -412,7 +412,7 @@ void Feed::slotAddToFetchQueue(FetchQueue* queue, bool intervalFetchOnly)
queue->addFeed(this);
else
{
- uint now = QDateTime::currentDateTime().toTime_t();
+ uint now = TQDateTime::currentDateTime().toTime_t();
// workaround for 3.5.x: if the last fetch went wrong, try again after 30 minutes
// this fixes annoying behaviour of akregator, especially when the host is reachable
@@ -446,7 +446,7 @@ void Feed::appendArticles(const RSS::Document &doc)
int nudge=0;
- QValueList<Article> deletedArticles = d->deletedArticles;
+ TQValueList<Article> deletedArticles = d->deletedArticles;
for (it = d_articles.begin(); it != en; ++it)
{
@@ -457,8 +457,8 @@ void Feed::appendArticles(const RSS::Document &doc)
nudge--;
appendArticle(mya);
- QValueList<ArticleInterceptor*> interceptors = ArticleInterceptorManager::self()->interceptors();
- for (QValueList<ArticleInterceptor*>::ConstIterator it = interceptors.begin(); it != interceptors.end(); ++it)
+ TQValueList<ArticleInterceptor*> interceptors = ArticleInterceptorManager::self()->interceptors();
+ for (TQValueList<ArticleInterceptor*>::ConstIterator it = interceptors.begin(); it != interceptors.end(); ++it)
(*it)->processArticle(mya);
d->addedArticlesNotify.append(mya);
@@ -494,9 +494,9 @@ void Feed::appendArticles(const RSS::Document &doc)
}
}
- QValueList<Article>::ConstIterator dit = deletedArticles.begin();
- QValueList<Article>::ConstIterator dtmp;
- QValueList<Article>::ConstIterator den = deletedArticles.end();
+ TQValueList<Article>::ConstIterator dit = deletedArticles.begin();
+ TQValueList<Article>::ConstIterator dtmp;
+ TQValueList<Article>::ConstIterator den = deletedArticles.end();
// delete articles with delete flag set completely from archive, which aren't in the current feed source anymore
while (dit != den)
@@ -519,7 +519,7 @@ bool Feed::usesExpiryByAge() const
bool Feed::isExpired(const Article& a) const
{
- QDateTime now = QDateTime::currentDateTime();
+ TQDateTime now = TQDateTime::currentDateTime();
int expiryAge = -1;
// check whether the feed uses the global default and the default is limitArticleAge
if ( d->archiveMode == globalDefault && Settings::archiveMode() == Settings::EnumArchiveMode::limitArticleAge)
@@ -551,9 +551,9 @@ void Feed::fetch(bool followDiscovery)
d->fetchTries = 0;
// mark all new as unread
- QValueList<Article> articles = d->articles.values();
- QValueList<Article>::Iterator it;
- QValueList<Article>::Iterator en = articles.end();
+ TQValueList<Article> articles = d->articles.values();
+ TQValueList<Article>::Iterator it;
+ TQValueList<Article>::Iterator en = articles.end();
for (it = articles.begin(); it != en; ++it)
{
if ((*it).status() == Article::New)
@@ -579,12 +579,12 @@ void Feed::tryFetch()
{
d->fetchError = false;
- d->loader = RSS::Loader::create( this, SLOT(fetchCompleted(Loader *, Document, Status)) );
- //connect(d->loader, SIGNAL(progress(unsigned long)), this, SLOT(slotSetProgress(unsigned long)));
+ d->loader = RSS::Loader::create( this, TQT_SLOT(fetchCompleted(Loader *, Document, Status)) );
+ //connect(d->loader, TQT_SIGNAL(progress(unsigned long)), this, TQT_SLOT(slotSetProgress(unsigned long)));
d->loader->loadFrom( d->xmlUrl, new RSS::FileRetriever );
}
-void Feed::slotImageFetched(const QPixmap& image)
+void Feed::slotImageFetched(const TQPixmap& image)
{
if (image.isNull())
return;
@@ -618,7 +618,7 @@ void Feed::fetchCompleted(RSS::Loader *l, RSS::Document doc, RSS::Status status)
else
{
d->fetchError = true;
- d->lastErrorFetch = QDateTime::currentDateTime().toTime_t();
+ d->lastErrorFetch = TQDateTime::currentDateTime().toTime_t();
emit fetchError(this);
}
return;
@@ -635,7 +635,7 @@ void Feed::fetchCompleted(RSS::Loader *l, RSS::Document doc, RSS::Status status)
if (doc.image() && d->imagePixmap.isNull())
{
d->image = *doc.image();
- connect(&d->image, SIGNAL(gotPixmap(const QPixmap&)), this, SLOT(slotImageFetched(const QPixmap&)));
+ connect(&d->image, TQT_SIGNAL(gotPixmap(const TQPixmap&)), this, TQT_SLOT(slotImageFetched(const TQPixmap&)));
d->image.getPixmap();
}
@@ -647,7 +647,7 @@ void Feed::fetchCompleted(RSS::Loader *l, RSS::Document doc, RSS::Status status)
appendArticles(doc);
- d->archive->setLastFetch( QDateTime::currentDateTime().toTime_t());
+ d->archive->setLastFetch( TQDateTime::currentDateTime().toTime_t());
emit fetched(this);
}
@@ -661,9 +661,9 @@ void Feed::slotDeleteExpiredArticles()
if ( !usesExpiryByAge() )
return;
- QValueList<Article> articles = d->articles.values();
+ TQValueList<Article> articles = d->articles.values();
- QValueList<Article>::Iterator en = articles.end();
+ TQValueList<Article>::Iterator en = articles.end();
setNotificationMode(false);
@@ -672,7 +672,7 @@ void Feed::slotDeleteExpiredArticles()
// doNotExpiredArticles once instead of in every iteration
if (Settings::doNotExpireImportantArticles())
{
- for (QValueList<Article>::Iterator it = articles.begin(); it != en; ++it)
+ for (TQValueList<Article>::Iterator it = articles.begin(); it != en; ++it)
{
if (!(*it).keep() && isExpired(*it))
{
@@ -682,7 +682,7 @@ void Feed::slotDeleteExpiredArticles()
}
else
{
- for (QValueList<Article>::Iterator it = articles.begin(); it != en; ++it)
+ for (TQValueList<Article>::Iterator it = articles.begin(); it != en; ++it)
{
if (isExpired(*it))
{
@@ -693,7 +693,7 @@ void Feed::slotDeleteExpiredArticles()
setNotificationMode(true);
}
-void Feed::setFavicon(const QPixmap &p)
+void Feed::setFavicon(const TQPixmap &p)
{
d->favicon = p;
nodeModified();
@@ -776,7 +776,7 @@ void Feed::doArticleNotification()
{
// copy list, otherwise the refcounting in Article::Private breaks for
// some reason (causing segfaults)
- QValueList<Article> l = d->addedArticlesNotify;
+ TQValueList<Article> l = d->addedArticlesNotify;
emit signalArticlesAdded(this, l);
d->addedArticlesNotify.clear();
}
@@ -784,7 +784,7 @@ void Feed::doArticleNotification()
{
// copy list, otherwise the refcounting in Article::Private breaks for
// some reason (causing segfaults)
- QValueList<Article> l = d->updatedArticlesNotify;
+ TQValueList<Article> l = d->updatedArticlesNotify;
emit signalArticlesUpdated(this, l);
d->updatedArticlesNotify.clear();
}
@@ -792,7 +792,7 @@ void Feed::doArticleNotification()
{
// copy list, otherwise the refcounting in Article::Private breaks for
// some reason (causing segfaults)
- QValueList<Article> l = d->removedArticlesNotify;
+ TQValueList<Article> l = d->removedArticlesNotify;
emit signalArticlesRemoved(this, l);
d->removedArticlesNotify.clear();
}
@@ -811,11 +811,11 @@ void Feed::enforceLimitArticleNumber()
return;
setNotificationMode(false);
- QValueList<Article> articles = d->articles.values();
+ TQValueList<Article> articles = d->articles.values();
qHeapSort(articles);
- QValueList<Article>::Iterator it = articles.begin();
- QValueList<Article>::Iterator tmp;
- QValueList<Article>::Iterator en = articles.end();
+ TQValueList<Article>::Iterator it = articles.begin();
+ TQValueList<Article>::Iterator tmp;
+ TQValueList<Article>::Iterator en = articles.end();
int c = 0;