• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

mailcommon

  • sources
  • kde-4.12
  • kdepim
  • mailcommon
  • filter
mailfilter.h
Go to the documentation of this file.
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2  * kmail: KDE mail client
3  * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  */
20 #ifndef MAILCOMMON_MAILFILTER_H
21 #define MAILCOMMON_MAILFILTER_H
22 
23 #include "../mailcommon_export.h"
24 
25 #include "filteraction.h"
26 #include "../search/searchpattern.h"
27 
28 #include <kshortcut.h>
29 #include <akonadi/collection.h>
30 
31 #include <kmime/kmime_message.h>
32 
33 #include <QtCore/QDataStream>
34 
35 class KConfigGroup;
36 
37 namespace MailCommon {
38 
39 // maximum number of filter actions per filter
40 const int FILTER_MAX_ACTIONS = 8;
41 
42 class MAILCOMMON_EXPORT MailFilter
43 {
44  friend MAILCOMMON_EXPORT QDataStream& operator<<( QDataStream &stream, const MailFilter &filter );
45  friend MAILCOMMON_EXPORT QDataStream& operator>>( QDataStream &stream, MailFilter &filter );
46 
47 public:
59  enum ReturnCode { NoResult, GoOn, CriticalError };
60 
70  enum AccountType { All, ButImap, Checked };
71 
73  MailFilter();
74 
78  explicit MailFilter( const KConfigGroup & aConfig, bool internal, bool & needUpdate );
79 
81  MailFilter( const MailFilter & other );
82 
84  ~MailFilter();
85 
89  QString identifier() const;
90 
92  QString name() const;
93 
105  ReturnCode execActions(ItemContext &context, bool& stopIt , bool applyOnOutbound) const ;
106 
110  SearchRule::RequiredPart requiredPart(const QString& id) const;
111 
113  void writeConfig( KConfigGroup& config, bool exportFilter ) const;
114 
116  bool readConfig( const KConfigGroup& config, bool interactive = false );
117 
119  void purify();
120 
122  bool isEmpty() const;
123 
127  QList<FilterAction*>* actions();
128 
130  const QList<FilterAction*>* actions() const;
131 
135  SearchPattern* pattern();
136 
140  const SearchPattern* pattern() const;
141 
146  void setApplyOnOutbound( bool aApply = true );
147 
152  void setApplyBeforeOutbound( bool aApply = true );
153 
158  bool applyOnOutbound() const;
159 
164  bool applyBeforeOutbound() const;
165 
170  void setApplyOnInbound( bool aApply = true );
171 
176  bool applyOnInbound() const;
177 
182  void setApplyOnExplicit( bool aApply = true );
183 
188  bool applyOnExplicit() const;
189 
197  void setApplicability( AccountType aApply = All );
198 
205  AccountType applicability() const;
206 
213  void setApplyOnAccount( const QString& id, bool aApply = true );
214 
219  bool applyOnAccount( const QString& id ) const;
220 
221  void setStopProcessingHere( bool aStop );
222  bool stopProcessingHere() const;
223 
226  void setConfigureShortcut( bool aShort );
227 
232  bool configureShortcut() const;
233 
238  void setConfigureToolbar( bool aTool );
239 
244  bool configureToolbar() const;
245 
249  QString toolbarName() const;
250 
258  void setToolbarName( const QString &toolbarName );
259 
264  void setShortcut( const KShortcut &shortcut );
265 
269  const KShortcut & shortcut() const;
270 
275  void setIcon( const QString &icon );
276 
280  QString icon() const;
281 
289  bool folderRemoved( const Akonadi::Collection& aFolder, const Akonadi::Collection& aNewFolder );
290 
294 #ifndef NDEBUG
295  const QString asString() const;
296 #endif
297 
302  void setAutoNaming( bool useAutomaticNames );
303 
306  bool isAutoNaming() const;
307 
310  bool isEnabled() const;
311  void setEnabled( bool );
312 
313  void generateSieveScript(QStringList &requires, QString &code);
314 
315 private:
316  QString mIdentifier;
317  SearchPattern mPattern;
318  QList<FilterAction*> mActions;
319  QStringList mAccounts;
320  QString mIcon;
321  QString mToolbarName;
322  KShortcut mShortcut;
323  bool bApplyOnInbound : 1;
324  bool bApplyBeforeOutbound : 1;
325  bool bApplyOnOutbound : 1;
326  bool bApplyOnExplicit : 1;
327  bool bStopProcessingHere : 1;
328  bool bConfigureShortcut : 1;
329  bool bConfigureToolbar : 1;
330  bool bAutoNaming : 1;
331  bool bEnabled : 1;
332  AccountType mApplicability;
333 };
334 
335 MAILCOMMON_EXPORT QDataStream& operator<<( QDataStream &stream, const MailFilter &filter );
336 MAILCOMMON_EXPORT QDataStream& operator>>( QDataStream &stream, MailFilter &filter );
337 
338 }
339 
340 #endif /*MAILCOMMON_MAILFILTER_H*/
MailCommon::MailFilter::ReturnCode
ReturnCode
Result codes returned by process.
Definition: mailfilter.h:59
MailCommon::FILTER_MAX_ACTIONS
const int FILTER_MAX_ACTIONS
Definition: mailfilter.h:40
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchpattern.h:104
MailCommon::SearchPattern
This class is an abstraction of a search over messages.
Definition: searchpattern.h:595
MAILCOMMON_EXPORT
#define MAILCOMMON_EXPORT
Definition: mailcommon_export.h:35
MailCommon::MailFilter::AccountType
AccountType
Account type codes used by setApplicability.
Definition: mailfilter.h:70
MailCommon::operator>>
MAILCOMMON_EXPORT QDataStream & operator>>(QDataStream &stream, MailFilter &filter)
Definition: mailfilter.cpp:662
MailCommon::operator<<
MAILCOMMON_EXPORT QDataStream & operator<<(QDataStream &stream, const MailFilter &filter)
Definition: mailfilter.cpp:631
context
const char * context
Definition: searchpatternedit.cpp:54
MailCommon::ItemContext
A helper class for the filtering process.
Definition: itemcontext.h:39
MailCommon::MailFilter
Definition: mailfilter.h:42
filteraction.h
QList
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailcommon

Skip menu "mailcommon"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal