• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • sources
  • kde-4.12
  • kdepimlibs
  • akonadi
  • contact
  • editor
addresseditwidget.h
1 /*
2  This file is part of Akonadi Contact.
3 
4  Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #ifndef ADDRESSEDITWIDGET_H
23 #define ADDRESSEDITWIDGET_H
24 
25 #include <QWidget>
26 
27 #include <kabc/address.h>
28 #include <kabc/addressee.h>
29 #include <kcombobox.h>
30 #include <kdialog.h>
31 
32 class QCheckBox;
33 class QLabel;
34 
35 class KLineEdit;
36 class KTextEdit;
37 
41 class AddressSelectionWidget : public KComboBox
42 {
43  Q_OBJECT
44 
45  public:
51  explicit AddressSelectionWidget( QWidget *parent = 0 );
52 
56  virtual ~AddressSelectionWidget();
57 
62  void setAddresses( const KABC::Address::List &addresses );
63 
68  void setCurrentAddress( const KABC::Address &address );
69 
73  KABC::Address currentAddress() const;
74 
75  Q_SIGNALS:
82  void selectionChanged( const KABC::Address &address );
83 
84  private Q_SLOTS:
85  void selected( int );
86 
87  private:
88  void updateView();
89 
90  KABC::Address::List mAddresses;
91 };
92 
96 class AddressTypeCombo : public KComboBox
97 {
98  Q_OBJECT
99 
100  public:
106  explicit AddressTypeCombo( QWidget *parent = 0 );
107 
111  ~AddressTypeCombo();
112 
117  void setType( KABC::Address::Type type );
118 
122  KABC::Address::Type type() const;
123 
124  private Q_SLOTS:
125  void selected( int );
126  void otherSelected();
127 
128  private:
129  void update();
130 
131  KABC::Address::Type mType;
132  int mLastSelected;
133  QList<int> mTypeList;
134 };
135 
139 class AddressEditWidget : public QWidget
140 {
141  Q_OBJECT
142 
143  public:
144  explicit AddressEditWidget( QWidget *parent = 0 );
145  ~AddressEditWidget();
146 
147  void loadContact( const KABC::Addressee &contact );
148  void storeContact( KABC::Addressee &contact ) const;
149 
150  void setReadOnly( bool readOnly );
151 
152  public Q_SLOTS:
153  void updateName( const QString &name );
154 
155  private Q_SLOTS:
156  void updateAddressView();
157  void createAddress();
158  void editAddress();
159  void deleteAddress();
160 
161  private:
162  void updateButtons();
163  void fixPreferredAddress( const KABC::Address &preferredAddress );
164 
165  AddressSelectionWidget *mAddressSelectionWidget;
166 
167  QLabel *mAddressView;
168  QPushButton *mCreateButton;
169  QPushButton *mEditButton;
170  QPushButton *mDeleteButton;
171 
172  KABC::Address::List mAddressList;
173  QString mName;
174  bool mReadOnly;
175 };
176 
180 class AddressEditDialog : public KDialog
181 {
182  Q_OBJECT
183 
184  public:
185  explicit AddressEditDialog( QWidget *parent = 0 );
186  ~AddressEditDialog();
187 
188  void setAddress( const KABC::Address &address );
189  KABC::Address address() const;
190 
191  private Q_SLOTS:
192  void editLabel();
193 
194  private:
195  void fillCountryCombo();
196 
197  AddressTypeCombo *mTypeCombo;
198  KTextEdit *mStreetTextEdit;
199  KComboBox *mCountryCombo;
200  KLineEdit *mRegionEdit;
201  KLineEdit *mLocalityEdit;
202  KLineEdit *mPostalCodeEdit;
203  KLineEdit *mPOBoxEdit;
204  QCheckBox *mPreferredCheckBox;
205 
206  KABC::Address mAddress;
207  QString mLabel;
208 };
209 
210 #endif
AddressTypeCombo::setType
void setType(KABC::Address::Type type)
Sets the type that shall be selected in the combobox.
Definition: addresseditwidget.cpp:171
AddressSelectionWidget::AddressSelectionWidget
AddressSelectionWidget(QWidget *parent=0)
Creates a new address selection widget.
Definition: addresseditwidget.cpp:104
AddressTypeCombo
A widget for selecting the type of an address.
Definition: addresseditwidget.h:96
AddressTypeCombo::AddressTypeCombo
AddressTypeCombo(QWidget *parent=0)
Creates a new address type combo.
Definition: addresseditwidget.cpp:151
AddressSelectionWidget::~AddressSelectionWidget
virtual ~AddressSelectionWidget()
Destroys the address selection widget.
Definition: addresseditwidget.cpp:110
AddressSelectionWidget::selectionChanged
void selectionChanged(const KABC::Address &address)
This signal is emitted whenever the selection of the address has changed.
AddressTypeCombo::~AddressTypeCombo
~AddressTypeCombo()
Destroys the address type combo.
Definition: addresseditwidget.cpp:167
AddressEditWidget
An editor widget for addresses.
Definition: addresseditwidget.h:139
AddressTypeCombo::type
KABC::Address::Type type() const
Returns the type that is currently selected.
Definition: addresseditwidget.cpp:182
AddressSelectionWidget::setCurrentAddress
void setCurrentAddress(const KABC::Address &address)
Sets the current address.
Definition: addresseditwidget.cpp:120
AddressSelectionWidget::setAddresses
void setAddresses(const KABC::Address::List &addresses)
Sets the list of addresses that can be chosen from.
Definition: addresseditwidget.cpp:114
AddressSelectionWidget
A widget that shows a list of addresses for selection.
Definition: addresseditwidget.h:41
AddressEditDialog
Dialog for editing address details.
Definition: addresseditwidget.h:180
AddressSelectionWidget::currentAddress
KABC::Address currentAddress() const
Returns the current selected address.
Definition: addresseditwidget.cpp:128
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal