kaddressbook Library API Documentation

addresseditwidget.h

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