~bfiller/address-book-service/add-upstart

« back to all changes in this revision

Viewing changes to common/fetch-hint.h

  • Committer: Tarmac
  • Author(s): Renato Araujo Oliveira Filho
  • Date: 2013-06-27 15:59:10 UTC
  • mfrom: (25.4.5 code-style-fix)
  • Revision ID: tarmac-20130627155910-f0xjfi79wfv0cl1c
Initial implementation of FetchHint.

Approved by Bill Filler, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
4
 * This file is part of contact-service-app.
 
5
 *
 
6
 * contact-service-app is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * contact-service-app 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, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#ifndef __GALERA_FETCH_HINT_H__
 
20
#define __GALERA_FETCH_HINT_H__
 
21
 
 
22
#include <QtContacts/QContactFetchHint>
 
23
#include <QtContacts/QContactDetail>
 
24
#include <QtContacts/QContact>
 
25
 
 
26
namespace galera
 
27
{
 
28
 
 
29
class FetchHint
 
30
{
 
31
public:
 
32
    FetchHint(const QtContacts::QContactFetchHint &hint);
 
33
    FetchHint(const QString &hint);
 
34
    FetchHint(const FetchHint &other);
 
35
    FetchHint();
 
36
 
 
37
    bool isEmpty() const;
 
38
    QString toString() const;
 
39
    QStringList fields() const;
 
40
    QtContacts::QContactFetchHint toContactFetchHint() const;
 
41
    static QMap<QString, QtContacts::QContactDetail::DetailType> contactFieldNames();
 
42
    static QList<QtContacts::QContactDetail::DetailType> parseFieldNames(QStringList fieldNames);
 
43
 
 
44
private:
 
45
    QtContacts::QContactFetchHint m_hint;
 
46
    QString m_strHint;
 
47
    QStringList m_fields;
 
48
 
 
49
 
 
50
 
 
51
    void update();
 
52
    static QtContacts::QContactFetchHint buildFilter(const QString &originalHint);
 
53
};
 
54
 
 
55
}
 
56
 
 
57
#endif