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,259 +1,259 @@
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());
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
@@ -386,203 +386,203 @@ void KOViewManager::showWeekView()
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
@@ -45,353 +45,353 @@ SearchDialog::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}