phonewidget.h 1.3 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
    This file is part of Contact Editor.
Laurent Montel's avatar
Laurent Montel committed
3

4
5
    SPDX-FileCopyrightText: 2016 eyeOS S.L.U., a Telefonica company, sales@eyeos.com
    SPDX-FileCopyrightText: 2016-2020 Laurent Montel <montel.org>
Laurent Montel's avatar
Laurent Montel committed
6

7
    SPDX-License-Identifier: LGPL-2.0-or-later
Laurent Montel's avatar
Laurent Montel committed
8
9
*/

Laurent Montel's avatar
Laurent Montel committed
10
#pragma once
Laurent Montel's avatar
Laurent Montel committed
11
12

#include "contacteditor_private_export.h"
Laurent Montel's avatar
Laurent Montel committed
13
#include <QWidget>
Laurent Montel's avatar
Laurent Montel committed
14
class QToolButton;
Laurent Montel's avatar
Laurent Montel committed
15
16
namespace KContacts
{
Laurent Montel's avatar
Laurent Montel committed
17
18
class PhoneNumber;
}
Laurent Montel's avatar
Laurent Montel committed
19
20
namespace ContactEditor
{
Laurent Montel's avatar
Laurent Montel committed
21
22
class PreferredLineEditWidget;
class PhoneComboBoxType;
Laurent Montel's avatar
Laurent Montel committed
23
class CONTACTEDITOR_TESTS_EXPORT PhoneWidget : public QWidget
Laurent Montel's avatar
Laurent Montel committed
24
25
26
27
28
29
30
31
32
33
34
{
    Q_OBJECT
public:
    explicit PhoneWidget(QWidget *parent = nullptr);
    ~PhoneWidget();

    void updateAddRemoveButton(bool addButtonEnabled);
    void loadPhone(const KContacts::PhoneNumber &number);
    KContacts::PhoneNumber storePhone();
    void clearWidget();
    void setPreferred(bool b);
35
    void setReadOnly(bool readOnly);
Laurent Montel's avatar
Laurent Montel committed
36
Q_SIGNALS:
Laurent Montel's avatar
Laurent Montel committed
37
38
39
    void addWidget(ContactEditor::PhoneWidget *);
    void removeWidget(ContactEditor::PhoneWidget *);
    void preferredChanged(ContactEditor::PhoneWidget *);
Laurent Montel's avatar
Laurent Montel committed
40

Laurent Montel's avatar
Laurent Montel committed
41
private:
Laurent Montel's avatar
Laurent Montel committed
42
43
44
    void slotAddPhone();
    void slotRemovePhone();
    void slotPreferredChanged();
Laurent Montel's avatar
Laurent Montel committed
45
46
47
48
    PreferredLineEditWidget *mPhoneNumberEdit = nullptr;
    QToolButton *mAddButton = nullptr;
    QToolButton *mRemoveButton = nullptr;
    PhoneComboBoxType *mPhoneType = nullptr;
Laurent Montel's avatar
Laurent Montel committed
49
50
};
}