kpilot

pilotUser.h

Go to the documentation of this file.
00001 #ifndef _KPILOT_PILOTUSER_H
00002 #define _KPILOT_PILOTUSER_H
00003 /* pilotUser.h          KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 **
00007 ** Wrapper for the PilotUser struct from pilot-link, which describes
00008 ** the user-data set in the Pilot.
00009 */
00010 
00011 /*
00012 ** This program is free software; you can redistribute it and/or modify
00013 ** it under the terms of the GNU Lesser General Public License as published by
00014 ** the Free Software Foundation; either version 2.1 of the License, or
00015 ** (at your option) any later version.
00016 **
00017 ** This program is distributed in the hope that it will be useful,
00018 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 ** GNU Lesser General Public License for more details.
00021 **
00022 ** You should have received a copy of the GNU Lesser General Public License
00023 ** along with this program in a file called COPYING; if not, write to
00024 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 ** MA 02110-1301, USA.
00026 */
00027 
00028 /*
00029 ** Bug reports and questions can be sent to kde-pim@kde.org
00030 */
00031 
00032 #include <stdlib.h>
00033 #include <string.h>
00034 #include <time.h>
00035 
00036 #include <pi-dlp.h>
00037 
00038 #include "pilot.h"
00039 
00040 class KPilotUser
00041 {
00042 public:
00044     KPilotUser()
00045     {
00046         ::memset(&fUser,0,sizeof(struct PilotUser));
00047     }
00051     KPilotUser(const PilotUser *user)
00052     {
00053         fUser = *user;
00054     }
00055 
00057     PilotUser *data()
00058     {
00059         return &fUser;
00060     }
00061 
00063     QString name() const
00064     {
00065         return Pilot::fromPilot( fUser.username );
00066     }
00070     void setName( const QString &name )
00071     {
00072         Pilot::toPilot( name, fUser.username, sizeof(fUser.username) );
00073     }
00074 
00078     const int passwordLength() const
00079     {
00080         return fUser.passwordLength;
00081     }
00082 
00087     unsigned long getLastSyncPC() const
00088     {
00089         return fUser.lastSyncPC;
00090     }
00095     void setLastSyncPC(unsigned long pc)
00096     {
00097         fUser.lastSyncPC = pc;
00098     }
00099 
00103     time_t getLastSuccessfulSyncDate()
00104     {
00105         return fUser.successfulSyncDate;
00106     }
00108     void setLastSuccessfulSyncDate(time_t when)
00109     {
00110         fUser.successfulSyncDate = when;
00111     }
00112 
00114     time_t getLastSyncDate()
00115     {
00116         return fUser.lastSyncDate;
00117     }
00119     void setLastSyncDate(time_t when)
00120     {
00121         fUser.lastSyncDate = when;
00122     }
00123 
00124 private:
00125     struct PilotUser fUser;
00126 };
00127 
00128 #endif