kaddressbook Library API Documentation

addresseditwidget.h

00001 #ifndef ADDRESSEDITWIDGET_H
00002 #define ADDRESSEDITWIDGET_H
00003 /*
00004     This file is part of KAddressBook.
00005     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 
00026 #include <qwidget.h>
00027 
00028 #include <kdialogbase.h>
00029 #include <kabc/address.h>
00030 #include <kabc/addressee.h>
00031 
00032 #include "addresseeconfig.h"
00033 #include "typecombo.h"
00034 
00035 class QButtonGroup;
00036 class QToolButton;
00037 class QListView;
00038 class QTextEdit;
00039 class QCheckBox;
00040 
00041 class KLineEdit;
00042 class KListView;
00043 class KComboBox;
00044 
00045 typedef TypeCombo<KABC::Address> AddressTypeCombo;
00046 
00050 class AddressEditWidget : public QWidget
00051 {
00052   Q_OBJECT
00053 
00054   public:
00055     AddressEditWidget(QWidget *parent, const char *name = 0);
00056     ~AddressEditWidget();
00057 
00058     KABC::Address::List addresses();
00059     void setAddresses(const KABC::Address::List &list);
00060     
00061     void updateTypeCombo( const KABC::Address::List&, KComboBox* );
00062     KABC::Address currentAddress( KComboBox*, int );
00063 
00064   signals:
00065     void modified();
00066     
00067   protected slots:
00068     void updateAddressEdit();
00069 
00070     void edit();
00071 
00072   private:
00073     AddressTypeCombo *mTypeCombo;
00074 
00075     QPushButton *mEditButton;
00076     QPushButton *mRemoveButton;
00077     QTextEdit *mAddressTextEdit;
00078 
00079     KABC::Address::List mAddressList;
00080     int mIndex;
00081 };
00082 
00086 class AddressEditDialog : public KDialogBase
00087 {
00088   Q_OBJECT
00089 
00090   public:
00091     AddressEditDialog( const KABC::Address::List &list, int selected,
00092                        QWidget *parent, const char *name = 0 );
00093     ~AddressEditDialog();
00094 
00095     KABC::Address::List addresses();
00096     bool changed() const;
00097 
00098   protected slots:
00099     void addAddress();
00100     void removeAddress();
00101 
00102     void updateAddressEdits();
00103     void modified();
00104 
00105   private:
00106     void fillCountryCombo(KComboBox *combo);
00107 
00108     void saveAddress();
00109 
00110     KABC::Address::List mAddressList;
00111 
00112     AddressTypeCombo *mTypeCombo;
00113 
00114     QCheckBox *mPreferredCheckBox;
00115     QTextEdit *mStreetTextEdit;
00116     KComboBox *mCountryCombo;
00117     KLineEdit *mRegionEdit;
00118     KLineEdit *mLocalityEdit;
00119     KLineEdit *mPostalCodeEdit;
00120     KLineEdit *mPOBoxEdit;
00121     QPushButton *removeButton;
00122     bool mChanged;
00123 };
00124 
00128 class AddressTypeDialog : public KDialogBase
00129 {
00130   public:
00131     AddressTypeDialog( int type, QWidget *parent );
00132     ~AddressTypeDialog();
00133 
00134     int type();
00135 
00136   private:
00137     QButtonGroup *mGroup;
00138 
00139     KABC::Address::TypeList mTypeList;
00140 };
00141 
00142 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:36 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001