summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp21
-rw-r--r--korganizer/kotodoviewitem.cpp14
-rw-r--r--libkcal/incidence.cpp13
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/incidencebase.cpp13
-rw-r--r--libkcal/incidencebase.h2
6 files changed, 40 insertions, 25 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index b236c2d..4fc1194 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -142,10 +142,8 @@ bool ListItemVisitor::visit(Event *e)
142 mItem->setText(10, KOPrefs::instance()->calName( e->calID() )); 142 mItem->setText(10, KOPrefs::instance()->calName( e->calID() ));
143 mItem->setText(11, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); 143 mItem->setText(11, KGlobal::locale()->formatDateTime( e->lastModified(), true, true ));
144 mItem->setSortKey(11,e->lastModifiedSortKey());
144 145
145 QString key; 146 QString key;
146 QDate d = e->lastModified().date(); 147 QTime t;
147 QTime t = e->lastModified().time();
148 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() );
149 mItem->setSortKey(12,key);
150 t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 148 t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
151 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 149 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
@@ -201,9 +199,8 @@ bool ListItemVisitor::visit(Todo *t)
201 mItem->setText(10, KOPrefs::instance()->calName( t->calID() )); 199 mItem->setText(10, KOPrefs::instance()->calName( t->calID() ));
202 mItem->setText(11, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); 200 mItem->setText(11, KGlobal::locale()->formatDateTime( t->lastModified(), true, true ));
201 mItem->setSortKey(11,t->lastModifiedSortKey());
203 QString key; 202 QString key;
204 QDate d = t->lastModified().date(); 203 QDate d;
205 QTime tm = t->lastModified().time(); 204 QTime tm;
206 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() );
207 mItem->setSortKey(11,key);
208 if (t->hasDueDate()) { 205 if (t->hasDueDate()) {
209 d = t->dtDue().date(); 206 d = t->dtDue().date();
@@ -247,15 +244,11 @@ bool ListItemVisitor::visit(Journal * j)
247 mItem->setText(10, KOPrefs::instance()->calName( j->calID() )); 244 mItem->setText(10, KOPrefs::instance()->calName( j->calID() ));
248 mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); 245 mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true ));
246 mItem->setSortKey(11,j->lastModifiedSortKey());
249 247
250 QString key; 248 QString key;
251 QDate d = j->lastModified().date(); 249 QDate d;
252 QTime tm = j->lastModified().time();
253 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() );
254 mItem->setSortKey(12,key);
255 d = j->dtStart().date(); 250 d = j->dtStart().date();
256 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 251 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
257 mItem->setSortKey(1,key); 252 mItem->setSortKey(1,key);
258 mItem->setSortKey(7,key);
259
260 return true; 253 return true;
261} 254}
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index bdef94c..848e9e7 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -120,6 +120,4 @@ void KOTodoViewItem::construct()
120 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 120 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
121 121
122
123
124 keyd = ""; 122 keyd = "";
125 keyt = ""; 123 keyt = "";
@@ -161,16 +159,12 @@ void KOTodoViewItem::construct()
161 setText(11, KGlobal::locale()->formatDateTime( mTodo->lastModifiedSub(), true, true )); 159 setText(11, KGlobal::locale()->formatDateTime( mTodo->lastModifiedSub(), true, true ));
162 QString key; 160 QString key;
163 QDate d = mTodo->lastModified().date(); 161 QDate d;
164 QTime t = mTodo->lastModified().time(); 162 QTime t;
165 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); 163 setSortKey(9,mTodo->lastModifiedSortKey());
166 setSortKey(9,key);
167 d = mTodo->created().date(); 164 d = mTodo->created().date();
168 t = mTodo->created().time(); 165 t = mTodo->created().time();
169 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); 166 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() );
170 setSortKey(10,key); 167 setSortKey(10,key);
171 d = mTodo->lastModifiedSub().date(); 168 setSortKey(11,mTodo->lastModifiedSubSortKey());
172 t = mTodo->lastModifiedSub().time();
173 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() );
174 setSortKey(11,key);
175 169
176#if 0 170#if 0
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 39c14f5..fe9f854 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -343,4 +343,10 @@ void Incidence::setLastModifiedSubInvalid()
343 mRelatedTo->setLastModifiedSubInvalid(); 343 mRelatedTo->setLastModifiedSubInvalid();
344} 344}
345QString Incidence::lastModifiedSubSortKey() const
346{
347 if ( mLastModifiedSubSortKey.isEmpty() )
348 return lastModifiedSortKey();
349 return mLastModifiedSubSortKey;
350}
345QDateTime Incidence::lastModifiedSub() 351QDateTime Incidence::lastModifiedSub()
346{ 352{
@@ -356,4 +362,11 @@ QDateTime Incidence::lastModifiedSub()
356 mLastModifiedSub = inc->lastModifiedSub(); 362 mLastModifiedSub = inc->lastModifiedSub();
357 } 363 }
364 mLastModifiedSubSortKey.sprintf("%04d%02d%02d%02d%02d%02d",
365 mLastModifiedSub.date().year(),
366 mLastModifiedSub.date().month(),
367 mLastModifiedSub.date().day(),
368 mLastModifiedSub.time().hour(),
369 mLastModifiedSub.time().minute(),
370 mLastModifiedSub.time().second() );
358 return mLastModifiedSub; 371 return mLastModifiedSub;
359} 372}
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index eef9e64..dc49640 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -280,4 +280,5 @@ class Incidence : public IncidenceBase
280 bool isAnniversary() const; 280 bool isAnniversary() const;
281 QDateTime lastModifiedSub(); 281 QDateTime lastModifiedSub();
282 QString lastModifiedSubSortKey() const;
282 QString recurrenceText() const; 283 QString recurrenceText() const;
283 void setLastModifiedSubInvalid(); 284 void setLastModifiedSubInvalid();
@@ -293,4 +294,5 @@ protected:
293 private: 294 private:
294 void checkCategories(); 295 void checkCategories();
296 QString mLastModifiedSubSortKey;
295 bool mHoliday, mBirthday, mAnniversary; 297 bool mHoliday, mBirthday, mAnniversary;
296 int mRevision; 298 int mRevision;
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 022dead..cfef973 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -194,5 +194,5 @@ QString IncidenceBase::uid() const
194void IncidenceBase::setLastModifiedSubInvalid() 194void IncidenceBase::setLastModifiedSubInvalid()
195{ 195{
196 196 // virtual method
197} 197}
198void IncidenceBase::setLastModified(const QDateTime &lm) 198void IncidenceBase::setLastModified(const QDateTime &lm)
@@ -202,7 +202,18 @@ void IncidenceBase::setLastModified(const QDateTime &lm)
202 // Calendar::updateEvent(). 202 // Calendar::updateEvent().
203 mLastModified = getEvenTime(lm); 203 mLastModified = getEvenTime(lm);
204 mLastModifiedKey.sprintf("%04d%02d%02d%02d%02d%02d",
205 mLastModified.date().year(),
206 mLastModified.date().month(),
207 mLastModified.date().day(),
208 mLastModified.time().hour(),
209 mLastModified.time().minute(),
210 mLastModified.time().second() );
204 setLastModifiedSubInvalid(); 211 setLastModifiedSubInvalid();
205 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); 212 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
206} 213}
214QString IncidenceBase::lastModifiedSortKey() const
215{
216 return mLastModifiedKey;
217}
207 218
208QDateTime IncidenceBase::lastModified() const 219QDateTime IncidenceBase::lastModified() const
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 665c1f6..444d4c4 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -64,4 +64,5 @@ class IncidenceBase : public CustomProperties
64 /** Return the time the incidence was last modified. */ 64 /** Return the time the incidence was last modified. */
65 QDateTime lastModified() const; 65 QDateTime lastModified() const;
66 QString lastModifiedSortKey() const;
66 67
67 /** sets the organizer for the event */ 68 /** sets the organizer for the event */
@@ -161,4 +162,5 @@ class IncidenceBase : public CustomProperties
161 // base components 162 // base components
162 QString mOrganizer; 163 QString mOrganizer;
164 QString mLastModifiedKey;
163 QString mUid; 165 QString mUid;
164 int mCalID; 166 int mCalID;