-rw-r--r-- | libopie2/opiepim/core/opimcontact.cpp | 18 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimcontactfields.cpp | 22 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimdateconversion.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimevent.cpp | 6 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimnotifymanager.cpp | 7 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimrecord.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimtimezone.cpp | 5 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimtodo.cpp | 22 | ||||
-rw-r--r-- | libopie2/opiepim/core/otodoaccess.cpp | 2 |
9 files changed, 55 insertions, 41 deletions
diff --git a/libopie2/opiepim/core/opimcontact.cpp b/libopie2/opiepim/core/opimcontact.cpp index c1e06c8..48a74d0 100644 --- a/libopie2/opiepim/core/opimcontact.cpp +++ b/libopie2/opiepim/core/opimcontact.cpp | |||
@@ -13,94 +13,96 @@ | |||
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define QTOPIA_INTERNAL_CONTACT_MRE | 30 | #define QTOPIA_INTERNAL_CONTACT_MRE |
31 | 31 | ||
32 | #include "opimcontact.h" | 32 | #include "opimcontact.h" |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/opimresolver.h> | 35 | #include <opie2/opimresolver.h> |
36 | #include <opie2/opimdateconversion.h> | 36 | #include <opie2/opimdateconversion.h> |
37 | #include <opie2/odebug.h> | ||
38 | |||
37 | #include <qpe/stringutil.h> | 39 | #include <qpe/stringutil.h> |
38 | #include <qpe/timestring.h> | 40 | #include <qpe/timestring.h> |
39 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
40 | 42 | ||
41 | /* QT */ | 43 | /* QT */ |
42 | #include <qstylesheet.h> | 44 | #include <qstylesheet.h> |
43 | 45 | ||
44 | /* STD */ | 46 | /* STD */ |
45 | #include <stdio.h> | 47 | #include <stdio.h> |
46 | 48 | ||
47 | /*! | 49 | /*! |
48 | \class Contact contact.h | 50 | \class Contact contact.h |
49 | \brief The Contact class holds the data of an address book entry. | 51 | \brief The Contact class holds the data of an address book entry. |
50 | 52 | ||
51 | This data includes information the name of the person, contact | 53 | This data includes information the name of the person, contact |
52 | information, and business information such as deparment and job title. | 54 | information, and business information such as deparment and job title. |
53 | 55 | ||
54 | \ingroup qtopiaemb | 56 | \ingroup qtopiaemb |
55 | \ingroup qtopiadesktop | 57 | \ingroup qtopiadesktop |
56 | */ | 58 | */ |
57 | 59 | ||
58 | 60 | ||
59 | namespace Opie | 61 | namespace Opie |
60 | { | 62 | { |
61 | /*! | 63 | /*! |
62 | Creates a new, empty contact. | 64 | Creates a new, empty contact. |
63 | */ | 65 | */ |
64 | OPimContact::OPimContact():OPimRecord(), mMap(), d( 0 ) | 66 | OPimContact::OPimContact():OPimRecord(), mMap(), d( 0 ) |
65 | {} | 67 | {} |
66 | 68 | ||
67 | /*! | 69 | /*! |
68 | \internal | 70 | \internal |
69 | Creates a new contact. The properties of the contact are | 71 | Creates a new contact. The properties of the contact are |
70 | set from \a fromMap. | 72 | set from \a fromMap. |
71 | */ | 73 | */ |
72 | OPimContact::OPimContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 ) | 74 | OPimContact::OPimContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 ) |
73 | { | 75 | { |
74 | QString cats = mMap[ Qtopia::AddressCategory ]; | 76 | QString cats = mMap[ Qtopia::AddressCategory ]; |
75 | if ( !cats.isEmpty() ) | 77 | if ( !cats.isEmpty() ) |
76 | setCategories( idsFromString( cats ) ); | 78 | setCategories( idsFromString( cats ) ); |
77 | 79 | ||
78 | QString uidStr = find( Qtopia::AddressUid ); | 80 | QString uidStr = find( Qtopia::AddressUid ); |
79 | 81 | ||
80 | if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) ) | 82 | if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) ) |
81 | { | 83 | { |
82 | qWarning( "Invalid UID found. Generate new one.." ); | 84 | owarn << "Invalid UID found. Generate new one.." << oendl; |
83 | setUid( uidGen().generate() ); | 85 | setUid( uidGen().generate() ); |
84 | } | 86 | } |
85 | else | 87 | else |
86 | setUid( uidStr.toInt() ); | 88 | setUid( uidStr.toInt() ); |
87 | 89 | ||
88 | // if ( !uidStr.isEmpty() ) | 90 | // if ( !uidStr.isEmpty() ) |
89 | // setUid( uidStr.toInt() ); | 91 | // setUid( uidStr.toInt() ); |
90 | } | 92 | } |
91 | 93 | ||
92 | /*! | 94 | /*! |
93 | Destroys a contact. | 95 | Destroys a contact. |
94 | */ | 96 | */ |
95 | OPimContact::~OPimContact() | 97 | OPimContact::~OPimContact() |
96 | {} | 98 | {} |
97 | 99 | ||
98 | /*! \fn void OPimContact::setTitle( const QString &str ) | 100 | /*! \fn void OPimContact::setTitle( const QString &str ) |
99 | Sets the title of the contact to \a str. | 101 | Sets the title of the contact to \a str. |
100 | */ | 102 | */ |
101 | 103 | ||
102 | /*! \fn void OPimContact::setFirstName( const QString &str ) | 104 | /*! \fn void OPimContact::setFirstName( const QString &str ) |
103 | Sets the first name of the contact to \a str. | 105 | Sets the first name of the contact to \a str. |
104 | */ | 106 | */ |
105 | 107 | ||
106 | /*! \fn void OPimContact::setMiddleName( const QString &str ) | 108 | /*! \fn void OPimContact::setMiddleName( const QString &str ) |
@@ -910,49 +912,49 @@ QStringList OPimContact::childrenList() const | |||
910 | email list | 912 | email list |
911 | */ | 913 | */ |
912 | 914 | ||
913 | /*! \fn void OPimContact::clearEmails() | 915 | /*! \fn void OPimContact::clearEmails() |
914 | 916 | ||
915 | Clears the email list. | 917 | Clears the email list. |
916 | */ | 918 | */ |
917 | 919 | ||
918 | /*! \fn void OPimContact::insertEmails( const QStringList &emailList ) | 920 | /*! \fn void OPimContact::insertEmails( const QStringList &emailList ) |
919 | 921 | ||
920 | Appends the \a emailList to the exiting email list | 922 | Appends the \a emailList to the exiting email list |
921 | */ | 923 | */ |
922 | 924 | ||
923 | /*! | 925 | /*! |
924 | Returns a list of email addresses belonging to the contact, including | 926 | Returns a list of email addresses belonging to the contact, including |
925 | the default email address. | 927 | the default email address. |
926 | */ | 928 | */ |
927 | QStringList OPimContact::emailList() const | 929 | QStringList OPimContact::emailList() const |
928 | { | 930 | { |
929 | QString emailStr = emails(); | 931 | QString emailStr = emails(); |
930 | 932 | ||
931 | QStringList r; | 933 | QStringList r; |
932 | if ( !emailStr.isEmpty() ) | 934 | if ( !emailStr.isEmpty() ) |
933 | { | 935 | { |
934 | qDebug( " emailstr " ); | 936 | odebug << " emailstr " << oendl; |
935 | QStringList l = QStringList::split( emailSeparator(), emailStr ); | 937 | QStringList l = QStringList::split( emailSeparator(), emailStr ); |
936 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) | 938 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) |
937 | r += ( *it ).simplifyWhiteSpace(); | 939 | r += ( *it ).simplifyWhiteSpace(); |
938 | } | 940 | } |
939 | 941 | ||
940 | return r; | 942 | return r; |
941 | } | 943 | } |
942 | 944 | ||
943 | /*! | 945 | /*! |
944 | \overload | 946 | \overload |
945 | 947 | ||
946 | Generates the string for the contact to be filed as from the first, | 948 | Generates the string for the contact to be filed as from the first, |
947 | middle and last name of the contact. | 949 | middle and last name of the contact. |
948 | */ | 950 | */ |
949 | void OPimContact::setFileAs() | 951 | void OPimContact::setFileAs() |
950 | { | 952 | { |
951 | QString lastName, firstName, middleName, fileas; | 953 | QString lastName, firstName, middleName, fileas; |
952 | 954 | ||
953 | lastName = find( Qtopia::LastName ); | 955 | lastName = find( Qtopia::LastName ); |
954 | firstName = find( Qtopia::FirstName ); | 956 | firstName = find( Qtopia::FirstName ); |
955 | middleName = find( Qtopia::MiddleName ); | 957 | middleName = find( Qtopia::MiddleName ); |
956 | if ( !lastName.isEmpty() && !firstName.isEmpty() | 958 | if ( !lastName.isEmpty() && !firstName.isEmpty() |
957 | && !middleName.isEmpty() ) | 959 | && !middleName.isEmpty() ) |
958 | fileas = lastName + ", " + firstName + " " + middleName; | 960 | fileas = lastName + ", " + firstName + " " + middleName; |
@@ -1115,172 +1117,172 @@ QString OPimContact::toShortText() const | |||
1115 | QString OPimContact::type() const | 1117 | QString OPimContact::type() const |
1116 | { | 1118 | { |
1117 | return QString::fromLatin1( "OPimContact" ); | 1119 | return QString::fromLatin1( "OPimContact" ); |
1118 | } | 1120 | } |
1119 | 1121 | ||
1120 | 1122 | ||
1121 | class QString OPimContact::recordField( int pos ) const | 1123 | class QString OPimContact::recordField( int pos ) const |
1122 | { | 1124 | { |
1123 | QStringList SLFIELDS = fields(); // ?? why this ? (se) | 1125 | QStringList SLFIELDS = fields(); // ?? why this ? (se) |
1124 | return SLFIELDS[ pos ]; | 1126 | return SLFIELDS[ pos ]; |
1125 | } | 1127 | } |
1126 | 1128 | ||
1127 | // In future releases, we should store birthday and anniversary | 1129 | // In future releases, we should store birthday and anniversary |
1128 | // internally as QDate instead of QString ! | 1130 | // internally as QDate instead of QString ! |
1129 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) | 1131 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) |
1130 | 1132 | ||
1131 | /*! \fn void OPimContact::setBirthday( const QDate& date ) | 1133 | /*! \fn void OPimContact::setBirthday( const QDate& date ) |
1132 | Sets the birthday for the contact to \a date. If date is null | 1134 | Sets the birthday for the contact to \a date. If date is null |
1133 | the current stored date will be removed. | 1135 | the current stored date will be removed. |
1134 | */ | 1136 | */ |
1135 | void OPimContact::setBirthday( const QDate &v ) | 1137 | void OPimContact::setBirthday( const QDate &v ) |
1136 | { | 1138 | { |
1137 | if ( v.isNull() ) | 1139 | if ( v.isNull() ) |
1138 | { | 1140 | { |
1139 | qWarning( "Remove Birthday" ); | 1141 | owarn << "Remove Birthday" << oendl; |
1140 | replace( Qtopia::Birthday, QString::null ); | 1142 | replace( Qtopia::Birthday, QString::null ); |
1141 | return ; | 1143 | return ; |
1142 | } | 1144 | } |
1143 | 1145 | ||
1144 | if ( v.isValid() ) | 1146 | if ( v.isValid() ) |
1145 | replace( Qtopia::Birthday, OPimDateConversion::dateToString( v ) ); | 1147 | replace( Qtopia::Birthday, OPimDateConversion::dateToString( v ) ); |
1146 | 1148 | ||
1147 | } | 1149 | } |
1148 | 1150 | ||
1149 | 1151 | ||
1150 | /*! \fn void OPimContact::setAnniversary( const QDate &date ) | 1152 | /*! \fn void OPimContact::setAnniversary( const QDate &date ) |
1151 | Sets the anniversary of the contact to \a date. If date is | 1153 | Sets the anniversary of the contact to \a date. If date is |
1152 | null, the current stored date will be removed. | 1154 | null, the current stored date will be removed. |
1153 | */ | 1155 | */ |
1154 | void OPimContact::setAnniversary( const QDate &v ) | 1156 | void OPimContact::setAnniversary( const QDate &v ) |
1155 | { | 1157 | { |
1156 | if ( v.isNull() ) | 1158 | if ( v.isNull() ) |
1157 | { | 1159 | { |
1158 | qWarning( "Remove Anniversary" ); | 1160 | owarn << "Remove Anniversary" << oendl; |
1159 | replace( Qtopia::Anniversary, QString::null ); | 1161 | replace( Qtopia::Anniversary, QString::null ); |
1160 | return ; | 1162 | return ; |
1161 | } | 1163 | } |
1162 | 1164 | ||
1163 | if ( v.isValid() ) | 1165 | if ( v.isValid() ) |
1164 | replace( Qtopia::Anniversary, OPimDateConversion::dateToString( v ) ); | 1166 | replace( Qtopia::Anniversary, OPimDateConversion::dateToString( v ) ); |
1165 | } | 1167 | } |
1166 | 1168 | ||
1167 | 1169 | ||
1168 | /*! \fn QDate OPimContact::birthday() const | 1170 | /*! \fn QDate OPimContact::birthday() const |
1169 | Returns the birthday of the contact. | 1171 | Returns the birthday of the contact. |
1170 | */ | 1172 | */ |
1171 | QDate OPimContact::birthday() const | 1173 | QDate OPimContact::birthday() const |
1172 | { | 1174 | { |
1173 | QString str = find( Qtopia::Birthday ); | 1175 | QString str = find( Qtopia::Birthday ); |
1174 | // qWarning ("Birthday %s", str.latin1() ); | 1176 | // qWarning ("Birthday %s", str.latin1() ); |
1175 | if ( !str.isEmpty() ) | 1177 | if ( !str.isEmpty() ) |
1176 | return OPimDateConversion::dateFromString ( str ); | 1178 | return OPimDateConversion::dateFromString ( str ); |
1177 | else | 1179 | else |
1178 | return QDate(); | 1180 | return QDate(); |
1179 | } | 1181 | } |
1180 | 1182 | ||
1181 | 1183 | ||
1182 | /*! \fn QDate OPimContact::anniversary() const | 1184 | /*! \fn QDate OPimContact::anniversary() const |
1183 | Returns the anniversary of the contact. | 1185 | Returns the anniversary of the contact. |
1184 | */ | 1186 | */ |
1185 | QDate OPimContact::anniversary() const | 1187 | QDate OPimContact::anniversary() const |
1186 | { | 1188 | { |
1187 | QDate empty; | 1189 | QDate empty; |
1188 | QString str = find( Qtopia::Anniversary ); | 1190 | QString str = find( Qtopia::Anniversary ); |
1189 | // qWarning ("Anniversary %s", str.latin1() ); | 1191 | // qWarning ("Anniversary %s", str.latin1() ); |
1190 | if ( !str.isEmpty() ) | 1192 | if ( !str.isEmpty() ) |
1191 | return OPimDateConversion::dateFromString ( str ); | 1193 | return OPimDateConversion::dateFromString ( str ); |
1192 | else | 1194 | else |
1193 | return empty; | 1195 | return empty; |
1194 | } | 1196 | } |
1195 | 1197 | ||
1196 | 1198 | ||
1197 | void OPimContact::insertEmail( const QString &v ) | 1199 | void OPimContact::insertEmail( const QString &v ) |
1198 | { | 1200 | { |
1199 | //qDebug("insertEmail %s", v.latin1()); | 1201 | //odebug << "insertEmail " << v << "" << oendl; |
1200 | QString e = v.simplifyWhiteSpace(); | 1202 | QString e = v.simplifyWhiteSpace(); |
1201 | QString def = defaultEmail(); | 1203 | QString def = defaultEmail(); |
1202 | 1204 | ||
1203 | // if no default, set it as the default email and don't insert | 1205 | // if no default, set it as the default email and don't insert |
1204 | if ( def.isEmpty() ) | 1206 | if ( def.isEmpty() ) |
1205 | { | 1207 | { |
1206 | setDefaultEmail( e ); // will insert into the list for us | 1208 | setDefaultEmail( e ); // will insert into the list for us |
1207 | return ; | 1209 | return ; |
1208 | } | 1210 | } |
1209 | 1211 | ||
1210 | // otherwise, insert assuming doesn't already exist | 1212 | // otherwise, insert assuming doesn't already exist |
1211 | QString emailsStr = find( Qtopia::Emails ); | 1213 | QString emailsStr = find( Qtopia::Emails ); |
1212 | if ( emailsStr.contains( e ) ) | 1214 | if ( emailsStr.contains( e ) ) |
1213 | return ; | 1215 | return ; |
1214 | if ( !emailsStr.isEmpty() ) | 1216 | if ( !emailsStr.isEmpty() ) |
1215 | emailsStr += emailSeparator(); | 1217 | emailsStr += emailSeparator(); |
1216 | emailsStr += e; | 1218 | emailsStr += e; |
1217 | replace( Qtopia::Emails, emailsStr ); | 1219 | replace( Qtopia::Emails, emailsStr ); |
1218 | } | 1220 | } |
1219 | 1221 | ||
1220 | 1222 | ||
1221 | void OPimContact::removeEmail( const QString &v ) | 1223 | void OPimContact::removeEmail( const QString &v ) |
1222 | { | 1224 | { |
1223 | QString e = v.simplifyWhiteSpace(); | 1225 | QString e = v.simplifyWhiteSpace(); |
1224 | QString def = defaultEmail(); | 1226 | QString def = defaultEmail(); |
1225 | QString emailsStr = find( Qtopia::Emails ); | 1227 | QString emailsStr = find( Qtopia::Emails ); |
1226 | QStringList emails = emailList(); | 1228 | QStringList emails = emailList(); |
1227 | 1229 | ||
1228 | // otherwise, must first contain it | 1230 | // otherwise, must first contain it |
1229 | if ( !emailsStr.contains( e ) ) | 1231 | if ( !emailsStr.contains( e ) ) |
1230 | return ; | 1232 | return ; |
1231 | 1233 | ||
1232 | // remove it | 1234 | // remove it |
1233 | //qDebug(" removing email from list %s", e.latin1()); | 1235 | //odebug << " removing email from list " << e << "" << oendl; |
1234 | emails.remove( e ); | 1236 | emails.remove( e ); |
1235 | // reset the string | 1237 | // reset the string |
1236 | emailsStr = emails.join( emailSeparator() ); // Sharp's brain dead separator | 1238 | emailsStr = emails.join( emailSeparator() ); // Sharp's brain dead separator |
1237 | replace( Qtopia::Emails, emailsStr ); | 1239 | replace( Qtopia::Emails, emailsStr ); |
1238 | 1240 | ||
1239 | // if default, then replace the default email with the first one | 1241 | // if default, then replace the default email with the first one |
1240 | if ( def == e ) | 1242 | if ( def == e ) |
1241 | { | 1243 | { |
1242 | //qDebug("removeEmail is default; setting new default"); | 1244 | //odebug << "removeEmail is default; setting new default" << oendl; |
1243 | if ( !emails.count() ) | 1245 | if ( !emails.count() ) |
1244 | clearEmails(); | 1246 | clearEmails(); |
1245 | else // setDefaultEmail will remove e from the list | 1247 | else // setDefaultEmail will remove e from the list |
1246 | setDefaultEmail( emails.first() ); | 1248 | setDefaultEmail( emails.first() ); |
1247 | } | 1249 | } |
1248 | } | 1250 | } |
1249 | 1251 | ||
1250 | 1252 | ||
1251 | void OPimContact::clearEmails() | 1253 | void OPimContact::clearEmails() |
1252 | { | 1254 | { |
1253 | mMap.remove( Qtopia::DefaultEmail ); | 1255 | mMap.remove( Qtopia::DefaultEmail ); |
1254 | mMap.remove( Qtopia::Emails ); | 1256 | mMap.remove( Qtopia::Emails ); |
1255 | } | 1257 | } |
1256 | 1258 | ||
1257 | 1259 | ||
1258 | void OPimContact::setDefaultEmail( const QString &v ) | 1260 | void OPimContact::setDefaultEmail( const QString &v ) |
1259 | { | 1261 | { |
1260 | QString e = v.simplifyWhiteSpace(); | 1262 | QString e = v.simplifyWhiteSpace(); |
1261 | 1263 | ||
1262 | //qDebug("OPimContact::setDefaultEmail %s", e.latin1()); | 1264 | //odebug << "OPimContact::setDefaultEmail " << e << "" << oendl; |
1263 | replace( Qtopia::DefaultEmail, e ); | 1265 | replace( Qtopia::DefaultEmail, e ); |
1264 | 1266 | ||
1265 | if ( !e.isEmpty() ) | 1267 | if ( !e.isEmpty() ) |
1266 | insertEmail( e ); | 1268 | insertEmail( e ); |
1267 | 1269 | ||
1268 | } | 1270 | } |
1269 | 1271 | ||
1270 | 1272 | ||
1271 | void OPimContact::insertEmails( const QStringList &v ) | 1273 | void OPimContact::insertEmails( const QStringList &v ) |
1272 | { | 1274 | { |
1273 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) | 1275 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) |
1274 | insertEmail( *it ); | 1276 | insertEmail( *it ); |
1275 | } | 1277 | } |
1276 | 1278 | ||
1277 | 1279 | ||
1278 | int OPimContact::rtti() const | 1280 | int OPimContact::rtti() const |
1279 | { | 1281 | { |
1280 | return OPimResolver::AddressBook; | 1282 | return OPimResolver::AddressBook; |
1281 | } | 1283 | } |
1282 | 1284 | ||
1283 | 1285 | ||
1284 | void OPimContact::setUid( int i ) | 1286 | void OPimContact::setUid( int i ) |
1285 | { | 1287 | { |
1286 | OPimRecord::setUid( i ); | 1288 | OPimRecord::setUid( i ); |
diff --git a/libopie2/opiepim/core/opimcontactfields.cpp b/libopie2/opiepim/core/opimcontactfields.cpp index 120beb6..5d45d1f 100644 --- a/libopie2/opiepim/core/opimcontactfields.cpp +++ b/libopie2/opiepim/core/opimcontactfields.cpp | |||
@@ -10,48 +10,50 @@ | |||
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimcontactfields.h" | 30 | #include "opimcontactfields.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimcontact.h> | 33 | #include <opie2/opimcontact.h> |
34 | #include <opie2/odebug.h> | ||
35 | |||
34 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
35 | 37 | ||
36 | /* QT */ | 38 | /* QT */ |
37 | #include <qobject.h> | 39 | #include <qobject.h> |
38 | 40 | ||
39 | 41 | ||
40 | namespace Opie | 42 | namespace Opie |
41 | { | 43 | { |
42 | /*! | 44 | /*! |
43 | \internal | 45 | \internal |
44 | Returns a list of personal field names for a contact. | 46 | Returns a list of personal field names for a contact. |
45 | */ | 47 | */ |
46 | QStringList OPimContactFields::personalfields( bool sorted, bool translated ) | 48 | QStringList OPimContactFields::personalfields( bool sorted, bool translated ) |
47 | { | 49 | { |
48 | QStringList list; | 50 | QStringList list; |
49 | QMap<int, QString> mapIdToStr; | 51 | QMap<int, QString> mapIdToStr; |
50 | if ( translated ) | 52 | if ( translated ) |
51 | mapIdToStr = idToTrFields(); | 53 | mapIdToStr = idToTrFields(); |
52 | else | 54 | else |
53 | mapIdToStr = idToUntrFields(); | 55 | mapIdToStr = idToUntrFields(); |
54 | 56 | ||
55 | list.append( mapIdToStr[ Qtopia::AddressUid ] ); | 57 | list.append( mapIdToStr[ Qtopia::AddressUid ] ); |
56 | list.append( mapIdToStr[ Qtopia::AddressCategory ] ); | 58 | list.append( mapIdToStr[ Qtopia::AddressCategory ] ); |
57 | 59 | ||
@@ -421,96 +423,96 @@ OPimContactFields::OPimContactFields() : | |||
421 | // use it as a start pattern | 423 | // use it as a start pattern |
422 | Config cfg ( "AddressBook" ); | 424 | Config cfg ( "AddressBook" ); |
423 | cfg.setGroup( "ContactFieldOrder" ); | 425 | cfg.setGroup( "ContactFieldOrder" ); |
424 | globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); | 426 | globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); |
425 | } | 427 | } |
426 | 428 | ||
427 | OPimContactFields::~OPimContactFields() | 429 | OPimContactFields::~OPimContactFields() |
428 | { | 430 | { |
429 | 431 | ||
430 | // We will store the fieldorder into the config file | 432 | // We will store the fieldorder into the config file |
431 | // to reuse it for the future.. | 433 | // to reuse it for the future.. |
432 | if ( changedFieldOrder ) | 434 | if ( changedFieldOrder ) |
433 | { | 435 | { |
434 | Config cfg ( "AddressBook" ); | 436 | Config cfg ( "AddressBook" ); |
435 | cfg.setGroup( "ContactFieldOrder" ); | 437 | cfg.setGroup( "ContactFieldOrder" ); |
436 | cfg.writeEntry( "General", globalFieldOrder ); | 438 | cfg.writeEntry( "General", globalFieldOrder ); |
437 | } | 439 | } |
438 | } | 440 | } |
439 | 441 | ||
440 | 442 | ||
441 | 443 | ||
442 | void OPimContactFields::saveToRecord( OPimContact &cnt ) | 444 | void OPimContactFields::saveToRecord( OPimContact &cnt ) |
443 | { | 445 | { |
444 | 446 | ||
445 | qDebug( "ocontactfields saveToRecord: >%s<", fieldOrder.latin1() ); | 447 | odebug << "ocontactfields saveToRecord: >" << fieldOrder << "<" << oendl; |
446 | 448 | ||
447 | // Store fieldorder into this contact. | 449 | // Store fieldorder into this contact. |
448 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); | 450 | cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); |
449 | 451 | ||
450 | globalFieldOrder = fieldOrder; | 452 | globalFieldOrder = fieldOrder; |
451 | changedFieldOrder = true; | 453 | changedFieldOrder = true; |
452 | 454 | ||
453 | } | 455 | } |
454 | 456 | ||
455 | void OPimContactFields::loadFromRecord( const OPimContact &cnt ) | 457 | void OPimContactFields::loadFromRecord( const OPimContact &cnt ) |
456 | { | 458 | { |
457 | qDebug( "ocontactfields loadFromRecord" ); | 459 | odebug << "ocontactfields loadFromRecord" << oendl; |
458 | qDebug( "loading >%s<", cnt.fullName().latin1() ); | 460 | odebug << "loading >" << cnt.fullName() << "<" << oendl; |
459 | 461 | ||
460 | // Get fieldorder for this contact. If none is defined, | 462 | // Get fieldorder for this contact. If none is defined, |
461 | // we will use the global one from the config file.. | 463 | // we will use the global one from the config file.. |
462 | 464 | ||
463 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); | 465 | fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); |
464 | 466 | ||
465 | qDebug( "fieldOrder from contact>%s<", fieldOrder.latin1() ); | 467 | odebug << "fieldOrder from contact>" << fieldOrder << "<" << oendl; |
466 | 468 | ||
467 | if ( fieldOrder.isEmpty() ) | 469 | if ( fieldOrder.isEmpty() ) |
468 | { | 470 | { |
469 | fieldOrder = globalFieldOrder; | 471 | fieldOrder = globalFieldOrder; |
470 | } | 472 | } |
471 | 473 | ||
472 | 474 | ||
473 | qDebug( "effective fieldOrder in loadFromRecord >%s<", fieldOrder.latin1() ); | 475 | odebug << "effective fieldOrder in loadFromRecord >" << fieldOrder << "<" << oendl; |
474 | } | 476 | } |
475 | 477 | ||
476 | void OPimContactFields::setFieldOrder( int num, int index ) | 478 | void OPimContactFields::setFieldOrder( int num, int index ) |
477 | { | 479 | { |
478 | qDebug( "qcontactfields setfieldorder pos %i -> %i", num, index ); | 480 | odebug << "qcontactfields setfieldorder pos " << num << " -> " << index << "" << oendl; |
479 | 481 | ||
480 | fieldOrder[ num ] = QString::number( index, 16 ) [ 0 ]; | 482 | fieldOrder[ num ] = QString::number( index, 16 ) [ 0 ]; |
481 | 483 | ||
482 | // We will store this new fieldorder globally to | 484 | // We will store this new fieldorder globally to |
483 | // remember it for contacts which have none | 485 | // remember it for contacts which have none |
484 | globalFieldOrder = fieldOrder; | 486 | globalFieldOrder = fieldOrder; |
485 | changedFieldOrder = true; | 487 | changedFieldOrder = true; |
486 | 488 | ||
487 | qDebug( "fieldOrder >%s<", fieldOrder.latin1() ); | 489 | odebug << "fieldOrder >" << fieldOrder << "<" << oendl; |
488 | } | 490 | } |
489 | 491 | ||
490 | int OPimContactFields::getFieldOrder( int num, int defIndex ) | 492 | int OPimContactFields::getFieldOrder( int num, int defIndex ) |
491 | { | 493 | { |
492 | qDebug( "ocontactfields getFieldOrder" ); | 494 | odebug << "ocontactfields getFieldOrder" << oendl; |
493 | qDebug( "fieldOrder >%s<", fieldOrder.latin1() ); | 495 | odebug << "fieldOrder >" << fieldOrder << "<" << oendl; |
494 | 496 | ||
495 | // Get index of combo as char.. | 497 | // Get index of combo as char.. |
496 | QChar poschar = fieldOrder[ num ]; | 498 | QChar poschar = fieldOrder[ num ]; |
497 | 499 | ||
498 | bool ok; | 500 | bool ok; |
499 | int ret = 0; | 501 | int ret = 0; |
500 | // Convert char to number.. | 502 | // Convert char to number.. |
501 | if ( !( poschar == QChar::null ) ) | 503 | if ( !( poschar == QChar::null ) ) |
502 | ret = QString( poschar ).toInt( &ok, 16 ); | 504 | ret = QString( poschar ).toInt( &ok, 16 ); |
503 | else | 505 | else |
504 | ok = false; | 506 | ok = false; |
505 | 507 | ||
506 | // Return default value if index for | 508 | // Return default value if index for |
507 | // num was not set or if anything else happened.. | 509 | // num was not set or if anything else happened.. |
508 | if ( !ok ) ret = defIndex; | 510 | if ( !ok ) ret = defIndex; |
509 | 511 | ||
510 | qDebug( "returning >%i<", ret ); | 512 | odebug << "returning >" << ret << "<" << oendl; |
511 | 513 | ||
512 | return ret; | 514 | return ret; |
513 | 515 | ||
514 | } | 516 | } |
515 | 517 | ||
516 | } | 518 | } |
diff --git a/libopie2/opiepim/core/opimdateconversion.cpp b/libopie2/opiepim/core/opimdateconversion.cpp index 8bf891b..c93e178 100644 --- a/libopie2/opiepim/core/opimdateconversion.cpp +++ b/libopie2/opiepim/core/opimdateconversion.cpp | |||
@@ -7,112 +7,114 @@ _;:, .> :=|. This program is free software; you can | |||
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | /* OPIE */ | 29 | /* OPIE */ |
30 | #include <opie2/opimdateconversion.h> | 30 | #include <opie2/opimdateconversion.h> |
31 | #include <opie2/odebug.h> | ||
32 | |||
31 | #include <qpe/timeconversion.h> | 33 | #include <qpe/timeconversion.h> |
32 | 34 | ||
33 | namespace Opie | 35 | namespace Opie |
34 | { | 36 | { |
35 | 37 | ||
36 | QString OPimDateConversion::dateToString( const QDate &d ) | 38 | QString OPimDateConversion::dateToString( const QDate &d ) |
37 | { | 39 | { |
38 | if ( d.isNull() || !d.isValid() ) | 40 | if ( d.isNull() || !d.isValid() ) |
39 | return QString::null; | 41 | return QString::null; |
40 | 42 | ||
41 | // ISO format in year, month, day (YYYYMMDD); e.g. 20021231 | 43 | // ISO format in year, month, day (YYYYMMDD); e.g. 20021231 |
42 | QString year = QString::number( d.year() ); | 44 | QString year = QString::number( d.year() ); |
43 | QString month = QString::number( d.month() ); | 45 | QString month = QString::number( d.month() ); |
44 | month = month.rightJustify( 2, '0' ); | 46 | month = month.rightJustify( 2, '0' ); |
45 | QString day = QString::number( d.day() ); | 47 | QString day = QString::number( d.day() ); |
46 | day = day.rightJustify( 2, '0' ); | 48 | day = day.rightJustify( 2, '0' ); |
47 | 49 | ||
48 | QString str = year + month + day; | 50 | QString str = year + month + day; |
49 | //qDebug( "\tPimContact dateToStr = %s", str.latin1() ); | 51 | //odebug << "\tPimContact dateToStr = " << str << "" << oendl; |
50 | 52 | ||
51 | return str; | 53 | return str; |
52 | } | 54 | } |
53 | 55 | ||
54 | 56 | ||
55 | QDate OPimDateConversion::dateFromString( const QString& s ) | 57 | QDate OPimDateConversion::dateFromString( const QString& s ) |
56 | { | 58 | { |
57 | QDate date; | 59 | QDate date; |
58 | 60 | ||
59 | if ( s.isEmpty() ) | 61 | if ( s.isEmpty() ) |
60 | return date; | 62 | return date; |
61 | 63 | ||
62 | // Be backward compatible to old Opie format: | 64 | // Be backward compatible to old Opie format: |
63 | // Try to load old format. If it fails, try new ISO-Format! | 65 | // Try to load old format. If it fails, try new ISO-Format! |
64 | date = TimeConversion::fromString ( s ); | 66 | date = TimeConversion::fromString ( s ); |
65 | if ( date.isValid() ) | 67 | if ( date.isValid() ) |
66 | return date; | 68 | return date; |
67 | 69 | ||
68 | // Read ISO-Format (YYYYMMDD) | 70 | // Read ISO-Format (YYYYMMDD) |
69 | int year = s.mid( 0, 4 ).toInt(); | 71 | int year = s.mid( 0, 4 ).toInt(); |
70 | int month = s.mid( 4, 2 ).toInt(); | 72 | int month = s.mid( 4, 2 ).toInt(); |
71 | int day = s.mid( 6, 2 ).toInt(); | 73 | int day = s.mid( 6, 2 ).toInt(); |
72 | 74 | ||
73 | // do some quick sanity checking -eilers | 75 | // do some quick sanity checking -eilers |
74 | // but we isValid() again? -zecke | 76 | // but we isValid() again? -zecke |
75 | if ( year < 1900 || year > 3000 ) | 77 | if ( year < 1900 || year > 3000 ) |
76 | { | 78 | { |
77 | qWarning( "PimContact year is not in range" ); | 79 | owarn << "PimContact year is not in range" << oendl; |
78 | return date; | 80 | return date; |
79 | } | 81 | } |
80 | if ( month < 0 || month > 12 ) | 82 | if ( month < 0 || month > 12 ) |
81 | { | 83 | { |
82 | qWarning( "PimContact month is not in range" ); | 84 | owarn << "PimContact month is not in range" << oendl; |
83 | return date; | 85 | return date; |
84 | } | 86 | } |
85 | if ( day < 0 || day > 31 ) | 87 | if ( day < 0 || day > 31 ) |
86 | { | 88 | { |
87 | qWarning( "PimContact day is not in range" ); | 89 | owarn << "PimContact day is not in range" << oendl; |
88 | return date; | 90 | return date; |
89 | } | 91 | } |
90 | 92 | ||
91 | date.setYMD( year, month, day ); | 93 | date.setYMD( year, month, day ); |
92 | if ( !date.isValid() ) | 94 | if ( !date.isValid() ) |
93 | { | 95 | { |
94 | qWarning( "PimContact date is not valid" ); | 96 | owarn << "PimContact date is not valid" << oendl; |
95 | return date; | 97 | return date; |
96 | } | 98 | } |
97 | 99 | ||
98 | return date; | 100 | return date; |
99 | } | 101 | } |
100 | 102 | ||
101 | 103 | ||
102 | QString OPimDateConversion::dateTimeToString( const QDateTime& dt ) | 104 | QString OPimDateConversion::dateTimeToString( const QDateTime& dt ) |
103 | { | 105 | { |
104 | if ( !dt.isValid() || dt.isNull() ) | 106 | if ( !dt.isValid() || dt.isNull() ) |
105 | return QString::null; | 107 | return QString::null; |
106 | 108 | ||
107 | QString year = QString::number( dt.date().year() ); | 109 | QString year = QString::number( dt.date().year() ); |
108 | QString month = QString::number( dt.date().month() ); | 110 | QString month = QString::number( dt.date().month() ); |
109 | QString day = QString::number( dt.date().day() ); | 111 | QString day = QString::number( dt.date().day() ); |
110 | 112 | ||
111 | QString hour = QString::number( dt.time().hour() ); | 113 | QString hour = QString::number( dt.time().hour() ); |
112 | QString min = QString::number( dt.time().minute() ); | 114 | QString min = QString::number( dt.time().minute() ); |
113 | QString sec = QString::number( dt.time().second() ); | 115 | QString sec = QString::number( dt.time().second() ); |
114 | 116 | ||
115 | month = month.rightJustify( 2, '0' ); | 117 | month = month.rightJustify( 2, '0' ); |
116 | day = day. rightJustify( 2, '0' ); | 118 | day = day. rightJustify( 2, '0' ); |
117 | hour = hour. rightJustify( 2, '0' ); | 119 | hour = hour. rightJustify( 2, '0' ); |
118 | min = min. rightJustify( 2, '0' ); | 120 | min = min. rightJustify( 2, '0' ); |
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp index 9d46651..8752fce 100644 --- a/libopie2/opiepim/core/opimevent.cpp +++ b/libopie2/opiepim/core/opimevent.cpp | |||
@@ -12,48 +12,50 @@ | |||
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimevent.h" | 30 | #include "opimevent.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimrecurrence.h> | 33 | #include <opie2/opimrecurrence.h> |
34 | #include <opie2/opimresolver.h> | 34 | #include <opie2/opimresolver.h> |
35 | #include <opie2/opimnotifymanager.h> | 35 | #include <opie2/opimnotifymanager.h> |
36 | #include <opie2/odebug.h> | ||
37 | |||
36 | #include <qpe/categories.h> | 38 | #include <qpe/categories.h> |
37 | #include <qpe/stringutil.h> | 39 | #include <qpe/stringutil.h> |
38 | 40 | ||
39 | /* QT */ | 41 | /* QT */ |
40 | 42 | ||
41 | namespace Opie | 43 | namespace Opie |
42 | { | 44 | { |
43 | 45 | ||
44 | int OCalendarHelper::week( const QDate& date ) | 46 | int OCalendarHelper::week( const QDate& date ) |
45 | { | 47 | { |
46 | // Calculates the week this date is in within that | 48 | // Calculates the week this date is in within that |
47 | // month. Equals the "row" is is in in the month view | 49 | // month. Equals the "row" is is in in the month view |
48 | int week = 1; | 50 | int week = 1; |
49 | QDate tmp( date.year(), date.month(), 1 ); | 51 | QDate tmp( date.year(), date.month(), 1 ); |
50 | if ( date.dayOfWeek() < tmp.dayOfWeek() ) | 52 | if ( date.dayOfWeek() < tmp.dayOfWeek() ) |
51 | ++week; | 53 | ++week; |
52 | 54 | ||
53 | week += ( date.day() - 1 ) / 7; | 55 | week += ( date.day() - 1 ) / 7; |
54 | 56 | ||
55 | return week; | 57 | return week; |
56 | } | 58 | } |
57 | 59 | ||
58 | 60 | ||
59 | int OCalendarHelper::ocurrence( const QDate& date ) | 61 | int OCalendarHelper::ocurrence( const QDate& date ) |
@@ -620,52 +622,52 @@ void OPimEvent::fromMap( const QMap<int, QString>& map ) | |||
620 | if ( map[ OPimEvent::FType ] == "AllDay" ) | 622 | if ( map[ OPimEvent::FType ] == "AllDay" ) |
621 | setAllDay( true ); | 623 | setAllDay( true ); |
622 | else | 624 | else |
623 | setAllDay( false ); | 625 | setAllDay( false ); |
624 | 626 | ||
625 | if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) | 627 | if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) ) |
626 | { | 628 | { |
627 | setTimeZone( map[ OPimEvent::FTimeZone ] ); | 629 | setTimeZone( map[ OPimEvent::FTimeZone ] ); |
628 | } | 630 | } |
629 | 631 | ||
630 | time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong(); | 632 | time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong(); |
631 | time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong(); | 633 | time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong(); |
632 | 634 | ||
633 | /* AllDay is always in UTC */ | 635 | /* AllDay is always in UTC */ |
634 | if ( isAllDay() ) | 636 | if ( isAllDay() ) |
635 | { | 637 | { |
636 | OPimTimeZone utc = OPimTimeZone::utc(); | 638 | OPimTimeZone utc = OPimTimeZone::utc(); |
637 | setStartDateTime( utc.fromUTCDateTime( start ) ); | 639 | setStartDateTime( utc.fromUTCDateTime( start ) ); |
638 | setEndDateTime ( utc.fromUTCDateTime( end ) ); | 640 | setEndDateTime ( utc.fromUTCDateTime( end ) ); |
639 | setTimeZone( "UTC" ); // make sure it is really utc | 641 | setTimeZone( "UTC" ); // make sure it is really utc |
640 | } | 642 | } |
641 | else | 643 | else |
642 | { | 644 | { |
643 | /* to current date time */ | 645 | /* to current date time */ |
644 | // qWarning(" Start is %d", start ); | 646 | // owarn << " Start is " << start << "" << oendl; |
645 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); | 647 | OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); |
646 | QDateTime date = zone.toDateTime( start ); | 648 | QDateTime date = zone.toDateTime( start ); |
647 | qWarning( " Start is %s", date.toString().latin1() ); | 649 | owarn << " Start is " << date.toString() << "" << oendl; |
648 | setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); | 650 | setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); |
649 | 651 | ||
650 | date = zone.toDateTime( end ); | 652 | date = zone.toDateTime( end ); |
651 | setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); | 653 | setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); |
652 | } | 654 | } |
653 | 655 | ||
654 | int alarmTime = -1; | 656 | int alarmTime = -1; |
655 | if ( !map[ OPimEvent::FAlarm ].isEmpty() ) | 657 | if ( !map[ OPimEvent::FAlarm ].isEmpty() ) |
656 | alarmTime = map[ OPimEvent::FAlarm ].toInt(); | 658 | alarmTime = map[ OPimEvent::FAlarm ].toInt(); |
657 | 659 | ||
658 | int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); | 660 | int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent ); |
659 | if ( ( alarmTime != -1 ) ) | 661 | if ( ( alarmTime != -1 ) ) |
660 | { | 662 | { |
661 | QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); | 663 | QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 ); |
662 | OPimAlarm al( sound , dt ); | 664 | OPimAlarm al( sound , dt ); |
663 | notifiers().add( al ); | 665 | notifiers().add( al ); |
664 | } | 666 | } |
665 | 667 | ||
666 | 668 | ||
667 | if ( !map[ OPimEvent::FNote ].isEmpty() ) | 669 | if ( !map[ OPimEvent::FNote ].isEmpty() ) |
668 | setNote( map[ OPimEvent::FNote ] ); | 670 | setNote( map[ OPimEvent::FNote ] ); |
669 | 671 | ||
670 | if ( !map[ OPimEvent::FRecParent ].isEmpty() ) | 672 | if ( !map[ OPimEvent::FRecParent ].isEmpty() ) |
671 | setParent( map[ OPimEvent::FRecParent ].toInt() ); | 673 | setParent( map[ OPimEvent::FRecParent ].toInt() ); |
diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp index 573340a..0f863aa 100644 --- a/libopie2/opiepim/core/opimnotifymanager.cpp +++ b/libopie2/opiepim/core/opimnotifymanager.cpp | |||
@@ -10,48 +10,49 @@ | |||
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimnotifymanager.h" | 30 | #include "opimnotifymanager.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimdateconversion.h> | 33 | #include <opie2/opimdateconversion.h> |
34 | #include <opie2/odebug.h> | ||
34 | 35 | ||
35 | /* QT */ | 36 | /* QT */ |
36 | #include <qstringlist.h> | 37 | #include <qstringlist.h> |
37 | 38 | ||
38 | namespace Opie | 39 | namespace Opie |
39 | { | 40 | { |
40 | 41 | ||
41 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al ) | 42 | OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al ) |
42 | : m_rem( rem ), m_al( al ) | 43 | : m_rem( rem ), m_al( al ) |
43 | {} | 44 | {} |
44 | 45 | ||
45 | 46 | ||
46 | OPimNotifyManager::~OPimNotifyManager() | 47 | OPimNotifyManager::~OPimNotifyManager() |
47 | {} | 48 | {} |
48 | 49 | ||
49 | 50 | ||
50 | /* use static_cast and type instead of dynamic... */ | 51 | /* use static_cast and type instead of dynamic... */ |
51 | void OPimNotifyManager::add( const OPimNotify& noti ) | 52 | void OPimNotifyManager::add( const OPimNotify& noti ) |
52 | { | 53 | { |
53 | if ( noti.type() == QString::fromLatin1( "OPimReminder" ) ) | 54 | if ( noti.type() == QString::fromLatin1( "OPimReminder" ) ) |
54 | { | 55 | { |
55 | const OPimReminder & rem = static_cast<const OPimReminder&>( noti ); | 56 | const OPimReminder & rem = static_cast<const OPimReminder&>( noti ); |
56 | m_rem.append( rem ); | 57 | m_rem.append( rem ); |
57 | } | 58 | } |
@@ -142,108 +143,108 @@ void OPimNotifyManager::setReminders( const Reminders& rem ) | |||
142 | * The idea is to check if the provider for our service | 143 | * The idea is to check if the provider for our service |
143 | * is online | 144 | * is online |
144 | * if it is we will use QCOP | 145 | * if it is we will use QCOP |
145 | * if not the Factory to get the backend... | 146 | * if not the Factory to get the backend... |
146 | * Qtopia1.6 services would be kewl to have here.... | 147 | * Qtopia1.6 services would be kewl to have here.... |
147 | */ | 148 | */ |
148 | void OPimNotifyManager::registerNotify( const OPimNotify& ) | 149 | void OPimNotifyManager::registerNotify( const OPimNotify& ) |
149 | { | 150 | { |
150 | } | 151 | } |
151 | 152 | ||
152 | 153 | ||
153 | /* FIXME!!! */ | 154 | /* FIXME!!! */ |
154 | /** | 155 | /** |
155 | * same as above... | 156 | * same as above... |
156 | * Also implement Url model | 157 | * Also implement Url model |
157 | * have a MainWindow.... | 158 | * have a MainWindow.... |
158 | */ | 159 | */ |
159 | void OPimNotifyManager::deregister( const OPimNotify& ) | 160 | void OPimNotifyManager::deregister( const OPimNotify& ) |
160 | { | 161 | { |
161 | } | 162 | } |
162 | 163 | ||
163 | 164 | ||
164 | bool OPimNotifyManager::isEmpty() const | 165 | bool OPimNotifyManager::isEmpty() const |
165 | { | 166 | { |
166 | qWarning( "is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); | 167 | owarn << "is Empty called on OPimNotifyManager " << m_rem.count() << " " << m_al.count() << "" << oendl; |
167 | if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; | 168 | if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; |
168 | else return false; | 169 | else return false; |
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | // Taken from otodoaccessxml.. code duplication bad. any alternative? | 173 | // Taken from otodoaccessxml.. code duplication bad. any alternative? |
173 | QString OPimNotifyManager::alarmsToString() const | 174 | QString OPimNotifyManager::alarmsToString() const |
174 | { | 175 | { |
175 | QString str; | 176 | QString str; |
176 | 177 | ||
177 | OPimNotifyManager::Alarms alarms = m_al; | 178 | OPimNotifyManager::Alarms alarms = m_al; |
178 | if ( !alarms.isEmpty() ) | 179 | if ( !alarms.isEmpty() ) |
179 | { | 180 | { |
180 | QStringList als; | 181 | QStringList als; |
181 | OPimNotifyManager::Alarms::Iterator it = alarms.begin(); | 182 | OPimNotifyManager::Alarms::Iterator it = alarms.begin(); |
182 | for ( ; it != alarms.end(); ++it ) | 183 | for ( ; it != alarms.end(); ++it ) |
183 | { | 184 | { |
184 | /* only if time is valid */ | 185 | /* only if time is valid */ |
185 | if ( ( *it ).dateTime().isValid() ) | 186 | if ( ( *it ).dateTime().isValid() ) |
186 | { | 187 | { |
187 | als << OPimDateConversion::dateTimeToString( ( *it ).dateTime() ) | 188 | als << OPimDateConversion::dateTimeToString( ( *it ).dateTime() ) |
188 | + ":" + QString::number( ( *it ).duration() ) | 189 | + ":" + QString::number( ( *it ).duration() ) |
189 | + ":" + QString::number( ( *it ).sound() ) | 190 | + ":" + QString::number( ( *it ).sound() ) |
190 | + ":"; | 191 | + ":"; |
191 | } | 192 | } |
192 | } | 193 | } |
193 | // now write the list | 194 | // now write the list |
194 | qWarning( "als: %s", als.join( "____________" ).latin1() ); | 195 | owarn << "als: " << als.join( "____________" ) << "" << oendl; |
195 | str = als.join( ";" ); | 196 | str = als.join( ";" ); |
196 | } | 197 | } |
197 | 198 | ||
198 | return str; | 199 | return str; |
199 | } | 200 | } |
200 | 201 | ||
201 | 202 | ||
202 | QString OPimNotifyManager::remindersToString() const | 203 | QString OPimNotifyManager::remindersToString() const |
203 | { | 204 | { |
204 | QString str; | 205 | QString str; |
205 | 206 | ||
206 | OPimNotifyManager::Reminders reminders = m_rem; | 207 | OPimNotifyManager::Reminders reminders = m_rem; |
207 | if ( !reminders.isEmpty() ) | 208 | if ( !reminders.isEmpty() ) |
208 | { | 209 | { |
209 | OPimNotifyManager::Reminders::Iterator it = reminders.begin(); | 210 | OPimNotifyManager::Reminders::Iterator it = reminders.begin(); |
210 | QStringList records; | 211 | QStringList records; |
211 | for ( ; it != reminders.end(); ++it ) | 212 | for ( ; it != reminders.end(); ++it ) |
212 | { | 213 | { |
213 | records << QString::number( ( *it ).recordUid() ); | 214 | records << QString::number( ( *it ).recordUid() ); |
214 | } | 215 | } |
215 | str = records.join( ";" ); | 216 | str = records.join( ";" ); |
216 | } | 217 | } |
217 | 218 | ||
218 | return str; | 219 | return str; |
219 | } | 220 | } |
220 | 221 | ||
221 | 222 | ||
222 | void OPimNotifyManager::alarmsFromString( const QString& str ) | 223 | void OPimNotifyManager::alarmsFromString( const QString& str ) |
223 | { | 224 | { |
224 | QStringList als = QStringList::split( ";", str ); | 225 | QStringList als = QStringList::split( ";", str ); |
225 | for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it ) | 226 | for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it ) |
226 | { | 227 | { |
227 | QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty | 228 | QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty |
228 | qWarning( "alarm: %s", alarm.join( "___" ).latin1() ); | 229 | owarn << "alarm: " << alarm.join( "___" ) << "" << oendl; |
229 | qWarning( "alarm[0]: %s %s", alarm[ 0 ].latin1(), | 230 | qWarning( "alarm[0]: %s %s", alarm[ 0 ].latin1(), |
230 | OPimDateConversion::dateTimeFromString( alarm[ 0 ] ).toString().latin1() ); | 231 | OPimDateConversion::dateTimeFromString( alarm[ 0 ] ).toString().latin1() ); |
231 | OPimAlarm al( alarm[ 2 ].toInt(), OPimDateConversion::dateTimeFromString( alarm[ 0 ] ), | 232 | OPimAlarm al( alarm[ 2 ].toInt(), OPimDateConversion::dateTimeFromString( alarm[ 0 ] ), |
232 | alarm[ 1 ].toInt() ); | 233 | alarm[ 1 ].toInt() ); |
233 | add( al ); | 234 | add( al ); |
234 | } | 235 | } |
235 | } | 236 | } |
236 | 237 | ||
237 | 238 | ||
238 | void OPimNotifyManager::remindersFromString( const QString& str ) | 239 | void OPimNotifyManager::remindersFromString( const QString& str ) |
239 | { | 240 | { |
240 | 241 | ||
241 | QStringList rems = QStringList::split( ";", str ); | 242 | QStringList rems = QStringList::split( ";", str ); |
242 | for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) | 243 | for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it ) |
243 | { | 244 | { |
244 | OPimReminder rem( ( *it ).toInt() ); | 245 | OPimReminder rem( ( *it ).toInt() ); |
245 | add( rem ); | 246 | add( rem ); |
246 | } | 247 | } |
247 | 248 | ||
248 | } | 249 | } |
249 | } | 250 | } |
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index c783092..6546d99 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp | |||
@@ -100,49 +100,49 @@ void OPimRecord::addCategoryName( const QString& ) | |||
100 | { | 100 | { |
101 | Categories catDB; | 101 | Categories catDB; |
102 | catDB.load( categoryFileName() ); | 102 | catDB.load( categoryFileName() ); |
103 | 103 | ||
104 | 104 | ||
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | bool OPimRecord::isEmpty() const | 108 | bool OPimRecord::isEmpty() const |
109 | { | 109 | { |
110 | return ( uid() == 0 ); | 110 | return ( uid() == 0 ); |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | /*QString OPimRecord::crossToString()const { | 114 | /*QString OPimRecord::crossToString()const { |
115 | QString str; | 115 | QString str; |
116 | QMap<QString, QArray<int> >::ConstIterator it; | 116 | QMap<QString, QArray<int> >::ConstIterator it; |
117 | for (it = m_relations.begin(); it != m_relations.end(); ++it ) { | 117 | for (it = m_relations.begin(); it != m_relations.end(); ++it ) { |
118 | QArray<int> id = it.data(); | 118 | QArray<int> id = it.data(); |
119 | for ( uint i = 0; i < id.size(); ++i ) { | 119 | for ( uint i = 0; i < id.size(); ++i ) { |
120 | str += it.key() + "," + QString::number( i ) + ";"; | 120 | str += it.key() + "," + QString::number( i ) + ";"; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | str = str.remove( str.length()-1, 1); // strip the ; | 123 | str = str.remove( str.length()-1, 1); // strip the ; |
124 | //qWarning("IDS " + str ); | 124 | //owarn << "IDS " + str << oendl; |
125 | 125 | ||
126 | return str; | 126 | return str; |
127 | }*/ | 127 | }*/ |
128 | /* if uid = 1 assign a new one */ | 128 | /* if uid = 1 assign a new one */ |
129 | void OPimRecord::setUid( int uid ) | 129 | void OPimRecord::setUid( int uid ) |
130 | { | 130 | { |
131 | if ( uid == 1 ) | 131 | if ( uid == 1 ) |
132 | uid = uidGen().generate(); | 132 | uid = uidGen().generate(); |
133 | 133 | ||
134 | Qtopia::Record::setUid( uid ); | 134 | Qtopia::Record::setUid( uid ); |
135 | }; | 135 | }; |
136 | 136 | ||
137 | 137 | ||
138 | Qtopia::UidGen &OPimRecord::uidGen() | 138 | Qtopia::UidGen &OPimRecord::uidGen() |
139 | { | 139 | { |
140 | return m_uidGen; | 140 | return m_uidGen; |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | OPimXRefManager &OPimRecord::xrefmanager() | 144 | OPimXRefManager &OPimRecord::xrefmanager() |
145 | { | 145 | { |
146 | return m_xrefman; | 146 | return m_xrefman; |
147 | } | 147 | } |
148 | 148 | ||
diff --git a/libopie2/opiepim/core/opimtimezone.cpp b/libopie2/opiepim/core/opimtimezone.cpp index be21b1b..fefceb5 100644 --- a/libopie2/opiepim/core/opimtimezone.cpp +++ b/libopie2/opiepim/core/opimtimezone.cpp | |||
@@ -8,48 +8,51 @@ | |||
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimtimezone.h" | 30 | #include "opimtimezone.h" |
31 | 31 | ||
32 | /* OPIE */ | ||
33 | #include <opie2/odebug.h> | ||
34 | |||
32 | /* STD */ | 35 | /* STD */ |
33 | #include <stdio.h> | 36 | #include <stdio.h> |
34 | #include <stdlib.h> | 37 | #include <stdlib.h> |
35 | #include <sys/types.h> | 38 | #include <sys/types.h> |
36 | 39 | ||
37 | namespace Opie | 40 | namespace Opie |
38 | { | 41 | { |
39 | 42 | ||
40 | QDateTime utcTime( time_t t ) | 43 | QDateTime utcTime( time_t t ) |
41 | { | 44 | { |
42 | tm * broken = ::gmtime( &t ); | 45 | tm * broken = ::gmtime( &t ); |
43 | QDateTime ret; | 46 | QDateTime ret; |
44 | ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon + 1, broken->tm_mday ) ); | 47 | ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon + 1, broken->tm_mday ) ); |
45 | ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); | 48 | ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); |
46 | return ret; | 49 | return ret; |
47 | } | 50 | } |
48 | QDateTime utcTime( time_t t, const QString& zone ) | 51 | QDateTime utcTime( time_t t, const QString& zone ) |
49 | { | 52 | { |
50 | QCString org = ::getenv( "TZ" ); | 53 | QCString org = ::getenv( "TZ" ); |
51 | #ifndef Q_OS_MACX // Following line causes bus errors on Mac | 54 | #ifndef Q_OS_MACX // Following line causes bus errors on Mac |
52 | 55 | ||
53 | ::setenv( "TZ", zone.latin1(), true ); | 56 | ::setenv( "TZ", zone.latin1(), true ); |
54 | ::tzset(); | 57 | ::tzset(); |
55 | 58 | ||
@@ -128,49 +131,49 @@ QDateTime OPimTimeZone::toUTCDateTime( const QDateTime& dt ) | |||
128 | { | 131 | { |
129 | return OPimTimeZone::utc().toDateTime( dt, *this ); | 132 | return OPimTimeZone::utc().toDateTime( dt, *this ); |
130 | } | 133 | } |
131 | 134 | ||
132 | 135 | ||
133 | QDateTime OPimTimeZone::fromUTCDateTime( time_t t ) | 136 | QDateTime OPimTimeZone::fromUTCDateTime( time_t t ) |
134 | { | 137 | { |
135 | return utcTime( t ); | 138 | return utcTime( t ); |
136 | } | 139 | } |
137 | 140 | ||
138 | 141 | ||
139 | QDateTime OPimTimeZone::toDateTime( time_t t ) | 142 | QDateTime OPimTimeZone::toDateTime( time_t t ) |
140 | { | 143 | { |
141 | return utcTime( t, m_name ); | 144 | return utcTime( t, m_name ); |
142 | } | 145 | } |
143 | 146 | ||
144 | 147 | ||
145 | /* | 148 | /* |
146 | * convert dt to utc using zone.m_name | 149 | * convert dt to utc using zone.m_name |
147 | * convert utc -> timeZoneDT using this->m_name | 150 | * convert utc -> timeZoneDT using this->m_name |
148 | */ | 151 | */ |
149 | QDateTime OPimTimeZone::toDateTime( const QDateTime& dt, const OPimTimeZone& zone ) | 152 | QDateTime OPimTimeZone::toDateTime( const QDateTime& dt, const OPimTimeZone& zone ) |
150 | { | 153 | { |
151 | time_t utc = to_Time_t( dt, zone.m_name ); | 154 | time_t utc = to_Time_t( dt, zone.m_name ); |
152 | qWarning( "%d %s", utc, zone.m_name.latin1() ); | 155 | owarn << "" << utc << " " << zone.m_name << "" << oendl; |
153 | return utcTime( utc, m_name ); | 156 | return utcTime( utc, m_name ); |
154 | } | 157 | } |
155 | 158 | ||
156 | 159 | ||
157 | time_t OPimTimeZone::fromDateTime( const QDateTime& time ) | 160 | time_t OPimTimeZone::fromDateTime( const QDateTime& time ) |
158 | { | 161 | { |
159 | return to_Time_t( time, m_name ); | 162 | return to_Time_t( time, m_name ); |
160 | } | 163 | } |
161 | 164 | ||
162 | 165 | ||
163 | time_t OPimTimeZone::fromUTCDateTime( const QDateTime& time ) | 166 | time_t OPimTimeZone::fromUTCDateTime( const QDateTime& time ) |
164 | { | 167 | { |
165 | return to_Time_t( time, "UTC" ); | 168 | return to_Time_t( time, "UTC" ); |
166 | } | 169 | } |
167 | 170 | ||
168 | 171 | ||
169 | OPimTimeZone OPimTimeZone::current() | 172 | OPimTimeZone OPimTimeZone::current() |
170 | { | 173 | { |
171 | QCString str = ::getenv( "TZ" ); | 174 | QCString str = ::getenv( "TZ" ); |
172 | OPimTimeZone zone( str ); | 175 | OPimTimeZone zone( str ); |
173 | return zone; | 176 | return zone; |
174 | } | 177 | } |
175 | 178 | ||
176 | 179 | ||
diff --git a/libopie2/opiepim/core/opimtodo.cpp b/libopie2/opiepim/core/opimtodo.cpp index 47433e0..27b36a6 100644 --- a/libopie2/opiepim/core/opimtodo.cpp +++ b/libopie2/opiepim/core/opimtodo.cpp | |||
@@ -14,48 +14,50 @@ | |||
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimtodo.h" | 30 | #include "opimtodo.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimstate.h> | 33 | #include <opie2/opimstate.h> |
34 | #include <opie2/opimrecurrence.h> | 34 | #include <opie2/opimrecurrence.h> |
35 | #include <opie2/opimmaintainer.h> | 35 | #include <opie2/opimmaintainer.h> |
36 | #include <opie2/opimnotifymanager.h> | 36 | #include <opie2/opimnotifymanager.h> |
37 | #include <opie2/opimresolver.h> | 37 | #include <opie2/opimresolver.h> |
38 | #include <opie2/odebug.h> | ||
39 | |||
38 | #include <qpe/palmtopuidgen.h> | 40 | #include <qpe/palmtopuidgen.h> |
39 | #include <qpe/palmtoprecord.h> | 41 | #include <qpe/palmtoprecord.h> |
40 | #include <qpe/categories.h> | 42 | #include <qpe/categories.h> |
41 | #include <qpe/categoryselect.h> | 43 | #include <qpe/categoryselect.h> |
42 | #include <qpe/stringutil.h> | 44 | #include <qpe/stringutil.h> |
43 | 45 | ||
44 | /* QT */ | 46 | /* QT */ |
45 | #include <qobject.h> | 47 | #include <qobject.h> |
46 | #include <qshared.h> | 48 | #include <qshared.h> |
47 | 49 | ||
48 | namespace Opie | 50 | namespace Opie |
49 | { | 51 | { |
50 | 52 | ||
51 | struct OPimTodo::OPimTodoData : public QShared | 53 | struct OPimTodo::OPimTodoData : public QShared |
52 | { | 54 | { |
53 | OPimTodoData() : QShared() | 55 | OPimTodoData() : QShared() |
54 | { | 56 | { |
55 | recur = 0; | 57 | recur = 0; |
56 | state = 0; | 58 | state = 0; |
57 | maintainer = 0; | 59 | maintainer = 0; |
58 | notifiers = 0; | 60 | notifiers = 0; |
59 | }; | 61 | }; |
60 | ~OPimTodoData() | 62 | ~OPimTodoData() |
61 | { | 63 | { |
@@ -64,97 +66,97 @@ struct OPimTodo::OPimTodoData : public QShared | |||
64 | delete notifiers; | 66 | delete notifiers; |
65 | } | 67 | } |
66 | 68 | ||
67 | QDate date; | 69 | QDate date; |
68 | bool isCompleted: 1; | 70 | bool isCompleted: 1; |
69 | bool hasDate: 1; | 71 | bool hasDate: 1; |
70 | int priority; | 72 | int priority; |
71 | QString desc; | 73 | QString desc; |
72 | QString sum; | 74 | QString sum; |
73 | QMap<QString, QString> extra; | 75 | QMap<QString, QString> extra; |
74 | ushort prog; | 76 | ushort prog; |
75 | OPimState *state; | 77 | OPimState *state; |
76 | OPimRecurrence *recur; | 78 | OPimRecurrence *recur; |
77 | OPimMaintainer *maintainer; | 79 | OPimMaintainer *maintainer; |
78 | QDate start; | 80 | QDate start; |
79 | QDate completed; | 81 | QDate completed; |
80 | OPimNotifyManager *notifiers; | 82 | OPimNotifyManager *notifiers; |
81 | }; | 83 | }; |
82 | 84 | ||
83 | 85 | ||
84 | OPimTodo::OPimTodo( const OPimTodo &event ) | 86 | OPimTodo::OPimTodo( const OPimTodo &event ) |
85 | : OPimRecord( event ), data( event.data ) | 87 | : OPimRecord( event ), data( event.data ) |
86 | { | 88 | { |
87 | data->ref(); | 89 | data->ref(); |
88 | // qWarning("ref up"); | 90 | // owarn << "ref up" << oendl; |
89 | } | 91 | } |
90 | 92 | ||
91 | 93 | ||
92 | OPimTodo::~OPimTodo() | 94 | OPimTodo::~OPimTodo() |
93 | { | 95 | { |
94 | 96 | ||
95 | // qWarning("~OPimTodo " ); | 97 | // owarn << "~OPimTodo " << oendl; |
96 | if ( data->deref() ) | 98 | if ( data->deref() ) |
97 | { | 99 | { |
98 | // qWarning("OPimTodo::dereffing"); | 100 | // owarn << "OPimTodo::dereffing" << oendl; |
99 | delete data; | 101 | delete data; |
100 | data = 0l; | 102 | data = 0l; |
101 | } | 103 | } |
102 | } | 104 | } |
103 | 105 | ||
104 | 106 | ||
105 | OPimTodo::OPimTodo( bool completed, int priority, | 107 | OPimTodo::OPimTodo( bool completed, int priority, |
106 | const QArray<int> &category, | 108 | const QArray<int> &category, |
107 | const QString& summary, | 109 | const QString& summary, |
108 | const QString &description, | 110 | const QString &description, |
109 | ushort progress, | 111 | ushort progress, |
110 | bool hasDate, QDate date, int uid ) | 112 | bool hasDate, QDate date, int uid ) |
111 | : OPimRecord( uid ) | 113 | : OPimRecord( uid ) |
112 | { | 114 | { |
113 | // qWarning("OPimTodoData " + summary); | 115 | // owarn << "OPimTodoData " + summary << oendl; |
114 | setCategories( category ); | 116 | setCategories( category ); |
115 | 117 | ||
116 | data = new OPimTodoData; | 118 | data = new OPimTodoData; |
117 | 119 | ||
118 | data->date = date; | 120 | data->date = date; |
119 | data->isCompleted = completed; | 121 | data->isCompleted = completed; |
120 | data->hasDate = hasDate; | 122 | data->hasDate = hasDate; |
121 | data->priority = priority; | 123 | data->priority = priority; |
122 | data->sum = summary; | 124 | data->sum = summary; |
123 | data->prog = progress; | 125 | data->prog = progress; |
124 | data->desc = Qtopia::simplifyMultiLineSpace( description ); | 126 | data->desc = Qtopia::simplifyMultiLineSpace( description ); |
125 | } | 127 | } |
126 | 128 | ||
127 | 129 | ||
128 | OPimTodo::OPimTodo( bool completed, int priority, | 130 | OPimTodo::OPimTodo( bool completed, int priority, |
129 | const QStringList &category, | 131 | const QStringList &category, |
130 | const QString& summary, | 132 | const QString& summary, |
131 | const QString &description, | 133 | const QString &description, |
132 | ushort progress, | 134 | ushort progress, |
133 | bool hasDate, QDate date, int uid ) | 135 | bool hasDate, QDate date, int uid ) |
134 | : OPimRecord( uid ) | 136 | : OPimRecord( uid ) |
135 | { | 137 | { |
136 | // qWarning("OPimTodoData" + summary); | 138 | // owarn << "OPimTodoData" + summary << oendl; |
137 | setCategories( idsFromString( category.join( ";" ) ) ); | 139 | setCategories( idsFromString( category.join( ";" ) ) ); |
138 | 140 | ||
139 | data = new OPimTodoData; | 141 | data = new OPimTodoData; |
140 | 142 | ||
141 | data->date = date; | 143 | data->date = date; |
142 | data->isCompleted = completed; | 144 | data->isCompleted = completed; |
143 | data->hasDate = hasDate; | 145 | data->hasDate = hasDate; |
144 | data->priority = priority; | 146 | data->priority = priority; |
145 | data->sum = summary; | 147 | data->sum = summary; |
146 | data->prog = progress; | 148 | data->prog = progress; |
147 | data->desc = Qtopia::simplifyMultiLineSpace( description ); | 149 | data->desc = Qtopia::simplifyMultiLineSpace( description ); |
148 | } | 150 | } |
149 | 151 | ||
150 | 152 | ||
151 | bool OPimTodo::match( const QRegExp ®Exp ) const | 153 | bool OPimTodo::match( const QRegExp ®Exp ) const |
152 | { | 154 | { |
153 | if ( QString::number( data->priority ).find( regExp ) != -1 ) | 155 | if ( QString::number( data->priority ).find( regExp ) != -1 ) |
154 | { | 156 | { |
155 | setLastHitField( Priority ); | 157 | setLastHitField( Priority ); |
156 | return true; | 158 | return true; |
157 | } | 159 | } |
158 | else if ( data->hasDate && data->date.toString().find( regExp ) != -1 ) | 160 | else if ( data->hasDate && data->date.toString().find( regExp ) != -1 ) |
159 | { | 161 | { |
160 | setLastHitField( HasDate ); | 162 | setLastHitField( HasDate ); |
@@ -285,49 +287,49 @@ bool OPimTodo::hasMaintainer() const | |||
285 | OPimMaintainer OPimTodo::maintainer() const | 287 | OPimMaintainer OPimTodo::maintainer() const |
286 | { | 288 | { |
287 | if ( !data->maintainer ) return OPimMaintainer(); | 289 | if ( !data->maintainer ) return OPimMaintainer(); |
288 | 290 | ||
289 | return ( *data->maintainer ); | 291 | return ( *data->maintainer ); |
290 | } | 292 | } |
291 | 293 | ||
292 | 294 | ||
293 | void OPimTodo::setCompleted( bool completed ) | 295 | void OPimTodo::setCompleted( bool completed ) |
294 | { | 296 | { |
295 | changeOrModify(); | 297 | changeOrModify(); |
296 | data->isCompleted = completed; | 298 | data->isCompleted = completed; |
297 | } | 299 | } |
298 | 300 | ||
299 | 301 | ||
300 | void OPimTodo::setHasDueDate( bool hasDate ) | 302 | void OPimTodo::setHasDueDate( bool hasDate ) |
301 | { | 303 | { |
302 | changeOrModify(); | 304 | changeOrModify(); |
303 | data->hasDate = hasDate; | 305 | data->hasDate = hasDate; |
304 | } | 306 | } |
305 | 307 | ||
306 | 308 | ||
307 | void OPimTodo::setDescription( const QString &desc ) | 309 | void OPimTodo::setDescription( const QString &desc ) |
308 | { | 310 | { |
309 | // qWarning( "desc " + desc ); | 311 | // owarn << "desc " + desc << oendl; |
310 | changeOrModify(); | 312 | changeOrModify(); |
311 | data->desc = Qtopia::simplifyMultiLineSpace( desc ); | 313 | data->desc = Qtopia::simplifyMultiLineSpace( desc ); |
312 | } | 314 | } |
313 | 315 | ||
314 | 316 | ||
315 | void OPimTodo::setSummary( const QString& sum ) | 317 | void OPimTodo::setSummary( const QString& sum ) |
316 | { | 318 | { |
317 | changeOrModify(); | 319 | changeOrModify(); |
318 | data->sum = sum; | 320 | data->sum = sum; |
319 | } | 321 | } |
320 | 322 | ||
321 | 323 | ||
322 | void OPimTodo::setPriority( int prio ) | 324 | void OPimTodo::setPriority( int prio ) |
323 | { | 325 | { |
324 | changeOrModify(); | 326 | changeOrModify(); |
325 | data->priority = prio; | 327 | data->priority = prio; |
326 | } | 328 | } |
327 | 329 | ||
328 | 330 | ||
329 | void OPimTodo::setDueDate( const QDate& date ) | 331 | void OPimTodo::setDueDate( const QDate& date ) |
330 | { | 332 | { |
331 | changeOrModify(); | 333 | changeOrModify(); |
332 | data->date = date; | 334 | data->date = date; |
333 | } | 335 | } |
@@ -570,107 +572,107 @@ bool OPimTodo::operator>=( const OPimTodo &toDoEvent ) const | |||
570 | } | 572 | } |
571 | return true; | 573 | return true; |
572 | } | 574 | } |
573 | 575 | ||
574 | 576 | ||
575 | bool OPimTodo::operator==( const OPimTodo &toDoEvent ) const | 577 | bool OPimTodo::operator==( const OPimTodo &toDoEvent ) const |
576 | { | 578 | { |
577 | if ( data->priority != toDoEvent.data->priority ) return false; | 579 | if ( data->priority != toDoEvent.data->priority ) return false; |
578 | if ( data->priority != toDoEvent.data->prog ) return false; | 580 | if ( data->priority != toDoEvent.data->prog ) return false; |
579 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; | 581 | if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; |
580 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; | 582 | if ( data->hasDate != toDoEvent.data->hasDate ) return false; |
581 | if ( data->date != toDoEvent.data->date ) return false; | 583 | if ( data->date != toDoEvent.data->date ) return false; |
582 | if ( data->sum != toDoEvent.data->sum ) return false; | 584 | if ( data->sum != toDoEvent.data->sum ) return false; |
583 | if ( data->desc != toDoEvent.data->desc ) return false; | 585 | if ( data->desc != toDoEvent.data->desc ) return false; |
584 | if ( data->maintainer != toDoEvent.data->maintainer ) | 586 | if ( data->maintainer != toDoEvent.data->maintainer ) |
585 | return false; | 587 | return false; |
586 | 588 | ||
587 | return OPimRecord::operator==( toDoEvent ); | 589 | return OPimRecord::operator==( toDoEvent ); |
588 | } | 590 | } |
589 | 591 | ||
590 | 592 | ||
591 | void OPimTodo::deref() | 593 | void OPimTodo::deref() |
592 | { | 594 | { |
593 | 595 | ||
594 | // qWarning("deref in ToDoEvent"); | 596 | // owarn << "deref in ToDoEvent" << oendl; |
595 | if ( data->deref() ) | 597 | if ( data->deref() ) |
596 | { | 598 | { |
597 | // qWarning("deleting"); | 599 | // owarn << "deleting" << oendl; |
598 | delete data; | 600 | delete data; |
599 | data = 0; | 601 | data = 0; |
600 | } | 602 | } |
601 | } | 603 | } |
602 | 604 | ||
603 | 605 | ||
604 | OPimTodo &OPimTodo::operator=( const OPimTodo &item ) | 606 | OPimTodo &OPimTodo::operator=( const OPimTodo &item ) |
605 | { | 607 | { |
606 | if ( this == &item ) return * this; | 608 | if ( this == &item ) return * this; |
607 | 609 | ||
608 | OPimRecord::operator=( item ); | 610 | OPimRecord::operator=( item ); |
609 | //qWarning("operator= ref "); | 611 | //owarn << "operator= ref " << oendl; |
610 | item.data->ref(); | 612 | item.data->ref(); |
611 | deref(); | 613 | deref(); |
612 | data = item.data; | 614 | data = item.data; |
613 | 615 | ||
614 | return *this; | 616 | return *this; |
615 | } | 617 | } |
616 | 618 | ||
617 | 619 | ||
618 | QMap<int, QString> OPimTodo::toMap() const | 620 | QMap<int, QString> OPimTodo::toMap() const |
619 | { | 621 | { |
620 | QMap<int, QString> map; | 622 | QMap<int, QString> map; |
621 | 623 | ||
622 | map.insert( Uid, QString::number( uid() ) ); | 624 | map.insert( Uid, QString::number( uid() ) ); |
623 | map.insert( Category, idsToString( categories() ) ); | 625 | map.insert( Category, idsToString( categories() ) ); |
624 | map.insert( HasDate, QString::number( data->hasDate ) ); | 626 | map.insert( HasDate, QString::number( data->hasDate ) ); |
625 | map.insert( Completed, QString::number( data->isCompleted ) ); | 627 | map.insert( Completed, QString::number( data->isCompleted ) ); |
626 | map.insert( Description, data->desc ); | 628 | map.insert( Description, data->desc ); |
627 | map.insert( Summary, data->sum ); | 629 | map.insert( Summary, data->sum ); |
628 | map.insert( Priority, QString::number( data->priority ) ); | 630 | map.insert( Priority, QString::number( data->priority ) ); |
629 | map.insert( DateDay, QString::number( data->date.day() ) ); | 631 | map.insert( DateDay, QString::number( data->date.day() ) ); |
630 | map.insert( DateMonth, QString::number( data->date.month() ) ); | 632 | map.insert( DateMonth, QString::number( data->date.month() ) ); |
631 | map.insert( DateYear, QString::number( data->date.year() ) ); | 633 | map.insert( DateYear, QString::number( data->date.year() ) ); |
632 | map.insert( Progress, QString::number( data->prog ) ); | 634 | map.insert( Progress, QString::number( data->prog ) ); |
633 | // map.insert( CrossReference, crossToString() ); | 635 | // map.insert( CrossReference, crossToString() ); |
634 | /* FIXME!!! map.insert( State, ); | 636 | /* FIXME!!! map.insert( State, ); |
635 | map.insert( Recurrence, ); | 637 | map.insert( Recurrence, ); |
636 | map.insert( Reminders, ); | 638 | map.insert( Reminders, ); |
637 | map. | 639 | map. |
638 | */ | 640 | */ |
639 | return map; | 641 | return map; |
640 | } | 642 | } |
641 | 643 | ||
642 | 644 | ||
643 | /** | 645 | /** |
644 | * change or modify looks at the ref count and either | 646 | * change or modify looks at the ref count and either |
645 | * creates a new QShared Object or it can modify it | 647 | * creates a new QShared Object or it can modify it |
646 | * right in place | 648 | * right in place |
647 | */ | 649 | */ |
648 | void OPimTodo::changeOrModify() | 650 | void OPimTodo::changeOrModify() |
649 | { | 651 | { |
650 | if ( data->count != 1 ) | 652 | if ( data->count != 1 ) |
651 | { | 653 | { |
652 | qWarning( "changeOrModify" ); | 654 | owarn << "changeOrModify" << oendl; |
653 | data->deref(); | 655 | data->deref(); |
654 | OPimTodoData* d2 = new OPimTodoData(); | 656 | OPimTodoData* d2 = new OPimTodoData(); |
655 | copy( data, d2 ); | 657 | copy( data, d2 ); |
656 | data = d2; | 658 | data = d2; |
657 | } | 659 | } |
658 | } | 660 | } |
659 | 661 | ||
660 | 662 | ||
661 | // WATCHOUT | 663 | // WATCHOUT |
662 | /* | 664 | /* |
663 | * if you add something to the Data struct | 665 | * if you add something to the Data struct |
664 | * be sure to copy it here | 666 | * be sure to copy it here |
665 | */ | 667 | */ |
666 | void OPimTodo::copy( OPimTodoData* src, OPimTodoData* dest ) | 668 | void OPimTodo::copy( OPimTodoData* src, OPimTodoData* dest ) |
667 | { | 669 | { |
668 | dest->date = src->date; | 670 | dest->date = src->date; |
669 | dest->isCompleted = src->isCompleted; | 671 | dest->isCompleted = src->isCompleted; |
670 | dest->hasDate = src->hasDate; | 672 | dest->hasDate = src->hasDate; |
671 | dest->priority = src->priority; | 673 | dest->priority = src->priority; |
672 | dest->desc = src->desc; | 674 | dest->desc = src->desc; |
673 | dest->sum = src->sum; | 675 | dest->sum = src->sum; |
674 | dest->extra = src->extra; | 676 | dest->extra = src->extra; |
675 | dest->prog = src->prog; | 677 | dest->prog = src->prog; |
676 | 678 | ||
diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp index c4adbbd..26a68a0 100644 --- a/libopie2/opiepim/core/otodoaccess.cpp +++ b/libopie2/opiepim/core/otodoaccess.cpp | |||
@@ -29,49 +29,49 @@ | |||
29 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
30 | 30 | ||
31 | #include <qpe/alarmserver.h> | 31 | #include <qpe/alarmserver.h> |
32 | 32 | ||
33 | // #include "otodoaccesssql.h" | 33 | // #include "otodoaccesssql.h" |
34 | #include <opie2/otodoaccess.h> | 34 | #include <opie2/otodoaccess.h> |
35 | #include <opie2/obackendfactory.h> | 35 | #include <opie2/obackendfactory.h> |
36 | #include <opie2/opimresolver.h> | 36 | #include <opie2/opimresolver.h> |
37 | #include <opie2/opimglobal.h> | 37 | #include <opie2/opimglobal.h> |
38 | 38 | ||
39 | namespace Opie { | 39 | namespace Opie { |
40 | OPimTodoAccess::OPimTodoAccess( OPimTodoAccessBackend* end, enum Access ) | 40 | OPimTodoAccess::OPimTodoAccess( OPimTodoAccessBackend* end, enum Access ) |
41 | : QObject(), OPimAccessTemplate<OPimTodo>( end ), m_todoBackEnd( end ) | 41 | : QObject(), OPimAccessTemplate<OPimTodo>( end ), m_todoBackEnd( end ) |
42 | { | 42 | { |
43 | // if (end == 0l ) | 43 | // if (end == 0l ) |
44 | // m_todoBackEnd = new OPimTodoAccessBackendSQL( QString::null); | 44 | // m_todoBackEnd = new OPimTodoAccessBackendSQL( QString::null); |
45 | 45 | ||
46 | // Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben ! | 46 | // Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben ! |
47 | if (end == 0l ) | 47 | if (end == 0l ) |
48 | m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::defaultBackend (OPimGlobal::TODOLIST, QString::null); | 48 | m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::defaultBackend (OPimGlobal::TODOLIST, QString::null); |
49 | 49 | ||
50 | setBackEnd( m_todoBackEnd ); | 50 | setBackEnd( m_todoBackEnd ); |
51 | } | 51 | } |
52 | OPimTodoAccess::~OPimTodoAccess() { | 52 | OPimTodoAccess::~OPimTodoAccess() { |
53 | // qWarning("~OPimTodoAccess"); | 53 | // owarn << "~OPimTodoAccess" << oendl; |
54 | } | 54 | } |
55 | void OPimTodoAccess::mergeWith( const QValueList<OPimTodo>& list ) { | 55 | void OPimTodoAccess::mergeWith( const QValueList<OPimTodo>& list ) { |
56 | QValueList<OPimTodo>::ConstIterator it; | 56 | QValueList<OPimTodo>::ConstIterator it; |
57 | for ( it = list.begin(); it != list.end(); ++it ) { | 57 | for ( it = list.begin(); it != list.end(); ++it ) { |
58 | replace( (*it) ); | 58 | replace( (*it) ); |
59 | } | 59 | } |
60 | } | 60 | } |
61 | OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start, | 61 | OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start, |
62 | const QDate& end, | 62 | const QDate& end, |
63 | bool includeNoDates ) { | 63 | bool includeNoDates ) { |
64 | QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); | 64 | QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates ); |
65 | 65 | ||
66 | List lis( ints, this ); | 66 | List lis( ints, this ); |
67 | return lis; | 67 | return lis; |
68 | } | 68 | } |
69 | OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start, | 69 | OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start, |
70 | bool includeNoDates ) { | 70 | bool includeNoDates ) { |
71 | return effectiveToDos( start, QDate::currentDate(), | 71 | return effectiveToDos( start, QDate::currentDate(), |
72 | includeNoDates ); | 72 | includeNoDates ); |
73 | } | 73 | } |
74 | OPimTodoAccess::List OPimTodoAccess::overDue() { | 74 | OPimTodoAccess::List OPimTodoAccess::overDue() { |
75 | List lis( m_todoBackEnd->overDue(), this ); | 75 | List lis( m_todoBackEnd->overDue(), this ); |
76 | return lis; | 76 | return lis; |
77 | } | 77 | } |