author | zecke <zecke> | 2004-05-22 10:17:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-22 10:17:20 (UTC) |
commit | 77f189ec4b959a2874942b00b070ea60c091a7fa (patch) (side-by-side diff) | |
tree | 57e36d30a275db1b139ccc5995080b553f33b0f0 /libopie2/opiepim | |
parent | 35b6ab7a844145378a6e427c4666fa65b63d3cfd (diff) | |
download | opie-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?
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 54 |
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 { }; - + @@ -178,3 +178,3 @@ namespace { // This is the recurrance-stuff .. Exceptions are currently not supported (see OPimRecurrence.cpp) ! (eilers) - qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; + qu += "RType, RWeekdays, RPosition, RFreq, RHasEndDate, EndDate, Created, Exceptions, "; qu += "reminders, alarms, maintainer, startdate, completeddate);"; @@ -222,3 +222,3 @@ namespace { sDay = sDate.day(); - } + } @@ -230,13 +230,13 @@ namespace { eDay = eDate.day(); - } + } QString qu; QMap<int, QString> recMap = m_todo.recurrence().toMap(); - qu = "insert into todolist VALUES(" - + QString::number( m_todo.uid() ) + "," + qu = "insert into todolist VALUES(" + + QString::number( m_todo.uid() ) + "," + "'" + m_todo.idsToString( m_todo.categories() ) + "'" + "," - + QString::number( m_todo.isCompleted() ) + "," + + QString::number( m_todo.isCompleted() ) + "," + "'" + m_todo.description() + "'" + "," - + "'" + m_todo.summary() + "'" + "," + + "'" + m_todo.summary() + "'" + "," + QString::number(m_todo.priority() ) + "," - + "'" + QString::number(year).rightJustify( 4, '0' ) + "-" + + "'" + QString::number(year).rightJustify( 4, '0' ) + "-" + QString::number(month).rightJustify( 2, '0' ) @@ -253,6 +253,6 @@ namespace { + "'" + recMap[ OPimRecurrence::Exceptions ] + "'" + ","; - + if ( m_todo.hasNotifiers() ) { OPimNotifyManager manager = m_todo.notifiers(); - qu += "'" + manager.remindersToString() + "'" + "," + qu += "'" + manager.remindersToString() + "'" + "," + "'" + manager.alarmsToString() + "'" + ","; @@ -265,3 +265,3 @@ namespace { qu += QString( "''" ) + QString( "," ) // Maintainers (cur. not supported !) - + "'" + QString::number(sYear).rightJustify( 4, '0' ) + "-" + + "'" + QString::number(sYear).rightJustify( 4, '0' ) + "-" + QString::number(sMonth).rightJustify( 2, '0' ) @@ -271,3 +271,3 @@ namespace { + "-"+QString::number(eDay).rightJustify( 2, '0' ) + "'" - + ")"; + + "); "; @@ -277,9 +277,9 @@ namespace { QMap<QString, QString> customMap = m_todo.toExtraMap(); - for( QMap<QString, QString>::Iterator it = customMap.begin(); + for( QMap<QString, QString>::Iterator it = customMap.begin(); it != customMap.end(); ++it ){ - qu += "insert into custom_data VALUES(" + qu += "insert into custom_data VALUES(" + QString::number( m_todo.uid() ) + "," - + QString::number( id++ ) - + ",'" + + QString::number( id++ ) + + ",'" + it.key() @@ -287,7 +287,7 @@ namespace { + "0" // Priority for future enhancements - + ",'" + + ",'" + it.data() + "');"; - } - + } + @@ -646,3 +646,3 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { // Request information from addressbook table and create the OPimTodo-object. - + bool hasDueDate = false; QDate dueDate = QDate::currentDate(); @@ -672,3 +672,3 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { to.setCompletedDate( completedDate ); - + OPimNotifyManager& manager = to.notifiers(); @@ -690,3 +690,3 @@ OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { recMap.insert( OPimRecurrence::Exceptions , item.data("Exceptions") ); - + OPimRecurrence recur; @@ -775,3 +775,3 @@ QArray<int> OPimTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const qu += " rlike(\""+ r.pattern() + "\",\"summary\")"; - + qu += ")"; @@ -803,3 +803,3 @@ QBitArray OPimTodoAccessBackendSQL::sup() const{ ar[OPimTodo::Maintainer] = false; - + return ar; @@ -808,3 +808,3 @@ QBitArray OPimTodoAccessBackendSQL::sup() const{ void OPimTodoAccessBackendSQL::removeAllCompleted(){ - // First we need the uids from all entries which are + // First we need the uids from all entries which are // completed. Then, we just have to remove them... @@ -857,3 +857,3 @@ QMap<QString, QString> OPimTodoAccessBackendSQL::requestCustom( int uid ) const QMap<QString, QString> customMap; - + FindCustomQuery query( uid ); |