00001 #ifndef FILTERMESSAGETYPE_H 00002 #define FILTERMESSAGETYPE_H 00003 00004 #include <QMetaType> 00005 00006 #include <QSet> 00007 00008 #include "filter/filter.h" 00009 #include "datatypes/account.h" 00010 00011 class ServiceMgr; 00012 class QAction; 00013 class FilterMessageType : public Filter 00014 { 00015 Q_OBJECT 00016 Q_ENUMS(MessageType) 00017 00018 public: 00019 enum MessageType {NEW, ALL, INBOX, OUTBOX, DRAFTS}; 00020 00021 explicit FilterMessageType(ServiceMgr* mgr, QObject *parent = 0); 00022 00023 int filterableType() const; 00024 bool isFiltered(QVariant value) const; 00025 QActionGroup* createActions(); 00026 00027 private: 00028 MessageType mAllowedType; 00029 AccountList mAccountList; 00030 00031 QSet<QString> mLocalAccountIds; 00032 QSet<QString> mCachedDraftIds; 00033 00034 void updateLocalCache(); 00035 00036 private slots: 00037 void setAllowedTypeAction(QAction* action); 00038 void updateAccountList(QString, AccountList); 00039 void updateDrafts(MessageList drafts); 00040 }; 00041 00042 Q_DECLARE_METATYPE(FilterMessageType::MessageType) 00043 00044 #endif // FILTERMESSAGETYPE_H