pilotOrganizerEntry.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <stdlib.h>
00030
00031 #include <pi-source.h>
00032 #include <pi-dlp.h>
00033 #include <pi-todo.h>
00034
00035 #ifndef _KDEBUG_H_
00036 #include <kdebug.h>
00037 #endif
00038
00039 #ifndef _KPILOT_OPTIONS_H
00040 #include "options.h"
00041 #endif
00042
00043 #include "pilotOrganizerEntry.h"
00044 #include <calendar.h>
00045
00046 using namespace KCal;
00047
00048
00049 static const char *pilotOrganizerEntry_id =
00050 "$Id: pilotOrganizerEntry.cc,v 1.2.4.1 2003/03/12 23:31:10 adridg Exp $";
00051
00052 PilotOrganizerEntry::PilotOrganizerEntry(void):PilotAppCategory() {
00053 ::memset(&fData, 0, sizeof(OrganizerEntry));
00054 }
00055
00056
00057 PilotOrganizerEntry::PilotOrganizerEntry(PilotRecord * rec):PilotAppCategory(rec) {
00058
00059 (void) pilotOrganizerEntry_id;
00060 }
00061
00062
00063 PilotOrganizerEntry::PilotOrganizerEntry(const PilotOrganizerEntry & e):PilotAppCategory(e) {
00064 ::memcpy(&fData, &e.fData, sizeof fData );
00065 }
00066
00067 PilotOrganizerEntry::PilotOrganizerEntry(KCal::Todo*todo):PilotAppCategory() {
00068
00069 }
00070
00071 PilotOrganizerEntry& PilotOrganizerEntry::operator=(const KCal::Todo &todo) {
00072
00073 }
00074 KCal::Todo* PilotOrganizerEntry::getTodo(){
00075 KCal::Todo*todo=new KCal::Todo();
00076
00077 }
00078
00079
00080 PilotOrganizerEntry & PilotOrganizerEntry::operator = (const PilotOrganizerEntry & e) {
00081 if (this != &e) {
00082 PilotAppCategory::operator =(e);
00083 ::memcpy(&fData, &e.fData, sizeof(fData));
00084 }
00085 return *this;
00086 }
00087
00088 void PilotOrganizerEntry::setDate(const po_date_type tp, unsigned short int d) {
00089 QTime tm;
00090 if (d == 0xffff) { QDate dt; fData.dates[tp].setDate(dt); fData.dates[tp].setTime(tm); return;}
00091 QDate dt( (d >> 9) + 4, ((d >> 5) & 15) - 1, d & 31);
00092
00093 fData.dates[tp].setDate(dt);
00094 fData.dates[tp].setTime(tm);
00095 };
00096
00097 void PilotOrganizerEntry::setDescription(const char *desc) {
00098 KPILOT_FREE(fData.descr);
00099 if (desc) {
00100 if (::strlen(desc) > 0) {
00101 fData.descr = (char *)::malloc(::strlen(desc) + 1);
00102 if (fData.descr) {
00103 ::strcpy(fData.descr, desc);
00104 } else {
00105 kdError(LIBPILOTDB_AREA) << __FUNCTION__
00106 << ": malloc() failed, description not set"
00107 << endl;
00108 }
00109 } else fData.descr = 0L;
00110 }
00111 else {
00112 fData.descr = 0L;
00113 }
00114 }
00115
00116 void PilotOrganizerEntry::setNote(const char *note) {
00117 KPILOT_FREE(fData.note);
00118 if (note) {
00119 if (::strlen(note) > 0) {
00120 fData.note = (char *)::malloc(::strlen(note) + 1);
00121 if (fData.note) {
00122 ::strcpy(fData.note, note);
00123 } else {
00124 kdError(LIBPILOTDB_AREA) << __FUNCTION__
00125 << ": malloc() failed, note not set" << endl;
00126 }
00127 } else fData.note = 0;
00128 }
00129 else
00130 {
00131 fData.note = 0L;
00132 }
00133 }
00134
00135 void PilotOrganizerEntry::setCustStr(const char *note) {
00136 KPILOT_FREE(fData.customstr);
00137 if (note) {
00138 if (::strlen(note) > 0) {
00139 fData.customstr = (char *)::malloc(::strlen(note) + 1);
00140 if (fData.customstr) {
00141 ::strcpy(fData.customstr, note);
00142 } else {
00143 kdError(LIBPILOTDB_AREA) << __FUNCTION__
00144 << ": malloc() failed, note not set" << endl;
00145 }
00146 } else fData.customstr = 0;
00147 }
00148 else
00149 {
00150 fData.customstr = 0L;
00151 }
00152 }
00153
00154 void PilotOrganizerEntry::free_OrganizerEntry(OrganizerEntry*entry) {
00155 if (entry->descr) free(entry->descr);
00156 if (entry->note) free(entry->note);
00157 if (entry->customstr) free(entry->customstr);
00158 }
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
This file is part of the documentation for kdelibs Version 3.1.5.