summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index a1bf9ff..bbf83d9 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -23,195 +23,201 @@
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qwhatsthis.h> 35#include <qwhatsthis.h>
36#include <qregexp.h> 36#include <qregexp.h>
37 37
38#include <klocale.h> 38#include <klocale.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41#include <kglobal.h> 41#include <kglobal.h>
42 42
43#include <libkdepim/kpimglobalprefs.h> 43#include <libkdepim/kpimglobalprefs.h>
44#include <libkcal/calendar.h> 44#include <libkcal/calendar.h>
45#include <libkcal/calendarlocal.h> 45#include <libkcal/calendarlocal.h>
46#include <libkcal/icalformat.h> 46#include <libkcal/icalformat.h>
47#include <libkcal/vcalformat.h> 47#include <libkcal/vcalformat.h>
48#include <libkcal/recurrence.h> 48#include <libkcal/recurrence.h>
49#include <libkcal/filestorage.h> 49#include <libkcal/filestorage.h>
50#include <libkdepim/categoryselectdialog.h> 50#include <libkdepim/categoryselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57 57
58#ifndef KORG_NOPRINTER 58#ifndef KORG_NOPRINTER
59#include "calprinter.h" 59#include "calprinter.h"
60#endif 60#endif
61#include "koglobals.h" 61#include "koglobals.h"
62#include "koprefs.h" 62#include "koprefs.h"
63#include "kfiledialog.h" 63#include "kfiledialog.h"
64 64
65#include "kolistview.h" 65#include "kolistview.h"
66 66
67 67
68 68
69 69
70class KOListViewWhatsThis :public QWhatsThis 70class KOListViewWhatsThis :public QWhatsThis
71{ 71{
72public: 72public:
73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
74 74
75protected: 75protected:
76 virtual QString text( const QPoint& p) 76 virtual QString text( const QPoint& p)
77 { 77 {
78 return _view->getWhatsThisText(p) ; 78 return _view->getWhatsThisText(p) ;
79 } 79 }
80private: 80private:
81 QWidget* _wid; 81 QWidget* _wid;
82 KOListView * _view; 82 KOListView * _view;
83}; 83};
84 84
85 85
86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
87{ 87{
88 mItem = item; 88 mItem = item;
89 mDate = date; 89 mDate = date;
90} 90}
91 91
92ListItemVisitor::~ListItemVisitor() 92ListItemVisitor::~ListItemVisitor()
93{ 93{
94} 94}
95 95
96bool ListItemVisitor::visit(Event *e) 96bool ListItemVisitor::visit(Event *e)
97{ 97{
98 bool ok = false; 98 bool ok = false;
99 QString start, end; 99 QString start, end;
100 QDate ds, de; 100 QDate ds, de;
101 if ( e->doesRecur() ) { 101 if ( e->doesRecur() ) {
102 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 102 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
103 if ( ok ) { 103 if ( ok ) {
104 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 104 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
105 start = KGlobal::locale()->formatDate(ds,true); 105 start = KGlobal::locale()->formatDate(ds,true);
106 de = ds.addDays( days); 106 de = ds.addDays( days);
107 end = KGlobal::locale()->formatDate(de,true); 107 end = KGlobal::locale()->formatDate(de,true);
108 } 108 }
109 109
110 } 110 }
111 if ( ! ok ) { 111 if ( ! ok ) {
112 start =e->dtStartDateStr(); 112 start =e->dtStartDateStr();
113 end = e->dtEndDateStr(); 113 end = e->dtEndDateStr();
114 ds = e->dtStart().date(); 114 ds = e->dtStart().date();
115 de = e->dtEnd().date(); 115 de = e->dtEnd().date();
116 } 116 }
117 mItem->setText(0,e->summary()); 117 mItem->setText(0,e->summary());
118 mItem->setText(1,start); 118 mItem->setText(1,start);
119 mItem->setText(2,e->dtStartTimeStr()); 119 if ( e->doesFloat() )
120 mItem->setText(2,"---");
121 else
122 mItem->setText(2,e->dtStartTimeStr());
120 mItem->setText(3,end); 123 mItem->setText(3,end);
121 mItem->setText(4,e->dtEndTimeStr()); 124 if ( e->doesFloat() )
125 mItem->setText(4,"---");
126 else
127 mItem->setText(4,e->dtEndTimeStr());
122 if ( e->isAlarmEnabled() ) { 128 if ( e->isAlarmEnabled() ) {
123 mItem->setText(5,e->alarms().first()->offsetText() ); 129 mItem->setText(5,e->alarms().first()->offsetText() );
124 } else { 130 } else {
125 mItem->setText(5, i18n("No")); 131 mItem->setText(5, i18n("No"));
126 } 132 }
127 mItem->setText(6, e->recurrence()->recurrenceText()); 133 mItem->setText(6, e->recurrence()->recurrenceText());
128 if( ! e->doesRecur() ) 134 if( ! e->doesRecur() )
129 mItem->setSortKey( 6, "-" ); 135 mItem->setSortKey( 6, "-" );
130 mItem->setText(7,"---"); 136 mItem->setText(7,"---");
131 mItem->setText(8,"---"); 137 mItem->setText(8,"---");
132 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 138 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
133 mItem->setText(10,e->categoriesStr()); 139 mItem->setText(10,e->categoriesStr());
134 140
135 QString key; 141 QString key;
136 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 142 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
137 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 143 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
138 mItem->setSortKey(1,key); 144 mItem->setSortKey(1,key);
139 145
140 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 146 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
141 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 147 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
142 mItem->setSortKey(3,key); 148 mItem->setSortKey(3,key);
143 return true; 149 return true;
144} 150}
145 151
146bool ListItemVisitor::visit(Todo *t) 152bool ListItemVisitor::visit(Todo *t)
147{ 153{
148 mItem->setText(0,i18n("Todo: %1").arg(t->summary())); 154 mItem->setText(0,i18n("Todo: %1").arg(t->summary()));
149 if (t->hasStartDate()) { 155 if (t->hasStartDate()) {
150 mItem->setText(1,t->dtStartDateStr()); 156 mItem->setText(1,t->dtStartDateStr());
151 if (t->doesFloat()) { 157 if (t->doesFloat()) {
152 mItem->setText(2,"---"); 158 mItem->setText(2,"---");
153 } else { 159 } else {
154 mItem->setText(2,t->dtStartTimeStr()); 160 mItem->setText(2,t->dtStartTimeStr());
155 } 161 }
156 } else { 162 } else {
157 mItem->setText(1,"---"); 163 mItem->setText(1,"---");
158 mItem->setText(2,"---"); 164 mItem->setText(2,"---");
159 } 165 }
160 mItem->setText(3,"---"); 166 mItem->setText(3,"---");
161 mItem->setText(4,"---"); 167 mItem->setText(4,"---");
162 if ( t->isAlarmEnabled() ) { 168 if ( t->isAlarmEnabled() ) {
163 mItem->setText(5,t->alarms().first()->offsetText() ); 169 mItem->setText(5,t->alarms().first()->offsetText() );
164 } else { 170 } else {
165 mItem->setText(5, i18n("No")); 171 mItem->setText(5, i18n("No"));
166 } 172 }
167 mItem->setText(6, t->recurrence()->recurrenceText()); 173 mItem->setText(6, t->recurrence()->recurrenceText());
168 if( ! t->doesRecur() ) 174 if( ! t->doesRecur() )
169 mItem->setSortKey( 6, "-" ); 175 mItem->setSortKey( 6, "-" );
170 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
171 mItem->setText(7,t->dtDueDateStr()); 177 mItem->setText(7,t->dtDueDateStr());
172 if (t->doesFloat()) { 178 if (t->doesFloat()) {
173 mItem->setText(8,"---"); 179 mItem->setText(8,"---");
174 } else { 180 } else {
175 mItem->setText(8,t->dtDueTimeStr()); 181 mItem->setText(8,t->dtDueTimeStr());
176 } 182 }
177 } else { 183 } else {
178 mItem->setText(7,"---"); 184 mItem->setText(7,"---");
179 mItem->setText(8,"---"); 185 mItem->setText(8,"---");
180 } 186 }
181 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 187 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
182 mItem->setText(10,t->categoriesStr()); 188 mItem->setText(10,t->categoriesStr());
183 189
184 QString key; 190 QString key;
185 QDate d; 191 QDate d;
186 if (t->hasDueDate()) { 192 if (t->hasDueDate()) {
187 d = t->dtDue().date(); 193 d = t->dtDue().date();
188 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 194 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
189 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
190 mItem->setSortKey(7,key); 196 mItem->setSortKey(7,key);
191 } 197 }
192 if ( t->hasStartDate() ) { 198 if ( t->hasStartDate() ) {
193 d = t->dtStart().date(); 199 d = t->dtStart().date();
194 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 200 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 201 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
196 mItem->setSortKey(1,key); 202 mItem->setSortKey(1,key);
197 } 203 }
198 return true; 204 return true;
199} 205}
200 206
201bool ListItemVisitor::visit(Journal * j) 207bool ListItemVisitor::visit(Journal * j)
202{ 208{
203 QString des = j->description().left(30); 209 QString des = j->description().left(30);
204 des = des.simplifyWhiteSpace (); 210 des = des.simplifyWhiteSpace ();
205 des.replace (QRegExp ("\\n"),"" ); 211 des.replace (QRegExp ("\\n"),"" );
206 des.replace (QRegExp ("\\r"),"" ); 212 des.replace (QRegExp ("\\r"),"" );
207 mItem->setText(0,i18n("Journal: ")+des.left(25)); 213 mItem->setText(0,i18n("Journal: ")+des.left(25));
208 mItem->setText(1,j->dtStartDateStr()); 214 mItem->setText(1,j->dtStartDateStr());
209 mItem->setText(2,"---"); 215 mItem->setText(2,"---");
210 mItem->setText(3,"---"); 216 mItem->setText(3,"---");
211 mItem->setText(4,"---"); 217 mItem->setText(4,"---");
212 mItem->setText(5,"---"); 218 mItem->setText(5,"---");
213 mItem->setText(6,"---"); 219 mItem->setText(6,"---");
214 mItem->setText(7,j->dtStartDateStr()); 220 mItem->setText(7,j->dtStartDateStr());
215 mItem->setText(8,"---"); 221 mItem->setText(8,"---");
216 mItem->setText(9,"---"); 222 mItem->setText(9,"---");
217 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 223 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );