~ubuntu-branches/debian/sid/baloo-kf5/sid

« back to all changes in this revision

Viewing changes to src/pim/lib/emailquery.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-07-10 21:13:07 UTC
  • Revision ID: package-import@ubuntu.com-20140710211307-iku0qs6vlplgn06m
Tags: upstream-5.0.0b
ImportĀ upstreamĀ versionĀ 5.0.0b

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of the KDE Baloo Project
 
3
 * Copyright (C) 2013  Vishesh Handa <me@vhanda.in>
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2.1 of the License, or (at your option) version 3, or any
 
9
 * later version accepted by the membership of KDE e.V. (or its
 
10
 * successor approved by the membership of KDE e.V.), which shall
 
11
 * act as a proxy defined in Section 6 of version 3 of the license.
 
12
 *
 
13
 * This library is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Lesser General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Lesser General Public
 
19
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
20
 *
 
21
 */
 
22
 
 
23
#ifndef _EMAIL_QUERY_H
 
24
#define _EMAIL_QUERY_H
 
25
 
 
26
#include "pim_export.h"
 
27
#include "query.h"
 
28
 
 
29
#include <QStringList>
 
30
#include <Collection>
 
31
 
 
32
namespace Baloo {
 
33
namespace PIM {
 
34
 
 
35
class BALOO_PIM_EXPORT EmailQuery : public Query
 
36
{
 
37
public:
 
38
    EmailQuery();
 
39
    virtual ~EmailQuery();
 
40
 
 
41
    enum OpType {
 
42
        OpAnd = 0,
 
43
        OpOr
 
44
    };
 
45
 
 
46
    void setSearchType(OpType op);
 
47
 
 
48
    void setInvolves(const QStringList& involves);
 
49
    void addInvolves(const QString& email);
 
50
 
 
51
    void setTo(const QStringList& to);
 
52
    void addTo(const QString& to);
 
53
 
 
54
    void setFrom(const QString& from);
 
55
    void addFrom(const QString& from);
 
56
 
 
57
    void setCc(const QStringList& cc);
 
58
    void addCc(const QString& cc);
 
59
 
 
60
    void setBcc(const QStringList& bcc);
 
61
    void addBcc(const QString& bcc);
 
62
 
 
63
    void setCollection(const QList<Akonadi::Collection::Id>& collections);
 
64
    void addCollection(Akonadi::Collection::Id id);
 
65
 
 
66
    /**
 
67
     * By default the importance is ignored
 
68
     */
 
69
    void setImportant(bool important = true);
 
70
 
 
71
    /**
 
72
     * By default the read status is ignored
 
73
     */
 
74
    void setRead(bool read = true);
 
75
 
 
76
    /**
 
77
     * By default the attachment status is ignored
 
78
     */
 
79
    void setAttachment(bool hasAttachment = true);
 
80
 
 
81
    /**
 
82
     * Matches the string \p match anywhere in the entire email
 
83
     * body
 
84
     */
 
85
    void matches(const QString& match);
 
86
 
 
87
    /**
 
88
     * Matches the string \p subjectMatch specifically in the
 
89
     * email subject
 
90
     */
 
91
    void subjectMatches(const QString& subjectMatch);
 
92
 
 
93
    /**
 
94
     * Matches the string \p bodyMatch specifically in the body email
 
95
     */
 
96
    void bodyMatches(const QString& bodyMatch);
 
97
 
 
98
 
 
99
    void setLimit(int limit);
 
100
    int limit() const;
 
101
 
 
102
    /**
 
103
     * Execute the query and return an iterator to fetch
 
104
     * the results
 
105
     */
 
106
    ResultIterator exec();
 
107
 
 
108
private:
 
109
    //@cond PRIVATE
 
110
    class Private;
 
111
    Private * const d;
 
112
    //@endcond
 
113
};
 
114
 
 
115
}
 
116
}
 
117
 
 
118
#endif // _EMAIL_QUERY_H