diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /akregator/src/articlefilter.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-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/articlefilter.cpp')
-rw-r--r-- | akregator/src/articlefilter.cpp | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/akregator/src/articlefilter.cpp b/akregator/src/articlefilter.cpp index f21605fad..a8bf8a365 100644 --- a/akregator/src/articlefilter.cpp +++ b/akregator/src/articlefilter.cpp @@ -33,77 +33,77 @@ #include <kdebug.h> #include <kurl.h> -#include <qregexp.h> +#include <tqregexp.h> namespace Akregator { namespace Filters { -QString Criterion::subjectToString(Subject subj) +TQString Criterion::subjectToString(Subject subj) { switch (subj) { case Title: - return QString::fromLatin1("Title"); + return TQString::fromLatin1("Title"); case Link: - return QString::fromLatin1("Link"); + return TQString::fromLatin1("Link"); case Author: - return QString::fromLatin1("Author"); + return TQString::fromLatin1("Author"); case Description: - return QString::fromLatin1("Description"); + return TQString::fromLatin1("Description"); case Status: - return QString::fromLatin1("Status"); + return TQString::fromLatin1("Status"); case KeepFlag: - return QString::fromLatin1("KeepFlag"); + return TQString::fromLatin1("KeepFlag"); default: // should never happen (TM) - return QString::fromLatin1("Description"); + return TQString::fromLatin1("Description"); } } -Criterion::Subject Criterion::stringToSubject(const QString& subjStr) +Criterion::Subject Criterion::stringToSubject(const TQString& subjStr) { - if (subjStr == QString::fromLatin1("Title")) + if (subjStr == TQString::fromLatin1("Title")) return Title; - else if (subjStr == QString::fromLatin1("Link")) + else if (subjStr == TQString::fromLatin1("Link")) return Link; - else if (subjStr == QString::fromLatin1("Description")) + else if (subjStr == TQString::fromLatin1("Description")) return Description; - else if (subjStr == QString::fromLatin1("Author")) + else if (subjStr == TQString::fromLatin1("Author")) return Author; - else if (subjStr == QString::fromLatin1("Status")) + else if (subjStr == TQString::fromLatin1("Status")) return Status; - else if (subjStr == QString::fromLatin1("KeepFlag")) + else if (subjStr == TQString::fromLatin1("KeepFlag")) return KeepFlag; // hopefully never reached return Description; } -QString Criterion::predicateToString(Predicate pred) +TQString Criterion::predicateToString(Predicate pred) { switch (pred) { case Contains: - return QString::fromLatin1("Contains"); + return TQString::fromLatin1("Contains"); case Equals: - return QString::fromLatin1("Equals"); + return TQString::fromLatin1("Equals"); case Matches: - return QString::fromLatin1("Matches"); + return TQString::fromLatin1("Matches"); case Negation: - return QString::fromLatin1("Negation"); + return TQString::fromLatin1("Negation"); default:// hopefully never reached - return QString::fromLatin1("Contains"); + return TQString::fromLatin1("Contains"); } } -Criterion::Predicate Criterion::stringToPredicate(const QString& predStr) +Criterion::Predicate Criterion::stringToPredicate(const TQString& predStr) { - if (predStr == QString::fromLatin1("Contains")) + if (predStr == TQString::fromLatin1("Contains")) return Contains; - else if (predStr == QString::fromLatin1("Equals")) + else if (predStr == TQString::fromLatin1("Equals")) return Equals; - else if (predStr == QString::fromLatin1("Matches")) + else if (predStr == TQString::fromLatin1("Matches")) return Matches; - else if (predStr == QString::fromLatin1("Negation")) + else if (predStr == TQString::fromLatin1("Negation")) return Negation; // hopefully never reached @@ -114,7 +114,7 @@ Criterion::Criterion() { } -Criterion::Criterion( Subject subject, Predicate predicate, const QVariant &object ) +Criterion::Criterion( Subject subject, Predicate predicate, const TQVariant &object ) : m_subject( subject ) , m_predicate( predicate ) , m_object( object ) @@ -124,50 +124,50 @@ Criterion::Criterion( Subject subject, Predicate predicate, const QVariant &obje void Criterion::writeConfig(KConfig* config) const { - config->writeEntry(QString::fromLatin1("subject"), subjectToString(m_subject)); + config->writeEntry(TQString::fromLatin1("subject"), subjectToString(m_subject)); - config->writeEntry(QString::fromLatin1("predicate"), predicateToString(m_predicate)); + config->writeEntry(TQString::fromLatin1("predicate"), predicateToString(m_predicate)); - config->writeEntry(QString::fromLatin1("objectType"), QString(m_object.typeName())); + config->writeEntry(TQString::fromLatin1("objectType"), TQString(m_object.typeName())); - config->writeEntry(QString::fromLatin1("objectValue"), m_object); + config->writeEntry(TQString::fromLatin1("objectValue"), m_object); } void Criterion::readConfig(KConfig* config) { - m_subject = stringToSubject(config->readEntry(QString::fromLatin1("subject"))); - m_predicate = stringToPredicate(config->readEntry(QString::fromLatin1("predicate"))); - QVariant::Type type = QVariant::nameToType(config->readEntry(QString::fromLatin1("objType")).ascii()); + m_subject = stringToSubject(config->readEntry(TQString::fromLatin1("subject"))); + m_predicate = stringToPredicate(config->readEntry(TQString::fromLatin1("predicate"))); + TQVariant::Type type = TQVariant::nameToType(config->readEntry(TQString::fromLatin1("objType")).ascii()); - if (type != QVariant::Invalid) + if (type != TQVariant::Invalid) { - m_object = config->readPropertyEntry(QString::fromLatin1("objectValue"), type); + m_object = config->readPropertyEntry(TQString::fromLatin1("objectValue"), type); } } bool Criterion::satisfiedBy( const Article &article ) const { - QVariant concreteSubject; + TQVariant concreteSubject; switch ( m_subject ) { case Title: - concreteSubject = QVariant(article.title()); + concreteSubject = TQVariant(article.title()); break; case Description: - concreteSubject = QVariant(article.description()); + concreteSubject = TQVariant(article.description()); break; case Author: - concreteSubject = QVariant(article.author()); + concreteSubject = TQVariant(article.author()); break; case Link: // ### Maybe use prettyURL here? - concreteSubject = QVariant(article.link().url()); + concreteSubject = TQVariant(article.link().url()); break; case Status: - concreteSubject = QVariant(article.status()); + concreteSubject = TQVariant(article.status()); break; case KeepFlag: - concreteSubject = QVariant(article.keep()); + concreteSubject = TQVariant(article.keep()); default: break; } @@ -175,7 +175,7 @@ bool Criterion::satisfiedBy( const Article &article ) const bool satisfied = false; const Predicate predicateType = static_cast<Predicate>( m_predicate & ~Negation ); - QString subjectType=concreteSubject.typeName(); + TQString subjectType=concreteSubject.typeName(); switch ( predicateType ) { case Contains: @@ -188,7 +188,7 @@ bool Criterion::satisfiedBy( const Article &article ) const satisfied = concreteSubject.toString() == m_object.toString(); break; case Matches: - satisfied = QRegExp( m_object.toString() ).search( concreteSubject.toString() ) != -1; + satisfied = TQRegExp( m_object.toString() ).search( concreteSubject.toString() ) != -1; break; default: kdDebug() << "Internal inconsistency; predicateType should never be Negation" << endl; @@ -212,7 +212,7 @@ Criterion::Predicate Criterion::predicate() const return m_predicate; } -QVariant Criterion::object() const +TQVariant Criterion::object() const { return m_object; } @@ -236,7 +236,7 @@ ArticleMatcher* ArticleMatcher::clone() const return new ArticleMatcher(*this); } -ArticleMatcher::ArticleMatcher( const QValueList<Criterion> &criteria, Association assoc) +ArticleMatcher::ArticleMatcher( const TQValueList<Criterion> &criteria, Association assoc) : m_criteria( criteria ) , m_association( assoc ) { @@ -269,15 +269,15 @@ bool ArticleMatcher::matches( const Article &a ) const void ArticleMatcher::writeConfig(KConfig* config) const { - config->writeEntry(QString::fromLatin1("matcherAssociation"), associationToString(m_association)); + config->writeEntry(TQString::fromLatin1("matcherAssociation"), associationToString(m_association)); - config->writeEntry(QString::fromLatin1("matcherCriteriaCount"), m_criteria.count()); + config->writeEntry(TQString::fromLatin1("matcherCriteriaCount"), m_criteria.count()); int index = 0; - for (QValueList<Criterion>::ConstIterator it = m_criteria.begin(); it != m_criteria.end(); ++it) + for (TQValueList<Criterion>::ConstIterator it = m_criteria.begin(); it != m_criteria.end(); ++it) { - config->setGroup(config->group()+QString::fromLatin1("_Criterion")+QString::number(index)); + config->setGroup(config->group()+TQString::fromLatin1("_Criterion")+TQString::number(index)); (*it).writeConfig(config); ++index; } @@ -286,14 +286,14 @@ void ArticleMatcher::writeConfig(KConfig* config) const void ArticleMatcher::readConfig(KConfig* config) { m_criteria.clear(); - m_association = stringToAssociation(config->readEntry(QString::fromLatin1("matcherAssociation"))); + m_association = stringToAssociation(config->readEntry(TQString::fromLatin1("matcherAssociation"))); - int count = config->readNumEntry(QString::fromLatin1("matcherCriteriaCount"), 0); + int count = config->readNumEntry(TQString::fromLatin1("matcherCriteriaCount"), 0); for (int i = 0; i < count; ++i) { Criterion c; - config->setGroup(config->group()+QString::fromLatin1("_Criterion")+QString::number(i)); + config->setGroup(config->group()+TQString::fromLatin1("_Criterion")+TQString::number(i)); c.readConfig(config); m_criteria.append(c); } @@ -317,8 +317,8 @@ bool ArticleMatcher::anyCriterionMatches( const Article &a ) const { if (m_criteria.count()==0) return true; - QValueList<Criterion>::ConstIterator it = m_criteria.begin(); - QValueList<Criterion>::ConstIterator end = m_criteria.end(); + TQValueList<Criterion>::ConstIterator it = m_criteria.begin(); + TQValueList<Criterion>::ConstIterator end = m_criteria.end(); for ( ; it != end; ++it ) { if ( ( *it ).satisfiedBy( a ) ) { return true; @@ -331,8 +331,8 @@ bool ArticleMatcher::allCriteriaMatch( const Article &a ) const { if (m_criteria.count()==0) return true; - QValueList<Criterion>::ConstIterator it = m_criteria.begin(); - QValueList<Criterion>::ConstIterator end = m_criteria.end(); + TQValueList<Criterion>::ConstIterator it = m_criteria.begin(); + TQValueList<Criterion>::ConstIterator end = m_criteria.end(); for ( ; it != end; ++it ) { if ( !( *it ).satisfiedBy( a ) ) { return false; @@ -341,26 +341,26 @@ bool ArticleMatcher::allCriteriaMatch( const Article &a ) const return true; } -ArticleMatcher::Association ArticleMatcher::stringToAssociation(const QString& assocStr) +ArticleMatcher::Association ArticleMatcher::stringToAssociation(const TQString& assocStr) { - if (assocStr == QString::fromLatin1("LogicalAnd")) + if (assocStr == TQString::fromLatin1("LogicalAnd")) return LogicalAnd; - else if (assocStr == QString::fromLatin1("LogicalOr")) + else if (assocStr == TQString::fromLatin1("LogicalOr")) return LogicalOr; else return None; } -QString ArticleMatcher::associationToString(Association association) +TQString ArticleMatcher::associationToString(Association association) { switch (association) { case LogicalAnd: - return QString::fromLatin1("LogicalAnd"); + return TQString::fromLatin1("LogicalAnd"); case LogicalOr: - return QString::fromLatin1("LogicalOr"); + return TQString::fromLatin1("LogicalOr"); default: - return QString::fromLatin1("None"); + return TQString::fromLatin1("None"); } } @@ -368,14 +368,14 @@ QString ArticleMatcher::associationToString(Association association) class TagMatcher::TagMatcherPrivate { public: - QString tagID; + TQString tagID; bool operator==(const TagMatcherPrivate& other) const { return tagID == other.tagID; } }; -TagMatcher::TagMatcher(const QString& tagID) : d(new TagMatcherPrivate) +TagMatcher::TagMatcher(const TQString& tagID) : d(new TagMatcherPrivate) { d->tagID = tagID; } @@ -408,13 +408,13 @@ TagMatcher::TagMatcher(const TagMatcher& other) : AbstractMatcher(other), d(0) void TagMatcher::writeConfig(KConfig* config) const { - config->writeEntry(QString::fromLatin1("matcherType"), QString::fromLatin1("TagMatcher")); - config->writeEntry(QString::fromLatin1("matcherParams"), d->tagID); + config->writeEntry(TQString::fromLatin1("matcherType"), TQString::fromLatin1("TagMatcher")); + config->writeEntry(TQString::fromLatin1("matcherParams"), d->tagID); } void TagMatcher::readConfig(KConfig* config) { - d->tagID = config->readEntry(QString::fromLatin1("matcherParams")); + d->tagID = config->readEntry(TQString::fromLatin1("matcherParams")); } bool TagMatcher::operator==(const AbstractMatcher& other) const @@ -464,13 +464,13 @@ void SetStatusAction::setStatus(int status) void SetStatusAction::writeConfig(KConfig* config) const { - config->writeEntry(QString::fromLatin1("actionType"), QString::fromLatin1("SetStatusAction")); - config->writeEntry(QString::fromLatin1("actionParams"), m_status); + config->writeEntry(TQString::fromLatin1("actionType"), TQString::fromLatin1("SetStatusAction")); + config->writeEntry(TQString::fromLatin1("actionParams"), m_status); } void SetStatusAction::readConfig(KConfig* config) { - m_status = config->readNumEntry(QString::fromLatin1("actionParams"), Article::Read); + m_status = config->readNumEntry(TQString::fromLatin1("actionParams"), Article::Read); } bool SetStatusAction::operator==(const AbstractAction& other) @@ -484,7 +484,7 @@ bool SetStatusAction::operator==(const AbstractAction& other) } -AssignTagAction::AssignTagAction(const QString& tagID) : m_tagID(tagID) +AssignTagAction::AssignTagAction(const TQString& tagID) : m_tagID(tagID) { } @@ -499,7 +499,7 @@ class ArticleFilter::ArticleFilterPrivate : public Shared public: AbstractAction* action; AbstractMatcher* matcher; - QString name; + TQString name; int id; }; @@ -581,12 +581,12 @@ bool ArticleFilter::operator==(const ArticleFilter& other) const void ArticleFilterList::writeConfig(KConfig* config) const { - config->setGroup(QString::fromLatin1("Filters")); - config->writeEntry(QString::fromLatin1("count"), count()); + config->setGroup(TQString::fromLatin1("Filters")); + config->writeEntry(TQString::fromLatin1("count"), count()); int index = 0; for (ArticleFilterList::ConstIterator it = begin(); it != end(); ++it) { - config->setGroup(QString::fromLatin1("Filters_")+QString::number(index)); + config->setGroup(TQString::fromLatin1("Filters_")+TQString::number(index)); (*it).writeConfig(config); ++index; } @@ -595,11 +595,11 @@ void ArticleFilterList::writeConfig(KConfig* config) const void ArticleFilterList::readConfig(KConfig* config) { clear(); - config->setGroup(QString::fromLatin1("Filters")); - int count = config->readNumEntry(QString::fromLatin1("count"), 0); + config->setGroup(TQString::fromLatin1("Filters")); + int count = config->readNumEntry(TQString::fromLatin1("count"), 0); for (int i = 0; i < count; ++i) { - config->setGroup(QString::fromLatin1("Filters_")+QString::number(i)); + config->setGroup(TQString::fromLatin1("Filters_")+TQString::number(i)); ArticleFilter filter; filter.readConfig(config); append(filter); @@ -609,13 +609,13 @@ void ArticleFilterList::readConfig(KConfig* config) void AssignTagAction::readConfig(KConfig* config) { - m_tagID = config->readEntry(QString::fromLatin1("actionParams")); + m_tagID = config->readEntry(TQString::fromLatin1("actionParams")); } void AssignTagAction::writeConfig(KConfig* config) const { - config->writeEntry(QString::fromLatin1("actionType"), QString::fromLatin1("AssignTagAction")); - config->writeEntry(QString::fromLatin1("actionParams"), m_tagID); + config->writeEntry(TQString::fromLatin1("actionType"), TQString::fromLatin1("AssignTagAction")); + config->writeEntry(TQString::fromLatin1("actionParams"), m_tagID); } bool AssignTagAction::operator==(const AbstractAction& other) @@ -628,12 +628,12 @@ bool AssignTagAction::operator==(const AbstractAction& other) return m_tagID == o->m_tagID; } -const QString& AssignTagAction::tagID() const +const TQString& AssignTagAction::tagID() const { return m_tagID; } -void AssignTagAction::setTagID(const QString& tagID) +void AssignTagAction::setTagID(const TQString& tagID) { m_tagID = tagID; } @@ -644,7 +644,7 @@ void DeleteAction::readConfig(KConfig* /*config*/) void DeleteAction::writeConfig(KConfig* config) const { - config->writeEntry(QString::fromLatin1("actionType"), QString::fromLatin1("DeleteAction")); + config->writeEntry(TQString::fromLatin1("actionType"), TQString::fromLatin1("DeleteAction")); } bool DeleteAction::operator==(const AbstractAction& other) @@ -661,27 +661,27 @@ void ArticleFilter::readConfig(KConfig* config) delete d->action; d->action = 0; - d->name = config->readEntry(QString::fromLatin1("name")); - d->id = config->readNumEntry(QString::fromLatin1("id"), 0); + d->name = config->readEntry(TQString::fromLatin1("name")); + d->id = config->readNumEntry(TQString::fromLatin1("id"), 0); - QString matcherType = config->readEntry(QString::fromLatin1("matcherType")); + TQString matcherType = config->readEntry(TQString::fromLatin1("matcherType")); - if (matcherType == QString::fromLatin1("TagMatcher")) + if (matcherType == TQString::fromLatin1("TagMatcher")) d->matcher = new TagMatcher(); - else if (matcherType == QString::fromLatin1("ArticleMatcher")) + else if (matcherType == TQString::fromLatin1("ArticleMatcher")) d->matcher = new ArticleMatcher(); if (d->matcher) d->matcher->readConfig(config); - QString actionType = config->readEntry(QString::fromLatin1("actionType")); + TQString actionType = config->readEntry(TQString::fromLatin1("actionType")); - if (actionType == QString::fromLatin1("AssignTagAction")) + if (actionType == TQString::fromLatin1("AssignTagAction")) d->action = new AssignTagAction(); - else if (actionType == QString::fromLatin1("DeleteAction")) + else if (actionType == TQString::fromLatin1("DeleteAction")) d->action = new DeleteAction(); - else if (actionType == QString::fromLatin1("SetStatusAction")) + else if (actionType == TQString::fromLatin1("SetStatusAction")) d->action = new SetStatusAction(); if (d->action) @@ -690,18 +690,18 @@ void ArticleFilter::readConfig(KConfig* config) void ArticleFilter::writeConfig(KConfig* config) const { - config->writeEntry(QString::fromLatin1("name"), d->name); - config->writeEntry(QString::fromLatin1("id"), d->id); + config->writeEntry(TQString::fromLatin1("name"), d->name); + config->writeEntry(TQString::fromLatin1("id"), d->id); d->matcher->writeConfig(config); d->action->writeConfig(config); } -void ArticleFilter::setName(const QString& name) +void ArticleFilter::setName(const TQString& name) { d->name = name; } -const QString& ArticleFilter::name() const +const TQString& ArticleFilter::name() const { return d->name; } |