kpilot Library API Documentation

pilotAddress.h

00001 #ifndef _KPILOT_PILOTADDRESS_H
00002 #define _KPILOT_PILOTADDRESS_H
00003 /* pilotAddress.h           KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 **
00007 ** This is a wrapper for pilot-link's address structures.
00008 */
00009 
00010 /*
00011 ** This program is free software; you can redistribute it and/or modify
00012 ** it under the terms of the GNU Lesser General Public License as published by
00013 ** the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
00020 **
00021 ** You should have received a copy of the GNU Lesser General Public License
00022 ** along with this program in a file called COPYING; if not, write to
00023 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00024 ** MA 02111-1307, USA.
00025 */
00026 
00027 /*
00028 ** Bug reports and questions can be sent to kde-pim@kde.org
00029 */
00030 
00031 #include <time.h>
00032 #include <string.h>
00033 
00034 #ifndef _PILOT_MACROS_H_
00035 #include <pi-macros.h>
00036 #endif
00037 
00038 #ifndef _PILOT_ADDRESS_H_
00039 #include <pi-address.h>
00040 #endif
00041 
00042 #ifndef _KPILOT_PILOTAPPCATEGORY_H
00043 #include "pilotAppCategory.h"
00044 #endif
00045 
00081 class PilotAddress : public PilotAppCategory
00082 {
00083 public:
00084     enum EPhoneType {
00085         eWork=0, eHome, eFax, eOther, eEmail, eMain,
00086         ePager, eMobile
00087         };
00088 
00089     PilotAddress(struct AddressAppInfo &appInfo);
00090     PilotAddress(struct AddressAppInfo &appInfo, PilotRecord* rec);
00091     PilotAddress(const PilotAddress &copyFrom);
00092     PilotAddress& operator=( const PilotAddress &r );
00093     bool operator==(const PilotAddress &r);
00094 
00095     ~PilotAddress();
00096 
00100     virtual QString getTextRepresentation(bool richText=false);
00101 
00105     void reset() { memset(&fAddressInfo, 0, sizeof(struct Address)); }
00106 
00116     void setField(int field, const QString &text);
00117     QString getField(int field) const;
00118 
00119     QString getCategoryLabel() const;
00120 
00125     bool setCategory(const QString &label);
00126 
00127 
00132     QString getPhoneField(EPhoneType type, bool checkCustom4=true) const;
00133 
00137     void setPhoneField(EPhoneType type, const QString &field,
00138         bool overflowCustom=true);
00139 
00148     int getShownPhone() const { return fAddressInfo.showPhone; }
00149     void setShownPhone(EPhoneType phoneType);
00150     int  getPhoneLabelIndex(int index) { return fAddressInfo.phoneLabel[index]; }
00151     PilotRecord* pack() { return PilotAppCategory::pack(); }
00152 
00153 
00154     void *pack(void *, int *);
00155     void unpack(const void *, int = 0) { }
00156 
00157     static const int APP_BUFFER_SIZE;
00158 
00159 protected:
00160     // Get the pointers in cases where no conversion to
00161     // unicode is desired.
00162     //
00163     const char *getFieldP(int field) const
00164         { return fAddressInfo.entry[field]; }
00165 
00166 private:
00167     void _copyAddressInfo(const struct Address &copyFrom);
00168     int _getNextEmptyPhoneSlot() const;
00169 
00173     int _getAppPhoneLabelNum(const QString &phoneType) const;
00174 
00178     int _findPhoneFieldSlot(int appTypeNum) const;
00179 
00180     struct AddressAppInfo &fAppInfo;
00181     struct Address fAddressInfo;
00182 };
00183 
00184 
00185 
00186 
00187 #endif
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:48 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003