summaryrefslogtreecommitdiff
authorsimon <simon>2002-03-25 19:20:12 (UTC)
committer simon <simon>2002-03-25 19:20:12 (UTC)
commit843b7b0841976f8d6ea0ff0306dc0f59ebdeece0 (patch) (unidiff)
treeebe9b0d81db9a22d083438200c1efb201a1834e8
parent956522a9355051294e12e85e564d8ae1f0b928a3 (diff)
downloadopie-843b7b0841976f8d6ea0ff0306dc0f59ebdeece0.zip
opie-843b7b0841976f8d6ea0ff0306dc0f59ebdeece0.tar.gz
opie-843b7b0841976f8d6ea0ff0306dc0f59ebdeece0.tar.bz2
- added missing default: break; in switch
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--library/backend/task.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/backend/task.cpp b/library/backend/task.cpp
index e7d697d..f0a38f1 100644
--- a/library/backend/task.cpp
+++ b/library/backend/task.cpp
@@ -6,96 +6,97 @@
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qpe/task.h> 21#include <qpe/task.h>
22#include <qregexp.h> 22#include <qregexp.h>
23#include <qstring.h> 23#include <qstring.h>
24#include <qpe/recordfields.h> 24#include <qpe/recordfields.h>
25#include "vobject_p.h" 25#include "vobject_p.h"
26#include "timeconversion.h" 26#include "timeconversion.h"
27#include "qfiledirect_p.h" 27#include "qfiledirect_p.h"
28 28
29#include <stdio.h> 29#include <stdio.h>
30 30
31using namespace Qtopia; 31using namespace Qtopia;
32UidGen Task::sUidGen( UidGen::Qtopia ); 32UidGen Task::sUidGen( UidGen::Qtopia );
33 33
34Task::Task() : Record(), mDue( FALSE ), 34Task::Task() : Record(), mDue( FALSE ),
35mDueDate( QDate::currentDate() ), 35mDueDate( QDate::currentDate() ),
36mCompleted( FALSE ), mPriority( 3 ), mDesc() 36mCompleted( FALSE ), mPriority( 3 ), mDesc()
37{ 37{
38} 38}
39 39
40Task::Task( const QMap<int, QString> &m ) : Record(), mDue( FALSE ), 40Task::Task( const QMap<int, QString> &m ) : Record(), mDue( FALSE ),
41mDueDate( QDate::currentDate() ), mCompleted( FALSE ), mPriority( 3 ), mDesc() 41mDueDate( QDate::currentDate() ), mCompleted( FALSE ), mPriority( 3 ), mDesc()
42{ 42{
43 //qDebug("Task::Task fromMap"); 43 //qDebug("Task::Task fromMap");
44 //dump( m ); 44 //dump( m );
45 for ( QMap<int,QString>::ConstIterator it = m.begin(); it != m.end();++it ) 45 for ( QMap<int,QString>::ConstIterator it = m.begin(); it != m.end();++it )
46 switch ( (TaskFields) it.key() ) { 46 switch ( (TaskFields) it.key() ) {
47 case HasDate: if ( *it == "1" ) mDue = TRUE; break; 47 case HasDate: if ( *it == "1" ) mDue = TRUE; break;
48 case Completed: setCompleted( *it == "1" ); break; 48 case Completed: setCompleted( *it == "1" ); break;
49 case TaskCategory: setCategories( idsFromString( *it ) ); break; 49 case TaskCategory: setCategories( idsFromString( *it ) ); break;
50 case TaskDescription: setDescription( *it ); break; 50 case TaskDescription: setDescription( *it ); break;
51 case Priority: setPriority( (*it).toInt() ); break; 51 case Priority: setPriority( (*it).toInt() ); break;
52 case Date: mDueDate = TimeConversion::fromString( (*it) ); break; 52 case Date: mDueDate = TimeConversion::fromString( (*it) ); break;
53 case TaskUid: setUid( (*it).toInt() ); break; 53 case TaskUid: setUid( (*it).toInt() ); break;
54 default: break;
54 } 55 }
55} 56}
56 57
57Task::~Task() 58Task::~Task()
58{ 59{
59} 60}
60 61
61QMap<int, QString> Task::toMap() const 62QMap<int, QString> Task::toMap() const
62{ 63{
63 QMap<int, QString> m; 64 QMap<int, QString> m;
64 m.insert( HasDate, hasDueDate() ? "1" : "0" ); 65 m.insert( HasDate, hasDueDate() ? "1" : "0" );
65 m.insert( Completed, isCompleted() ? "1" : "0" ); 66 m.insert( Completed, isCompleted() ? "1" : "0" );
66 m.insert( TaskCategory, idsToString( categories() ) ); 67 m.insert( TaskCategory, idsToString( categories() ) );
67 m.insert( TaskDescription, description() ); 68 m.insert( TaskDescription, description() );
68 m.insert( Priority, QString::number( priority() ) ); 69 m.insert( Priority, QString::number( priority() ) );
69 m.insert( Date, TimeConversion::toString( dueDate() ) ); 70 m.insert( Date, TimeConversion::toString( dueDate() ) );
70 m.insert( TaskUid, QString::number(uid()) ); 71 m.insert( TaskUid, QString::number(uid()) );
71 72
72 //qDebug("Task::toMap"); 73 //qDebug("Task::toMap");
73 //dump( m ); 74 //dump( m );
74 return m; 75 return m;
75} 76}
76 77
77void Task::save( QString& buf ) const 78void Task::save( QString& buf ) const
78{ 79{
79 buf += " Completed=\""; 80 buf += " Completed=\"";
80 // qDebug( "writing %d", complete ); 81 // qDebug( "writing %d", complete );
81 buf += QString::number( (int)mCompleted ); 82 buf += QString::number( (int)mCompleted );
82 buf += "\""; 83 buf += "\"";
83 buf += " HasDate=\""; 84 buf += " HasDate=\"";
84 // qDebug( "writing %d", ); 85 // qDebug( "writing %d", );
85 buf += QString::number( (int)mDue ); 86 buf += QString::number( (int)mDue );
86 buf += "\""; 87 buf += "\"";
87 buf += " Priority=\""; 88 buf += " Priority=\"";
88 // qDebug ("writing %d", prior ); 89 // qDebug ("writing %d", prior );
89 buf += QString::number( mPriority ); 90 buf += QString::number( mPriority );
90 buf += "\""; 91 buf += "\"";
91 buf += " Categories=\""; 92 buf += " Categories=\"";
92 buf += Qtopia::Record::idsToString( categories() ); 93 buf += Qtopia::Record::idsToString( categories() );
93 buf += "\""; 94 buf += "\"";
94 buf += " Description=\""; 95 buf += " Description=\"";
95 // qDebug( "writing note %s", note.latin1() ); 96 // qDebug( "writing note %s", note.latin1() );
96 buf += Qtopia::escapeString( mDesc ); 97 buf += Qtopia::escapeString( mDesc );
97 buf += "\""; 98 buf += "\"";
98 if ( mDue ) { 99 if ( mDue ) {
99 // qDebug("saving ymd %d %d %d", mDueDate.year(), mDueDate.month(), 100 // qDebug("saving ymd %d %d %d", mDueDate.year(), mDueDate.month(),
100 // mDueDate.day() ); 101 // mDueDate.day() );
101 buf += " DateYear=\""; 102 buf += " DateYear=\"";