diff options
Diffstat (limited to 'akregator/src/mk4storage/feedstoragemk4impl.cpp')
-rw-r--r-- | akregator/src/mk4storage/feedstoragemk4impl.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/akregator/src/mk4storage/feedstoragemk4impl.cpp b/akregator/src/mk4storage/feedstoragemk4impl.cpp index 521f9f326..b03f0438b 100644 --- a/akregator/src/mk4storage/feedstoragemk4impl.cpp +++ b/akregator/src/mk4storage/feedstoragemk4impl.cpp @@ -31,8 +31,8 @@ #include "../librss/document.h" #include <mk4.h> -#include <qdom.h> -#include <qfile.h> +#include <tqdom.h> +#include <tqfile.h> #include <kdebug.h> #include <kglobal.h> @@ -72,7 +72,7 @@ class FeedStorageMK4Impl::FeedStorageMK4ImplPrivate pcategories("categories") {} - QString url; + TQString url; c4_Storage* storage; StorageMK4Impl* mainStorage; c4_View archiveView; @@ -85,7 +85,7 @@ class FeedStorageMK4Impl::FeedStorageMK4ImplPrivate bool modified; bool taggingEnabled; bool convert; - QString oldArchivePath; + TQString oldArchivePath; c4_StringProp pguid, ptitle, pdescription, plink, pcommentsLink, ptag, pEnclosureType, pEnclosureUrl, pcatTerm, pcatScheme, pcatName, pauthor; c4_IntProp phash, pguidIsHash, pguidIsPermaLink, pcomments, pstatus, ppubDate, pHasEnclosure, pEnclosureLength; c4_ViewProp ptags, ptaggedArticles, pcategorizedArticles, pcategories; @@ -97,15 +97,15 @@ void FeedStorageMK4Impl::convertOldArchive() return; d->convert = false; - QFile file(d->oldArchivePath); + TQFile file(d->oldArchivePath); if ( !file.open(IO_ReadOnly) ) return; - QTextStream stream(&file); - stream.setEncoding(QTextStream::UnicodeUTF8); - QString data=stream.read(); - QDomDocument xmldoc; + TQTextStream stream(&file); + stream.setEncoding(TQTextStream::UnicodeUTF8); + TQString data=stream.read(); + TQDomDocument xmldoc; if (!xmldoc.setContent(data)) return; @@ -129,7 +129,7 @@ void FeedStorageMK4Impl::convertOldArchive() commit(); } -FeedStorageMK4Impl::FeedStorageMK4Impl(const QString& url, StorageMK4Impl* main) +FeedStorageMK4Impl::FeedStorageMK4Impl(const TQString& url, StorageMK4Impl* main) { d = new FeedStorageMK4ImplPrivate; d->autoCommit = main->autoCommit(); @@ -137,20 +137,20 @@ FeedStorageMK4Impl::FeedStorageMK4Impl(const QString& url, StorageMK4Impl* main) d->mainStorage = main; d->taggingEnabled = main->taggingEnabled(); - QString url2 = url; + TQString url2 = url; if (url.length() > 255) { - url2 = url.left(200) + QString::number(Akregator::Utils::calcHash(url), 16); + url2 = url.left(200) + TQString::number(Akregator::Utils::calcHash(url), 16); } kdDebug() << url2 << endl; - QString t = url2; - QString t2 = url2; - QString filePath = main->archivePath() +"/"+ t.replace("/", "_").replace(":", "_"); + TQString t = url2; + TQString t2 = url2; + TQString filePath = main->archivePath() +"/"+ t.replace("/", "_").replace(":", "_"); d->oldArchivePath = KGlobal::dirs()->saveLocation("data", "akregator/Archive/") + t2.replace("/", "_").replace(":", "_") + ".xml"; - d->convert = !QFile::exists(filePath + ".mk4") && QFile::exists(d->oldArchivePath); + d->convert = !TQFile::exists(filePath + ".mk4") && TQFile::exists(d->oldArchivePath); d->storage = new c4_Storage((filePath + ".mk4").local8Bit(), true); d->archiveView = d->storage->GetAs("articles[guid:S,title:S,hash:I,guidIsHash:I,guidIsPermaLink:I,description:S,link:S,comments:I,commentsLink:S,status:I,pubDate:I,tags[tag:S],hasEnclosure:I,enclosureUrl:S,enclosureType:S,enclosureLength:I,categories[catTerm:S,catScheme:S,catName:S],author:S]"); @@ -245,14 +245,14 @@ void FeedStorageMK4Impl::setLastFetch(int lastFetch) d->mainStorage->setLastFetchFor(d->url, lastFetch); } -QStringList FeedStorageMK4Impl::articles(const QString& tag) +TQStringList FeedStorageMK4Impl::articles(const TQString& tag) { - QStringList list; + TQStringList list; if (tag.isNull()) // return all articles { int size = d->archiveView.GetSize(); for (int i = 0; i < size; i++) // fill with guids - list += QString(d->pguid(d->archiveView.GetAt(i))); + list += TQString(d->pguid(d->archiveView.GetAt(i))); } else if (d->taggingEnabled) { @@ -265,16 +265,16 @@ QStringList FeedStorageMK4Impl::articles(const QString& tag) c4_View tagView = d->ptaggedArticles(tagrow); int size = tagView.GetSize(); for (int i = 0; i < size; i++) - list += QString(d->pguid(tagView.GetAt(i))); + list += TQString(d->pguid(tagView.GetAt(i))); } } return list; } -QStringList FeedStorageMK4Impl::articles(const Category& cat) +TQStringList FeedStorageMK4Impl::articles(const Category& cat) { - QStringList list; + TQStringList list; /* c4_Row catrow; d->pcatTerm(catrow) = cat.term.utf8().data(); @@ -287,13 +287,13 @@ QStringList FeedStorageMK4Impl::articles(const Category& cat) c4_View catView = d->pcategorizedArticles(catrow); int size = catView.GetSize(); for (int i = 0; i < size; i++) - list += QString(d->pguid(catView.GetAt(i))); + list += TQString(d->pguid(catView.GetAt(i))); } */ return list; } -void FeedStorageMK4Impl::addEntry(const QString& guid) +void FeedStorageMK4Impl::addEntry(const TQString& guid) { c4_Row row; d->pguid(row) = guid.ascii(); @@ -305,26 +305,26 @@ void FeedStorageMK4Impl::addEntry(const QString& guid) } } -bool FeedStorageMK4Impl::contains(const QString& guid) +bool FeedStorageMK4Impl::contains(const TQString& guid) { return findArticle(guid) != -1; } -int FeedStorageMK4Impl::findArticle(const QString& guid) +int FeedStorageMK4Impl::findArticle(const TQString& guid) { c4_Row findrow; d->pguid(findrow) = guid.ascii(); return d->archiveView.Find(findrow); } -void FeedStorageMK4Impl::deleteArticle(const QString& guid) +void FeedStorageMK4Impl::deleteArticle(const TQString& guid) { int findidx = findArticle(guid); if (findidx != -1) { - QStringList list = tags(guid); - for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) + TQStringList list = tags(guid); + for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) removeTag(guid, *it); setTotalCount(totalCount()-1); d->archiveView.RemoveAt(findidx); @@ -332,38 +332,38 @@ void FeedStorageMK4Impl::deleteArticle(const QString& guid) } } -int FeedStorageMK4Impl::comments(const QString& guid) +int FeedStorageMK4Impl::comments(const TQString& guid) { int findidx = findArticle(guid); return findidx != -1 ? d->pcomments(d->archiveView.GetAt(findidx)) : 0; } -QString FeedStorageMK4Impl::commentsLink(const QString& guid) +TQString FeedStorageMK4Impl::commentsLink(const TQString& guid) { int findidx = findArticle(guid); - return findidx != -1 ? QString(d->pcommentsLink(d->archiveView.GetAt(findidx))) : ""; + return findidx != -1 ? TQString(d->pcommentsLink(d->archiveView.GetAt(findidx))) : ""; } -bool FeedStorageMK4Impl::guidIsHash(const QString& guid) +bool FeedStorageMK4Impl::guidIsHash(const TQString& guid) { int findidx = findArticle(guid); return findidx != -1 ? d->pguidIsHash(d->archiveView.GetAt(findidx)) : false; } -bool FeedStorageMK4Impl::guidIsPermaLink(const QString& guid) +bool FeedStorageMK4Impl::guidIsPermaLink(const TQString& guid) { int findidx = findArticle(guid); return findidx != -1 ? d->pguidIsPermaLink(d->archiveView.GetAt(findidx)) : false; } -uint FeedStorageMK4Impl::hash(const QString& guid) +uint FeedStorageMK4Impl::hash(const TQString& guid) { int findidx = findArticle(guid); return findidx != -1 ? d->phash(d->archiveView.GetAt(findidx)) : 0; } -void FeedStorageMK4Impl::setDeleted(const QString& guid) +void FeedStorageMK4Impl::setDeleted(const TQString& guid) { int findidx = findArticle(guid); if (findidx == -1) @@ -371,8 +371,8 @@ void FeedStorageMK4Impl::setDeleted(const QString& guid) c4_Row row; row = d->archiveView.GetAt(findidx); - QStringList list = tags(guid); - for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) + TQStringList list = tags(guid); + for (TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it) removeTag(guid, *it); d->pdescription(row) = ""; d->ptitle(row) = ""; @@ -383,25 +383,25 @@ void FeedStorageMK4Impl::setDeleted(const QString& guid) markDirty(); } -QString FeedStorageMK4Impl::link(const QString& guid) +TQString FeedStorageMK4Impl::link(const TQString& guid) { int findidx = findArticle(guid); - return findidx != -1 ? QString(d->plink(d->archiveView.GetAt(findidx))) : ""; + return findidx != -1 ? TQString(d->plink(d->archiveView.GetAt(findidx))) : ""; } -uint FeedStorageMK4Impl::pubDate(const QString& guid) +uint FeedStorageMK4Impl::pubDate(const TQString& guid) { int findidx = findArticle(guid); return findidx != -1 ? d->ppubDate(d->archiveView.GetAt(findidx)) : 0; } -int FeedStorageMK4Impl::status(const QString& guid) +int FeedStorageMK4Impl::status(const TQString& guid) { int findidx = findArticle(guid); return findidx != -1 ? d->pstatus(d->archiveView.GetAt(findidx)) : 0; } -void FeedStorageMK4Impl::setStatus(const QString& guid, int status) +void FeedStorageMK4Impl::setStatus(const TQString& guid, int status) { int findidx = findArticle(guid); if (findidx == -1) @@ -413,20 +413,20 @@ void FeedStorageMK4Impl::setStatus(const QString& guid, int status) markDirty(); } -QString FeedStorageMK4Impl::title(const QString& guid) +TQString FeedStorageMK4Impl::title(const TQString& guid) { int findidx = findArticle(guid); - return findidx != -1 ? QString::fromUtf8(d->ptitle(d->archiveView.GetAt(findidx))) : ""; + return findidx != -1 ? TQString::fromUtf8(d->ptitle(d->archiveView.GetAt(findidx))) : ""; } -QString FeedStorageMK4Impl::description(const QString& guid) +TQString FeedStorageMK4Impl::description(const TQString& guid) { int findidx = findArticle(guid); - return findidx != -1 ? QString::fromUtf8(d->pdescription(d->archiveView.GetAt(findidx))) : ""; + return findidx != -1 ? TQString::fromUtf8(d->pdescription(d->archiveView.GetAt(findidx))) : ""; } -void FeedStorageMK4Impl::setPubDate(const QString& guid, uint pubdate) +void FeedStorageMK4Impl::setPubDate(const TQString& guid, uint pubdate) { int findidx = findArticle(guid); if (findidx == -1) @@ -438,7 +438,7 @@ void FeedStorageMK4Impl::setPubDate(const QString& guid, uint pubdate) markDirty(); } -void FeedStorageMK4Impl::setGuidIsHash(const QString& guid, bool isHash) +void FeedStorageMK4Impl::setGuidIsHash(const TQString& guid, bool isHash) { int findidx = findArticle(guid); if (findidx == -1) @@ -450,7 +450,7 @@ void FeedStorageMK4Impl::setGuidIsHash(const QString& guid, bool isHash) markDirty(); } -void FeedStorageMK4Impl::setLink(const QString& guid, const QString& link) +void FeedStorageMK4Impl::setLink(const TQString& guid, const TQString& link) { int findidx = findArticle(guid); if (findidx == -1) @@ -462,7 +462,7 @@ void FeedStorageMK4Impl::setLink(const QString& guid, const QString& link) markDirty(); } -void FeedStorageMK4Impl::setHash(const QString& guid, uint hash) +void FeedStorageMK4Impl::setHash(const TQString& guid, uint hash) { int findidx = findArticle(guid); if (findidx == -1) @@ -474,7 +474,7 @@ void FeedStorageMK4Impl::setHash(const QString& guid, uint hash) markDirty(); } -void FeedStorageMK4Impl::setTitle(const QString& guid, const QString& title) +void FeedStorageMK4Impl::setTitle(const TQString& guid, const TQString& title) { int findidx = findArticle(guid); if (findidx == -1) @@ -486,7 +486,7 @@ void FeedStorageMK4Impl::setTitle(const QString& guid, const QString& title) markDirty(); } -void FeedStorageMK4Impl::setDescription(const QString& guid, const QString& description) +void FeedStorageMK4Impl::setDescription(const TQString& guid, const TQString& description) { int findidx = findArticle(guid); if (findidx == -1) @@ -498,7 +498,7 @@ void FeedStorageMK4Impl::setDescription(const QString& guid, const QString& desc markDirty(); } -void FeedStorageMK4Impl::setAuthor(const QString& guid, const QString& author) +void FeedStorageMK4Impl::setAuthor(const TQString& guid, const TQString& author) { int findidx = findArticle(guid); if (findidx == -1) @@ -510,14 +510,14 @@ void FeedStorageMK4Impl::setAuthor(const QString& guid, const QString& author) markDirty(); } -QString FeedStorageMK4Impl::author(const QString& guid) +TQString FeedStorageMK4Impl::author(const TQString& guid) { int findidx = findArticle(guid); - return findidx != -1 ? QString::fromUtf8(d->pauthor(d->archiveView.GetAt(findidx))) : ""; + return findidx != -1 ? TQString::fromUtf8(d->pauthor(d->archiveView.GetAt(findidx))) : ""; } -void FeedStorageMK4Impl::setCommentsLink(const QString& guid, const QString& commentsLink) +void FeedStorageMK4Impl::setCommentsLink(const TQString& guid, const TQString& commentsLink) { int findidx = findArticle(guid); if (findidx == -1) @@ -529,7 +529,7 @@ void FeedStorageMK4Impl::setCommentsLink(const QString& guid, const QString& com markDirty(); } -void FeedStorageMK4Impl::setComments(const QString& guid, int comments) +void FeedStorageMK4Impl::setComments(const TQString& guid, int comments) { int findidx = findArticle(guid); if (findidx == -1) @@ -542,7 +542,7 @@ void FeedStorageMK4Impl::setComments(const QString& guid, int comments) } -void FeedStorageMK4Impl::setGuidIsPermaLink(const QString& guid, bool isPermaLink) +void FeedStorageMK4Impl::setGuidIsPermaLink(const TQString& guid, bool isPermaLink) { int findidx = findArticle(guid); if (findidx == -1) @@ -554,7 +554,7 @@ void FeedStorageMK4Impl::setGuidIsPermaLink(const QString& guid, bool isPermaLin markDirty(); } -void FeedStorageMK4Impl::addCategory(const QString& /*guid*/, const Category& /*cat*/) +void FeedStorageMK4Impl::addCategory(const TQString& /*guid*/, const Category& /*cat*/) { return; /* @@ -610,10 +610,10 @@ void FeedStorageMK4Impl::addCategory(const QString& /*guid*/, const Category& /* */ } -QValueList<Category> FeedStorageMK4Impl::categories(const QString& /*guid*/) +TQValueList<Category> FeedStorageMK4Impl::categories(const TQString& /*guid*/) { - QValueList<Category> list; + TQValueList<Category> list; return list; /* if (!guid.isNull()) // return categories for an article @@ -631,9 +631,9 @@ QValueList<Category> FeedStorageMK4Impl::categories(const QString& /*guid*/) { Category cat; - cat.term = QString::fromUtf8(d->pcatTerm(catView.GetAt(i))); - cat.scheme = QString::fromUtf8(d->pcatScheme(catView.GetAt(i))); - cat.name = QString::fromUtf8(d->pcatName(catView.GetAt(i))); + cat.term = TQString::fromUtf8(d->pcatTerm(catView.GetAt(i))); + cat.scheme = TQString::fromUtf8(d->pcatScheme(catView.GetAt(i))); + cat.name = TQString::fromUtf8(d->pcatName(catView.GetAt(i))); list += cat; } @@ -646,9 +646,9 @@ QValueList<Category> FeedStorageMK4Impl::categories(const QString& /*guid*/) c4_Row row = d->catView.GetAt(i); Category cat; - cat.term = QString(d->pcatTerm(row)); - cat.scheme = QString(d->pcatScheme(row)); - cat.name = QString(d->pcatName(row)); + cat.term = TQString(d->pcatTerm(row)); + cat.scheme = TQString(d->pcatScheme(row)); + cat.name = TQString(d->pcatName(row)); list += cat; } @@ -657,7 +657,7 @@ QValueList<Category> FeedStorageMK4Impl::categories(const QString& /*guid*/) return list;*/ } -void FeedStorageMK4Impl::addTag(const QString& guid, const QString& tag) +void FeedStorageMK4Impl::addTag(const TQString& guid, const TQString& tag) { if (!d->taggingEnabled) return; @@ -701,7 +701,7 @@ void FeedStorageMK4Impl::addTag(const QString& guid, const QString& tag) } } -void FeedStorageMK4Impl::removeTag(const QString& guid, const QString& tag) +void FeedStorageMK4Impl::removeTag(const TQString& guid, const TQString& tag) { if (!d->taggingEnabled) return; @@ -746,9 +746,9 @@ void FeedStorageMK4Impl::removeTag(const QString& guid, const QString& tag) } } -QStringList FeedStorageMK4Impl::tags(const QString& guid) +TQStringList FeedStorageMK4Impl::tags(const TQString& guid) { - QStringList list; + TQStringList list; if (!d->taggingEnabled) return list; @@ -765,13 +765,13 @@ QStringList FeedStorageMK4Impl::tags(const QString& guid) int size = tagView.GetSize(); for (int i = 0; i < size; ++i) - list += QString::fromUtf8(d->ptag(tagView.GetAt(i))); + list += TQString::fromUtf8(d->ptag(tagView.GetAt(i))); } else // return all tags in the feed { int size = d->tagView.GetSize(); for (int i = 0; i < size; i++) - list += QString(d->ptag(d->tagView.GetAt(i))); + list += TQString(d->ptag(d->tagView.GetAt(i))); } return list; @@ -779,15 +779,15 @@ QStringList FeedStorageMK4Impl::tags(const QString& guid) void FeedStorageMK4Impl::add(FeedStorage* source) { - QStringList articles = source->articles(); - for (QStringList::ConstIterator it = articles.begin(); it != articles.end(); ++it) + TQStringList articles = source->articles(); + for (TQStringList::ConstIterator it = articles.begin(); it != articles.end(); ++it) copyArticle(*it, source); setUnread(source->unread()); setLastFetch(source->lastFetch()); setTotalCount(source->totalCount()); } -void FeedStorageMK4Impl::copyArticle(const QString& guid, FeedStorage* source) +void FeedStorageMK4Impl::copyArticle(const TQString& guid, FeedStorage* source) { if (!contains(guid)) addEntry(guid); @@ -803,12 +803,12 @@ void FeedStorageMK4Impl::copyArticle(const QString& guid, FeedStorage* source) setTitle(guid, source->title(guid)); setAuthor(guid, source->author(guid)); - QStringList tags = source->tags(guid); - for (QStringList::ConstIterator it = tags.begin(); it != tags.end(); ++it) + TQStringList tags = source->tags(guid); + for (TQStringList::ConstIterator it = tags.begin(); it != tags.end(); ++it) addTag(guid, *it); } -void FeedStorageMK4Impl::setEnclosure(const QString& guid, const QString& url, const QString& type, int length) +void FeedStorageMK4Impl::setEnclosure(const TQString& guid, const TQString& url, const TQString& type, int length) { int findidx = findArticle(guid); if (findidx == -1) @@ -824,7 +824,7 @@ void FeedStorageMK4Impl::setEnclosure(const QString& guid, const QString& url, c markDirty(); } -void FeedStorageMK4Impl::removeEnclosure(const QString& guid) +void FeedStorageMK4Impl::removeEnclosure(const TQString& guid) { int findidx = findArticle(guid); if (findidx == -1) @@ -840,14 +840,14 @@ void FeedStorageMK4Impl::removeEnclosure(const QString& guid) markDirty(); } -void FeedStorageMK4Impl::enclosure(const QString& guid, bool& hasEnclosure, QString& url, QString& type, int& length) +void FeedStorageMK4Impl::enclosure(const TQString& guid, bool& hasEnclosure, TQString& url, TQString& type, int& length) { int findidx = findArticle(guid); if (findidx == -1) { hasEnclosure = false; - url = QString::null; - type = QString::null; + url = TQString::null; + type = TQString::null; length = -1; return; } |