summaryrefslogtreecommitdiff
path: root/libopie/pim/otodoaccessxml.cpp
Unidiff
Diffstat (limited to 'libopie/pim/otodoaccessxml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/otodoaccessxml.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 3d15354..f688735 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -66,49 +66,49 @@ char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
66} 66}
67} 67}
68 68
69 69
70OTodoAccessXML::OTodoAccessXML( const QString& appName, 70OTodoAccessXML::OTodoAccessXML( const QString& appName,
71 const QString& fileName ) 71 const QString& fileName )
72 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false ) 72 : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false )
73{ 73{
74 if (!fileName.isEmpty() ) 74 if (!fileName.isEmpty() )
75 m_file = fileName; 75 m_file = fileName;
76 else 76 else
77 m_file = Global::applicationFileName( "todolist", "todolist.xml" ); 77 m_file = Global::applicationFileName( "todolist", "todolist.xml" );
78} 78}
79OTodoAccessXML::~OTodoAccessXML() { 79OTodoAccessXML::~OTodoAccessXML() {
80 80
81} 81}
82bool OTodoAccessXML::load() { 82bool OTodoAccessXML::load() {
83 rec = 0; 83 rec = 0;
84 m_opened = true; 84 m_opened = true;
85 m_changed = false; 85 m_changed = false;
86 /* initialize dict */ 86 /* initialize dict */
87 /* 87 /*
88 * UPDATE dict if you change anything!!! 88 * UPDATE dict if you change anything!!!
89 */ 89 */
90 QAsciiDict<int> dict(21); 90 QAsciiDict<int> dict(26);
91 dict.setAutoDelete( TRUE ); 91 dict.setAutoDelete( TRUE );
92 dict.insert("Categories" , new int(OTodo::Category) ); 92 dict.insert("Categories" , new int(OTodo::Category) );
93 dict.insert("Uid" , new int(OTodo::Uid) ); 93 dict.insert("Uid" , new int(OTodo::Uid) );
94 dict.insert("HasDate" , new int(OTodo::HasDate) ); 94 dict.insert("HasDate" , new int(OTodo::HasDate) );
95 dict.insert("Completed" , new int(OTodo::Completed) ); 95 dict.insert("Completed" , new int(OTodo::Completed) );
96 dict.insert("Description" , new int(OTodo::Description) ); 96 dict.insert("Description" , new int(OTodo::Description) );
97 dict.insert("Summary" , new int(OTodo::Summary) ); 97 dict.insert("Summary" , new int(OTodo::Summary) );
98 dict.insert("Priority" , new int(OTodo::Priority) ); 98 dict.insert("Priority" , new int(OTodo::Priority) );
99 dict.insert("DateDay" , new int(OTodo::DateDay) ); 99 dict.insert("DateDay" , new int(OTodo::DateDay) );
100 dict.insert("DateMonth" , new int(OTodo::DateMonth) ); 100 dict.insert("DateMonth" , new int(OTodo::DateMonth) );
101 dict.insert("DateYear" , new int(OTodo::DateYear) ); 101 dict.insert("DateYear" , new int(OTodo::DateYear) );
102 dict.insert("Progress" , new int(OTodo::Progress) ); 102 dict.insert("Progress" , new int(OTodo::Progress) );
103 dict.insert("CompletedDate", new int(OTodo::CompletedDate) ); 103 dict.insert("CompletedDate", new int(OTodo::CompletedDate) );
104 dict.insert("StartDate", new int(OTodo::StartDate) ); 104 dict.insert("StartDate", new int(OTodo::StartDate) );
105 dict.insert("CrossReference", new int(OTodo::CrossReference) ); 105 dict.insert("CrossReference", new int(OTodo::CrossReference) );
106 dict.insert("State", new int(OTodo::State) ); 106 dict.insert("State", new int(OTodo::State) );
107 dict.insert("Alarms", new int(OTodo::Alarms) ); 107 dict.insert("Alarms", new int(OTodo::Alarms) );
108 dict.insert("Reminders", new int(OTodo::Reminders) ); 108 dict.insert("Reminders", new int(OTodo::Reminders) );
109 dict.insert("Notifiers", new int(OTodo::Notifiers) ); 109 dict.insert("Notifiers", new int(OTodo::Notifiers) );
110 dict.insert("Maintainer", new int(OTodo::Maintainer) ); 110 dict.insert("Maintainer", new int(OTodo::Maintainer) );
111 dict.insert("rtype", new int(FRType) ); 111 dict.insert("rtype", new int(FRType) );
112 dict.insert("rweekdays", new int(FRWeekdays) ); 112 dict.insert("rweekdays", new int(FRWeekdays) );
113 dict.insert("rposition", new int(FRPosition) ); 113 dict.insert("rposition", new int(FRPosition) );
114 dict.insert("rfreq", new int(FRFreq) ); 114 dict.insert("rfreq", new int(FRFreq) );
@@ -815,52 +815,54 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
815 continue; 815 continue;
816 } 816 }
817 817
818 if ((*it).isCompleted() && comp ) { 818 if ((*it).isCompleted() && comp ) {
819 continue; 819 continue;
820 } 820 }
821 821
822 822
823 OTodoXMLContainer* con = new OTodoXMLContainer(); 823 OTodoXMLContainer* con = new OTodoXMLContainer();
824 con->todo = (*it); 824 con->todo = (*it);
825 vector.insert(item, con ); 825 vector.insert(item, con );
826 item++; 826 item++;
827 } 827 }
828 vector.resize( item ); 828 vector.resize( item );
829 /* sort it now */ 829 /* sort it now */
830 vector.sort(); 830 vector.sort();
831 /* now get the uids */ 831 /* now get the uids */
832 QArray<int> array( vector.count() ); 832 QArray<int> array( vector.count() );
833 for (uint i= 0; i < vector.count(); i++ ) { 833 for (uint i= 0; i < vector.count(); i++ ) {
834 array[i] = ( vector.at(i) )->todo.uid(); 834 array[i] = ( vector.at(i) )->todo.uid();
835 } 835 }
836 return array; 836 return array;
837}; 837};
838void OTodoAccessXML::removeAllCompleted() { 838void OTodoAccessXML::removeAllCompleted() {
839 QMap<int, OTodo> events = m_events;
839 for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) { 840 for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) {
840 if ( (*it).isCompleted() ) 841 if ( (*it).isCompleted() )
841 m_events.remove( it ); 842 events.remove( it.key() );
842 } 843 }
844 m_events = events;
843} 845}
844QBitArray OTodoAccessXML::supports()const { 846QBitArray OTodoAccessXML::supports()const {
845 static QBitArray ar = sup(); 847 static QBitArray ar = sup();
846 return ar; 848 return ar;
847} 849}
848QBitArray OTodoAccessXML::sup() { 850QBitArray OTodoAccessXML::sup() {
849 QBitArray ar( OTodo::CompletedDate +1 ); 851 QBitArray ar( OTodo::CompletedDate +1 );
850 ar.fill( true ); 852 ar.fill( true );
851 ar[OTodo::CrossReference] = false; 853 ar[OTodo::CrossReference] = false;
852 ar[OTodo::State ] = false; 854 ar[OTodo::State ] = false;
853 ar[OTodo::Reminders] = false; 855 ar[OTodo::Reminders] = false;
854 ar[OTodo::Notifiers] = false; 856 ar[OTodo::Notifiers] = false;
855 ar[OTodo::Maintainer] = false; 857 ar[OTodo::Maintainer] = false;
856 858
857 return ar; 859 return ar;
858} 860}
859QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const 861QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const
860{ 862{
861 QArray<int> m_currentQuery( m_events.count() ); 863 QArray<int> m_currentQuery( m_events.count() );
862 uint arraycounter = 0; 864 uint arraycounter = 0;
863 865
864 QMap<int, OTodo>::ConstIterator it; 866 QMap<int, OTodo>::ConstIterator it;
865 for (it = m_events.begin(); it != m_events.end(); ++it ) { 867 for (it = m_events.begin(); it != m_events.end(); ++it ) {
866 if ( it.data().match( r ) ) 868 if ( it.data().match( r ) )