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 /libkdepim/kscoring.h | |
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 'libkdepim/kscoring.h')
-rw-r--r-- | libkdepim/kscoring.h | 238 |
1 files changed, 119 insertions, 119 deletions
diff --git a/libkdepim/kscoring.h b/libkdepim/kscoring.h index 3252a33ea..a0cdcf0b3 100644 --- a/libkdepim/kscoring.h +++ b/libkdepim/kscoring.h @@ -20,19 +20,19 @@ #include <unistd.h> -#include <qglobal.h> -#include <qptrlist.h> -#include <qptrstack.h> -#include <qregexp.h> - -#include <qobject.h> -#include <qstring.h> -#include <qstringlist.h> -#include <qdatetime.h> -#include <qcolor.h> -#include <qtable.h> -#include <qmap.h> -#include <qdict.h> +#include <tqglobal.h> +#include <tqptrlist.h> +#include <tqptrstack.h> +#include <tqregexp.h> + +#include <tqobject.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqdatetime.h> +#include <tqcolor.h> +#include <tqtable.h> +#include <tqmap.h> +#include <tqdict.h> #include <kdialogbase.h> #include <klineedit.h> @@ -67,12 +67,12 @@ public: virtual ~ScorableArticle(); virtual void addScore(short) {} - virtual void displayMessage(const QString&); - virtual void changeColor(const QColor&) {} + virtual void displayMessage(const TQString&); + virtual void changeColor(const TQColor&) {} virtual void markAsRead() {} - virtual QString from() const = 0; - virtual QString subject() const = 0; - virtual QString getHeaderByType(const QString&) const = 0; + virtual TQString from() const = 0; + virtual TQString subject() const = 0; + virtual TQString getHeaderByType(const TQString&) const = 0; //virtual ScorableGroup group() const =0; }; @@ -85,49 +85,49 @@ class KDE_EXPORT ActionBase { public: ActionBase(); virtual ~ActionBase(); - virtual QString toString() const =0; + virtual TQString toString() const =0; virtual void apply(ScorableArticle&) const =0; virtual ActionBase* clone() const =0; virtual int getType() const =0; - virtual QString getValueString() const { return QString(); } - virtual void setValue(const QString&) {} - static ActionBase* factory(int type, const QString &value); - static QStringList userNames(); - static QString userName(int type); - static int getTypeForName(const QString& name); - static int getTypeForUserName(const QString& name); - QString userName() { return userName(getType()); } + virtual TQString getValueString() const { return TQString(); } + virtual void setValue(const TQString&) {} + static ActionBase* factory(int type, const TQString &value); + static TQStringList userNames(); + static TQString userName(int type); + static int getTypeForName(const TQString& name); + static int getTypeForUserName(const TQString& name); + TQString userName() { return userName(getType()); } enum ActionTypes { SETSCORE, NOTIFY, COLOR, MARKASREAD }; }; class KDE_EXPORT ActionColor : public ActionBase { public: - ActionColor(const QColor&); - ActionColor(const QString&); + ActionColor(const TQColor&); + ActionColor(const TQString&); ActionColor(const ActionColor&); virtual ~ActionColor(); - virtual QString toString() const; + virtual TQString toString() const; virtual int getType() const { return COLOR; } - virtual QString getValueString() const { return color.name(); } - virtual void setValue(const QString& s) { color.setNamedColor(s); } - void setValue(const QColor& c) { color = c; } - QColor value() const { return color; } + virtual TQString getValueString() const { return color.name(); } + virtual void setValue(const TQString& s) { color.setNamedColor(s); } + void setValue(const TQColor& c) { color = c; } + TQColor value() const { return color; } virtual void apply(ScorableArticle&) const; virtual ActionColor* clone() const; private: - QColor color; + TQColor color; }; class KDE_EXPORT ActionSetScore : public ActionBase { public: ActionSetScore(short); ActionSetScore(const ActionSetScore&); - ActionSetScore(const QString&); + ActionSetScore(const TQString&); virtual ~ActionSetScore(); - virtual QString toString() const; + virtual TQString toString() const; virtual int getType() const { return SETSCORE; } - virtual QString getValueString() const { return QString::number(val); } - virtual void setValue(const QString& s) { val = s.toShort(); } + virtual TQString getValueString() const { return TQString::number(val); } + virtual void setValue(const TQString& s) { val = s.toShort(); } void setValue(short v) { val = v; } short value() const { return val; } virtual void apply(ScorableArticle&) const; @@ -138,17 +138,17 @@ class KDE_EXPORT ActionSetScore : public ActionBase { class KDE_EXPORT ActionNotify : public ActionBase { public: - ActionNotify(const QString&); + ActionNotify(const TQString&); ActionNotify(const ActionNotify&); virtual ~ActionNotify() {} - virtual QString toString() const; + virtual TQString toString() const; virtual int getType() const { return NOTIFY; } - virtual QString getValueString() const { return note; } - virtual void setValue(const QString& s) { note = s; } + virtual TQString getValueString() const { return note; } + virtual void setValue(const TQString& s) { note = s; } virtual void apply(ScorableArticle&) const; virtual ActionNotify* clone() const; private: - QString note; + TQString note; }; class KDE_EXPORT ActionMarkAsRead : public ActionBase { @@ -156,7 +156,7 @@ class KDE_EXPORT ActionMarkAsRead : public ActionBase { ActionMarkAsRead(); ActionMarkAsRead( const ActionMarkAsRead& ); virtual ~ActionMarkAsRead() {} - virtual QString toString() const; + virtual TQString toString() const; virtual int getType() const { return MARKASREAD; } virtual void apply( ScorableArticle &article ) const; virtual ActionMarkAsRead* clone() const; @@ -167,16 +167,16 @@ class KDE_EXPORT NotifyCollection public: NotifyCollection(); ~NotifyCollection(); - void addNote(const ScorableArticle&, const QString&); - QString collection() const; - void displayCollection(QWidget *p=0) const; + void addNote(const ScorableArticle&, const TQString&); + TQString collection() const; + void displayCollection(TQWidget *p=0) const; private: struct article_info { - QString from; - QString subject; + TQString from; + TQString subject; }; - typedef QValueList<article_info> article_list; - typedef QDict<article_list> note_list; + typedef TQValueList<article_info> article_list; + typedef TQDict<article_list> note_list; note_list notifyList; }; @@ -188,31 +188,31 @@ class KDE_EXPORT KScoringExpression public: enum Condition { CONTAINS, MATCH, EQUALS, SMALLER, GREATER, MATCHCS }; - KScoringExpression(const QString&,const QString&,const QString&, const QString&); + KScoringExpression(const TQString&,const TQString&,const TQString&, const TQString&); ~KScoringExpression(); bool match(ScorableArticle& a) const ; - QString getTypeString() const; - static QString getTypeString(int); + TQString getTypeString() const; + static TQString getTypeString(int); int getType() const; - QString toString() const; - void write(QTextStream& ) const; + TQString toString() const; + void write(TQTextStream& ) const; bool isNeg() const { return neg; } Condition getCondition() const { return cond; } - QString getExpression() const { return expr_str; } - QString getHeader() const { return header; } - static QStringList conditionNames(); - static QStringList headerNames(); - static int getConditionForName(const QString&); - static QString getNameForCondition(int); + TQString getExpression() const { return expr_str; } + TQString getHeader() const { return header; } + static TQStringList conditionNames(); + static TQStringList headerNames(); + static int getConditionForName(const TQString&); + static TQString getNameForCondition(int); private: bool neg; - QString header; + TQString header; const char* c_header; Condition cond; - QRegExp expr; - QString expr_str; + TQRegExp expr; + TQString expr_str; int expr_int; }; @@ -221,59 +221,59 @@ class KDE_EXPORT KScoringRule { friend class KScoringManager; public: - KScoringRule(const QString& name); + KScoringRule(const TQString& name); KScoringRule(const KScoringRule& r); ~KScoringRule(); - typedef QPtrList<KScoringExpression> ScoreExprList; - typedef QPtrList<ActionBase> ActionList; - typedef QStringList GroupList; + typedef TQPtrList<KScoringExpression> ScoreExprList; + typedef TQPtrList<ActionBase> ActionList; + typedef TQStringList GroupList; enum LinkMode { AND, OR }; - QString getName() const { return name; } - QStringList getGroups() const { return groups; } - void setGroups(const QStringList &l) { groups = l; } + TQString getName() const { return name; } + TQStringList getGroups() const { return groups; } + void setGroups(const TQStringList &l) { groups = l; } LinkMode getLinkMode() const { return link; } - QString getLinkModeName() const; - QString getExpireDateString() const; - QDate getExpireDate() const { return expires; } - void setExpireDate(const QDate &d) { expires = d; } + TQString getLinkModeName() const; + TQString getExpireDateString() const; + TQDate getExpireDate() const { return expires; } + void setExpireDate(const TQDate &d) { expires = d; } bool isExpired() const; ScoreExprList getExpressions() const { return expressions; } ActionList getActions() const { return actions; } void cleanExpressions(); void cleanActions(); - bool matchGroup(const QString& group) const ; + bool matchGroup(const TQString& group) const ; void applyRule(ScorableArticle& a) const; - void applyRule(ScorableArticle& a, const QString& group) const; + void applyRule(ScorableArticle& a, const TQString& group) const; void applyAction(ScorableArticle& a) const; - void setLinkMode(const QString& link); + void setLinkMode(const TQString& link); void setLinkMode(LinkMode m) { link = m; } - void setExpire(const QString& exp); + void setExpire(const TQString& exp); void addExpression( KScoringExpression* ); - void addGroup( const QString& group) { groups.append(group); } - //void addServer(const QString& server) { servers.append(server); } - void addAction(int, const QString& ); + void addGroup( const TQString& group) { groups.append(group); } + //void addServer(const TQString& server) { servers.append(server); } + void addAction(int, const TQString& ); void addAction(ActionBase*); - void updateXML(QDomElement& e, QDomDocument& d); - QString toString() const; + void updateXML(TQDomElement& e, TQDomDocument& d); + TQString toString() const; // writes the rule in XML format into the textstream - void write(QTextStream& ) const; + void write(TQTextStream& ) const; protected: //! assert that the name is unique - void setName(const QString &n) { name = n; } + void setName(const TQString &n) { name = n; } private: - QString name; + TQString name; GroupList groups; //ServerList servers; LinkMode link; ScoreExprList expressions; ActionList actions; - QDate expires; + TQDate expires; }; /** this helper class implements a stack for lists of lists of rules. @@ -286,16 +286,16 @@ public: RuleStack(); ~RuleStack(); //! puts the list on the stack, doesn't change the list - void push(QPtrList<KScoringRule>&); + void push(TQPtrList<KScoringRule>&); //! clears the argument list and copy the content of the TOS into it //! after that the TOS gets dropped - void pop(QPtrList<KScoringRule>&); + void pop(TQPtrList<KScoringRule>&); //! like pop but without dropping the TOS - void top(QPtrList<KScoringRule>&); + void top(TQPtrList<KScoringRule>&); //! drops the TOS void drop(); private: - QPtrStack< QPtrList<KScoringRule> > stack; + TQPtrStack< TQPtrList<KScoringRule> > stack; }; //---------------------------------------------------------------------------- @@ -306,20 +306,20 @@ class KDE_EXPORT KScoringManager : public QObject public: //* this is the container for all rules - typedef QPtrList<KScoringRule> ScoringRuleList; + typedef TQPtrList<KScoringRule> ScoringRuleList; - KScoringManager(const QString& appName = QString::null); + KScoringManager(const TQString& appName = TQString::null); virtual ~KScoringManager(); //* returns a list of all available groups, must be overridden - virtual QStringList getGroups() const =0; + virtual TQStringList getGroups() const =0; //! returns a list of common (or available) headers //! defaults to returning { Subject, From, Message-ID, Date } - virtual QStringList getDefaultHeaders() const; + virtual TQStringList getDefaultHeaders() const; //* setting current server and group and calling applyRules(ScorableArticle&) - void applyRules(ScorableArticle& article, const QString& group/*, const QString& server*/); + void applyRules(ScorableArticle& article, const TQString& group/*, const TQString& server*/); //* assuming a properly set group void applyRules(ScorableArticle&); //* same as above @@ -335,33 +335,33 @@ class KDE_EXPORT KScoringManager : public QObject void removeTOS(); KScoringRule* addRule(KScoringRule *); - KScoringRule* addRule(const ScorableArticle&, QString group, short =0); + KScoringRule* addRule(const ScorableArticle&, TQString group, short =0); KScoringRule* addRule(); void cancelNewRule(KScoringRule *); void deleteRule(KScoringRule *); - void editRule(KScoringRule *e, QWidget *w=0); + void editRule(KScoringRule *e, TQWidget *w=0); KScoringRule* copyRule(KScoringRule *); void moveRuleAbove( KScoringRule *above, KScoringRule *below ); void moveRuleBelow( KScoringRule *below, KScoringRule *above ); - void setGroup(const QString& g); + void setGroup(const TQString& g); // has to be called after setGroup() or initCache() bool hasRulesForCurrentGroup(); - QString findUniqueName() const; + TQString findUniqueName() const; /** called from an editor whenever it finishes editing the rule base, causes the finishedEditing signal to be emitted */ void editorReady(); ScoringRuleList getAllRules() const { return allRules; } - KScoringRule *findRule(const QString&); - QStringList getRuleNames(); - void setRuleName(KScoringRule *, const QString&); + KScoringRule *findRule(const TQString&); + TQStringList getRuleNames(); + void setRuleName(KScoringRule *, const TQString&); int getRuleCount() const { return allRules.count(); } - QString toString() const; + TQString toString() const; bool setCacheValid(bool v); bool isCacheValid() { return cacheValid; } - void initCache(const QString& group/*, const QString& server*/); + void initCache(const TQString& group/*, const TQString& server*/); void load(); void save(); @@ -375,15 +375,15 @@ class KDE_EXPORT KScoringManager : public QObject signals: void changedRules(); - void changedRuleName(const QString& oldName, const QString& newName); + void changedRuleName(const TQString& oldName, const TQString& newName); void finishedEditing(); private: void addRuleInternal(KScoringRule *e); void expireRules(); - QDomDocument createXMLfromInternal(); - void createInternalFromXML(QDomNode); + TQDomDocument createXMLfromInternal(); + void createInternalFromXML(TQDomNode); // list of all Rules ScoringRuleList allRules; @@ -395,13 +395,13 @@ class KDE_EXPORT KScoringManager : public QObject bool cacheValid; // current rule set, ie the cache ScoringRuleList ruleList; - //QString server; - QString group; + //TQString server; + TQString group; //ScorableServer* _s; // filename of the scorefile - QString mFilename; + TQString mFilename; }; @@ -410,16 +410,16 @@ class KDE_EXPORT NotifyDialog : public KDialogBase { Q_OBJECT public: - static void display(ScorableArticle&,const QString&); + static void display(ScorableArticle&,const TQString&); protected slots: void slotShowAgainToggled(bool); private: - NotifyDialog(QWidget* p =0); + NotifyDialog(TQWidget* p =0); static NotifyDialog *me; - QLabel *note; - QString msg; - typedef QMap<QString,bool> NotesMap; + TQLabel *note; + TQString msg; + typedef TQMap<TQString,bool> NotesMap; static NotesMap dict; }; |