summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2004-05-22 10:17:20 (UTC)
committer zecke <zecke>2004-05-22 10:17:20 (UTC)
commit77f189ec4b959a2874942b00b070ea60c091a7fa (patch) (unidiff)
tree57e36d30a275db1b139ccc5995080b553f33b0f0 /libopie2
parent35b6ab7a844145378a6e427c4666fa65b63d3cfd (diff)
downloadopie-77f189ec4b959a2874942b00b070ea60c091a7fa.zip
opie-77f189ec4b959a2874942b00b070ea60c091a7fa.tar.gz
opie-77f189ec4b959a2874942b00b070ea60c091a7fa.tar.bz2
Fix inserting data with custom tables
Also I don't like the string comparsions. Are they really needed?
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccesssql.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp
index ef036d5..132b5a6 100644
--- a/libopie2/opiepim/backend/otodoaccesssql.cpp
+++ b/libopie2/opiepim/backend/otodoaccesssql.cpp
@@ -168,3 +168,3 @@ namespace {
168 }; 168 };
169 169
170 170
@@ -178,3 +178,3 @@ namespace {
178 // This is the recurrance-stuff .. Exceptions are currently not supported (see OPimRecurrence.cpp) ! (eilers) 178 // This is the recurrance-stuff .. Exceptions are currently not supported (see OPimRecurrence.cpp) ! (eilers)
179 qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; 179 qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, ";
180 qu += "reminders, alarms, maintainer, startdate, completeddate);"; 180 qu += "reminders, alarms, maintainer, startdate, completeddate);";
@@ -222,3 +222,3 @@ namespace {
222 sDay = sDate.day(); 222 sDay = sDate.day();
223 } 223 }
224 224
@@ -230,13 +230,13 @@ namespace {
230 eDay = eDate.day(); 230 eDay = eDate.day();
231 } 231 }
232 QString qu; 232 QString qu;
233 QMap<int, QString> recMap = m_todo.recurrence().toMap(); 233 QMap<int, QString> recMap = m_todo.recurrence().toMap();
234 qu = "insert into todolist VALUES(" 234 qu = "insert into todolist VALUES("
235 + QString::number( m_todo.uid() ) + "," 235 + QString::number( m_todo.uid() ) + ","
236 + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + "," 236 + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + ","
237 + QString::number( m_todo.isCompleted() ) + "," 237 + QString::number( m_todo.isCompleted() ) + ","
238 + "'" + m_todo.description() + "'" + "," 238 + "'" + m_todo.description() + "'" + ","
239 + "'" + m_todo.summary() + "'" + "," 239 + "'" + m_todo.summary() + "'" + ","
240 + QString::number(m_todo.priority() ) + "," 240 + QString::number(m_todo.priority() ) + ","
241 + "'" + QString::number(year).rightJustify( 4, '0' ) + "-" 241 + "'" + QString::number(year).rightJustify( 4, '0' ) + "-"
242 + QString::number(month).rightJustify( 2, '0' ) 242 + QString::number(month).rightJustify( 2, '0' )
@@ -253,6 +253,6 @@ namespace {
253 + "'" + recMap[ OPimRecurrence::Exceptions ] + "'" + ","; 253 + "'" + recMap[ OPimRecurrence::Exceptions ] + "'" + ",";
254 254
255 if ( m_todo.hasNotifiers() ) { 255 if ( m_todo.hasNotifiers() ) {
256 OPimNotifyManager manager = m_todo.notifiers(); 256 OPimNotifyManager manager = m_todo.notifiers();
257 qu += "'" + manager.remindersToString() + "'" + "," 257 qu += "'" + manager.remindersToString() + "'" + ","
258 + "'" + manager.alarmsToString() + "'" + ","; 258 + "'" + manager.alarmsToString() + "'" + ",";
@@ -265,3 +265,3 @@ namespace {
265 qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !) 265 qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !)
266 + "'" + QString::number(sYear).rightJustify( 4, '0' ) + "-" 266 + "'" + QString::number(sYear).rightJustify( 4, '0' ) + "-"
267 + QString::number(sMonth).rightJustify( 2, '0' ) 267 + QString::number(sMonth).rightJustify( 2, '0' )
@@ -271,3 +271,3 @@ namespace {
271 + "-"+QString::number(eDay).rightJustify( 2, '0' ) + "'" 271 + "-"+QString::number(eDay).rightJustify( 2, '0' ) + "'"
272 + ")"; 272 + "); ";
273 273
@@ -277,9 +277,9 @@ namespace {
277 QMap<QString, QString> customMap = m_todo.toExtraMap(); 277 QMap<QString, QString> customMap = m_todo.toExtraMap();
278 for( QMap<QString, QString>::Iterator it = customMap.begin(); 278 for( QMap<QString, QString>::Iterator it = customMap.begin();
279 it != customMap.end(); ++it ){ 279 it != customMap.end(); ++it ){
280 qu += "insert into custom_data VALUES(" 280 qu += "insert into custom_data VALUES("
281 + QString::number( m_todo.uid() ) 281 + QString::number( m_todo.uid() )
282 + "," 282 + ","
283 + QString::number( id++ ) 283 + QString::number( id++ )
284 + ",'" 284 + ",'"
285 + it.key() 285 + it.key()
@@ -287,7 +287,7 @@ namespace {
287 + "0" // Priority for future enhancements 287 + "0" // Priority for future enhancements
288 + ",'" 288 + ",'"
289 + it.data() 289 + it.data()
290 + "');"; 290 + "');";
291 } 291 }
292 292
293 293
@@ -646,3 +646,3 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
646 // Request information from addressbook table and create the OPimTodo-object. 646 // Request information from addressbook table and create the OPimTodo-object.
647 647
648 bool hasDueDate = false; QDate dueDate = QDate::currentDate(); 648 bool hasDueDate = false; QDate dueDate = QDate::currentDate();
@@ -672,3 +672,3 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
672 to.setCompletedDate( completedDate ); 672 to.setCompletedDate( completedDate );
673 673
674 OPimNotifyManager& manager = to.notifiers(); 674 OPimNotifyManager& manager = to.notifiers();
@@ -690,3 +690,3 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const {
690 recMap.insert( OPimRecurrence::Exceptions , item.data("Exceptions") ); 690 recMap.insert( OPimRecurrence::Exceptions , item.data("Exceptions") );
691 691
692 OPimRecurrence recur; 692 OPimRecurrence recur;
@@ -775,3 +775,3 @@ QArray<int> OPimTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const
775 qu += " rlike(\""+ r.pattern() + "\",\"summary\")"; 775 qu += " rlike(\""+ r.pattern() + "\",\"summary\")";
776 776
777 qu += ")"; 777 qu += ")";
@@ -803,3 +803,3 @@ QBitArray OPimTodoAccessBackendSQL::sup() const{
803 ar[OPimTodo::Maintainer] = false; 803 ar[OPimTodo::Maintainer] = false;
804 804
805 return ar; 805 return ar;
@@ -808,3 +808,3 @@ QBitArray OPimTodoAccessBackendSQL::sup() const{
808void OPimTodoAccessBackendSQL::removeAllCompleted(){ 808void OPimTodoAccessBackendSQL::removeAllCompleted(){
809 // First we need the uids from all entries which are 809 // First we need the uids from all entries which are
810 // completed. Then, we just have to remove them... 810 // completed. Then, we just have to remove them...
@@ -857,3 +857,3 @@ QMap<QString, QString> OPimTodoAccessBackendSQL::requestCustom( int uid ) const
857 QMap<QString, QString> customMap; 857 QMap<QString, QString> customMap;
858 858
859 FindCustomQuery query( uid ); 859 FindCustomQuery query( uid );