customfieldslistwidget.h 1.83 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1 2 3 4
/*
    This file is part of Akonadi Contact.

    Copyright (C) 2016 eyeOS S.L.U., a Telefonica company, sales@eyeos.com
Laurent Montel's avatar
Laurent Montel committed
5
    Copyright (C) 2016-2017 Laurent Montel <laurent.montel@kdab.com>
Laurent Montel's avatar
Laurent Montel committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

    This library is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published by
    the Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    This library is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
    License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to the
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
*/

Laurent Montel's avatar
Laurent Montel committed
23 24
#ifndef CUSTOMFIELDSLISTWIDGET_H
#define CUSTOMFIELDSLISTWIDGET_H
Laurent Montel's avatar
Laurent Montel committed
25 26

#include <QWidget>
Laurent Montel's avatar
Laurent Montel committed
27
#include "customfieldsmodel.h"
Laurent Montel's avatar
Laurent Montel committed
28
class QTreeView;
Laurent Montel's avatar
Laurent Montel committed
29 30 31 32
namespace KContacts
{
class Addressee;
}
Laurent Montel's avatar
Laurent Montel committed
33
class CustomFieldsModel;
Laurent Montel's avatar
Laurent Montel committed
34 35
namespace Akonadi
{
Laurent Montel's avatar
Laurent Montel committed
36
class CustomFieldsListWidget : public QWidget
Laurent Montel's avatar
Laurent Montel committed
37 38 39
{
    Q_OBJECT
public:
Laurent Montel's avatar
Laurent Montel committed
40
    explicit CustomFieldsListWidget(QWidget *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
41
    ~CustomFieldsListWidget();
Laurent Montel's avatar
Laurent Montel committed
42 43 44
    void storeContact(KContacts::Addressee &contact) const;
    void loadContact(const KContacts::Addressee &contact);
    void setReadOnly(bool readOnly);
Laurent Montel's avatar
Laurent Montel committed
45

Laurent Montel's avatar
Laurent Montel committed
46 47
    void setLocalCustomFieldDescriptions(const QVariantList &descriptions);
    QVariantList localCustomFieldDescriptions() const;
Laurent Montel's avatar
Laurent Montel committed
48 49 50
public Q_SLOTS:
    void slotAddNewField(const CustomField &field);

Laurent Montel's avatar
Laurent Montel committed
51 52 53 54
private:
    CustomField::List mLocalCustomFields;
    QTreeView *mCustomFieldList;
    CustomFieldsModel *mModel;
Laurent Montel's avatar
Laurent Montel committed
55 56
};
}
Laurent Montel's avatar
Laurent Montel committed
57
#endif // CUSTOMFIELDSLISTWIDGET_H