searchjob.h
00001 /* 00002 Copyright (c) 2009 Andras Mantia <amantia@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #ifndef KIMAP_SEARCHJOB_H 00021 #define KIMAP_SEARCHJOB_H 00022 00023 #include "kimap_export.h" 00024 00025 #include "job.h" 00026 00027 class QDate; 00028 00029 namespace KIMAP { 00030 00031 class Session; 00032 struct Message; 00033 class SearchJobPrivate; 00034 00035 class KIMAP_EXPORT SearchJob : public Job 00036 { 00037 Q_OBJECT 00038 Q_DECLARE_PRIVATE(SearchJob) 00039 00040 friend class SessionPrivate; 00041 00042 public: 00043 enum SearchLogic { 00044 And = 0, 00045 Or, 00046 Not 00047 }; 00048 00049 enum SearchCriteria { 00050 All = 0, 00051 Answered, 00052 BCC, 00053 Before, 00054 Body, 00055 CC, 00056 Deleted, 00057 Draft, 00058 Flagged, 00059 From, 00060 Header, 00061 Keyword, 00062 Larger, 00063 New, 00064 Old, 00065 On, 00066 Recent, 00067 Seen, 00068 SentBefore, 00069 SentOn, 00070 SentSince, 00071 Since, 00072 Smaller, 00073 Subject, 00074 Text, 00075 To, 00076 Uid, 00077 Unanswered, 00078 Undeleted, 00079 Undraft, 00080 Unflagged, 00081 Unkeyword, 00082 Unseen 00083 }; 00084 00085 explicit SearchJob( Session *session ); 00086 virtual ~SearchJob(); 00087 00088 void setUidBased(bool uidBased); 00089 bool isUidBased() const; 00090 00091 void setCharset( const QByteArray &charSet ); 00092 QByteArray charset() const; 00093 00099 KDE_DEPRECATED QList<int> foundItems(); 00100 00106 QList<qint64> results() const; 00107 00113 void addSearchCriteria( SearchCriteria criteria ); 00114 00122 void addSearchCriteria( SearchCriteria criteria, const QByteArray &argument ); 00123 00131 void addSearchCriteria( SearchCriteria criteria, int argument ); 00132 00140 void addSearchCriteria( SearchCriteria criteria, const QDate& argument ); 00141 00147 void addSearchCriteria( const QByteArray &searchCriteria ); 00148 00153 void setSearchLogic(SearchLogic logic); 00154 00155 protected: 00156 virtual void doStart(); 00157 virtual void handleResponse(const Message &response); 00158 }; 00159 00160 } 00161 00162 #endif