Akonadi Contacts

addresslocationwidget.h
1/*
2 This file is part of Contact Editor.
3
4 SPDX-FileCopyrightText: 2016 eyeOS S.L.U., a Telefonica company, sales@eyeos.com
5 SPDX-FileCopyrightText: 2016-2020 Laurent Montel <montel.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#pragma once
11
12#include <KContacts/Address>
13#include <QWidget>
14
15class QStackedWidget;
16class QCheckBox;
17class KLineEdit;
18class QComboBox;
19class QPushButton;
20
21namespace Akonadi
22{
23class SelectAddressTypeComboBox;
24
25class AddressLocationWidget : public QWidget
26{
28public:
29 enum Mode {
30 CreateAddress = 0,
31 ModifyAddress
32 };
33
34 explicit AddressLocationWidget(QWidget *parent = nullptr);
35 ~AddressLocationWidget() override;
36
37 void setAddress(const KContacts::Address &address);
38 [[nodiscard]] KContacts::Address address() const;
39
40 void slotModifyAddress(const KContacts::Address &address, int currentIndex);
41
42 void clear();
43
44 void setReadOnly(bool readOnly);
45
46 [[nodiscard]] bool wasChanged() const;
48 void addNewAddress(const KContacts::Address &address);
49 void updateAddress(const KContacts::Address &address, int index);
50 void updateAddressCanceled();
51 void removeAddress(int index);
52
53private:
54 void slotChanged();
55 void slotAddAddress();
56 void slotUpdateAddress();
57 void slotRemoveAddress();
58 void slotCancelModifyAddress();
59 void fillCountryCombo();
60 void switchMode();
61 void reset();
62 KContacts::Address mAddress;
63 QCheckBox *mPreferredCheckBox = nullptr;
64 KLineEdit *mPOBoxEdit = nullptr;
65 KLineEdit *mLocalityEdit = nullptr;
66 KLineEdit *mRegionEdit = nullptr;
67 KLineEdit *mPostalCodeEdit = nullptr;
68 KLineEdit *mStreetEdit = nullptr;
69 QComboBox *mCountryCombo = nullptr;
70 QPushButton *mAddAddress = nullptr;
71 QPushButton *mRemoveAddress = nullptr;
72 QPushButton *mModifyAddress = nullptr;
73 QPushButton *mCancelAddress = nullptr;
74 QStackedWidget *mButtonStack = nullptr;
75 SelectAddressTypeComboBox *mTypeCombo = nullptr;
76 int mCurrentAddress = -1;
77 Mode mCurrentMode;
78 bool mWasChanged = false;
79};
80
81}
A widget for editing the display name of a contact.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.