author | eilers <eilers> | 2003-11-17 15:55:43 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-11-17 15:55:43 (UTC) |
commit | 3ba032c6a4833260ef6274b6b2bf6a6a9ccc2540 (patch) (unidiff) | |
tree | 051c0bda86446e65009f2e6f42c57272e93f562c /libopie | |
parent | c4a6e9c529ea6bcb1c9a42fee33a70300f116c98 (diff) | |
download | opie-3ba032c6a4833260ef6274b6b2bf6a6a9ccc2540.zip opie-3ba032c6a4833260ef6274b6b2bf6a6a9ccc2540.tar.gz opie-3ba032c6a4833260ef6274b6b2bf6a6a9ccc2540.tar.bz2 |
Minor changes..
-rw-r--r-- | libopie/pim/odatebookaccessbackend_xml.cpp | 2 | ||||
-rw-r--r-- | libopie/pim/opimrecord.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/libopie/pim/odatebookaccessbackend_xml.cpp b/libopie/pim/odatebookaccessbackend_xml.cpp index 5ea945c..39c43c5 100644 --- a/libopie/pim/odatebookaccessbackend_xml.cpp +++ b/libopie/pim/odatebookaccessbackend_xml.cpp | |||
@@ -48,97 +48,97 @@ char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) | |||
48 | return ((char *)hsearch); | 48 | return ((char *)hsearch); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | namespace { | 52 | namespace { |
53 | time_t start, end, created, rp_end; | 53 | time_t start, end, created, rp_end; |
54 | ORecur* rec; | 54 | ORecur* rec; |
55 | ORecur* recur() { | 55 | ORecur* recur() { |
56 | if (!rec) | 56 | if (!rec) |
57 | rec = new ORecur; | 57 | rec = new ORecur; |
58 | 58 | ||
59 | return rec; | 59 | return rec; |
60 | } | 60 | } |
61 | int alarmTime; | 61 | int alarmTime; |
62 | int snd; | 62 | int snd; |
63 | enum Attribute{ | 63 | enum Attribute{ |
64 | FDescription = 0, | 64 | FDescription = 0, |
65 | FLocation, | 65 | FLocation, |
66 | FCategories, | 66 | FCategories, |
67 | FUid, | 67 | FUid, |
68 | FType, | 68 | FType, |
69 | FAlarm, | 69 | FAlarm, |
70 | FSound, | 70 | FSound, |
71 | FRType, | 71 | FRType, |
72 | FRWeekdays, | 72 | FRWeekdays, |
73 | FRPosition, | 73 | FRPosition, |
74 | FRFreq, | 74 | FRFreq, |
75 | FRHasEndDate, | 75 | FRHasEndDate, |
76 | FREndDate, | 76 | FREndDate, |
77 | FRStart, | 77 | FRStart, |
78 | FREnd, | 78 | FREnd, |
79 | FNote, | 79 | FNote, |
80 | FCreated, | 80 | FCreated, |
81 | FTimeZone, | 81 | FTimeZone, |
82 | FRecParent, | 82 | FRecParent, |
83 | FRecChildren, | 83 | FRecChildren, |
84 | FExceptions | 84 | FExceptions |
85 | }; | 85 | }; |
86 | inline void save( const OEvent& ev, QString& buf ) { | 86 | inline void save( const OEvent& ev, QString& buf ) { |
87 | qWarning("Saving %d %s", ev.uid(), ev.description().latin1() ); | 87 | qWarning("Saving %d %s", ev.uid(), ev.description().latin1() ); |
88 | buf += " description=\"" + Qtopia::escapeString(ev.description() ) + "\""; | 88 | buf += " description=\"" + Qtopia::escapeString(ev.description() ) + "\""; |
89 | if (!ev.location().isEmpty() ) | 89 | if (!ev.location().isEmpty() ) |
90 | buf += " location=\"" + Qtopia::escapeString(ev.location() ) + "\""; | 90 | buf += " location=\"" + Qtopia::escapeString(ev.location() ) + "\""; |
91 | 91 | ||
92 | buf += " categories=\""+ Qtopia::escapeString( Qtopia::Record::idsToString( ev.categories() ) ) + "\""; | 92 | buf += " categories=\""+ Qtopia::escapeString( Qtopia::Record::idsToString( ev.categories() ) ) + "\""; |
93 | buf += " uid=\"" + QString::number( ev.uid() ) + "\""; | 93 | buf += " uid=\"" + QString::number( ev.uid() ) + "\""; |
94 | 94 | ||
95 | if (ev.isAllDay() ) | 95 | if (ev.isAllDay() ) |
96 | buf += " type=\"AllDay\""; | 96 | buf += " type=\"AllDay\""; // is that all ?? (eilers) |
97 | 97 | ||
98 | if (ev.hasNotifiers() ) { | 98 | if (ev.hasNotifiers() ) { |
99 | OPimAlarm alarm = ev.notifiers().alarms()[0]; // take only the first | 99 | OPimAlarm alarm = ev.notifiers().alarms()[0]; // take only the first |
100 | int minutes = alarm.dateTime().secsTo( ev.startDateTime() ) / 60; | 100 | int minutes = alarm.dateTime().secsTo( ev.startDateTime() ) / 60; |
101 | buf += " alarm=\"" + QString::number(minutes) + "\" sound=\""; | 101 | buf += " alarm=\"" + QString::number(minutes) + "\" sound=\""; |
102 | if ( alarm.sound() == OPimAlarm::Loud ) | 102 | if ( alarm.sound() == OPimAlarm::Loud ) |
103 | buf += "loud"; | 103 | buf += "loud"; |
104 | else | 104 | else |
105 | buf += "silent"; | 105 | buf += "silent"; |
106 | buf += "\""; | 106 | buf += "\""; |
107 | } | 107 | } |
108 | if ( ev.hasRecurrence() ) { | 108 | if ( ev.hasRecurrence() ) { |
109 | buf += ev.recurrence().toString(); | 109 | buf += ev.recurrence().toString(); |
110 | } | 110 | } |
111 | 111 | ||
112 | /* | 112 | /* |
113 | * fscking timezones :) well, we'll first convert | 113 | * fscking timezones :) well, we'll first convert |
114 | * the QDateTime to a QDateTime in UTC time | 114 | * the QDateTime to a QDateTime in UTC time |
115 | * and then we'll create a nice time_t | 115 | * and then we'll create a nice time_t |
116 | */ | 116 | */ |
117 | OTimeZone zone( ev.timeZone().isEmpty() ? OTimeZone::current() : ev.timeZone() ); | 117 | OTimeZone zone( ev.timeZone().isEmpty() ? OTimeZone::current() : ev.timeZone() ); |
118 | buf += " start=\"" + QString::number( zone.fromUTCDateTime( zone.toDateTime( ev.startDateTime(), OTimeZone::utc() ) ) ) + "\""; | 118 | buf += " start=\"" + QString::number( zone.fromUTCDateTime( zone.toDateTime( ev.startDateTime(), OTimeZone::utc() ) ) ) + "\""; |
119 | buf += " end=\"" + QString::number( zone.fromUTCDateTime( zone.toDateTime( ev.endDateTime() , OTimeZone::utc() ) ) ) + "\""; | 119 | buf += " end=\"" + QString::number( zone.fromUTCDateTime( zone.toDateTime( ev.endDateTime() , OTimeZone::utc() ) ) ) + "\""; |
120 | if (!ev.note().isEmpty() ) { | 120 | if (!ev.note().isEmpty() ) { |
121 | buf += " note=\"" + Qtopia::escapeString( ev.note() ) + "\""; | 121 | buf += " note=\"" + Qtopia::escapeString( ev.note() ) + "\""; |
122 | } | 122 | } |
123 | 123 | ||
124 | buf += " timezone=\""; | 124 | buf += " timezone=\""; |
125 | if ( ev.timeZone().isEmpty() ) | 125 | if ( ev.timeZone().isEmpty() ) |
126 | buf += "None"; | 126 | buf += "None"; |
127 | else | 127 | else |
128 | buf += ev.timeZone(); | 128 | buf += ev.timeZone(); |
129 | buf += "\""; | 129 | buf += "\""; |
130 | 130 | ||
131 | if (ev.parent() != 0 ) { | 131 | if (ev.parent() != 0 ) { |
132 | buf += " recparent=\""+QString::number(ev.parent() )+"\""; | 132 | buf += " recparent=\""+QString::number(ev.parent() )+"\""; |
133 | } | 133 | } |
134 | 134 | ||
135 | if (ev.children().count() != 0 ) { | 135 | if (ev.children().count() != 0 ) { |
136 | QArray<int> children = ev.children(); | 136 | QArray<int> children = ev.children(); |
137 | buf += " recchildren=\""; | 137 | buf += " recchildren=\""; |
138 | for ( uint i = 0; i < children.count(); i++ ) { | 138 | for ( uint i = 0; i < children.count(); i++ ) { |
139 | if ( i != 0 ) buf += " "; | 139 | if ( i != 0 ) buf += " "; |
140 | buf += QString::number( children[i] ); | 140 | buf += QString::number( children[i] ); |
141 | } | 141 | } |
142 | buf+= "\""; | 142 | buf+= "\""; |
143 | } | 143 | } |
144 | 144 | ||
diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h index 563b19c..3d774e2 100644 --- a/libopie/pim/opimrecord.h +++ b/libopie/pim/opimrecord.h | |||
@@ -50,96 +50,97 @@ public: | |||
50 | */ | 50 | */ |
51 | void setCategoryNames( const QStringList& ); | 51 | void setCategoryNames( const QStringList& ); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * addCategoryName adds a name | 54 | * addCategoryName adds a name |
55 | * to the internal category list | 55 | * to the internal category list |
56 | */ | 56 | */ |
57 | void addCategoryName( const QString& ); | 57 | void addCategoryName( const QString& ); |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * if a Record isEmpty | 60 | * if a Record isEmpty |
61 | * it's empty if it's 0 | 61 | * it's empty if it's 0 |
62 | */ | 62 | */ |
63 | virtual bool isEmpty()const; | 63 | virtual bool isEmpty()const; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * toRichText summary | 66 | * toRichText summary |
67 | */ | 67 | */ |
68 | virtual QString toRichText()const = 0; | 68 | virtual QString toRichText()const = 0; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * a small one line summary | 71 | * a small one line summary |
72 | */ | 72 | */ |
73 | virtual QString toShortText()const = 0; | 73 | virtual QString toShortText()const = 0; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * the name of the Record | 76 | * the name of the Record |
77 | */ | 77 | */ |
78 | virtual QString type()const = 0; | 78 | virtual QString type()const = 0; |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * matches the Records the regular expression? | 81 | * matches the Records the regular expression? |
82 | */ | 82 | */ |
83 | virtual bool match( const QString ®exp ) const | 83 | virtual bool match( const QString ®exp ) const |
84 | {setLastHitField( -1 ); | 84 | {setLastHitField( -1 ); |
85 | return Qtopia::Record::match(QRegExp(regexp));}; | 85 | return Qtopia::Record::match(QRegExp(regexp));}; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * if implemented this function returns which item has been | 88 | * if implemented this function returns which item has been |
89 | * last hit by the match() function. | 89 | * last hit by the match() function. |
90 | * or -1 if not implemented or no hit has occured | 90 | * or -1 if not implemented or no hit has occured |
91 | */ | 91 | */ |
92 | int lastHitField()const; | 92 | int lastHitField()const; |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * converts the internal structure to a map | 95 | * converts the internal structure to a map |
96 | */ | 96 | */ |
97 | virtual QMap<int, QString> toMap()const = 0; | 97 | virtual QMap<int, QString> toMap()const = 0; |
98 | // virtual fromMap( const <int, QString>& map ) = 0; // Should be added in the future (eilers) | ||
98 | 99 | ||
99 | /** | 100 | /** |
100 | * key value representation of extra items | 101 | * key value representation of extra items |
101 | */ | 102 | */ |
102 | QMap<QString, QString> toExtraMap()const; | 103 | QMap<QString, QString> toExtraMap()const; |
103 | void setExtraMap( const QMap<QString, QString>& ); | 104 | void setExtraMap( const QMap<QString, QString>& ); |
104 | 105 | ||
105 | /** | 106 | /** |
106 | * the name for a recordField | 107 | * the name for a recordField |
107 | */ | 108 | */ |
108 | virtual QString recordField(int)const = 0; | 109 | virtual QString recordField(int)const = 0; |
109 | 110 | ||
110 | /** | 111 | /** |
111 | * returns a reference of the | 112 | * returns a reference of the |
112 | * Cross Reference Manager | 113 | * Cross Reference Manager |
113 | * Partner 'One' is THIS PIM RECORD! | 114 | * Partner 'One' is THIS PIM RECORD! |
114 | * 'Two' is the Partner where we link to | 115 | * 'Two' is the Partner where we link to |
115 | */ | 116 | */ |
116 | OPimXRefManager& xrefmanager(); | 117 | OPimXRefManager& xrefmanager(); |
117 | 118 | ||
118 | /** | 119 | /** |
119 | * set the uid | 120 | * set the uid |
120 | */ | 121 | */ |
121 | virtual void setUid( int uid ); | 122 | virtual void setUid( int uid ); |
122 | 123 | ||
123 | /* | 124 | /* |
124 | * used inside the Templates for casting | 125 | * used inside the Templates for casting |
125 | * REIMPLEMENT in your .... | 126 | * REIMPLEMENT in your .... |
126 | */ | 127 | */ |
127 | static int rtti(); | 128 | static int rtti(); |
128 | 129 | ||
129 | /** | 130 | /** |
130 | * some marshalling and de marshalling code | 131 | * some marshalling and de marshalling code |
131 | * saves the OPimRecord | 132 | * saves the OPimRecord |
132 | * to and from a DataStream | 133 | * to and from a DataStream |
133 | */ | 134 | */ |
134 | virtual bool loadFromStream(QDataStream& ); | 135 | virtual bool loadFromStream(QDataStream& ); |
135 | virtual bool saveToStream( QDataStream& stream )const; | 136 | virtual bool saveToStream( QDataStream& stream )const; |
136 | 137 | ||
137 | protected: | 138 | protected: |
138 | // need to be const cause it is called from const methods | 139 | // need to be const cause it is called from const methods |
139 | mutable int m_lastHit; | 140 | mutable int m_lastHit; |
140 | void setLastHitField( int lastHit )const; | 141 | void setLastHitField( int lastHit )const; |
141 | Qtopia::UidGen &uidGen(); | 142 | Qtopia::UidGen &uidGen(); |
142 | // QString crossToString()const; | 143 | // QString crossToString()const; |
143 | 144 | ||
144 | private: | 145 | private: |
145 | class OPimRecordPrivate; | 146 | class OPimRecordPrivate; |