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         void reset() { memset(&fAddressInfo, 0, sizeof(struct Address)); }
00101 
00111         void setField(int field, const QString &text);
00112         QString getField(int field) const;
00113 
00114         QString getCategoryLabel() const;
00115         
00120         bool setCategory(const QString &label);
00121 
00122 
00127         QString getPhoneField(EPhoneType type, bool checkCustom4=true) const;
00128 
00132         void setPhoneField(EPhoneType type, const QString &field,
00133                 bool overflowCustom=true);
00134 
00143         int getShownPhone() const { return fAddressInfo.showPhone; }
00144         void setShownPhone(EPhoneType phoneType);
00145         int  getPhoneLabelIndex(int index) { return fAddressInfo.phoneLabel[index]; }
00146         PilotRecord* pack() { return PilotAppCategory::pack(); }
00147 
00148 
00149         void *pack(void *, int *);
00150         void unpack(const void *, int = 0) { }
00151 
00152         static const int APP_BUFFER_SIZE;
00153 
00154 protected:
00155         // Get the pointers in cases where no conversion to
00156         // unicode is desired.
00157         //
00158         const char *getFieldP(int field) const
00159                 { return fAddressInfo.entry[field]; }
00160 
00161 private:
00162         void _copyAddressInfo(const struct Address &copyFrom);
00163         int _getNextEmptyPhoneSlot() const;
00164 
00168         int _getAppPhoneLabelNum(const QString &phoneType) const;
00169 
00173         int _findPhoneFieldSlot(int appTypeNum) const;
00174 
00175         struct AddressAppInfo &fAppInfo;
00176         struct Address fAddressInfo;
00177 };
00178 
00179 
00180 
00181 
00182 #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:44 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001