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

mailcommon

  • sources
  • kde-4.14
  • kdepim
  • mailcommon
  • search
  • searchrule
searchrulestatus.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef SEARCHRULESTATUS_H
19 #define SEARCHRULESTATUS_H
20 
21 #include "search/searchpattern.h"
22 #include <Akonadi/Item>
23 #include <Akonadi/KMime/MessageStatus>
24 using Akonadi::MessageStatus;
25 namespace MailCommon {
26 
27 //TODO: Check if the below one is needed or not!
28 // The below are used in several places and here so they are accessible.
29 struct MessageStatusInfo {
30  const char *text;
31  const char *icon;
32 };
33 
34 // If you change the ordering here; also do it in the enum below
35 static const MessageStatusInfo StatusValues[] =
36 {
37  { I18N_NOOP2( "message status", "Important" ), "emblem-important" },
38  { I18N_NOOP2( "message status", "Action Item" ), "mail-task" },
39  { I18N_NOOP2( "message status", "Unread" ), "mail-unread" },
40  { I18N_NOOP2( "message status", "Read" ), "mail-read" },
41  { I18N_NOOP2( "message status", "Deleted" ), "mail-deleted" },
42  { I18N_NOOP2( "message status", "Replied" ), "mail-replied" },
43  { I18N_NOOP2( "message status", "Forwarded" ), "mail-forwarded" },
44  { I18N_NOOP2( "message status", "Queued" ), "mail-queued" },
45  { I18N_NOOP2( "message status", "Sent" ), "mail-sent" },
46  { I18N_NOOP2( "message status", "Watched" ), "mail-thread-watch" },
47  { I18N_NOOP2( "message status", "Ignored" ), "mail-thread-ignored" },
48  { I18N_NOOP2( "message status", "Spam" ), "mail-mark-junk" },
49  { I18N_NOOP2( "message status", "Ham" ), "mail-mark-notjunk" },
50  { I18N_NOOP2( "message status", "Has Attachment"), "mail-attachment" } //must be last
51 };
52 
53 // If you change the ordering here; also do it in the array above
54 enum StatusValueTypes {
55  StatusImportant = 0,
56  StatusToAct = 1,
57  StatusUnread = 2,
58  StatusRead = 3,
59  StatusDeleted = 4,
60  StatusReplied = 5,
61  StatusForwarded = 6,
62  StatusQueued = 7,
63  StatusSent = 8,
64  StatusWatched = 9,
65  StatusIgnored = 10,
66  StatusSpam = 11,
67  StatusHam = 12,
68  StatusHasAttachment = 13 //must be last
69 };
70 
71 static const int StatusValueCount =
72  sizeof( StatusValues ) / sizeof( MessageStatusInfo );
73 // we want to show all status entries in the quick search bar, but only the
74 // ones up to attachment in the search/filter dialog, because there the
75 // attachment case is handled separately.
76 static const int StatusValueCountWithoutHidden = StatusValueCount - 1;
77 
85 class MAILCOMMON_EXPORT SearchRuleStatus : public SearchRule
86 {
87 public:
88  explicit SearchRuleStatus( const QByteArray &field = QByteArray(),
89  Function function = FuncContains,
90  const QString &contents = QString() );
91 
92  explicit SearchRuleStatus( Akonadi::MessageStatus status,
93  Function function = FuncContains );
94 
95  virtual bool isEmpty() const ;
96  virtual bool matches( const Akonadi::Item &item ) const;
97 
101  virtual RequiredPart requiredPart() const;
102 
103  virtual void addQueryTerms( Akonadi::SearchTerm &groupTerm, bool &emptyIsNotAnError ) const;
104 
105  //Not possible to implement optimized form for status searching
106  using SearchRule::matches;
107 
108  static Akonadi::MessageStatus statusFromEnglishName( const QString & );
109 
110  virtual QString informationAboutNotValidRules() const;
111 
112 private:
113  Akonadi::MessageStatus mStatus;
114 };
115 
116 }
117 
118 #endif // SEARCHRULESTATUS_H
QByteArray
MailCommon::StatusSent
Definition: searchrulestatus.h:63
MailCommon::StatusValueCountWithoutHidden
static const int StatusValueCountWithoutHidden
Definition: searchrulestatus.h:76
MailCommon::StatusValueTypes
StatusValueTypes
Definition: searchrulestatus.h:54
MailCommon::StatusToAct
Definition: searchrulestatus.h:56
MailCommon::StatusUnread
Definition: searchrulestatus.h:57
MailCommon::StatusQueued
Definition: searchrulestatus.h:62
MailCommon::StatusWatched
Definition: searchrulestatus.h:64
MailCommon::SearchRule::Function
Function
Describes operators for comparison of field and contents.
Definition: searchrule.h:55
MailCommon::StatusReplied
Definition: searchrulestatus.h:60
MailCommon::SearchRule::matches
virtual bool matches(const Akonadi::Item &item) const =0
Tries to match the rule against the KMime::Message in the given item.
I18N_NOOP2
#define I18N_NOOP2(c, t)
Definition: searchpatternedit.cpp:48
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchrule.h:79
QString
MailCommon::SearchRuleStatus
This class represents a search to be performed against the status of a messsage.
Definition: searchrulestatus.h:85
MailCommon::StatusDeleted
Definition: searchrulestatus.h:59
MAILCOMMON_EXPORT
#define MAILCOMMON_EXPORT
Definition: mailcommon_export.h:35
searchpattern.h
MailCommon::SearchRule
This class represents one search pattern rule.
Definition: searchrule.h:38
MailCommon::StatusForwarded
Definition: searchrulestatus.h:61
MailCommon::StatusIgnored
Definition: searchrulestatus.h:65
MailCommon::StatusRead
Definition: searchrulestatus.h:58
MailCommon::StatusValues
static const MessageStatusInfo StatusValues[]
Definition: searchrulestatus.h:35
MailCommon::MessageStatusInfo::icon
const char * icon
Definition: searchrulestatus.h:31
MailCommon::StatusHasAttachment
Definition: searchrulestatus.h:68
MailCommon::MessageStatusInfo
Definition: searchrulestatus.h:29
MailCommon::StatusSpam
Definition: searchrulestatus.h:66
MailCommon::MessageStatusInfo::text
const char * text
Definition: searchrulestatus.h:30
MailCommon::StatusHam
Definition: searchrulestatus.h:67
MailCommon::StatusImportant
Definition: searchrulestatus.h:55
MailCommon::StatusValueCount
static const int StatusValueCount
Definition: searchrulestatus.h:71
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:41 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
  • pimprint

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