kpilot

addressWidget.h

Go to the documentation of this file.
00001 /* addressWidget.h          KPilot
00002 **
00003 ** Copyright (C) 1998-2001 by Dan Pilone
00004 ** Copyright (C) 2003 Reinhold Kainhofer <reinhold@kainhofer.com>
00005 **
00006 ** This file defines the address-viewing widget used in KPilot
00007 ** to display the Pilot's address records.
00008 */
00009 
00010 /*
00011 ** This program is free software; you can redistribute it and/or modify
00012 ** it under the terms of the GNU General Public License as published by
00013 ** the Free Software Foundation; either version 2 of the License, or
00014 ** (at your option) any later version.
00015 **
00016 ** This program is distributed in the hope that it will be useful,
00017 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 ** GNU General Public License for more details.
00020 **
00021 ** You should have received a copy of the GNU General Public License
00022 ** along with this program in a file called COPYING; if not, write to
00023 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00024 ** MA 02110-1301, USA.
00025 */
00026 
00027 /*
00028 ** Bug reports and questions can be sent to kde-pim@kde.org
00029 */
00030 #ifndef _KPILOT_ADDRESSWIDGET_H
00031 #define _KPILOT_ADDRESSWIDGET_H
00032 
00033 class QMultiLineEdit;
00034 class QListBox;
00035 class QComboBox;
00036 class QTextView;
00037 
00038 class PilotDatabase;
00039 
00040 
00041 #include "pilotComponent.h"
00042 #include "pilotAddress.h"
00043 
00044 class AddressWidget : public PilotComponent
00045 {
00046 Q_OBJECT
00047 
00048 public:
00049     AddressWidget(QWidget* parent,const QString& dbpath);
00050     ~AddressWidget();
00051 
00052     // Pilot Component Methods:
00053     virtual void showComponent();
00054     virtual void hideComponent();
00055     virtual bool preHotSync(QString &);
00056     virtual void postHotSync();
00057 
00058 public slots:
00063     void slotShowAddress(int);
00064     void slotEditRecord();
00065     void slotCreateNewRecord();
00066     void slotDeleteRecord();
00067     void slotEditCancelled();
00068     void slotExport();
00069 
00070     void slotUpdateButtons();   // Enable/disable buttons
00071 
00072 signals:
00073     void recordChanged(PilotAddress *);
00074 
00075 protected slots:
00080     void slotUpdateRecord(PilotAddress*);
00081 
00085     void slotAddRecord(PilotAddress*);
00086 
00091     void slotSetCategory(int);
00092 
00093 private:
00094     void setupWidget();
00095     void updateWidget(); // Called with the lists have changed..
00096     void writeAddress(PilotAddress* which,PilotDatabase *db=0L);
00097 
00104     int getAllAddresses(PilotDatabase *addressDB);
00105 
00110     QString createTitle(PilotAddress *,int displayMode);
00111 
00126     QComboBox            *fCatList;
00127     QTextView            *fAddrInfo;
00128     PilotAddressInfo     *fAddressAppInfo;
00129     QPtrList<PilotAddress>   fAddressList;
00130     QListBox             *fListBox;
00131     QPushButton      *fEditButton,*fDeleteButton;
00132 
00133 protected:
00138     int fPendingAddresses;
00139 
00140 public:
00141     typedef enum { PhoneNumberLength=16 } Constants ;
00142 };
00143 
00144 #endif