summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoviewitem.cpp2
-rw-r--r--korganizer/kotodoviewitem.h2
-rw-r--r--korganizer/koviewmanager.cpp2
-rw-r--r--korganizer/searchdialog.cpp22
-rw-r--r--korganizer/timespanview.cpp2
5 files changed, 15 insertions, 15 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index ead8628..21ecb73 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -1,457 +1,457 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qapp.h> 22#include <qapp.h>
23 23
24#include <kiconloader.h> 24#include <kiconloader.h>
25#include "kotodoviewitem.h" 25#include "kotodoviewitem.h"
26#include "kotodoview.h" 26#include "kotodoview.h"
27#include "koprefs.h" 27#include "koprefs.h"
28 28
29KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) 29KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo)
30 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 30 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
31{ 31{
32 construct(); 32 construct();
33} 33}
34 34
35KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) 35KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo )
36 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 36 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
37{ 37{
38 construct(); 38 construct();
39} 39}
40 40
41QString KOTodoViewItem::key(int column,bool) const 41QString KOTodoViewItem::key(int column,bool) const
42{ 42{
43 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 43 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
44 if (it == mKeyMap.end()) { 44 if (it == mKeyMap.end()) {
45 return text(column).lower(); 45 return text(column).lower();
46 } else { 46 } else {
47 return *it; 47 return *it;
48 } 48 }
49} 49}
50 50
51void KOTodoViewItem:: setup() 51void KOTodoViewItem:: setup()
52{ 52{
53 53
54 int h = 20; 54 int h = 20;
55 if ( listView () ) { 55 if ( listView () ) {
56 QFontMetrics fm ( listView ()->font () ); 56 QFontMetrics fm ( listView ()->font () );
57 h = fm.height(); 57 h = fm.height();
58 } 58 }
59 setHeight( h ); 59 setHeight( h );
60 60
61} 61}
62void KOTodoViewItem::setSortKey(int column,const QString &key) 62void KOTodoViewItem::setSortKey(int column,const QString &key)
63{ 63{
64 mKeyMap.insert(column,key); 64 mKeyMap.insert(column,key);
65} 65}
66 66
67#if QT_VERSION >= 300 67#if QT_VERSION >= 0x030000
68void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, 68void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w,
69 int y,int h) 69 int y,int h)
70{ 70{
71 QListViewItem::paintBranches(p,cg,w,y,h); 71 QListViewItem::paintBranches(p,cg,w,y,h);
72} 72}
73#else 73#else
74#endif 74#endif
75 75
76void KOTodoViewItem::construct() 76void KOTodoViewItem::construct()
77{ 77{
78 // qDebug("KOTodoViewItem::construct() "); 78 // qDebug("KOTodoViewItem::construct() ");
79 m_init = true; 79 m_init = true;
80 QString keyd = "=="; 80 QString keyd = "==";
81 QString keyt = "=="; 81 QString keyt = "==";
82 QString skeyd = "=="; 82 QString skeyd = "==";
83 QString skeyt = "=="; 83 QString skeyt = "==";
84 84
85 setOn(mTodo->isCompleted()); 85 setOn(mTodo->isCompleted());
86 setText(0,mTodo->summary()); 86 setText(0,mTodo->summary());
87 setText(1,QString::number(mTodo->priority())); 87 setText(1,QString::number(mTodo->priority()));
88 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 88 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
89 if (mTodo->percentComplete()<100) { 89 if (mTodo->percentComplete()<100) {
90 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 90 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
91 else setSortKey(2,QString::number(mTodo->percentComplete())); 91 else setSortKey(2,QString::number(mTodo->percentComplete()));
92 } 92 }
93 else { 93 else {
94 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 94 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
95 else setSortKey(2,QString::number(99)); 95 else setSortKey(2,QString::number(99));
96 } 96 }
97 if (mTodo->hasDueDate()) { 97 if (mTodo->hasDueDate()) {
98 setText(3, mTodo->dtDueDateStr()); 98 setText(3, mTodo->dtDueDateStr());
99 QDate d = mTodo->dtDue().date(); 99 QDate d = mTodo->dtDue().date();
100 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 100 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
101 // setSortKey(3,keyd); 101 // setSortKey(3,keyd);
102 if (mTodo->doesFloat()) { 102 if (mTodo->doesFloat()) {
103 setText(4,""); 103 setText(4,"");
104 } 104 }
105 else { 105 else {
106 setText(4,mTodo->dtDueTimeStr()); 106 setText(4,mTodo->dtDueTimeStr());
107 QTime t = mTodo->dtDue().time(); 107 QTime t = mTodo->dtDue().time();
108 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 108 keyt.sprintf("%02d%02d",t.hour(),t.minute());
109 //setSortKey(4,keyt); 109 //setSortKey(4,keyt);
110 } 110 }
111 } else { 111 } else {
112 setText(3,""); 112 setText(3,"");
113 setText(4,""); 113 setText(4,"");
114 } 114 }
115 setSortKey(3,keyd); 115 setSortKey(3,keyd);
116 setSortKey(4,keyt); 116 setSortKey(4,keyt);
117 117
118 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); 118 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
119 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 119 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
120 120
121 121
122 122
123 if (mTodo->hasStartDate()) { 123 if (mTodo->hasStartDate()) {
124 setText(5, mTodo->dtStartDateStr()); 124 setText(5, mTodo->dtStartDateStr());
125 QDate d = mTodo->dtStart().date(); 125 QDate d = mTodo->dtStart().date();
126 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 126 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
127 127
128 if (mTodo->doesFloat()) { 128 if (mTodo->doesFloat()) {
129 setText(6,""); 129 setText(6,"");
130 } 130 }
131 else { 131 else {
132 setText(6,mTodo->dtStartTimeStr()); 132 setText(6,mTodo->dtStartTimeStr());
133 QTime t = mTodo->dtStart().time(); 133 QTime t = mTodo->dtStart().time();
134 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 134 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
135 135
136 } 136 }
137 } else { 137 } else {
138 setText(5,""); 138 setText(5,"");
139 setText(6,""); 139 setText(6,"");
140 } 140 }
141 setSortKey(5,skeyd); 141 setSortKey(5,skeyd);
142 setSortKey(6,skeyt); 142 setSortKey(6,skeyt);
143 143
144 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); 144 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
145 setText(8,mTodo->categoriesStr()); 145 setText(8,mTodo->categoriesStr());
146 146
147#if 0 147#if 0
148 // Find sort id in description. It's the text behind the last '#' character 148 // Find sort id in description. It's the text behind the last '#' character
149 // found in the description. White spaces are removed from beginning and end 149 // found in the description. White spaces are removed from beginning and end
150 // of sort id. 150 // of sort id.
151 int pos = mTodo->description().findRev('#'); 151 int pos = mTodo->description().findRev('#');
152 if (pos < 0) { 152 if (pos < 0) {
153 setText(6,""); 153 setText(6,"");
154 } else { 154 } else {
155 QString str = mTodo->description().mid(pos+1); 155 QString str = mTodo->description().mid(pos+1);
156 str.stripWhiteSpace(); 156 str.stripWhiteSpace();
157 setText(6,str); 157 setText(6,str);
158 } 158 }
159#endif 159#endif
160 160
161 m_known = false; 161 m_known = false;
162 m_init = false; 162 m_init = false;
163 163
164 setMyPixmap(); 164 setMyPixmap();
165 165
166} 166}
167void KOTodoViewItem::setMyPixmap() 167void KOTodoViewItem::setMyPixmap()
168{ 168{
169 int size = 5; 169 int size = 5;
170 QPixmap pixi = QPixmap( 1, 1 ); 170 QPixmap pixi = QPixmap( 1, 1 );
171 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { 171 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) {
172// pixi = SmallIcon("redcross16"); 172// pixi = SmallIcon("redcross16");
173// } else { 173// } else {
174 QPainter p; 174 QPainter p;
175 175
176 int pixSize = 0; 176 int pixSize = 0;
177 QPixmap pPix = QPixmap( size, size ); 177 QPixmap pPix = QPixmap( size, size );
178 if ( mTodo->description().length() > 0 ) { 178 if ( mTodo->description().length() > 0 ) {
179 pixi.resize(size, pixSize+size); 179 pixi.resize(size, pixSize+size);
180 pPix.fill( Qt::darkGreen ); 180 pPix.fill( Qt::darkGreen );
181 p.begin( &pixi ); 181 p.begin( &pixi );
182 p. drawPixmap ( 0, pixSize, pPix); 182 p. drawPixmap ( 0, pixSize, pPix);
183 p.end(); 183 p.end();
184 pixSize += size; 184 pixSize += size;
185 } 185 }
186 if ( mTodo->isAlarmEnabled() ) { 186 if ( mTodo->isAlarmEnabled() ) {
187 pixi.resize(size, pixSize+size); 187 pixi.resize(size, pixSize+size);
188 pPix.fill( Qt::red ); 188 pPix.fill( Qt::red );
189 p.begin( &pixi ); 189 p.begin( &pixi );
190 p. drawPixmap ( 0, pixSize, pPix); 190 p. drawPixmap ( 0, pixSize, pPix);
191 p.end(); 191 p.end();
192 pixSize += size; 192 pixSize += size;
193 } 193 }
194 // } 194 // }
195 if ( pixi.width() > 1 ) { 195 if ( pixi.width() > 1 ) {
196 setPixmap ( 0,pixi ) ; 196 setPixmap ( 0,pixi ) ;
197 } else { 197 } else {
198 setPixmap ( 0,QPixmap() ) ; 198 setPixmap ( 0,QPixmap() ) ;
199 } 199 }
200} 200}
201void KOTodoViewItem::stateChange(bool state) 201void KOTodoViewItem::stateChange(bool state)
202{ 202{
203 // qDebug("KOTodoViewItem::stateChange "); 203 // qDebug("KOTodoViewItem::stateChange ");
204 // do not change setting on startup 204 // do not change setting on startup
205 if ( m_init ) return; 205 if ( m_init ) return;
206 206
207 kdDebug() << "State changed, modified " << state << endl; 207 kdDebug() << "State changed, modified " << state << endl;
208 QString keyd = "=="; 208 QString keyd = "==";
209 QString keyt = "=="; 209 QString keyt = "==";
210 210
211 if (state) mTodo->setCompleted(state); 211 if (state) mTodo->setCompleted(state);
212 else mTodo->setPercentComplete(0); 212 else mTodo->setPercentComplete(0);
213 if (isOn()!=state) { 213 if (isOn()!=state) {
214 setOn(state); 214 setOn(state);
215 } 215 }
216 216
217 if (mTodo->hasDueDate()) { 217 if (mTodo->hasDueDate()) {
218 setText(3, mTodo->dtDueDateStr()); 218 setText(3, mTodo->dtDueDateStr());
219 QDate d = mTodo->dtDue().date(); 219 QDate d = mTodo->dtDue().date();
220 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 220 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
221 setSortKey(3,keyd); 221 setSortKey(3,keyd);
222 if (mTodo->doesFloat()) { 222 if (mTodo->doesFloat()) {
223 setText(4,""); 223 setText(4,"");
224 } 224 }
225 else { 225 else {
226 setText(4,mTodo->dtDueTimeStr()); 226 setText(4,mTodo->dtDueTimeStr());
227 QTime t = mTodo->dtDue().time(); 227 QTime t = mTodo->dtDue().time();
228 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 228 keyt.sprintf("%02d%02d",t.hour(),t.minute());
229 setSortKey(4,keyt); 229 setSortKey(4,keyt);
230 } 230 }
231 } 231 }
232 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); 232 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);
233 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 233 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
234 234
235 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 235 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
236 if (mTodo->percentComplete()<100) { 236 if (mTodo->percentComplete()<100) {
237 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 237 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
238 else setSortKey(2,QString::number(mTodo->percentComplete())); 238 else setSortKey(2,QString::number(mTodo->percentComplete()));
239 } 239 }
240 else { 240 else {
241 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 241 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
242 else setSortKey(2,QString::number(99)); 242 else setSortKey(2,QString::number(99));
243 } 243 }
244 QListViewItem * myChild = firstChild(); 244 QListViewItem * myChild = firstChild();
245 KOTodoViewItem *item; 245 KOTodoViewItem *item;
246 while( myChild ) { 246 while( myChild ) {
247 item = static_cast<KOTodoViewItem*>(myChild); 247 item = static_cast<KOTodoViewItem*>(myChild);
248 item->stateChange(state); 248 item->stateChange(state);
249 myChild = myChild->nextSibling(); 249 myChild = myChild->nextSibling();
250 } 250 }
251 mTodoView->modified(true); 251 mTodoView->modified(true);
252 setMyPixmap(); 252 setMyPixmap();
253 mTodoView->setTodoModified( mTodo ); 253 mTodoView->setTodoModified( mTodo );
254} 254}
255 255
256bool KOTodoViewItem::isAlternate() 256bool KOTodoViewItem::isAlternate()
257{ 257{
258#ifndef KORG_NOLVALTERNATION 258#ifndef KORG_NOLVALTERNATION
259 KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 259 KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
260 if (lv && lv->alternateBackground().isValid()) 260 if (lv && lv->alternateBackground().isValid())
261 { 261 {
262 KOTodoViewItem *above = 0; 262 KOTodoViewItem *above = 0;
263 above = dynamic_cast<KOTodoViewItem *>(itemAbove()); 263 above = dynamic_cast<KOTodoViewItem *>(itemAbove());
264 m_known = above ? above->m_known : true; 264 m_known = above ? above->m_known : true;
265 if (m_known) 265 if (m_known)
266 { 266 {
267 m_odd = above ? !above->m_odd : false; 267 m_odd = above ? !above->m_odd : false;
268 } 268 }
269 else 269 else
270 { 270 {
271 KOTodoViewItem *item; 271 KOTodoViewItem *item;
272 bool previous = true; 272 bool previous = true;
273 if (QListViewItem::parent()) 273 if (QListViewItem::parent())
274 { 274 {
275 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); 275 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent());
276 if (item) 276 if (item)
277 previous = item->m_odd; 277 previous = item->m_odd;
278 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); 278 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild());
279 } 279 }
280 else 280 else
281 { 281 {
282 item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); 282 item = dynamic_cast<KOTodoViewItem *>(lv->firstChild());
283 } 283 }
284 284
285 while(item) 285 while(item)
286 { 286 {
287 item->m_odd = previous = !previous; 287 item->m_odd = previous = !previous;
288 item->m_known = true; 288 item->m_known = true;
289 item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); 289 item = dynamic_cast<KOTodoViewItem *>(item->nextSibling());
290 } 290 }
291 } 291 }
292 return m_odd; 292 return m_odd;
293 } 293 }
294 return false; 294 return false;
295#else 295#else
296 return false; 296 return false;
297#endif 297#endif
298} 298}
299 299
300void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) 300void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
301{ 301{
302 QColorGroup _cg = cg; 302 QColorGroup _cg = cg;
303 QColorGroup::ColorRole role; 303 QColorGroup::ColorRole role;
304 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) 304 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor )
305 role = QColorGroup::Text; 305 role = QColorGroup::Text;
306 else 306 else
307 role = QColorGroup::Base; 307 role = QColorGroup::Base;
308 //#ifndef KORG_NOLVALTERNATION 308 //#ifndef KORG_NOLVALTERNATION
309 // if (isAlternate()) 309 // if (isAlternate())
310 // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); 310 // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground());
311 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; 311 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors;
312 QColor colorToSet; 312 QColor colorToSet;
313 if ( setColor ) { 313 if ( setColor ) {
314 QStringList categories = mTodo->categories(); 314 QStringList categories = mTodo->categories();
315 QString cat = categories.first(); 315 QString cat = categories.first();
316 if ( !cat.isEmpty()) { 316 if ( !cat.isEmpty()) {
317 colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); 317 colorToSet = *(KOPrefs::instance()->categoryColor(cat) );
318 } else 318 } else
319 setColor = false; 319 setColor = false;
320 } 320 }
321 if (mTodo->hasDueDate()) { 321 if (mTodo->hasDueDate()) {
322 if (mTodo->dtDue().date()==QDate::currentDate() && 322 if (mTodo->dtDue().date()==QDate::currentDate() &&
323 !mTodo->isCompleted()) { 323 !mTodo->isCompleted()) {
324 //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor); 324 //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor);
325 colorToSet = KOPrefs::instance()->mTodoDueTodayColor; 325 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
326 setColor = true; 326 setColor = true;
327 } 327 }
328 if (mTodo->dtDue().date() < QDate::currentDate() && 328 if (mTodo->dtDue().date() < QDate::currentDate() &&
329 !mTodo->isCompleted()) { 329 !mTodo->isCompleted()) {
330 //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); 330 //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor);
331 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 331 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
332 setColor = true; 332 setColor = true;
333 } 333 }
334 } 334 }
335 335
336 if ( setColor ) { 336 if ( setColor ) {
337 _cg.setColor(role,colorToSet ); 337 _cg.setColor(role,colorToSet );
338 if ( role == QColorGroup::Base) { 338 if ( role == QColorGroup::Base) {
339 int rgb = colorToSet.red(); 339 int rgb = colorToSet.red();
340 rgb += colorToSet.blue()/2; 340 rgb += colorToSet.blue()/2;
341 rgb += colorToSet.green(); 341 rgb += colorToSet.green();
342 if ( rgb < 200 ) 342 if ( rgb < 200 )
343 _cg.setColor(QColorGroup::Text,Qt::white ); 343 _cg.setColor(QColorGroup::Text,Qt::white );
344 } 344 }
345 } 345 }
346 //#endif 346 //#endif
347 if ( column > 0 ){ 347 if ( column > 0 ){
348 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { 348 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
349 p->save(); 349 p->save();
350 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); 350 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
351 351
352 p->fillRect( 0, 0, width, height(), _cg.base() ); // background 352 p->fillRect( 0, 0, width, height(), _cg.base() ); // background
353 // p->setPen(Qt::black ); //border 353 // p->setPen(Qt::black ); //border
354 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling 354 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling
355 QColor fc = KOPrefs::instance()->mHighlightColor; 355 QColor fc = KOPrefs::instance()->mHighlightColor;
356 if ( mTodo->percentComplete() == 100 ) 356 if ( mTodo->percentComplete() == 100 )
357 fc = darkGreen; 357 fc = darkGreen;
358 p->drawRect( 2, 2, width-4, height()-4); 358 p->drawRect( 2, 2, width-4, height()-4);
359 p->fillRect( 3, 3, progress, height()-6, 359 p->fillRect( 3, 3, progress, height()-6,
360 fc ); 360 fc );
361 p->restore(); 361 p->restore();
362 } else { 362 } else {
363 QCheckListItem::paintCell(p, _cg, column, width, alignment); 363 QCheckListItem::paintCell(p, _cg, column, width, alignment);
364 } 364 }
365 return; 365 return;
366 } 366 }
367 367
368 int align = alignment; 368 int align = alignment;
369 369
370 if ( !p ) 370 if ( !p )
371 return; 371 return;
372 372
373 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); 373 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) );
374 374
375 QListView *lv = listView(); 375 QListView *lv = listView();
376 if ( !lv ) 376 if ( !lv )
377 return; 377 return;
378 int marg = 2;//lv->itemMargin(); 378 int marg = 2;//lv->itemMargin();
379 int r = 0; 379 int r = 0;
380 QCheckListItem::Type myType = QCheckListItem::CheckBox; 380 QCheckListItem::Type myType = QCheckListItem::CheckBox;
381 int BoxSize = 20; 381 int BoxSize = 20;
382 int boxOffset = 2; 382 int boxOffset = 2;
383 int xOffset = 2; 383 int xOffset = 2;
384 if (qApp->desktop()->width() < 300 ) { 384 if (qApp->desktop()->width() < 300 ) {
385 BoxSize = 14; 385 BoxSize = 14;
386 boxOffset = -1; 386 boxOffset = -1;
387 xOffset = 1; 387 xOffset = 1;
388 // marg = 0; 388 // marg = 0;
389 } 389 }
390 if ( height() < BoxSize ) { 390 if ( height() < BoxSize ) {
391 boxOffset = boxOffset - ((BoxSize - height())/2) ; 391 boxOffset = boxOffset - ((BoxSize - height())/2) ;
392 // qDebug("boxOffset %d height %d", boxOffset, height() ); 392 // qDebug("boxOffset %d height %d", boxOffset, height() );
393 BoxSize = height(); 393 BoxSize = height();
394 394
395 } 395 }
396 //bool winStyle = lv->style() == WindowsStyle; 396 //bool winStyle = lv->style() == WindowsStyle;
397 397
398 int lineStart = 5; 398 int lineStart = 5;
399 if ( myType == Controller ) { 399 if ( myType == Controller ) {
400 if ( !pixmap( 0 ) ) 400 if ( !pixmap( 0 ) )
401 r += BoxSize + 4; 401 r += BoxSize + 4;
402 } else { 402 } else {
403 ASSERT( lv ); //### 403 ASSERT( lv ); //###
404 //QFontMetrics fm( lv->font() ); 404 //QFontMetrics fm( lv->font() );
405 //int d = fm.height(); 405 //int d = fm.height();
406 int x = 0; 406 int x = 0;
407 int y = (height() - BoxSize) / 2; 407 int y = (height() - BoxSize) / 2;
408 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); 408 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) );
409 if ( myType == CheckBox ) { 409 if ( myType == CheckBox ) {
410 if ( isEnabled() ) 410 if ( isEnabled() )
411 p->setPen( QPen( _cg.text(), 1 ) ); 411 p->setPen( QPen( _cg.text(), 1 ) );
412 else 412 else
413 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); 413 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) );
414 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); 414 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 );
415 lineStart = x+marg; 415 lineStart = x+marg;
416 ///////////////////// 416 /////////////////////
417 x++; 417 x++;
418 y++; 418 y++;
419 if ( isOn() ) { 419 if ( isOn() ) {
420 QPointArray a( 7*2 ); 420 QPointArray a( 7*2 );
421 int i, xx, yy; 421 int i, xx, yy;
422 xx = x+xOffset+marg+(boxOffset/2); 422 xx = x+xOffset+marg+(boxOffset/2);
423 yy = y+5+boxOffset; 423 yy = y+5+boxOffset;
424 for ( i=0; i<3; i++ ) { 424 for ( i=0; i<3; i++ ) {
425 a.setPoint( 2*i, xx, yy ); 425 a.setPoint( 2*i, xx, yy );
426 a.setPoint( 2*i+1, xx, yy+2 ); 426 a.setPoint( 2*i+1, xx, yy+2 );
427 // qDebug(" "); 427 // qDebug(" ");
428 xx++; yy++; 428 xx++; yy++;
429 } 429 }
430 yy -= 2; 430 yy -= 2;
431 for ( i=3; i<7; i++ ) { 431 for ( i=3; i<7; i++ ) {
432 a.setPoint( 2*i, xx, yy ); 432 a.setPoint( 2*i, xx, yy );
433 a.setPoint( 2*i+1, xx, yy+2 ); 433 a.setPoint( 2*i+1, xx, yy+2 );
434 xx++; yy--; 434 xx++; yy--;
435 } 435 }
436 p->setPen( darkGreen ); 436 p->setPen( darkGreen );
437 p->drawLineSegments( a ); 437 p->drawLineSegments( a );
438 } 438 }
439 //////////////////////// 439 ////////////////////////
440 } 440 }
441 r += BoxSize + 4; 441 r += BoxSize + 4;
442 } 442 }
443 443
444 p->translate( r, 0 ); 444 p->translate( r, 0 );
445 p->setPen( QPen( _cg.text() ) ); 445 p->setPen( QPen( _cg.text() ) );
446 QListViewItem::paintCell( p, _cg, column, width - r, align ); 446 QListViewItem::paintCell( p, _cg, column, width - r, align );
447 if ( mTodo->cancelled () ) { 447 if ( mTodo->cancelled () ) {
448 p->setPen( black ); 448 p->setPen( black );
449 QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); 449 QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() );
450 int wid = br.width() +lineStart; 450 int wid = br.width() +lineStart;
451 if ( wid > width-3 ) 451 if ( wid > width-3 )
452 wid = width-3; 452 wid = width-3;
453 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); 453 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 );
454 454
455 } 455 }
456 456
457} 457}
diff --git a/korganizer/kotodoviewitem.h b/korganizer/kotodoviewitem.h
index 74dbe98..bd024c8 100644
--- a/korganizer/kotodoviewitem.h
+++ b/korganizer/kotodoviewitem.h
@@ -1,93 +1,93 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOTODOVIEWITEM_H 19#ifndef KOTODOVIEWITEM_H
20#define KOTODOVIEWITEM_H 20#define KOTODOVIEWITEM_H
21 21
22#include <qfont.h> 22#include <qfont.h>
23#include <qfontmetrics.h> 23#include <qfontmetrics.h>
24#include <qlineedit.h> 24#include <qlineedit.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26#include <qstrlist.h> 26#include <qstrlist.h>
27#include <qlistbox.h> 27#include <qlistbox.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qmap.h> 30#include <qmap.h>
31#include <qlistview.h> 31#include <qlistview.h>
32#include <qpainter.h> 32#include <qpainter.h>
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35#include <libkcal/todo.h> 35#include <libkcal/todo.h>
36 36
37using namespace KCal; 37using namespace KCal;
38 38
39class KOTodoView; 39class KOTodoView;
40 40
41/** 41/**
42 This class provides a way of displaying a single Event of Todo-Type in a 42 This class provides a way of displaying a single Event of Todo-Type in a
43 KTodoView. 43 KTodoView.
44 44
45 @author Cornelius Schumacher <schumacher@kde.org> 45 @author Cornelius Schumacher <schumacher@kde.org>
46 @see KOTodoView 46 @see KOTodoView
47*/ 47*/
48class KOTodoViewItem : public QCheckListItem 48class KOTodoViewItem : public QCheckListItem
49{ 49{
50 public: 50 public:
51 /** 51 /**
52 Constructor. 52 Constructor.
53 53
54 @param parent is the list view to which this item belongs. 54 @param parent is the list view to which this item belongs.
55 @param ev is the event to have the item display information for. 55 @param ev is the event to have the item display information for.
56 */ 56 */
57 KOTodoViewItem(QListView *parent, Todo *todo, KOTodoView *kotodo); 57 KOTodoViewItem(QListView *parent, Todo *todo, KOTodoView *kotodo);
58 KOTodoViewItem(KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo); 58 KOTodoViewItem(KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo);
59 //~KOTodoViewItem() { qDebug("~KOTodoViewItem() %s ", text(0).latin1() );} 59 //~KOTodoViewItem() { qDebug("~KOTodoViewItem() %s ", text(0).latin1() );}
60 60
61 void construct(); 61 void construct();
62 62
63 Todo *todo() { return mTodo; } 63 Todo *todo() { return mTodo; }
64 64
65 QString key(int, bool) const; 65 QString key(int, bool) const;
66 66
67 void setSortKey(int column,const QString &key); 67 void setSortKey(int column,const QString &key);
68 68
69 bool isAlternate(); 69 bool isAlternate();
70 70
71 virtual void paintCell(QPainter *p, const QColorGroup &cg, 71 virtual void paintCell(QPainter *p, const QColorGroup &cg,
72 int column, int width, int alignment); 72 int column, int width, int alignment);
73 virtual void setup(); 73 virtual void setup();
74 protected: 74 protected:
75#if QT_VERSION >= 300 75#if QT_VERSION >= 0x030000
76 void paintBranches(QPainter *p,const QColorGroup & cg,int w,int y,int h); 76 void paintBranches(QPainter *p,const QColorGroup & cg,int w,int y,int h);
77#else 77#else
78#endif 78#endif
79 virtual void stateChange(bool); 79 virtual void stateChange(bool);
80 void setMyPixmap(); 80 void setMyPixmap();
81 81
82 private: 82 private:
83 Todo *mTodo; 83 Todo *mTodo;
84 KOTodoView *mTodoView; 84 KOTodoView *mTodoView;
85 85
86 QMap<int,QString> mKeyMap; 86 QMap<int,QString> mKeyMap;
87 uint m_odd : 1; 87 uint m_odd : 1;
88 uint m_known : 1; 88 uint m_known : 1;
89 uint m_unused : 30; 89 uint m_unused : 30;
90 bool m_init; 90 bool m_init;
91}; 91};
92 92
93#endif 93#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index f6b7718..e255b83 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,588 +1,588 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27 27
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35#include <qdatetime.h> 35#include <qdatetime.h>
36#include "calendarview.h" 36#include "calendarview.h"
37#include "datenavigator.h" 37#include "datenavigator.h"
38#include "kotodoview.h" 38#include "kotodoview.h"
39#include "koagendaview.h" 39#include "koagendaview.h"
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48#include "kdatenavigator.h" 48#include "kdatenavigator.h"
49 49
50#include "koviewmanager.h" 50#include "koviewmanager.h"
51//extern bool externFlagMonthviewBlockPainting; 51//extern bool externFlagMonthviewBlockPainting;
52 52
53//bool globalFlagBlockPainting = false; 53//bool globalFlagBlockPainting = false;
54int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
55int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
56int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
61 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
62{ 62{
63 mCurrentView = 0; 63 mCurrentView = 0;
64 64
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") showMonthView(); 91 else if (view == "Month") showMonthView();
92 else if (view == "List") showListView(); 92 else if (view == "List") showListView();
93 else if (view == "Journal") showJournalView(); 93 else if (view == "Journal") showJournalView();
94 else if (view == "TimeSpan") showTimeSpanView(); 94 else if (view == "TimeSpan") showTimeSpanView();
95 else if (view == "Todo") showTodoView(); 95 else if (view == "Todo") showTodoView();
96 else { 96 else {
97 showAgendaView(); 97 showAgendaView();
98 } 98 }
99} 99}
100 100
101void KOViewManager::writeSettings(KConfig *config) 101void KOViewManager::writeSettings(KConfig *config)
102{ 102{
103 config->setGroup("General"); 103 config->setGroup("General");
104 104
105 QString view; 105 QString view;
106 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 106 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
107 else if (mCurrentView == mMonthView) view = "Month"; 107 else if (mCurrentView == mMonthView) view = "Month";
108 else if (mCurrentView == mListView) view = "List"; 108 else if (mCurrentView == mListView) view = "List";
109 else if (mCurrentView == mJournalView) view = "Journal"; 109 else if (mCurrentView == mJournalView) view = "Journal";
110 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 110 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
111 else if (mCurrentView == mTodoView) view = "Todo"; 111 else if (mCurrentView == mTodoView) view = "Todo";
112 else view = "Agenda"; 112 else view = "Agenda";
113 113
114 config->writeEntry("Current View",view); 114 config->writeEntry("Current View",view);
115 115
116 if (mAgendaView) { 116 if (mAgendaView) {
117 mAgendaView->writeSettings(config); 117 mAgendaView->writeSettings(config);
118 } 118 }
119 if (mTimeSpanView) { 119 if (mTimeSpanView) {
120 mTimeSpanView->writeSettings(config); 120 mTimeSpanView->writeSettings(config);
121 } 121 }
122 if (mListView) { 122 if (mListView) {
123 mListView->writeSettings(config); 123 mListView->writeSettings(config);
124 } 124 }
125 if (mTodoView) { 125 if (mTodoView) {
126 mTodoView->saveLayout(config,"Todo View"); 126 mTodoView->saveLayout(config,"Todo View");
127 } 127 }
128} 128}
129 129
130void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 130void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
131{ 131{
132 132
133 //mFlagShowNextxDays = false; 133 //mFlagShowNextxDays = false;
134 //if(view == mCurrentView) return; 134 //if(view == mCurrentView) return;
135 if ( view == 0 ) { 135 if ( view == 0 ) {
136 view = mCurrentView; 136 view = mCurrentView;
137 if ( view == 0 ) 137 if ( view == 0 )
138 return; 138 return;
139 } 139 }
140 bool full = fullScreen; 140 bool full = fullScreen;
141 if(view == mCurrentView && view != mWhatsNextView ) { 141 if(view == mCurrentView && view != mWhatsNextView ) {
142 if ( mCurrentAgendaView < 0 ) 142 if ( mCurrentAgendaView < 0 )
143 return; 143 return;
144 full = mMainView->leftFrame()->isVisible(); 144 full = mMainView->leftFrame()->isVisible();
145 } else { 145 } else {
146 mCurrentView = view; 146 mCurrentView = view;
147 147
148 // bool full = fullScreen; 148 // bool full = fullScreen;
149 bool isFull = !mMainView->leftFrame()->isVisible(); 149 bool isFull = !mMainView->leftFrame()->isVisible();
150 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 150 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
151 full = true; 151 full = true;
152 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 152 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
153 full = false; 153 full = false;
154 } 154 }
155 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 155 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
156 //raiseCurrentView( full ); 156 //raiseCurrentView( full );
157 mMainView->processIncidenceSelection( 0 ); 157 mMainView->processIncidenceSelection( 0 );
158 mMainView->updateView(); 158 mMainView->updateView();
159 raiseCurrentView( full ); 159 raiseCurrentView( full );
160 mMainView->adaptNavigationUnits(); 160 mMainView->adaptNavigationUnits();
161} 161}
162 162
163void KOViewManager::raiseCurrentView( bool fullScreen ) 163void KOViewManager::raiseCurrentView( bool fullScreen )
164{ 164{
165 //qDebug("raiseCurrentView "); 165 //qDebug("raiseCurrentView ");
166 mCurrentAgendaView = 0; 166 mCurrentAgendaView = 0;
167 int wid = mMainView->width() ; 167 int wid = mMainView->width() ;
168 int hei = mMainView->height(); 168 int hei = mMainView->height();
169 if ( mCurrentView == mMonthView ) { 169 if ( mCurrentView == mMonthView ) {
170 mMainView->navigatorBar()->show(); 170 mMainView->navigatorBar()->show();
171 hei -= mMainView->navigatorBar()->sizeHint().height(); 171 hei -= mMainView->navigatorBar()->sizeHint().height();
172 //mMainView->navigatorBar()->hide(); 172 //mMainView->navigatorBar()->hide();
173 } else { 173 } else {
174 mMainView->navigatorBar()->hide(); 174 mMainView->navigatorBar()->hide();
175 } 175 }
176 if ( fullScreen ) { 176 if ( fullScreen ) {
177 mMainView->leftFrame()->hide(); 177 mMainView->leftFrame()->hide();
178 } else { 178 } else {
179 mMainView->leftFrame()->show(); 179 mMainView->leftFrame()->show();
180 if ( KOPrefs::instance()->mVerticalScreen ) 180 if ( KOPrefs::instance()->mVerticalScreen )
181 hei -= mMainView->leftFrame()->height(); 181 hei -= mMainView->leftFrame()->height();
182 else 182 else
183 wid -= mMainView->leftFrame()->width(); 183 wid -= mMainView->leftFrame()->width();
184 } 184 }
185 185
186 if ( globalFlagBlockAgenda == 5 ) { 186 if ( globalFlagBlockAgenda == 5 ) {
187 globalFlagBlockAgenda = 4; 187 globalFlagBlockAgenda = 4;
188 globalFlagBlockAgendaItemPaint = 1; 188 globalFlagBlockAgendaItemPaint = 1;
189 } 189 }
190 mMainView->viewStack()->raiseWidget(mCurrentView); 190 mMainView->viewStack()->raiseWidget(mCurrentView);
191 if ( globalFlagBlockAgenda == 4 ) { 191 if ( globalFlagBlockAgenda == 4 ) {
192 if ( mCurrentView == mAgendaView ) { 192 if ( mCurrentView == mAgendaView ) {
193 //globalFlagBlockAgenda =1 ; 193 //globalFlagBlockAgenda =1 ;
194 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 194 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
195 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 195 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
196 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 196 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
197 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 197 mAgendaView->setStartHour( QTime::currentTime ().hour() );
198 qApp->processEvents(); 198 qApp->processEvents();
199 //qDebug("qApp->processEvents() "); 199 //qDebug("qApp->processEvents() ");
200 globalFlagBlockAgenda = 0; 200 globalFlagBlockAgenda = 0;
201 mAgendaView->repaintAgenda(); 201 mAgendaView->repaintAgenda();
202 202
203 } 203 }
204 globalFlagBlockAgenda = 0; 204 globalFlagBlockAgenda = 0;
205 } 205 }
206 //qDebug("raiseCurrentView ende "); 206 //qDebug("raiseCurrentView ende ");
207} 207}
208 208
209void KOViewManager::updateView() 209void KOViewManager::updateView()
210{ 210{
211 // qDebug("KOViewManager::updateView() "); 211 // qDebug("KOViewManager::updateView() ");
212 // if we are updating mTodoView, we get endless recursion 212 // if we are updating mTodoView, we get endless recursion
213 if ( mTodoView == mCurrentView ) 213 if ( mTodoView == mCurrentView )
214 return; 214 return;
215 if ( mCurrentView ) mCurrentView->updateView(); 215 if ( mCurrentView ) mCurrentView->updateView();
216 216
217} 217}
218 218
219void KOViewManager::updateView(const QDate &start, const QDate &end) 219void KOViewManager::updateView(const QDate &start, const QDate &end)
220{ 220{
221 // kdDebug() << "KOViewManager::updateView()" << endl; 221 // kdDebug() << "KOViewManager::updateView()" << endl;
222 222
223 if (mCurrentView) mCurrentView->showDates(start, end); 223 if (mCurrentView) mCurrentView->showDates(start, end);
224 224
225 if (mTodoView) mTodoView->updateView(); 225 if (mTodoView) mTodoView->updateView();
226} 226}
227 227
228 228
229void KOViewManager::updateWNview() 229void KOViewManager::updateWNview()
230{ 230{
231 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 231 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
232 mWhatsNextView->updateView(); 232 mWhatsNextView->updateView();
233 233
234} 234}
235void KOViewManager::showWhatsNextView() 235void KOViewManager::showWhatsNextView()
236{ 236{
237 if (!mWhatsNextView) { 237 if (!mWhatsNextView) {
238 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 238 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
239 "KOViewManager::WhatsNextView"); 239 "KOViewManager::WhatsNextView");
240 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 240 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
241 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 241 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
242 addView(mWhatsNextView); 242 addView(mWhatsNextView);
243 connect(this, SIGNAL( printWNV() ), 243 connect(this, SIGNAL( printWNV() ),
244 mWhatsNextView, SLOT( printMe() ) ); 244 mWhatsNextView, SLOT( printMe() ) );
245 } 245 }
246 globalFlagBlockAgenda = 1; 246 globalFlagBlockAgenda = 1;
247 showView(mWhatsNextView, true ); 247 showView(mWhatsNextView, true );
248 //mWhatsNextView->updateView(); 248 //mWhatsNextView->updateView();
249 249
250} 250}
251 251
252void KOViewManager::showListView() 252void KOViewManager::showListView()
253{ 253{
254 if (!mListView) { 254 if (!mListView) {
255 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 255 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
256 addView(mListView); 256 addView(mListView);
257 257
258 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 258 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
259 mMainView, SLOT(showIncidence(Incidence *))); 259 mMainView, SLOT(showIncidence(Incidence *)));
260 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 260 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
261 mMainView, SLOT(editIncidence(Incidence *))); 261 mMainView, SLOT(editIncidence(Incidence *)));
262 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 262 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
263 mMainView, SLOT(deleteIncidence(Incidence *))); 263 mMainView, SLOT(deleteIncidence(Incidence *)));
264 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 264 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
265 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 265 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
266 connect( mListView, SIGNAL( signalNewEvent() ), 266 connect( mListView, SIGNAL( signalNewEvent() ),
267 mMainView, SLOT( newEvent() ) ); 267 mMainView, SLOT( newEvent() ) );
268 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 268 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
269 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 269 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
270 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 270 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
271 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 271 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
272 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 272 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
273 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 273 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
274 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 274 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
275 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 275 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
276 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 276 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
277 } 277 }
278 // bool temp = mFlagShowNextxDays; 278 // bool temp = mFlagShowNextxDays;
279 //globalFlagBlockPainting = true; 279 //globalFlagBlockPainting = true;
280 globalFlagBlockAgenda = 1; 280 globalFlagBlockAgenda = 1;
281 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 281 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
282 mMainView->setBlockShowDates( true ); 282 mMainView->setBlockShowDates( true );
283 mMainView->dateNavigator()->selectMonth(); 283 mMainView->dateNavigator()->selectMonth();
284 mMainView->setBlockShowDates( false ); 284 mMainView->setBlockShowDates( false );
285 } 285 }
286 showView(mListView, KOPrefs::instance()->mFullViewTodo); 286 showView(mListView, KOPrefs::instance()->mFullViewTodo);
287 //mFlagShowNextxDays = temp; 287 //mFlagShowNextxDays = temp;
288} 288}
289 289
290void KOViewManager::showAgendaView( bool fullScreen ) 290void KOViewManager::showAgendaView( bool fullScreen )
291{ 291{
292 292
293 mMainView->dialogManager()->hideSearchDialog(); 293 mMainView->dialogManager()->hideSearchDialog();
294 // qDebug("KOViewManager::showAgendaView "); 294 // qDebug("KOViewManager::showAgendaView ");
295 bool full; 295 bool full;
296 full = fullScreen; 296 full = fullScreen;
297 if (!mAgendaView) { 297 if (!mAgendaView) {
298 full = false; 298 full = false;
299 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 299 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
300 addView(mAgendaView); 300 addView(mAgendaView);
301#ifndef DESKTOP_VERSION 301#ifndef DESKTOP_VERSION
302 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 302 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
303#endif 303#endif
304 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 304 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
305 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 305 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
306 306
307 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 307 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
308 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 308 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
309 mMainView, SLOT(newEvent(QDateTime))); 309 mMainView, SLOT(newEvent(QDateTime)));
310 // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 310 // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
311 // mMainView, SLOT(newEvent(QDateTime,QDateTime))); 311 // mMainView, SLOT(newEvent(QDateTime,QDateTime)));
312 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 312 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
313 mMainView, SLOT(newEvent(QDate))); 313 mMainView, SLOT(newEvent(QDate)));
314 314
315 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 315 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
316 mMainView, SLOT(editIncidence(Incidence *))); 316 mMainView, SLOT(editIncidence(Incidence *)));
317 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 317 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
318 mMainView, SLOT(showIncidence(Incidence *))); 318 mMainView, SLOT(showIncidence(Incidence *)));
319 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 319 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
320 mMainView, SLOT(deleteIncidence(Incidence *))); 320 mMainView, SLOT(deleteIncidence(Incidence *)));
321 321
322 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 322 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
323 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 323 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
324 324
325 connect(mAgendaView, SIGNAL( toggleExpand() ), 325 connect(mAgendaView, SIGNAL( toggleExpand() ),
326 mMainView, SLOT( toggleExpand() ) ); 326 mMainView, SLOT( toggleExpand() ) );
327 327
328 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), 328 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ),
329 mAgendaView, SLOT( setExpandedButton( bool ) ) ); 329 mAgendaView, SLOT( setExpandedButton( bool ) ) );
330 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 330 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
331 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 331 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
332 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 332 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
333 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 333 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
334 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 334 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
335 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 335 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
336 SLOT( updateTodo( Todo *, int ) ) ); 336 SLOT( updateTodo( Todo *, int ) ) );
337 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 337 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
338 mMainView, SIGNAL( todoModified( Todo *, int ))); 338 mMainView, SIGNAL( todoModified( Todo *, int )));
339 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 339 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
340 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 340 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
341 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 341 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
342 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 342 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
343 mAgendaView->readSettings(); 343 mAgendaView->readSettings();
344 mAgendaView->updateConfig(); 344 mAgendaView->updateConfig();
345 } 345 }
346 346
347 showView( mAgendaView, full); 347 showView( mAgendaView, full);
348 348
349} 349}
350 350
351void KOViewManager::showDayView() 351void KOViewManager::showDayView()
352{ 352{
353 mFlagShowNextxDays = false; 353 mFlagShowNextxDays = false;
354 globalFlagBlockLabel = 1; 354 globalFlagBlockLabel = 1;
355 globalFlagBlockAgenda = 1; 355 globalFlagBlockAgenda = 1;
356 if ( mCurrentAgendaView != 1 ) 356 if ( mCurrentAgendaView != 1 )
357 mCurrentAgendaView = -1; 357 mCurrentAgendaView = -1;
358 showAgendaView(); 358 showAgendaView();
359 qApp->processEvents(); 359 qApp->processEvents();
360 globalFlagBlockAgenda = 2; 360 globalFlagBlockAgenda = 2;
361 globalFlagBlockLabel = 0; 361 globalFlagBlockLabel = 0;
362 mMainView->dateNavigator()->selectDates( 1 ); 362 mMainView->dateNavigator()->selectDates( 1 );
363 mCurrentAgendaView = 1 ; 363 mCurrentAgendaView = 1 ;
364 364
365} 365}
366 366
367void KOViewManager::showWorkWeekView() 367void KOViewManager::showWorkWeekView()
368{ 368{
369 mFlagShowNextxDays = false; 369 mFlagShowNextxDays = false;
370 globalFlagBlockAgenda = 1; 370 globalFlagBlockAgenda = 1;
371 globalFlagBlockLabel = 1; 371 globalFlagBlockLabel = 1;
372 if ( mCurrentAgendaView != 5 ) 372 if ( mCurrentAgendaView != 5 )
373 mCurrentAgendaView = -1; 373 mCurrentAgendaView = -1;
374 showAgendaView(); 374 showAgendaView();
375 qApp->processEvents(); 375 qApp->processEvents();
376 globalFlagBlockAgenda = 2; 376 globalFlagBlockAgenda = 2;
377 globalFlagBlockLabel = 0; 377 globalFlagBlockLabel = 0;
378 mMainView->dateNavigator()->selectWorkWeek(); 378 mMainView->dateNavigator()->selectWorkWeek();
379 mCurrentAgendaView = 5 ; 379 mCurrentAgendaView = 5 ;
380 380
381} 381}
382 382
383void KOViewManager::showWeekView() 383void KOViewManager::showWeekView()
384{ 384{
385 /* 385 /*
386 globalFlagBlockAgenda = 2; 386 globalFlagBlockAgenda = 2;
387 qDebug("4globalFlagBlockAgenda = 2; "); 387 qDebug("4globalFlagBlockAgenda = 2; ");
388 //globalFlagBlockPainting = true; 388 //globalFlagBlockPainting = true;
389 mMainView->dateNavigator()->selectWeek(); 389 mMainView->dateNavigator()->selectWeek();
390 showAgendaView(); 390 showAgendaView();
391 */ 391 */
392 392
393 393
394 mFlagShowNextxDays = false; 394 mFlagShowNextxDays = false;
395 globalFlagBlockAgenda = 1; 395 globalFlagBlockAgenda = 1;
396 globalFlagBlockLabel = 1; 396 globalFlagBlockLabel = 1;
397 if ( mCurrentAgendaView != 7 ) 397 if ( mCurrentAgendaView != 7 )
398 mCurrentAgendaView = -1; 398 mCurrentAgendaView = -1;
399 showAgendaView(); 399 showAgendaView();
400 qApp->processEvents(); 400 qApp->processEvents();
401 globalFlagBlockAgenda = 2; 401 globalFlagBlockAgenda = 2;
402 globalFlagBlockLabel = 0; 402 globalFlagBlockLabel = 0;
403 mMainView->dateNavigator()->selectWeek(); 403 mMainView->dateNavigator()->selectWeek();
404 mCurrentAgendaView = 7 ; 404 mCurrentAgendaView = 7 ;
405} 405}
406 406
407void KOViewManager::showNextXView() 407void KOViewManager::showNextXView()
408{ 408{
409 409
410 globalFlagBlockAgenda = 1; 410 globalFlagBlockAgenda = 1;
411 if ( mCurrentAgendaView != 3 ) 411 if ( mCurrentAgendaView != 3 )
412 mCurrentAgendaView = -1; 412 mCurrentAgendaView = -1;
413 showAgendaView(KOPrefs::instance()->mFullViewMonth); 413 showAgendaView(KOPrefs::instance()->mFullViewMonth);
414 globalFlagBlockAgenda = 2; 414 globalFlagBlockAgenda = 2;
415 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 415 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
416 KOPrefs::instance()->mNextXDays ); 416 KOPrefs::instance()->mNextXDays );
417 mFlagShowNextxDays = true; 417 mFlagShowNextxDays = true;
418 mCurrentAgendaView = 3 ; 418 mCurrentAgendaView = 3 ;
419} 419}
420bool KOViewManager::showsNextDays() 420bool KOViewManager::showsNextDays()
421{ 421{
422 return mFlagShowNextxDays; 422 return mFlagShowNextxDays;
423} 423}
424void KOViewManager::showMonthView() 424void KOViewManager::showMonthView()
425{ 425{
426 if (!mMonthView) { 426 if (!mMonthView) {
427 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 427 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
428 428
429 addView(mMonthView); 429 addView(mMonthView);
430 // mMonthView->show(); 430 // mMonthView->show();
431 // SIGNALS/SLOTS FOR MONTH VIEW 431 // SIGNALS/SLOTS FOR MONTH VIEW
432 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 432 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
433 mMainView, SLOT(newEvent(QDateTime))); 433 mMainView, SLOT(newEvent(QDateTime)));
434 434
435 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 435 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
436 mMainView, SLOT(showIncidence(Incidence *))); 436 mMainView, SLOT(showIncidence(Incidence *)));
437 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 437 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
438 mMainView, SLOT(editIncidence(Incidence *))); 438 mMainView, SLOT(editIncidence(Incidence *)));
439 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 439 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
440 mMainView, SLOT(deleteIncidence(Incidence *))); 440 mMainView, SLOT(deleteIncidence(Incidence *)));
441 441
442 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 442 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
443 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 443 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
444 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 444 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
445 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 445 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
446 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 446 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
447 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 447 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
448 448
449 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 449 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
450 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 450 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
451 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 451 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
452 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 452 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
453 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 453 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
454 mMainView, SLOT ( selectWeekNum( int ) ) ); 454 mMainView, SLOT ( selectWeekNum( int ) ) );
455 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 455 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
456 mMainView, SLOT ( showDay( QDate ) ) ); 456 mMainView, SLOT ( showDay( QDate ) ) );
457 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 457 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
458 mMonthView->updateConfig(); 458 mMonthView->updateConfig();
459 } 459 }
460 460
461 globalFlagBlockAgenda = 1; 461 globalFlagBlockAgenda = 1;
462 //mFlagShowNextxDays = false; 462 //mFlagShowNextxDays = false;
463 // if(mMonthView == mCurrentView) return; 463 // if(mMonthView == mCurrentView) return;
464 mMainView->dateNavigator()->selectMonth(); 464 mMainView->dateNavigator()->selectMonth();
465 // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); 465 // DateList tmpList = mMainView->dateNavigator()->selectedDates( );
466 //mMonthView->showDates(tmpList.first(), tmpList.last()); 466 //mMonthView->showDates(tmpList.first(), tmpList.last());
467 467
468 showView(mMonthView, true ); 468 showView(mMonthView, true );
469 469
470} 470}
471 471
472void KOViewManager::showTodoView() 472void KOViewManager::showTodoView()
473{ 473{
474 //mFlagShowNextxDays = false; 474 //mFlagShowNextxDays = false;
475 if ( !mTodoView ) { 475 if ( !mTodoView ) {
476 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 476 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
477 "KOViewManager::TodoView" ); 477 "KOViewManager::TodoView" );
478 478
479 addView( mTodoView ); 479 addView( mTodoView );
480 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 480 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
481 481
482 // SIGNALS/SLOTS FOR TODO VIEW 482 // SIGNALS/SLOTS FOR TODO VIEW
483 connect( mTodoView, SIGNAL( newTodoSignal() ), 483 connect( mTodoView, SIGNAL( newTodoSignal() ),
484 mMainView, SLOT( newTodo() ) ); 484 mMainView, SLOT( newTodo() ) );
485 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 485 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
486 mMainView, SLOT( newSubTodo( Todo *) ) ); 486 mMainView, SLOT( newSubTodo( Todo *) ) );
487 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 487 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
488 mMainView, SLOT( showTodo( Todo * ) ) ); 488 mMainView, SLOT( showTodo( Todo * ) ) );
489 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 489 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
490 mMainView, SLOT( editTodo( Todo * ) ) ); 490 mMainView, SLOT( editTodo( Todo * ) ) );
491 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 491 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
492 mMainView, SLOT( deleteTodo( Todo * ) ) ); 492 mMainView, SLOT( deleteTodo( Todo * ) ) );
493 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 493 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
494 mMainView, SLOT( purgeCompleted() ) ); 494 mMainView, SLOT( purgeCompleted() ) );
495 495
496 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 496 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
497 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 497 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
498 498
499 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 499 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
500 SLOT( updateConfig() ) ); 500 SLOT( updateConfig() ) );
501 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 501 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
502 SLOT( updateTodo( Todo *, int ) ) ); 502 SLOT( updateTodo( Todo *, int ) ) );
503 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 503 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
504 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 504 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
505 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 505 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
506 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 506 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
507 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 507 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
508 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 508 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
509 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 509 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
510 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 510 mMainView, SLOT ( todo_unsub( Todo * ) ) );
511 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 511 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
512 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 512 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
513 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 513 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
514 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 514 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
515 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 515 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
516 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 516 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
517 KConfig *config = KOGlobals::config(); 517 KConfig *config = KOGlobals::config();
518 mTodoView->restoreLayout(config,"Todo View"); 518 mTodoView->restoreLayout(config,"Todo View");
519 mTodoView->setNavigator( mMainView->dateNavigator() ); 519 mTodoView->setNavigator( mMainView->dateNavigator() );
520 } 520 }
521 521
522 globalFlagBlockAgenda = 1; 522 globalFlagBlockAgenda = 1;
523 showView( mTodoView, true ); 523 showView( mTodoView, true );
524 524
525} 525}
526 526
527void KOViewManager::showJournalView() 527void KOViewManager::showJournalView()
528{ 528{
529 //mFlagShowNextxDays = false; 529 //mFlagShowNextxDays = false;
530 if (!mJournalView) { 530 if (!mJournalView) {
531 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 531 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
532 "KOViewManager::JournalView"); 532 "KOViewManager::JournalView");
533 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 533 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
534 SLOT( updateConfig() ) ); 534 SLOT( updateConfig() ) );
535 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 535 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
536 addView(mJournalView); 536 addView(mJournalView);
537 } 537 }
538 538
539 showView(mJournalView); 539 showView(mJournalView);
540} 540}
541 541
542void KOViewManager::showTimeSpanView() 542void KOViewManager::showTimeSpanView()
543{ 543{
544 //mFlagShowNextxDays = false; 544 //mFlagShowNextxDays = false;
545 if (!mTimeSpanView) { 545 if (!mTimeSpanView) {
546 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 546 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
547 "KOViewManager::TimeSpanView"); 547 "KOViewManager::TimeSpanView");
548 addView(mTimeSpanView); 548 addView(mTimeSpanView);
549 549
550 mTimeSpanView->readSettings(); 550 mTimeSpanView->readSettings();
551 } 551 }
552 552
553 showView(mTimeSpanView); 553 showView(mTimeSpanView);
554} 554}
555 555
556Incidence *KOViewManager::currentSelection() 556Incidence *KOViewManager::currentSelection()
557{ 557{
558 if (!mCurrentView) return 0; 558 if (!mCurrentView) return 0;
559 if ( mCurrentView == mListView ) { 559 if ( mCurrentView == mListView ) {
560 if ( mListView->currentItem() ) 560 if ( mListView->currentItem() )
561 return mListView->currentItem(); 561 return mListView->currentItem();
562 } 562 }
563 return mCurrentView->selectedIncidences().first(); 563 return mCurrentView->selectedIncidences().first();
564} 564}
565 565
566QDate KOViewManager::currentSelectionDate() 566QDate KOViewManager::currentSelectionDate()
567{ 567{
568 QDate qd; 568 QDate qd;
569 if (mCurrentView) { 569 if (mCurrentView) {
570 DateList qvl = mCurrentView->selectedDates(); 570 DateList qvl = mCurrentView->selectedDates();
571 if (!qvl.isEmpty()) qd = qvl.first(); 571 if (!qvl.isEmpty()) qd = qvl.first();
572 } 572 }
573 return qd; 573 return qd;
574} 574}
575 575
576void KOViewManager::addView(KOrg::BaseView *view) 576void KOViewManager::addView(KOrg::BaseView *view)
577{ 577{
578#if QT_VERSION >= 300 578#if QT_VERSION >= 0x030000
579 mMainView->viewStack()->addWidget( view ); 579 mMainView->viewStack()->addWidget( view );
580#else 580#else
581 mMainView->viewStack()->addWidget( view, 1 ); 581 mMainView->viewStack()->addWidget( view, 1 );
582#endif 582#endif
583} 583}
584 584
585void KOViewManager::setDocumentId( const QString &id ) 585void KOViewManager::setDocumentId( const QString &id )
586{ 586{
587 if (mTodoView) mTodoView->setDocumentId( id ); 587 if (mTodoView) mTodoView->setDocumentId( id );
588} 588}
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 72ee1d2..39966b5 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -1,397 +1,397 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qgroupbox.h> 27#include <qgroupbox.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qlineedit.h> 29#include <qlineedit.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31 31
32#include <klocale.h> 32#include <klocale.h>
33#include <kmessagebox.h> 33#include <kmessagebox.h>
34 34
35#include <libkdepim/kdateedit.h> 35#include <libkdepim/kdateedit.h>
36 36
37#include "koglobals.h" 37#include "koglobals.h"
38#include "koprefs.h" 38#include "koprefs.h"
39 39
40#include "calendarview.h" 40#include "calendarview.h"
41#include "koviewmanager.h" 41#include "koviewmanager.h"
42#include "searchdialog.h" 42#include "searchdialog.h"
43 43
44SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) 44SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
45 : KDialogBase(Plain,i18n("KO/Pi Find "),User1|Close,User1,parent,0,false,false, 45 : KDialogBase(Plain,i18n("KO/Pi Find "),User1|Close,User1,parent,0,false,false,
46 i18n("&Find")) 46 i18n("&Find"))
47{ 47{
48 mCalendar = calendar; 48 mCalendar = calendar;
49 QFrame *topFrame = plainPage(); 49 QFrame *topFrame = plainPage();
50 QVBoxLayout *layout = new QVBoxLayout(topFrame,0,spacingHint()); 50 QVBoxLayout *layout = new QVBoxLayout(topFrame,0,spacingHint());
51 51
52 // Search expression 52 // Search expression
53 QHBoxLayout *subLayout = new QHBoxLayout(); 53 QHBoxLayout *subLayout = new QHBoxLayout();
54 layout->addLayout(subLayout); 54 layout->addLayout(subLayout);
55 55
56 searchLabel = new QLabel(topFrame); 56 searchLabel = new QLabel(topFrame);
57 searchLabel->setText(i18n("Search for:")); 57 searchLabel->setText(i18n("Search for:"));
58 subLayout->addWidget(searchLabel); 58 subLayout->addWidget(searchLabel);
59 59
60 searchEdit = new QLineEdit(topFrame); 60 searchEdit = new QLineEdit(topFrame);
61 subLayout->addWidget(searchEdit); 61 subLayout->addWidget(searchEdit);
62 searchEdit->setText("*"); // Find all events by default 62 searchEdit->setText("*"); // Find all events by default
63 searchEdit->setFocus(); 63 searchEdit->setFocus();
64 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 64 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
65 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 65 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
66 // Subjects to search 66 // Subjects to search
67 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 67 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
68 // topFrame); 68 // topFrame);
69 69
70 70
71 71
72 QHBox *incidenceGroup = new QHBox( topFrame ); 72 QHBox *incidenceGroup = new QHBox( topFrame );
73 layout->addWidget(incidenceGroup); 73 layout->addWidget(incidenceGroup);
74 74
75 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 75 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
76 mSearchEvent->setChecked(true); 76 mSearchEvent->setChecked(true);
77 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 77 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
78 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 78 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
79 79
80 QHBox *subjectGroup = new QHBox( topFrame ); 80 QHBox *subjectGroup = new QHBox( topFrame );
81 layout->addWidget(subjectGroup); 81 layout->addWidget(subjectGroup);
82 82
83 mSummaryCheck = new QCheckBox(i18n("Summaries"),subjectGroup); 83 mSummaryCheck = new QCheckBox(i18n("Summaries"),subjectGroup);
84 mSummaryCheck->setChecked(true); 84 mSummaryCheck->setChecked(true);
85 mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup); 85 mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup);
86 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); 86 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
87 87
88 QHBox *attendeeGroup = new QHBox( topFrame ); 88 QHBox *attendeeGroup = new QHBox( topFrame );
89 layout->addWidget(attendeeGroup ); 89 layout->addWidget(attendeeGroup );
90 new QLabel( i18n("Attendee:"),attendeeGroup ); 90 new QLabel( i18n("Attendee:"),attendeeGroup );
91 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 91 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
92 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 92 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
93 // Date range 93 // Date range
94 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 94 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
95 // topFrame); 95 // topFrame);
96 // layout->addWidget(rangeGroup); 96 // layout->addWidget(rangeGroup);
97 97
98 QWidget *rangeWidget = new QWidget(topFrame); 98 QWidget *rangeWidget = new QWidget(topFrame);
99 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint()); 99 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,spacingHint());
100 100
101 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 101 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
102 mStartDate = new KDateEdit(rangeWidget); 102 mStartDate = new KDateEdit(rangeWidget);
103 rangeLayout->addWidget(mStartDate); 103 rangeLayout->addWidget(mStartDate);
104 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 104 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
105 mEndDate = new KDateEdit(rangeWidget); 105 mEndDate = new KDateEdit(rangeWidget);
106 mEndDate->setDate(QDate::currentDate().addDays(365)); 106 mEndDate->setDate(QDate::currentDate().addDays(365));
107 rangeLayout->addWidget(mEndDate); 107 rangeLayout->addWidget(mEndDate);
108 108
109 // mInclusiveCheck = new QCheckBox(i18n("Events have to be completely included"), topFrame); 109 // mInclusiveCheck = new QCheckBox(i18n("Events have to be completely included"), topFrame);
110 //mInclusiveCheck->setChecked(false); 110 //mInclusiveCheck->setChecked(false);
111 layout->addWidget(rangeWidget); 111 layout->addWidget(rangeWidget);
112 //layout->addWidget(mInclusiveCheck); 112 //layout->addWidget(mInclusiveCheck);
113 // Subjects to search 113 // Subjects to search
114 114
115 115
116 // Results list view 116 // Results list view
117 listView = new KOListView(mCalendar,topFrame); 117 listView = new KOListView(mCalendar,topFrame);
118 //listView->showDates(); 118 //listView->showDates();
119 119
120 120
121 layout->addWidget(listView); 121 layout->addWidget(listView);
122 122
123 // if ( KOPrefs::instance()->mCompactDialogs ) { 123 // if ( KOPrefs::instance()->mCompactDialogs ) {
124 // KOGlobals::fitDialogToScreen( this, true ); 124 // KOGlobals::fitDialogToScreen( this, true );
125 // } 125 // }
126 126
127 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 127 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
128 connect(this,SIGNAL(user1Clicked()),SLOT(doSearch())); 128 connect(this,SIGNAL(user1Clicked()),SLOT(doSearch()));
129 QPushButton *CloseButton = findButton( Close ); 129 QPushButton *CloseButton = findButton( Close );
130 //connect(CloseButton,SIGNAL(clicked()),listView, SLOT(clear())); 130 //connect(CloseButton,SIGNAL(clicked()),listView, SLOT(clear()));
131 131
132#ifndef DESKTOP_VERSION 132#ifndef DESKTOP_VERSION
133 setCaption(i18n("Click OK to search ->")); 133 setCaption(i18n("Click OK to search ->"));
134 hideButtons(); 134 hideButtons();
135#endif 135#endif
136} 136}
137 137
138SearchDialog::~SearchDialog() 138SearchDialog::~SearchDialog()
139{ 139{
140 140
141} 141}
142void SearchDialog::accept() 142void SearchDialog::accept()
143{ 143{
144 doSearch(); 144 doSearch();
145} 145}
146void SearchDialog::updateList() 146void SearchDialog::updateList()
147{ 147{
148 //listView->updateList(); 148 //listView->updateList();
149 if ( isVisible() ) { 149 if ( isVisible() ) {
150 updateView(); 150 updateView();
151 //qDebug("SearchDialog::updated "); 151 //qDebug("SearchDialog::updated ");
152 } 152 }
153 else { 153 else {
154 listView->clear(); 154 listView->clear();
155 //qDebug("SearchDialog::cleared "); 155 //qDebug("SearchDialog::cleared ");
156 156
157 } 157 }
158} 158}
159void SearchDialog::searchTextChanged( const QString &_text ) 159void SearchDialog::searchTextChanged( const QString &_text )
160{ 160{
161 enableButton( KDialogBase::User1, !_text.isEmpty() ); 161 enableButton( KDialogBase::User1, !_text.isEmpty() );
162} 162}
163 163
164void SearchDialog::doSearch() 164void SearchDialog::doSearch()
165{ 165{
166 QRegExp re; 166 QRegExp re;
167 167
168 re.setWildcard(true); // most people understand these better. 168 re.setWildcard(true); // most people understand these better.
169 re.setCaseSensitive(false); 169 re.setCaseSensitive(false);
170 re.setPattern(searchEdit->text()); 170 re.setPattern(searchEdit->text());
171 if (!re.isValid() ) { 171 if (!re.isValid() ) {
172 KMessageBox::sorry(this, 172 KMessageBox::sorry(this,
173 i18n("Invalid search expression,\ncannot perform " 173 i18n("Invalid search expression,\ncannot perform "
174 "the search.\nPlease enter a search expression\n" 174 "the search.\nPlease enter a search expression\n"
175 "using the wildcard characters\n '*' and '?'" 175 "using the wildcard characters\n '*' and '?'"
176 "where needed.")); 176 "where needed."));
177 return; 177 return;
178 } 178 }
179 179
180 search(re); 180 search(re);
181 181
182 listView->setStartDate( mStartDate->date() ); 182 listView->setStartDate( mStartDate->date() );
183 listView->showEvents(mMatchedEvents); 183 listView->showEvents(mMatchedEvents);
184 listView->addTodos(mMatchedTodos); 184 listView->addTodos(mMatchedTodos);
185 listView->addJournals(mMatchedJournals); 185 listView->addJournals(mMatchedJournals);
186 186
187 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 187 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
188 KMessageBox::information(this, 188 KMessageBox::information(this,
189 i18n("No event/todo were found matching\nyour search expression.\nUse the wildcard characters\n ' * ' and ' ? ' where needed.")); 189 i18n("No event/todo were found matching\nyour search expression.\nUse the wildcard characters\n ' * ' and ' ? ' where needed."));
190#ifndef DESKTOP_VERSION 190#ifndef DESKTOP_VERSION
191 setCaption(i18n("Click OK to search ->")); 191 setCaption(i18n("Click OK to search ->"));
192#else 192#else
193 setCaption(i18n("KO/Pi Find ")); 193 setCaption(i18n("KO/Pi Find "));
194#endif 194#endif
195 } else { 195 } else {
196 QString mess; 196 QString mess;
197 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 197 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
198 setCaption( i18n("KO/Pi Find: ") + mess); 198 setCaption( i18n("KO/Pi Find: ") + mess);
199 199
200 } 200 }
201} 201}
202void SearchDialog::updateConfig() 202void SearchDialog::updateConfig()
203{ 203{
204 listView->updateConfig(); 204 listView->updateConfig();
205} 205}
206void SearchDialog::updateView() 206void SearchDialog::updateView()
207{ 207{
208 208
209 QRegExp re; 209 QRegExp re;
210 re.setWildcard(true); // most people understand these better. 210 re.setWildcard(true); // most people understand these better.
211 re.setCaseSensitive(false); 211 re.setCaseSensitive(false);
212 re.setPattern(searchEdit->text()); 212 re.setPattern(searchEdit->text());
213 if (re.isValid()) { 213 if (re.isValid()) {
214 search(re); 214 search(re);
215 } else { 215 } else {
216 mMatchedEvents.clear(); 216 mMatchedEvents.clear();
217 mMatchedTodos.clear(); 217 mMatchedTodos.clear();
218 mMatchedJournals.clear(); 218 mMatchedJournals.clear();
219 } 219 }
220 listView->setStartDate( mStartDate->date() ); 220 listView->setStartDate( mStartDate->date() );
221 listView->showEvents(mMatchedEvents); 221 listView->showEvents(mMatchedEvents);
222 listView->addTodos(mMatchedTodos); 222 listView->addTodos(mMatchedTodos);
223 listView->addJournals(mMatchedJournals); 223 listView->addJournals(mMatchedJournals);
224} 224}
225 225
226void SearchDialog::search(const QRegExp &re) 226void SearchDialog::search(const QRegExp &re)
227{ 227{
228 QPtrList<Event> events = mCalendar->events( mStartDate->date(), 228 QPtrList<Event> events = mCalendar->events( mStartDate->date(),
229 mEndDate->date(), 229 mEndDate->date(),
230 false /*mInclusiveCheck->isChecked()*/ ); 230 false /*mInclusiveCheck->isChecked()*/ );
231 231
232 mMatchedEvents.clear(); 232 mMatchedEvents.clear();
233 if ( mSearchEvent->isChecked() ) { 233 if ( mSearchEvent->isChecked() ) {
234 Event *ev; 234 Event *ev;
235 for(ev=events.first();ev;ev=events.next()) { 235 for(ev=events.first();ev;ev=events.next()) {
236 if (mSummaryCheck->isChecked()) { 236 if (mSummaryCheck->isChecked()) {
237#if QT_VERSION >= 300 237#if QT_VERSION >= 0x030000
238 if (re.search(ev->summary()) != -1) 238 if (re.search(ev->summary()) != -1)
239#else 239#else
240 if (re.match(ev->summary()) != -1) 240 if (re.match(ev->summary()) != -1)
241#endif 241#endif
242 { 242 {
243 mMatchedEvents.append(ev); 243 mMatchedEvents.append(ev);
244 continue; 244 continue;
245 } 245 }
246 } 246 }
247 if (mDescriptionCheck->isChecked()) { 247 if (mDescriptionCheck->isChecked()) {
248#if QT_VERSION >= 300 248#if QT_VERSION >= 0x030000
249 if (re.search(ev->description()) != -1) 249 if (re.search(ev->description()) != -1)
250#else 250#else
251 if (re.match(ev->description()) != -1) 251 if (re.match(ev->description()) != -1)
252#endif 252#endif
253 { 253 {
254 mMatchedEvents.append(ev); 254 mMatchedEvents.append(ev);
255 continue; 255 continue;
256 } 256 }
257 } 257 }
258 if (mCategoryCheck->isChecked()) { 258 if (mCategoryCheck->isChecked()) {
259#if QT_VERSION >= 300 259#if QT_VERSION >= 0x030000
260 if (re.search(ev->categoriesStr()) != -1) 260 if (re.search(ev->categoriesStr()) != -1)
261#else 261#else
262 if (re.match(ev->categoriesStr()) != -1) 262 if (re.match(ev->categoriesStr()) != -1)
263#endif 263#endif
264 { 264 {
265 mMatchedEvents.append(ev); 265 mMatchedEvents.append(ev);
266 continue; 266 continue;
267 } 267 }
268 } 268 }
269 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 269 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
270 QPtrList<Attendee> tmpAList = ev->attendees(); 270 QPtrList<Attendee> tmpAList = ev->attendees();
271 Attendee *a; 271 Attendee *a;
272 for (a = tmpAList.first(); a; a = tmpAList.next()) { 272 for (a = tmpAList.first(); a; a = tmpAList.next()) {
273 if (mSearchAName->isChecked()) { 273 if (mSearchAName->isChecked()) {
274#if QT_VERSION >= 300 274#if QT_VERSION >= 0x030000
275 if (re.search(a->name()) != -1) 275 if (re.search(a->name()) != -1)
276#else 276#else
277 if (re.match(a->name()) != -1) 277 if (re.match(a->name()) != -1)
278#endif 278#endif
279 { 279 {
280 mMatchedEvents.append(ev); 280 mMatchedEvents.append(ev);
281 break; 281 break;
282 } 282 }
283 } 283 }
284 if (mSearchAEmail->isChecked()) { 284 if (mSearchAEmail->isChecked()) {
285#if QT_VERSION >= 300 285#if QT_VERSION >= 0x030000
286 if (re.search(a->email()) != -1) 286 if (re.search(a->email()) != -1)
287#else 287#else
288 if (re.match(a->email()) != -1) 288 if (re.match(a->email()) != -1)
289#endif 289#endif
290 { 290 {
291 mMatchedEvents.append(ev); 291 mMatchedEvents.append(ev);
292 break; 292 break;
293 } 293 }
294 } 294 }
295 } 295 }
296 } 296 }
297 } 297 }
298 } 298 }
299 QPtrList<Todo> todos = mCalendar->todos( ); 299 QPtrList<Todo> todos = mCalendar->todos( );
300 mMatchedTodos.clear(); 300 mMatchedTodos.clear();
301 if ( mSearchTodo->isChecked() ) { 301 if ( mSearchTodo->isChecked() ) {
302 Todo *tod; 302 Todo *tod;
303 for(tod=todos.first();tod;tod=todos.next()) { 303 for(tod=todos.first();tod;tod=todos.next()) {
304 if (mSummaryCheck->isChecked()) { 304 if (mSummaryCheck->isChecked()) {
305#if QT_VERSION >= 300 305#if QT_VERSION >= 0x030000
306 if (re.search(tod->summary()) != -1) 306 if (re.search(tod->summary()) != -1)
307#else 307#else
308 if (re.match(tod->summary()) != -1) 308 if (re.match(tod->summary()) != -1)
309#endif 309#endif
310 { 310 {
311 mMatchedTodos.append(tod); 311 mMatchedTodos.append(tod);
312 continue; 312 continue;
313 } 313 }
314 } 314 }
315 if (mDescriptionCheck->isChecked()) { 315 if (mDescriptionCheck->isChecked()) {
316#if QT_VERSION >= 300 316#if QT_VERSION >= 0x030000
317 if (re.search(tod->description()) != -1) 317 if (re.search(tod->description()) != -1)
318#else 318#else
319 if (re.match(tod->description()) != -1) 319 if (re.match(tod->description()) != -1)
320#endif 320#endif
321 { 321 {
322 mMatchedTodos.append(tod); 322 mMatchedTodos.append(tod);
323 continue; 323 continue;
324 } 324 }
325 } 325 }
326 if (mCategoryCheck->isChecked()) { 326 if (mCategoryCheck->isChecked()) {
327#if QT_VERSION >= 300 327#if QT_VERSION >= 0x030000
328 if (re.search(tod->categoriesStr()) != -1) 328 if (re.search(tod->categoriesStr()) != -1)
329#else 329#else
330 if (re.match(tod->categoriesStr()) != -1) 330 if (re.match(tod->categoriesStr()) != -1)
331#endif 331#endif
332 { 332 {
333 mMatchedTodos.append(tod); 333 mMatchedTodos.append(tod);
334 continue; 334 continue;
335 } 335 }
336 } 336 }
337 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) { 337 if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
338 QPtrList<Attendee> tmpAList = tod->attendees(); 338 QPtrList<Attendee> tmpAList = tod->attendees();
339 Attendee *a; 339 Attendee *a;
340 for (a = tmpAList.first(); a; a = tmpAList.next()) { 340 for (a = tmpAList.first(); a; a = tmpAList.next()) {
341 if (mSearchAName->isChecked()) { 341 if (mSearchAName->isChecked()) {
342#if QT_VERSION >= 300 342#if QT_VERSION >= 0x030000
343 if (re.search(a->name()) != -1) 343 if (re.search(a->name()) != -1)
344#else 344#else
345 if (re.match(a->name()) != -1) 345 if (re.match(a->name()) != -1)
346#endif 346#endif
347 { 347 {
348 mMatchedTodos.append(tod); 348 mMatchedTodos.append(tod);
349 break; 349 break;
350 } 350 }
351 } 351 }
352 if (mSearchAEmail->isChecked()) { 352 if (mSearchAEmail->isChecked()) {
353#if QT_VERSION >= 300 353#if QT_VERSION >= 0x030000
354 if (re.search(a->email()) != -1) 354 if (re.search(a->email()) != -1)
355#else 355#else
356 if (re.match(a->email()) != -1) 356 if (re.match(a->email()) != -1)
357#endif 357#endif
358 { 358 {
359 mMatchedTodos.append(tod); 359 mMatchedTodos.append(tod);
360 break; 360 break;
361 } 361 }
362 } 362 }
363 } 363 }
364 } 364 }
365 } 365 }
366 } 366 }
367 mMatchedJournals.clear(); 367 mMatchedJournals.clear();
368 if (mSearchJournal->isChecked() ) { 368 if (mSearchJournal->isChecked() ) {
369 QPtrList<Journal> journals = mCalendar->journals( ); 369 QPtrList<Journal> journals = mCalendar->journals( );
370 Journal* journ; 370 Journal* journ;
371 371
372 for(journ=journals.first();journ;journ=journals.next()) { 372 for(journ=journals.first();journ;journ=journals.next()) {
373 if ( journ->dtStart().date() <= mEndDate->date() 373 if ( journ->dtStart().date() <= mEndDate->date()
374 &&journ->dtStart().date() >= mStartDate->date()) { 374 &&journ->dtStart().date() >= mStartDate->date()) {
375#if QT_VERSION >= 300 375#if QT_VERSION >= 0x030000
376 if (re.search(journ->description()) != -1) 376 if (re.search(journ->description()) != -1)
377#else 377#else
378 if (re.match(journ->description()) != -1) 378 if (re.match(journ->description()) != -1)
379#endif 379#endif
380 { 380 {
381 mMatchedJournals.append(journ); 381 mMatchedJournals.append(journ);
382 continue; 382 continue;
383 } 383 }
384 } 384 }
385 } 385 }
386 } 386 }
387 387
388} 388}
389/* 389/*
390void SearchDialog::keyPressEvent ( QKeyEvent *e) 390void SearchDialog::keyPressEvent ( QKeyEvent *e)
391{ 391{
392 392
393 e->ignore(); 393 e->ignore();
394 394
395} 395}
396*/ 396*/
397//mMatchedJournals; 397//mMatchedJournals;
diff --git a/korganizer/timespanview.cpp b/korganizer/timespanview.cpp
index 67a3811..df8ff88 100644
--- a/korganizer/timespanview.cpp
+++ b/korganizer/timespanview.cpp
@@ -1,157 +1,157 @@
1 1
2#ifndef DESKTOP_VERSION 2#ifndef DESKTOP_VERSION
3#include <qksplitter.h> 3#include <qksplitter.h>
4#else 4#else
5#include <qsplitter.h> 5#include <qsplitter.h>
6#endif 6#endif
7#include <qlistview.h> 7#include <qlistview.h>
8#include <qlayout.h> 8#include <qlayout.h>
9#include <qheader.h> 9#include <qheader.h>
10#include <qpushbutton.h> 10#include <qpushbutton.h>
11 11
12#include <klocale.h> 12#include <klocale.h>
13#include <kdebug.h> 13#include <kdebug.h>
14 14
15#include "lineview.h" 15#include "lineview.h"
16#include "timeline.h" 16#include "timeline.h"
17 17
18#include "timespanview.h" 18#include "timespanview.h"
19 19
20 20
21TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) : 21TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) :
22 QWidget( parent, name ) 22 QWidget( parent, name )
23{ 23{
24 QBoxLayout *topLayout = new QVBoxLayout( this ); 24 QBoxLayout *topLayout = new QVBoxLayout( this );
25#ifndef DESKTOP_VERSION 25#ifndef DESKTOP_VERSION
26 mSplitter = new QKSplitter( this ); 26 mSplitter = new QKSplitter( this );
27#else 27#else
28 mSplitter = new QSplitter( this ); 28 mSplitter = new QSplitter( this );
29#endif 29#endif
30 topLayout->addWidget( mSplitter ); 30 topLayout->addWidget( mSplitter );
31 31
32 mList = new QListView( mSplitter ); 32 mList = new QListView( mSplitter );
33 mList->addColumn( i18n("Summary") ); 33 mList->addColumn( i18n("Summary") );
34 34
35 QWidget *rightPane = new QWidget( mSplitter ); 35 QWidget *rightPane = new QWidget( mSplitter );
36 QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane ); 36 QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane );
37 37
38 mTimeLine = new TimeLine( rightPane ); 38 mTimeLine = new TimeLine( rightPane );
39 mTimeLine->setFixedHeight( mList->header()->height() ); 39 mTimeLine->setFixedHeight( mList->header()->height() );
40 rightPaneLayout->addWidget( mTimeLine ); 40 rightPaneLayout->addWidget( mTimeLine );
41 41
42 mLineView = new LineView( rightPane ); 42 mLineView = new LineView( rightPane );
43 rightPaneLayout->addWidget( mLineView ); 43 rightPaneLayout->addWidget( mLineView );
44 44
45 QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout ); 45 QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout );
46 46
47 QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane ); 47 QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane );
48 connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) ); 48 connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) );
49 buttonLayout->addWidget( zoomInButton ); 49 buttonLayout->addWidget( zoomInButton );
50 50
51 QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane ); 51 QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane );
52 connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) ); 52 connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) );
53 buttonLayout->addWidget( zoomOutButton ); 53 buttonLayout->addWidget( zoomOutButton );
54 54
55 QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane ); 55 QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane );
56 connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) ); 56 connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) );
57 buttonLayout->addWidget( centerButton ); 57 buttonLayout->addWidget( centerButton );
58 58
59 connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)), 59 connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)),
60 mTimeLine,SLOT(setContentsPos(int))); 60 mTimeLine,SLOT(setContentsPos(int)));
61} 61}
62 62
63TimeSpanView::~TimeSpanView() 63TimeSpanView::~TimeSpanView()
64{ 64{
65} 65}
66 66
67QValueList<int> TimeSpanView::splitterSizes() 67QValueList<int> TimeSpanView::splitterSizes()
68{ 68{
69 return mSplitter->sizes(); 69 return mSplitter->sizes();
70} 70}
71 71
72void TimeSpanView::setSplitterSizes( QValueList<int> sizes ) 72void TimeSpanView::setSplitterSizes( QValueList<int> sizes )
73{ 73{
74 mSplitter->setSizes( sizes ); 74 mSplitter->setSizes( sizes );
75} 75}
76 76
77void TimeSpanView::addItem( KCal::Event *event ) 77void TimeSpanView::addItem( KCal::Event *event )
78{ 78{
79 new QListViewItem( mList, event->summary() ); 79 new QListViewItem( mList, event->summary() );
80 80
81 QDateTime startDt = event->dtStart(); 81 QDateTime startDt = event->dtStart();
82 QDateTime endDt = event->dtEnd(); 82 QDateTime endDt = event->dtEnd();
83 83
84// kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString() 84// kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString()
85// << " end: " << endDt.toString() << endl; 85// << " end: " << endDt.toString() << endl;
86 86
87 int startSecs = mStartDate.secsTo( startDt ); 87 int startSecs = mStartDate.secsTo( startDt );
88 int durationSecs = startDt.secsTo( endDt ); 88 int durationSecs = startDt.secsTo( endDt );
89 89
90// kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl; 90// kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl;
91 91
92 int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel; 92 int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel;
93 int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel; 93 int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel;
94 94
95// kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl; 95// kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl;
96 96
97 mLineView->addLine( startX, endX ); 97 mLineView->addLine( startX, endX );
98} 98}
99 99
100void TimeSpanView::clear() 100void TimeSpanView::clear()
101{ 101{
102 mList->clear(); 102 mList->clear();
103 mLineView->clear(); 103 mLineView->clear();
104} 104}
105 105
106void TimeSpanView::updateView() 106void TimeSpanView::updateView()
107{ 107{
108#if QT_VERSION >= 300 108#if QT_VERSION >= 0x030000
109 mLineView->updateContents(); 109 mLineView->updateContents();
110 mTimeLine->updateContents(); 110 mTimeLine->updateContents();
111#else 111#else
112#endif 112#endif
113} 113}
114 114
115void TimeSpanView::setDateRange( const QDateTime &start, const QDateTime &end ) 115void TimeSpanView::setDateRange( const QDateTime &start, const QDateTime &end )
116{ 116{
117 mStartDate = start; 117 mStartDate = start;
118 mEndDate = end; 118 mEndDate = end;
119 119
120 mTimeLine->setDateRange( start, end ); 120 mTimeLine->setDateRange( start, end );
121 121
122 mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth(); 122 mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mLineView->pixelWidth();
123} 123}
124 124
125QDateTime TimeSpanView::startDateTime() 125QDateTime TimeSpanView::startDateTime()
126{ 126{
127 return mStartDate; 127 return mStartDate;
128} 128}
129 129
130QDateTime TimeSpanView::endDateTime() 130QDateTime TimeSpanView::endDateTime()
131{ 131{
132 return mEndDate; 132 return mEndDate;
133} 133}
134 134
135void TimeSpanView::zoomIn() 135void TimeSpanView::zoomIn()
136{ 136{
137 int span = mStartDate.daysTo( mEndDate ); 137 int span = mStartDate.daysTo( mEndDate );
138 setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) ); 138 setDateRange( mStartDate.addDays( span / 4 ), mEndDate.addDays( span / -4 ) );
139 139
140 emit dateRangeChanged(); 140 emit dateRangeChanged();
141} 141}
142 142
143void TimeSpanView::zoomOut() 143void TimeSpanView::zoomOut()
144{ 144{
145 int span = mStartDate.daysTo( mEndDate ); 145 int span = mStartDate.daysTo( mEndDate );
146 setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) ); 146 setDateRange( mStartDate.addDays( span / -4 ), mEndDate.addDays( span / 4 ) );
147 147
148 emit dateRangeChanged(); 148 emit dateRangeChanged();
149} 149}
150 150
151void TimeSpanView::centerView() 151void TimeSpanView::centerView()
152{ 152{
153 QScrollBar *scrollBar = mLineView->horizontalScrollBar(); 153 QScrollBar *scrollBar = mLineView->horizontalScrollBar();
154 int min = scrollBar->minValue(); 154 int min = scrollBar->minValue();
155 int max = scrollBar->maxValue(); 155 int max = scrollBar->maxValue();
156 scrollBar->setValue( min + (max-min) / 2 ); 156 scrollBar->setValue( min + (max-min) / 2 );
157} 157}