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, [email protected]
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 
15 class QStackedWidget;
16 class QCheckBox;
17 class KLineEdit;
18 class KComboBox;
19 class QPushButton;
20 
21 namespace ContactEditor
22 {
23 class SelectAddressTypeComboBox;
24 
25 class AddressLocationWidget : public QWidget
26 {
27  Q_OBJECT
28 public:
29  enum Mode { CreateAddress = 0, ModifyAddress };
30 
31  explicit AddressLocationWidget(QWidget *parent = nullptr);
32  ~AddressLocationWidget() override;
33 
34  void setAddress(const KContacts::Address &address);
35  Q_REQUIRED_RESULT KContacts::Address address() const;
36 
37  void slotModifyAddress(const KContacts::Address &address, int currentIndex);
38 
39  void clear();
40 
41  void setReadOnly(bool readOnly);
42 
43  Q_REQUIRED_RESULT bool wasChanged() const;
44 Q_SIGNALS:
45  void addNewAddress(const KContacts::Address &address);
46  void updateAddress(const KContacts::Address &address, int index);
47  void updateAddressCanceled();
48  void removeAddress(int index);
49 
50 private:
51  void slotChanged();
52  void slotAddAddress();
53  void slotUpdateAddress();
54  void slotRemoveAddress();
55  void slotCancelModifyAddress();
56  void fillCountryCombo();
57  void switchMode();
58  void reset();
59  KContacts::Address mAddress;
60  QCheckBox *mPreferredCheckBox = nullptr;
61  KLineEdit *mPOBoxEdit = nullptr;
62  KLineEdit *mLocalityEdit = nullptr;
63  KLineEdit *mRegionEdit = nullptr;
64  KLineEdit *mPostalCodeEdit = nullptr;
65  KLineEdit *mStreetEdit = nullptr;
66  KComboBox *mCountryCombo = nullptr;
67  QPushButton *mAddAddress = nullptr;
68  QPushButton *mRemoveAddress = nullptr;
69  QPushButton *mModifyAddress = nullptr;
70  QPushButton *mCancelAddress = nullptr;
71  QStackedWidget *mButtonStack = nullptr;
72  SelectAddressTypeComboBox *mTypeCombo = nullptr;
73  int mCurrentAddress = -1;
74  Mode mCurrentMode;
75  bool mWasChanged = false;
76 };
77 
78 }
79 
Q_SIGNALSQ_SIGNALS
PostalAddress address(const QVariant &location)
Q_OBJECTQ_OBJECT
KGuiItem reset()
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jun 23 2021 23:09:24 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.