Diffstat (limited to 'libopie/pim/otodoaccessxml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 6 |
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 | |||
@@ -1,186 +1,186 @@ | |||
1 | #include <errno.h> | 1 | #include <errno.h> |
2 | #include <fcntl.h> | 2 | #include <fcntl.h> |
3 | 3 | ||
4 | #include <sys/mman.h> | 4 | #include <sys/mman.h> |
5 | #include <sys/stat.h> | 5 | #include <sys/stat.h> |
6 | #include <sys/types.h> | 6 | #include <sys/types.h> |
7 | 7 | ||
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | 9 | ||
10 | 10 | ||
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qvector.h> | 12 | #include <qvector.h> |
13 | 13 | ||
14 | #include <qpe/global.h> | 14 | #include <qpe/global.h> |
15 | #include <qpe/stringutil.h> | 15 | #include <qpe/stringutil.h> |
16 | #include <qpe/timeconversion.h> | 16 | #include <qpe/timeconversion.h> |
17 | 17 | ||
18 | #include "oconversion.h" | 18 | #include "oconversion.h" |
19 | #include "opimstate.h" | 19 | #include "opimstate.h" |
20 | #include "otimezone.h" | 20 | #include "otimezone.h" |
21 | #include "opimnotifymanager.h" | 21 | #include "opimnotifymanager.h" |
22 | #include "orecur.h" | 22 | #include "orecur.h" |
23 | #include "otodoaccessxml.h" | 23 | #include "otodoaccessxml.h" |
24 | 24 | ||
25 | namespace { | 25 | namespace { |
26 | time_t rp_end; | 26 | time_t rp_end; |
27 | ORecur* rec; | 27 | ORecur* rec; |
28 | ORecur *recur() { | 28 | ORecur *recur() { |
29 | if (!rec ) rec = new ORecur; | 29 | if (!rec ) rec = new ORecur; |
30 | return rec; | 30 | return rec; |
31 | } | 31 | } |
32 | int snd; | 32 | int snd; |
33 | enum MoreAttributes { | 33 | enum MoreAttributes { |
34 | FRType = OTodo::CompletedDate + 2, | 34 | FRType = OTodo::CompletedDate + 2, |
35 | FRWeekdays, | 35 | FRWeekdays, |
36 | FRPosition, | 36 | FRPosition, |
37 | FRFreq, | 37 | FRFreq, |
38 | FRHasEndDate, | 38 | FRHasEndDate, |
39 | FREndDate, | 39 | FREndDate, |
40 | FRStart, | 40 | FRStart, |
41 | FREnd | 41 | FREnd |
42 | }; | 42 | }; |
43 | // FROM TT again | 43 | // FROM TT again |
44 | char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) | 44 | char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) |
45 | { | 45 | { |
46 | char needleChar; | 46 | char needleChar; |
47 | char haystackChar; | 47 | char haystackChar; |
48 | if (!needle || !haystack || !hLen || !nLen) | 48 | if (!needle || !haystack || !hLen || !nLen) |
49 | return 0; | 49 | return 0; |
50 | 50 | ||
51 | const char* hsearch = haystack; | 51 | const char* hsearch = haystack; |
52 | 52 | ||
53 | if ((needleChar = *needle++) != 0) { | 53 | if ((needleChar = *needle++) != 0) { |
54 | nLen--; //(to make up for needle++) | 54 | nLen--; //(to make up for needle++) |
55 | do { | 55 | do { |
56 | do { | 56 | do { |
57 | if ((haystackChar = *hsearch++) == 0) | 57 | if ((haystackChar = *hsearch++) == 0) |
58 | return (0); | 58 | return (0); |
59 | if (hsearch >= haystack + hLen) | 59 | if (hsearch >= haystack + hLen) |
60 | return (0); | 60 | return (0); |
61 | } while (haystackChar != needleChar); | 61 | } while (haystackChar != needleChar); |
62 | } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); | 62 | } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); |
63 | hsearch--; | 63 | hsearch--; |
64 | } | 64 | } |
65 | return ((char *)hsearch); | 65 | return ((char *)hsearch); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
70 | OTodoAccessXML::OTodoAccessXML( const QString& appName, | 70 | OTodoAccessXML::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 | } |
79 | OTodoAccessXML::~OTodoAccessXML() { | 79 | OTodoAccessXML::~OTodoAccessXML() { |
80 | 80 | ||
81 | } | 81 | } |
82 | bool OTodoAccessXML::load() { | 82 | bool 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) ); |
115 | dict.insert("start", new int(FRStart) ); | 115 | dict.insert("start", new int(FRStart) ); |
116 | dict.insert("rhasenddate", new int(FRHasEndDate) ); | 116 | dict.insert("rhasenddate", new int(FRHasEndDate) ); |
117 | dict.insert("enddt", new int(FREndDate) ); | 117 | dict.insert("enddt", new int(FREndDate) ); |
118 | 118 | ||
119 | // here the custom XML parser from TT it's GPL | 119 | // here the custom XML parser from TT it's GPL |
120 | // but we want to push OpiePIM... to TT..... | 120 | // but we want to push OpiePIM... to TT..... |
121 | // mmap part from zecke :) | 121 | // mmap part from zecke :) |
122 | int fd = ::open( QFile::encodeName(m_file).data(), O_RDONLY ); | 122 | int fd = ::open( QFile::encodeName(m_file).data(), O_RDONLY ); |
123 | struct stat attribut; | 123 | struct stat attribut; |
124 | if ( fd < 0 ) return false; | 124 | if ( fd < 0 ) return false; |
125 | 125 | ||
126 | if ( fstat(fd, &attribut ) == -1 ) { | 126 | if ( fstat(fd, &attribut ) == -1 ) { |
127 | ::close( fd ); | 127 | ::close( fd ); |
128 | return false; | 128 | return false; |
129 | } | 129 | } |
130 | void* map_addr = ::mmap(NULL, attribut.st_size, PROT_READ, MAP_SHARED, fd, 0 ); | 130 | void* map_addr = ::mmap(NULL, attribut.st_size, PROT_READ, MAP_SHARED, fd, 0 ); |
131 | if ( map_addr == ( (caddr_t)-1) ) { | 131 | if ( map_addr == ( (caddr_t)-1) ) { |
132 | ::close(fd ); | 132 | ::close(fd ); |
133 | return false; | 133 | return false; |
134 | } | 134 | } |
135 | /* advise the kernel who we want to read it */ | 135 | /* advise the kernel who we want to read it */ |
136 | ::madvise( map_addr, attribut.st_size, MADV_SEQUENTIAL ); | 136 | ::madvise( map_addr, attribut.st_size, MADV_SEQUENTIAL ); |
137 | /* we do not the file any more */ | 137 | /* we do not the file any more */ |
138 | ::close( fd ); | 138 | ::close( fd ); |
139 | 139 | ||
140 | char* dt = (char*)map_addr; | 140 | char* dt = (char*)map_addr; |
141 | int len = attribut.st_size; | 141 | int len = attribut.st_size; |
142 | int i = 0; | 142 | int i = 0; |
143 | char *point; | 143 | char *point; |
144 | const char* collectionString = "<Task "; | 144 | const char* collectionString = "<Task "; |
145 | int strLen = strlen(collectionString); | 145 | int strLen = strlen(collectionString); |
146 | while ( ( point = strstrlen( dt+i, len -i, collectionString, strLen ) ) != 0l ) { | 146 | while ( ( point = strstrlen( dt+i, len -i, collectionString, strLen ) ) != 0l ) { |
147 | i = point -dt; | 147 | i = point -dt; |
148 | i+= strLen; | 148 | i+= strLen; |
149 | qWarning("Found a start at %d %d", i, (point-dt) ); | 149 | qWarning("Found a start at %d %d", i, (point-dt) ); |
150 | 150 | ||
151 | OTodo ev; | 151 | OTodo ev; |
152 | m_year = m_month = m_day = 0; | 152 | m_year = m_month = m_day = 0; |
153 | 153 | ||
154 | while ( TRUE ) { | 154 | while ( TRUE ) { |
155 | while ( i < len && (dt[i] == ' ' || dt[i] == '\n' || dt[i] == '\r') ) | 155 | while ( i < len && (dt[i] == ' ' || dt[i] == '\n' || dt[i] == '\r') ) |
156 | ++i; | 156 | ++i; |
157 | if ( i >= len-2 || (dt[i] == '/' && dt[i+1] == '>') ) | 157 | if ( i >= len-2 || (dt[i] == '/' && dt[i+1] == '>') ) |
158 | break; | 158 | break; |
159 | 159 | ||
160 | // we have another attribute, read it. | 160 | // we have another attribute, read it. |
161 | int j = i; | 161 | int j = i; |
162 | while ( j < len && dt[j] != '=' ) | 162 | while ( j < len && dt[j] != '=' ) |
163 | ++j; | 163 | ++j; |
164 | QCString attr( dt+i, j-i+1); | 164 | QCString attr( dt+i, j-i+1); |
165 | 165 | ||
166 | i = ++j; // skip = | 166 | i = ++j; // skip = |
167 | 167 | ||
168 | // find the start of quotes | 168 | // find the start of quotes |
169 | while ( i < len && dt[i] != '"' ) | 169 | while ( i < len && dt[i] != '"' ) |
170 | ++i; | 170 | ++i; |
171 | j = ++i; | 171 | j = ++i; |
172 | 172 | ||
173 | bool haveUtf = FALSE; | 173 | bool haveUtf = FALSE; |
174 | bool haveEnt = FALSE; | 174 | bool haveEnt = FALSE; |
175 | while ( j < len && dt[j] != '"' ) { | 175 | while ( j < len && dt[j] != '"' ) { |
176 | if ( ((unsigned char)dt[j]) > 0x7f ) | 176 | if ( ((unsigned char)dt[j]) > 0x7f ) |
177 | haveUtf = TRUE; | 177 | haveUtf = TRUE; |
178 | if ( dt[j] == '&' ) | 178 | if ( dt[j] == '&' ) |
179 | haveEnt = TRUE; | 179 | haveEnt = TRUE; |
180 | ++j; | 180 | ++j; |
181 | } | 181 | } |
182 | if ( i == j ) { | 182 | if ( i == j ) { |
183 | // empty value | 183 | // empty value |
184 | i = j + 1; | 184 | i = j + 1; |
185 | continue; | 185 | continue; |
186 | } | 186 | } |
@@ -743,132 +743,134 @@ public: | |||
743 | if ( ret ) | 743 | if ( ret ) |
744 | return ret; | 744 | return ret; |
745 | 745 | ||
746 | // default did not gave difference let's try it other way around | 746 | // default did not gave difference let's try it other way around |
747 | /* | 747 | /* |
748 | * General try if already checked if not test | 748 | * General try if already checked if not test |
749 | * and return | 749 | * and return |
750 | * 1.Completed | 750 | * 1.Completed |
751 | * 2.Priority | 751 | * 2.Priority |
752 | * 3.Description | 752 | * 3.Description |
753 | * 4.DueDate | 753 | * 4.DueDate |
754 | */ | 754 | */ |
755 | if (!seComp ) { | 755 | if (!seComp ) { |
756 | if ( (ret = completed( con1->todo, con2->todo ) ) ) { | 756 | if ( (ret = completed( con1->todo, con2->todo ) ) ) { |
757 | if (!m_asc ) ret *= -1; | 757 | if (!m_asc ) ret *= -1; |
758 | return ret; | 758 | return ret; |
759 | } | 759 | } |
760 | } | 760 | } |
761 | if (!sePrio ) { | 761 | if (!sePrio ) { |
762 | if ( (ret = priority( con1->todo, con2->todo ) ) ) { | 762 | if ( (ret = priority( con1->todo, con2->todo ) ) ) { |
763 | if (!m_asc ) ret *= -1; | 763 | if (!m_asc ) ret *= -1; |
764 | return ret; | 764 | return ret; |
765 | } | 765 | } |
766 | } | 766 | } |
767 | if (!seDesc ) { | 767 | if (!seDesc ) { |
768 | if ( (ret = description(con1->todo, con2->todo ) ) ) { | 768 | if ( (ret = description(con1->todo, con2->todo ) ) ) { |
769 | if (!m_asc) ret *= -1; | 769 | if (!m_asc) ret *= -1; |
770 | return ret; | 770 | return ret; |
771 | } | 771 | } |
772 | } | 772 | } |
773 | if (!seDeadline) { | 773 | if (!seDeadline) { |
774 | if ( (ret = deadline( con1->todo, con2->todo ) ) ) { | 774 | if ( (ret = deadline( con1->todo, con2->todo ) ) ) { |
775 | if (!m_asc) ret *= -1; | 775 | if (!m_asc) ret *= -1; |
776 | return ret; | 776 | return ret; |
777 | } | 777 | } |
778 | } | 778 | } |
779 | 779 | ||
780 | return 0; | 780 | return 0; |
781 | } | 781 | } |
782 | private: | 782 | private: |
783 | bool m_asc; | 783 | bool m_asc; |
784 | int m_sort; | 784 | int m_sort; |
785 | 785 | ||
786 | }; | 786 | }; |
787 | 787 | ||
788 | QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, | 788 | QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder, |
789 | int sortFilter, int cat ) { | 789 | int sortFilter, int cat ) { |
790 | OTodoXMLVector vector(m_events.count(), asc,sortOrder ); | 790 | OTodoXMLVector vector(m_events.count(), asc,sortOrder ); |
791 | QMap<int, OTodo>::Iterator it; | 791 | QMap<int, OTodo>::Iterator it; |
792 | int item = 0; | 792 | int item = 0; |
793 | 793 | ||
794 | bool bCat = sortFilter & 1 ? true : false; | 794 | bool bCat = sortFilter & 1 ? true : false; |
795 | bool bOnly = sortFilter & 2 ? true : false; | 795 | bool bOnly = sortFilter & 2 ? true : false; |
796 | bool comp = sortFilter & 4 ? true : false; | 796 | bool comp = sortFilter & 4 ? true : false; |
797 | for ( it = m_events.begin(); it != m_events.end(); ++it ) { | 797 | for ( it = m_events.begin(); it != m_events.end(); ++it ) { |
798 | 798 | ||
799 | /* show category */ | 799 | /* show category */ |
800 | /* -1 == unfiled */ | 800 | /* -1 == unfiled */ |
801 | if ( bCat && cat == -1 ) { | 801 | if ( bCat && cat == -1 ) { |
802 | if(!(*it).categories().isEmpty() ) | 802 | if(!(*it).categories().isEmpty() ) |
803 | continue; | 803 | continue; |
804 | }else if ( bCat && cat != 0) | 804 | }else if ( bCat && cat != 0) |
805 | if (!(*it).categories().contains( cat ) ) { | 805 | if (!(*it).categories().contains( cat ) ) { |
806 | continue; | 806 | continue; |
807 | } | 807 | } |
808 | /* isOverdue but we should not show overdue - why?*/ | 808 | /* isOverdue but we should not show overdue - why?*/ |
809 | /* if ( (*it).isOverdue() && !bOnly ) { | 809 | /* if ( (*it).isOverdue() && !bOnly ) { |
810 | qWarning("item is overdue but !bOnly"); | 810 | qWarning("item is overdue but !bOnly"); |
811 | continue; | 811 | continue; |
812 | } | 812 | } |
813 | */ | 813 | */ |
814 | if ( !(*it).isOverdue() && bOnly ) { | 814 | if ( !(*it).isOverdue() && bOnly ) { |
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 | }; |
838 | void OTodoAccessXML::removeAllCompleted() { | 838 | void 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 | } |
844 | QBitArray OTodoAccessXML::supports()const { | 846 | QBitArray OTodoAccessXML::supports()const { |
845 | static QBitArray ar = sup(); | 847 | static QBitArray ar = sup(); |
846 | return ar; | 848 | return ar; |
847 | } | 849 | } |
848 | QBitArray OTodoAccessXML::sup() { | 850 | QBitArray 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 | } |
859 | QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const | 861 | QArray<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 ) ) |
867 | m_currentQuery[arraycounter++] = it.data().uid(); | 869 | m_currentQuery[arraycounter++] = it.data().uid(); |
868 | 870 | ||
869 | } | 871 | } |
870 | // Shrink to fit.. | 872 | // Shrink to fit.. |
871 | m_currentQuery.resize(arraycounter); | 873 | m_currentQuery.resize(arraycounter); |
872 | 874 | ||
873 | return m_currentQuery; | 875 | return m_currentQuery; |
874 | } | 876 | } |