• 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
  • autotests
searchruletest.cpp
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 
19 #include "searchruletest.h"
20 #include "../search/searchrule/searchrule.h"
21 #include <qtest_kde.h>
22 class TestSearchRule : public MailCommon::SearchRule
23 {
24 public:
25  TestSearchRule(const QByteArray &field = QByteArray(), Function function = FuncContains,
26  const QString &contents = QString())
27  : MailCommon::SearchRule(field, function, contents)
28  {
29 
30  }
31 
32  bool matches(const Akonadi::Item &item) const {return false;}
33  bool isEmpty() const { return false; }
34  MailCommon::SearchRule::RequiredPart requiredPart() const { return MailCommon::SearchRule::CompleteMessage; }
35 };
36 
37 SearchRuleTest::SearchRuleTest(QObject *parent)
38  : QObject(parent)
39 {
40 
41 }
42 
43 void SearchRuleTest::shouldHaveDefaultValue()
44 {
45  TestSearchRule searchrule;
46  QCOMPARE(searchrule.field(), QByteArray());
47  QCOMPARE(searchrule.function(), MailCommon::SearchRule::FuncContains);
48  QVERIFY(searchrule.contents().isEmpty());
49 }
50 
51 void SearchRuleTest::shouldAssignValue()
52 {
53  TestSearchRule searchrule;
54  //TODO
55 }
56 
57 QTEST_KDEMAIN(SearchRuleTest, NoGUI)
QByteArray
SearchRuleTest
Definition: searchruletest.h:23
MailCommon::SearchRule::CompleteMessage
Definition: searchrule.h:82
MailCommon::SearchRule::isEmpty
virtual bool isEmpty() const =0
Determines whether the rule is worth considering.
MailCommon::SearchRule::requiredPart
virtual SearchRule::RequiredPart requiredPart() const =0
Returns the required part from the item that is needed for the search to operate. ...
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.
QObject
MailCommon::SearchRule::contents
QString contents() const
Returns the contents of the rule.
Definition: searchrule.cpp:511
SearchRuleTest::SearchRuleTest
SearchRuleTest(QObject *parent=0)
Definition: searchruletest.cpp:37
MailCommon::SearchRule::RequiredPart
RequiredPart
Definition: searchrule.h:79
QString
MailCommon::SearchRule::field
QByteArray field() const
Returns the message header field name (without the trailing ':').
Definition: searchrule.cpp:501
MailCommon::SearchRule
This class represents one search pattern rule.
Definition: searchrule.h:38
MailCommon::SearchRule::FuncContains
Definition: searchrule.h:57
MailCommon::SearchRule::function
Function function() const
Returns the filter function of the rule.
Definition: searchrule.cpp:491
MailCommon::SearchRule::SearchRule
SearchRule(const QByteArray &field=QByteArray(), Function function=FuncContains, const QString &contents=QString())
Creates new new search rule.
Definition: searchrule.cpp:64
searchruletest.h
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