summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp8
-rw-r--r--korganizer/kodaymatrix.cpp2
-rw-r--r--korganizer/kolistview.cpp8
-rw-r--r--korganizer/kolistview.h3
-rw-r--r--korganizer/komonthview.cpp6
-rw-r--r--korganizer/kotodoview.cpp8
-rw-r--r--korganizer/mainwindow.cpp6
-rw-r--r--korganizer/mainwindow.h1
8 files changed, 35 insertions, 7 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 1801d7e..df2e478 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,351 +1,355 @@
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 <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#include <qapplication.h> 38#include <qapplication.h>
39#define AGENDA_ICON_SIZE 7 39#define AGENDA_ICON_SIZE 7
40#endif 40#endif
41#include <libkcal/icaldrag.h> 41#include <libkcal/icaldrag.h>
42#include <libkcal/vcaldrag.h> 42#include <libkcal/vcaldrag.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44extern int globalFlagBlockAgenda; 44extern int globalFlagBlockAgenda;
45extern int globalFlagBlockAgendaItemPaint; 45extern int globalFlagBlockAgendaItemPaint;
46extern int globalFlagBlockAgendaItemUpdate; 46extern int globalFlagBlockAgendaItemUpdate;
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49 49
50#include "koagendaitem.h" 50#include "koagendaitem.h"
51//#include "koagendaitem.moc" 51//#include "koagendaitem.moc"
52 52
53 53
54//-------------------------------------------------------------------------- 54//--------------------------------------------------------------------------
55 55
56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
57 57
58//-------------------------------------------------------------------------- 58//--------------------------------------------------------------------------
59 59
60class KOAgendaItemWhatsThis :public QWhatsThis 60class KOAgendaItemWhatsThis :public QWhatsThis
61{ 61{
62public: 62public:
63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
64 64
65protected: 65protected:
66 virtual QString text( const QPoint& ) 66 virtual QString text( const QPoint& )
67 { 67 {
68 return _view->getWhatsThisText() ; 68 return _view->getWhatsThisText() ;
69 } 69 }
70private: 70private:
71 KOAgendaItem * _view; 71 KOAgendaItem * _view;
72}; 72};
73 73
74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
75 const char *name,WFlags) : 75 const char *name,WFlags) :
76 QWidget(parent, name), mIncidence(incidence), mDate(qd) 76 QWidget(parent, name), mIncidence(incidence), mDate(qd)
77{ 77{
78#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
80#endif 80#endif
81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
83 setWFlags ( wflags); 83 setWFlags ( wflags);
84 mAllDay = allday; 84 mAllDay = allday;
85 init ( incidence, qd ); 85 init ( incidence, qd );
86 //setMouseTracking(true); 86 //setMouseTracking(true);
87 //setAcceptDrops(true); 87 //setAcceptDrops(true);
88 xPaintCoord = -1; 88 xPaintCoord = -1;
89 yPaintCoord = -1; 89 yPaintCoord = -1;
90} 90}
91QString KOAgendaItem::getWhatsThisText() 91QString KOAgendaItem::getWhatsThisText()
92{ 92{
93 if ( mIncidence ) 93 if ( mIncidence )
94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
95 KOPrefs::instance()->mWTshowDetails, 95 KOPrefs::instance()->mWTshowDetails,
96 KOPrefs::instance()->mWTshowCreated, 96 KOPrefs::instance()->mWTshowCreated,
97 KOPrefs::instance()->mWTshowChanged); 97 KOPrefs::instance()->mWTshowChanged);
98 return "KOAgendaItem::getWhatsThisText()::internal error"; 98 return "KOAgendaItem::getWhatsThisText()::internal error";
99} 99}
100void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 100void KOAgendaItem::init ( Incidence *incidence, QDate qd )
101{ 101{
102 mIncidence = incidence; 102 mIncidence = incidence;
103 mDate = qd; 103 mDate = qd;
104 mFirstMultiItem = 0; 104 mFirstMultiItem = 0;
105 mNextMultiItem = 0; 105 mNextMultiItem = 0;
106 mLastMultiItem = 0; 106 mLastMultiItem = 0;
107 computeText(); 107 computeText();
108 108
109 if ( (incidence->type() == "Todo") && 109 if ( (incidence->type() == "Todo") &&
110 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
114 else 114 else
115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
116 } 116 }
117 else { 117 else {
118 QStringList categories = mIncidence->categories(); 118 QStringList categories = mIncidence->categories();
119 QString cat = categories.first(); 119 QString cat = categories.first();
120 if (cat.isEmpty()) { 120 if (cat.isEmpty()) {
121 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 121 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
123 else 123 else
124 mBackgroundColor =KOPrefs::instance()->mEventColor; 124 mBackgroundColor =KOPrefs::instance()->mEventColor;
125 } else { 125 } else {
126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
127 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 127 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
130 } 130 }
131 } 131 }
132 132
133 } 133 }
134 mColorGroup = QColorGroup( mBackgroundColor.light(), 134 mColorGroup = QColorGroup( mBackgroundColor.light(),
135 mBackgroundColor.dark(),mBackgroundColor.light(), 135 mBackgroundColor.dark(),mBackgroundColor.light(),
136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
137 setBackgroundColor( mBackgroundColor ); 137 setBackgroundColor( mBackgroundColor );
138 138
139 mConflictItems.clear(); 139 mConflictItems.clear();
140 setCellXY(0,0,1); 140 setCellXY(0,0,1);
141 setCellXWidth(0); 141 setCellXWidth(0);
142 setSubCell(0); 142 setSubCell(0);
143 setSubCells(1); 143 setSubCells(1);
144 setMultiItem(0,0,0); 144 setMultiItem(0,0,0);
145 startMove(); 145 startMove();
146 mSelected = true; 146 mSelected = true;
147 select(false); 147 select(false);
148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
149 mFontPixelSize = fontinf.height();; 149 mFontPixelSize = fontinf.height();;
150 hide(); 150 hide();
151 xPaintCoord = -1; 151 xPaintCoord = -1;
152 yPaintCoord = -1; 152 yPaintCoord = -1;
153} 153}
154 154
155 155
156KOAgendaItem::~KOAgendaItem() 156KOAgendaItem::~KOAgendaItem()
157{ 157{
158 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 158#if QT_VERSION >= 0x030000
159 // delete mKOAgendaItemWhatsThis; 159
160#else
161 delete mKOAgendaItemWhatsThis;
162#endif
163
160} 164}
161 165
162void KOAgendaItem::recreateIncidence() 166void KOAgendaItem::recreateIncidence()
163{ 167{
164#if 0 168#if 0
165 Incidence* newInc = mIncidence->clone(); 169 Incidence* newInc = mIncidence->clone();
166 newInc->recreate(); 170 newInc->recreate();
167 if ( mIncidence->doesRecur() ) { 171 if ( mIncidence->doesRecur() ) {
168 mIncidence->addExDate( mDate ); 172 mIncidence->addExDate( mDate );
169 newInc->recurrence()->unsetRecurs(); 173 newInc->recurrence()->unsetRecurs();
170 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 174 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
171 QTime tim = mIncidence->dtStart().time(); 175 QTime tim = mIncidence->dtStart().time();
172 newInc->setDtStart( QDateTime(mDate, tim) ); 176 newInc->setDtStart( QDateTime(mDate, tim) );
173 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 177 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
174 } 178 }
175#endif 179#endif
176 mIncidence = mIncidence->recreateCloneException( mDate ); 180 mIncidence = mIncidence->recreateCloneException( mDate );
177} 181}
178bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 182bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
179{ 183{
180 int size = AGENDA_ICON_SIZE; 184 int size = AGENDA_ICON_SIZE;
181 185
182 int yOff = 0; 186 int yOff = 0;
183 int xOff = 0; 187 int xOff = 0;
184 int x = pos().x() +3; 188 int x = pos().x() +3;
185 int y; 189 int y;
186 if ( mAllDay ) 190 if ( mAllDay )
187 y = pos().y()+3; 191 y = pos().y()+3;
188 else 192 else
189 y = mCellYTop * ( height() / cellHeight() ) +3; 193 y = mCellYTop * ( height() / cellHeight() ) +3;
190 if (mIncidence->cancelled()) { 194 if (mIncidence->cancelled()) {
191 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 195 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
192 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 196 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
193 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 197 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
194 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 198 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
195 if ( horLayout ) 199 if ( horLayout )
196 ++xOff; 200 ++xOff;
197 else 201 else
198 ++yOff; 202 ++yOff;
199 } 203 }
200 if (mIncidence->isAlarmEnabled()) { 204 if (mIncidence->isAlarmEnabled()) {
201 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 205 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
202 if ( horLayout ) 206 if ( horLayout )
203 ++xOff; 207 ++xOff;
204 else 208 else
205 ++yOff; 209 ++yOff;
206 } 210 }
207 if (mIncidence->recurrence()->doesRecur()) { 211 if (mIncidence->recurrence()->doesRecur()) {
208 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 212 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
209 if ( horLayout ) 213 if ( horLayout )
210 ++xOff; 214 ++xOff;
211 else 215 else
212 ++yOff; 216 ++yOff;
213 } 217 }
214 if (mIncidence->description().length() > 0) { 218 if (mIncidence->description().length() > 0) {
215 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
216 if ( horLayout ) 220 if ( horLayout )
217 ++xOff; 221 ++xOff;
218 else 222 else
219 ++yOff; 223 ++yOff;
220 } 224 }
221 if (mIncidence->isReadOnly()) { 225 if (mIncidence->isReadOnly()) {
222 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 226 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
223 if ( horLayout ) 227 if ( horLayout )
224 ++xOff; 228 ++xOff;
225 else 229 else
226 ++yOff; 230 ++yOff;
227 } 231 }
228 232
229 if (mIncidence->attendeeCount()>0) { 233 if (mIncidence->attendeeCount()>0) {
230 234
231 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 235 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
232 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 236 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
233 if ( horLayout ) 237 if ( horLayout )
234 ++xOff; 238 ++xOff;
235 else 239 else
236 ++yOff; 240 ++yOff;
237 } else { 241 } else {
238 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 242 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
239 if (me!=0) { 243 if (me!=0) {
240 244
241 245
242 } else { 246 } else {
243 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 247 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
244 if ( horLayout ) 248 if ( horLayout )
245 ++xOff; 249 ++xOff;
246 else 250 else
247 ++yOff; 251 ++yOff;
248 252
249 } 253 }
250 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 254 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
251 if ( horLayout ) 255 if ( horLayout )
252 ++xOff; 256 ++xOff;
253 else 257 else
254 ++yOff; 258 ++yOff;
255 259
256 } 260 }
257 261
258 } 262 }
259 return ( yOff || xOff ); 263 return ( yOff || xOff );
260} 264}
261 265
262 266
263void KOAgendaItem::select(bool selected) 267void KOAgendaItem::select(bool selected)
264{ 268{
265 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 269 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
266 if (mSelected == selected) return; 270 if (mSelected == selected) return;
267 mSelected = selected; 271 mSelected = selected;
268 if ( ! isVisible() ) 272 if ( ! isVisible() )
269 return; 273 return;
270 if ( firstMultiItem() ) 274 if ( firstMultiItem() )
271 firstMultiItem()->select( selected ); 275 firstMultiItem()->select( selected );
272 if ( !firstMultiItem() && nextMultiItem() ) { 276 if ( !firstMultiItem() && nextMultiItem() ) {
273 KOAgendaItem * placeItem = nextMultiItem(); 277 KOAgendaItem * placeItem = nextMultiItem();
274 while ( placeItem ) { 278 while ( placeItem ) {
275 placeItem->select( selected ); 279 placeItem->select( selected );
276 placeItem = placeItem->nextMultiItem(); 280 placeItem = placeItem->nextMultiItem();
277 } 281 }
278 } 282 }
279 globalFlagBlockAgendaItemUpdate = 0; 283 globalFlagBlockAgendaItemUpdate = 0;
280 paintMe( selected ); 284 paintMe( selected );
281 globalFlagBlockAgendaItemUpdate = 1; 285 globalFlagBlockAgendaItemUpdate = 1;
282 repaint( false ); 286 repaint( false );
283} 287}
284 288
285 289
286/* 290/*
287 The eventFilter has to filter the mouse events of the agenda item childs. The 291 The eventFilter has to filter the mouse events of the agenda item childs. The
288 events are fed into the event handling method of KOAgendaItem. This allows the 292 events are fed into the event handling method of KOAgendaItem. This allows the
289 KOAgenda to handle the KOAgendaItems by using an eventFilter. 293 KOAgenda to handle the KOAgendaItems by using an eventFilter.
290*/ 294*/
291bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 295bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
292{ 296{
293 if (e->type() == QEvent::MouseButtonPress || 297 if (e->type() == QEvent::MouseButtonPress ||
294 e->type() == QEvent::MouseButtonDblClick || 298 e->type() == QEvent::MouseButtonDblClick ||
295 e->type() == QEvent::MouseButtonRelease || 299 e->type() == QEvent::MouseButtonRelease ||
296 e->type() == QEvent::MouseMove) { 300 e->type() == QEvent::MouseMove) {
297 QMouseEvent *me = (QMouseEvent *)e; 301 QMouseEvent *me = (QMouseEvent *)e;
298 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> 302 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
299 mapToGlobal(me->pos())); 303 mapToGlobal(me->pos()));
300 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); 304 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
301 return event(&returnEvent); 305 return event(&returnEvent);
302 } else { 306 } else {
303 return false; 307 return false;
304 } 308 }
305} 309}
306void KOAgendaItem::repaintMe( ) 310void KOAgendaItem::repaintMe( )
307{ 311{
308 paintMe ( mSelected ); 312 paintMe ( mSelected );
309} 313}
310void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 314void KOAgendaItem::paintMe( bool selected, QPainter* paint )
311{ 315{
312 if ( globalFlagBlockAgendaItemUpdate && ! selected) 316 if ( globalFlagBlockAgendaItemUpdate && ! selected)
313 return; 317 return;
314 QPainter pa; 318 QPainter pa;
315 319
316 if ( mSelected ) { 320 if ( mSelected ) {
317 pa.begin( paintPixSel() ); 321 pa.begin( paintPixSel() );
318 } else { 322 } else {
319 if ( mAllDay ) 323 if ( mAllDay )
320 pa.begin( paintPixAllday() ); 324 pa.begin( paintPixAllday() );
321 else 325 else
322 pa.begin( paintPix() ); 326 pa.begin( paintPix() );
323 } 327 }
324 int x, yy, w, h; 328 int x, yy, w, h;
325 float nfh = 7.0; 329 float nfh = 7.0;
326 x = pos().x(); w = width(); h = height (); 330 x = pos().x(); w = width(); h = height ();
327 if ( mAllDay ) 331 if ( mAllDay )
328 yy = y(); 332 yy = y();
329 else 333 else
330 yy = mCellYTop * ( height() / cellHeight() ); 334 yy = mCellYTop * ( height() / cellHeight() );
331 xPaintCoord= x; 335 xPaintCoord= x;
332 yPaintCoord = yy; 336 yPaintCoord = yy;
333 wPaintCoord = width(); 337 wPaintCoord = width();
334 hPaintCoord = height(); 338 hPaintCoord = height();
335 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 339 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
336 if ( paint == 0 ) 340 if ( paint == 0 )
337 paint = &pa; 341 paint = &pa;
338 bool horLayout = ( w < h ); 342 bool horLayout = ( w < h );
339 int maxhei = mFontPixelSize+4; 343 int maxhei = mFontPixelSize+4;
340 if ( horLayout ) 344 if ( horLayout )
341 maxhei += AGENDA_ICON_SIZE -4; 345 maxhei += AGENDA_ICON_SIZE -4;
342 bool small = ( h < maxhei ); 346 bool small = ( h < maxhei );
343 if ( ! small ) 347 if ( ! small )
344 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 348 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
345 else { 349 else {
346 QFont f = KOPrefs::instance()->mAgendaViewFont; 350 QFont f = KOPrefs::instance()->mAgendaViewFont;
347 f.setBold( false ); 351 f.setBold( false );
348 int fh = f.pointSize(); 352 int fh = f.pointSize();
349 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 353 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
350 if ( nfh < 6 ) 354 if ( nfh < 6 )
351 nfh = 6; 355 nfh = 6;
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index c32a2a4..53ebdb2 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -1,258 +1,258 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> 3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
4 Parts of the source code have been copied from kdpdatebutton.cpp 4 Parts of the source code have been copied from kdpdatebutton.cpp
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 ode for Qt in the source distribution. 22 without including the source ode for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qevent.h> 25#include <qevent.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qptrlist.h> 27#include <qptrlist.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include <libkcal/vcaldrag.h> 35#include <libkcal/vcaldrag.h>
36#include <libkcal/icaldrag.h> 36#include <libkcal/icaldrag.h>
37#include <libkcal/dndfactory.h> 37#include <libkcal/dndfactory.h>
38#include <libkcal/calendarresources.h> 38#include <libkcal/calendarresources.h>
39#include <libkcal/resourcecalendar.h> 39#include <libkcal/resourcecalendar.h>
40#include <kresources/resourceselectdialog.h> 40#include <kresources/resourceselectdialog.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPLUGINS 44#ifndef KORG_NOPLUGINS
45#include "kocore.h" 45#include "kocore.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#include "koglobals.h" 48#include "koglobals.h"
49 49
50#include "kodaymatrix.h" 50#include "kodaymatrix.h"
51 51
52// ============================================================================ 52// ============================================================================
53// D Y N A M I C T I P 53// D Y N A M I C T I P
54// ============================================================================ 54// ============================================================================
55 55
56DynamicTip::DynamicTip( QWidget * parent ) 56DynamicTip::DynamicTip( QWidget * parent )
57 : QToolTip( parent ) 57 : QToolTip( parent )
58{ 58{
59 matrix = (KODayMatrix*)parent; 59 matrix = (KODayMatrix*)parent;
60} 60}
61 61
62class KODaymatrixWhatsThis :public QWhatsThis 62class KODaymatrixWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; 65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;};
66 ~KODaymatrixWhatsThis() { qDebug("DELETE KODaymatrixWhatsThis "); }; 66 ~KODaymatrixWhatsThis() { ; };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p ) 69 virtual QString text( const QPoint& p )
70 { 70 {
71 return _view->getWhatsThisText( p ) ; 71 return _view->getWhatsThisText( p ) ;
72 } 72 }
73private: 73private:
74 KODayMatrix * _view; 74 KODayMatrix * _view;
75}; 75};
76 76
77void DynamicTip::maybeTip( const QPoint &pos ) 77void DynamicTip::maybeTip( const QPoint &pos )
78{ 78{
79 //calculate which cell of the matrix the mouse is in 79 //calculate which cell of the matrix the mouse is in
80 QRect sz = matrix->frameRect(); 80 QRect sz = matrix->frameRect();
81 int dheight = sz.height()*7 / 42; 81 int dheight = sz.height()*7 / 42;
82 int dwidth = sz.width() / 7; 82 int dwidth = sz.width() / 7;
83 int row = pos.y()/dheight; 83 int row = pos.y()/dheight;
84 int col = pos.x()/dwidth; 84 int col = pos.x()/dwidth;
85 85
86 QRect rct(col*dwidth, row*dheight, dwidth, dheight); 86 QRect rct(col*dwidth, row*dheight, dwidth, dheight);
87 87
88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" << 88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
89// col << "][" << row << "] => " <<(col+row*7) << endl; 89// col << "][" << row << "] => " <<(col+row*7) << endl;
90 90
91 //show holiday names only 91 //show holiday names only
92 QString str = matrix->getHolidayLabel(col+row*7); 92 QString str = matrix->getHolidayLabel(col+row*7);
93 if (str.isEmpty()) return; 93 if (str.isEmpty()) return;
94 tip(rct, str); 94 tip(rct, str);
95} 95}
96 96
97 97
98// ============================================================================ 98// ============================================================================
99// K O D A Y M A T R I X 99// K O D A Y M A T R I X
100// ============================================================================ 100// ============================================================================
101 101
102const int KODayMatrix::NOSELECTION = -1000; 102const int KODayMatrix::NOSELECTION = -1000;
103const int KODayMatrix::NUMDAYS = 42; 103const int KODayMatrix::NUMDAYS = 42;
104 104
105KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) 105KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) 106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 )
107 107
108 108
109{ 109{
110 mLastView = -1; 110 mLastView = -1;
111 oldW = 0; 111 oldW = 0;
112 oldH = 0; 112 oldH = 0;
113 myPix.resize( 150, 120 ); 113 myPix.resize( 150, 120 );
114 mRedrawNeeded = true; 114 mRedrawNeeded = true;
115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
116 mPendingUpdateBeforeRepaint = false; 116 mPendingUpdateBeforeRepaint = false;
117 mouseDown = false; 117 mouseDown = false;
118 // initialize dynamic arrays 118 // initialize dynamic arrays
119 bDays.resize ( NUMDAYS ); 119 bDays.resize ( NUMDAYS );
120 pDays.resize ( NUMDAYS ); 120 pDays.resize ( NUMDAYS );
121 hDays.resize ( NUMDAYS ); 121 hDays.resize ( NUMDAYS );
122 eDays.resize ( NUMDAYS ); 122 eDays.resize ( NUMDAYS );
123 days = new QDate[NUMDAYS]; 123 days = new QDate[NUMDAYS];
124 daylbls = new QString[NUMDAYS]; 124 daylbls = new QString[NUMDAYS];
125 //events = new int[NUMDAYS]; 125 //events = new int[NUMDAYS];
126 mToolTip = new DynamicTip(this); 126 mToolTip = new DynamicTip(this);
127 127
128 // set default values used for drawing the matrix 128 // set default values used for drawing the matrix
129 mDefaultBackColor = palette().active().base(); 129 mDefaultBackColor = palette().active().base();
130 mDefaultTextColor = palette().active().foreground(); 130 mDefaultTextColor = palette().active().foreground();
131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
133 mSelectedDaysColor = QColor("white"); 133 mSelectedDaysColor = QColor("white");
134 mTodayMarginWidth = 2; 134 mTodayMarginWidth = 2;
135 mSelEnd = mSelStart = NOSELECTION; 135 mSelEnd = mSelStart = NOSELECTION;
136 136
137 setAcceptDrops(true); 137 setAcceptDrops(true);
138 //setFont( QFont("Arial", 10) ); 138 //setFont( QFont("Arial", 10) );
139 139
140 mUpdateTimer = new QTimer( this ); 140 mUpdateTimer = new QTimer( this );
141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
142 mRepaintTimer = new QTimer( this ); 142 mRepaintTimer = new QTimer( this );
143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
144 mDayChanged = false; 144 mDayChanged = false;
145 updateView(); 145 updateView();
146} 146}
147QString KODayMatrix::getWhatsThisText( QPoint p ) 147QString KODayMatrix::getWhatsThisText( QPoint p )
148{ 148{
149 149
150 int tmp = getDayIndexFrom(p.x(), p.y()); 150 int tmp = getDayIndexFrom(p.x(), p.y());
151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
152 return QString(); 152 return QString();
153 QDate mDate = days[tmp]; 153 QDate mDate = days[tmp];
154 QPtrList<Event> eventlist = mCalendar->events(mDate); 154 QPtrList<Event> eventlist = mCalendar->events(mDate);
155 Event *event; 155 Event *event;
156 QStringList mToolTip; 156 QStringList mToolTip;
157 for(event=eventlist.first();event != 0;event=eventlist.next()) { 157 for(event=eventlist.first();event != 0;event=eventlist.next()) {
158 QString mToolTipText; 158 QString mToolTipText;
159 QString text; 159 QString text;
160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
161 if (event->isMultiDay()) { 161 if (event->isMultiDay()) {
162 QString prefix = "<->";multiday = 2; 162 QString prefix = "<->";multiday = 2;
163 QString time; 163 QString time;
164 if ( event->doesRecur() ) { 164 if ( event->doesRecur() ) {
165 if ( event->recursOn( mDate) ) { 165 if ( event->recursOn( mDate) ) {
166 prefix ="->" ;multiday = 1; 166 prefix ="->" ;multiday = 1;
167 } 167 }
168 else { 168 else {
169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
170 if ( event->recursOn( mDate.addDays( -days)) ) { 170 if ( event->recursOn( mDate.addDays( -days)) ) {
171 prefix ="<-" ;multiday = 3; 171 prefix ="<-" ;multiday = 3;
172 } 172 }
173 } 173 }
174 } else { 174 } else {
175 if (mDate == event->dtStart().date()) { 175 if (mDate == event->dtStart().date()) {
176 prefix ="->" ;multiday = 1; 176 prefix ="->" ;multiday = 1;
177 } else if (mDate == event->dtEnd().date()) { 177 } else if (mDate == event->dtEnd().date()) {
178 prefix ="<-" ;multiday = 3; 178 prefix ="<-" ;multiday = 3;
179 } 179 }
180 } 180 }
181 if ( !event->doesFloat() ) { 181 if ( !event->doesFloat() ) {
182 if ( mDate == event->dtStart().date () ) 182 if ( mDate == event->dtStart().date () )
183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
184 else if ( mDate == event->dtEnd().date () ) 184 else if ( mDate == event->dtEnd().date () )
185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
186 186
187 } 187 }
188 text = time + event->summary(); 188 text = time + event->summary();
189 mToolTipText += prefix + text; 189 mToolTipText += prefix + text;
190 } else { 190 } else {
191 if (event->doesFloat()) { 191 if (event->doesFloat()) {
192 text = event->summary(); 192 text = event->summary();
193 mToolTipText += text; 193 mToolTipText += text;
194 } 194 }
195 else { 195 else {
196 text = KGlobal::locale()->formatTime(event->dtStart().time()); 196 text = KGlobal::locale()->formatTime(event->dtStart().time());
197 text += " " + event->summary(); 197 text += " " + event->summary();
198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
199 } 199 }
200 } 200 }
201 if ( !event->location().isEmpty() ) 201 if ( !event->location().isEmpty() )
202 mToolTipText += " (" + event->location() + ")"; 202 mToolTipText += " (" + event->location() + ")";
203#if QT_VERSION >= 0x030000 203#if QT_VERSION >= 0x030000
204 mToolTipText.replace( '<' , "&lt;" ); 204 mToolTipText.replace( '<' , "&lt;" );
205 mToolTipText.replace( '>' , "&gt;" ); 205 mToolTipText.replace( '>' , "&gt;" );
206#else 206#else
207 if ( mToolTipText.find ('<') >= 0 ) { 207 if ( mToolTipText.find ('<') >= 0 ) {
208 mToolTipText.replace( QRegExp("<") , "&lt;" ); 208 mToolTipText.replace( QRegExp("<") , "&lt;" );
209 } 209 }
210 if ( mToolTipText.find ('>') >= 0 ) { 210 if ( mToolTipText.find ('>') >= 0 ) {
211 mToolTipText.replace( QRegExp(">") , "&gt;" ); 211 mToolTipText.replace( QRegExp(">") , "&gt;" );
212 } 212 }
213#endif 213#endif
214 //qDebug("TTT: %s ", mToolTipText.latin1()); 214 //qDebug("TTT: %s ", mToolTipText.latin1());
215 mToolTip.append( mToolTipText ); 215 mToolTip.append( mToolTipText );
216 } 216 }
217 mToolTip.sort(); 217 mToolTip.sort();
218 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); 218 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
219} 219}
220void KODayMatrix::setCalendar( Calendar *cal ) 220void KODayMatrix::setCalendar( Calendar *cal )
221{ 221{
222 mCalendar = cal; 222 mCalendar = cal;
223 223
224 setAcceptDrops( mCalendar ); 224 setAcceptDrops( mCalendar );
225 225
226 updateEvents(); 226 updateEvents();
227} 227}
228 228
229QColor KODayMatrix::getShadedColor(QColor color) 229QColor KODayMatrix::getShadedColor(QColor color)
230{ 230{
231 QColor shaded; 231 QColor shaded;
232 int h=0; 232 int h=0;
233 int s=0; 233 int s=0;
234 int v=0; 234 int v=0;
235 color.hsv(&h,&s,&v); 235 color.hsv(&h,&s,&v);
236 s = s/4; 236 s = s/4;
237 v = 192+v/4; 237 v = 192+v/4;
238 shaded.setHsv(h,s,v); 238 shaded.setHsv(h,s,v);
239 239
240 return shaded; 240 return shaded;
241} 241}
242 242
243KODayMatrix::~KODayMatrix() 243KODayMatrix::~KODayMatrix()
244{ 244{
245#if QT_VERSION >= 0x030000 245#if QT_VERSION >= 0x030000
246 246
247#else 247#else
248 delete mKODaymatrixWhatsThis; 248 delete mKODaymatrixWhatsThis;
249#endif 249#endif
250 250
251 // delete mKODaymatrixWhatsThis; 251 // delete mKODaymatrixWhatsThis;
252 delete [] days; 252 delete [] days;
253 delete [] daylbls; 253 delete [] daylbls;
254 //delete [] events; 254 //delete [] events;
255 delete mToolTip; 255 delete mToolTip;
256} 256}
257 257
258/* 258/*
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index fd86095..b94916a 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -72,461 +72,466 @@ class KOListViewWhatsThis :public QWhatsThis
72public: 72public:
73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 73 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
74 74
75protected: 75protected:
76 virtual QString text( const QPoint& p) 76 virtual QString text( const QPoint& p)
77 { 77 {
78 return _view->getWhatsThisText(p) ; 78 return _view->getWhatsThisText(p) ;
79 } 79 }
80private: 80private:
81 QWidget* _wid; 81 QWidget* _wid;
82 KOListView * _view; 82 KOListView * _view;
83}; 83};
84 84
85 85
86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
87{ 87{
88 mItem = item; 88 mItem = item;
89 mDate = date; 89 mDate = date;
90} 90}
91 91
92ListItemVisitor::~ListItemVisitor() 92ListItemVisitor::~ListItemVisitor()
93{ 93{
94} 94}
95 95
96bool ListItemVisitor::visit(Event *e) 96bool ListItemVisitor::visit(Event *e)
97{ 97{
98 bool ok = false; 98 bool ok = false;
99 QString start, end; 99 QString start, end;
100 QDate ds, de; 100 QDate ds, de;
101 if ( e->doesRecur() ) { 101 if ( e->doesRecur() ) {
102 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 102 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
103 if ( ok ) { 103 if ( ok ) {
104 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 104 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
105 start = KGlobal::locale()->formatDate(ds,true); 105 start = KGlobal::locale()->formatDate(ds,true);
106 de = ds.addDays( days); 106 de = ds.addDays( days);
107 end = KGlobal::locale()->formatDate(de,true); 107 end = KGlobal::locale()->formatDate(de,true);
108 } 108 }
109 109
110 } 110 }
111 if ( ! ok ) { 111 if ( ! ok ) {
112 start =e->dtStartDateStr(); 112 start =e->dtStartDateStr();
113 end = e->dtEndDateStr(); 113 end = e->dtEndDateStr();
114 ds = e->dtStart().date(); 114 ds = e->dtStart().date();
115 de = e->dtEnd().date(); 115 de = e->dtEnd().date();
116 } 116 }
117 mItem->setText(0,e->summary()); 117 mItem->setText(0,e->summary());
118 mItem->setText(1,start); 118 mItem->setText(1,start);
119 if ( e->doesFloat() ) 119 if ( e->doesFloat() )
120 mItem->setText(2,"---"); 120 mItem->setText(2,"---");
121 else 121 else
122 mItem->setText(2,e->dtStartTimeStr()); 122 mItem->setText(2,e->dtStartTimeStr());
123 mItem->setText(3,end); 123 mItem->setText(3,end);
124 if ( e->doesFloat() ) 124 if ( e->doesFloat() )
125 mItem->setText(4,"---"); 125 mItem->setText(4,"---");
126 else 126 else
127 mItem->setText(4,e->dtEndTimeStr()); 127 mItem->setText(4,e->dtEndTimeStr());
128 if ( e->isAlarmEnabled() ) { 128 if ( e->isAlarmEnabled() ) {
129 mItem->setText(5,e->alarms().first()->offsetText() ); 129 mItem->setText(5,e->alarms().first()->offsetText() );
130 } else { 130 } else {
131 mItem->setText(5, i18n("No")); 131 mItem->setText(5, i18n("No"));
132 } 132 }
133 mItem->setText(6, e->recurrence()->recurrenceText()); 133 mItem->setText(6, e->recurrence()->recurrenceText());
134 if( ! e->doesRecur() ) 134 if( ! e->doesRecur() )
135 mItem->setSortKey( 6, "-" ); 135 mItem->setSortKey( 6, "-" );
136 mItem->setText(7,"---"); 136 mItem->setText(7,"---");
137 mItem->setText(8,"---"); 137 mItem->setText(8,"---");
138 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 138 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
139 mItem->setText(10,e->categoriesStr()); 139 mItem->setText(10,e->categoriesStr());
140 140
141 QString key; 141 QString key;
142 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 142 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
143 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 143 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
144 mItem->setSortKey(1,key); 144 mItem->setSortKey(1,key);
145 145
146 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 146 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
147 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 147 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
148 mItem->setSortKey(3,key); 148 mItem->setSortKey(3,key);
149 return true; 149 return true;
150} 150}
151 151
152bool ListItemVisitor::visit(Todo *t) 152bool ListItemVisitor::visit(Todo *t)
153{ 153{
154 mItem->setText(0,i18n("Todo: %1").arg(t->summary())); 154 mItem->setText(0,i18n("Todo: %1").arg(t->summary()));
155 if (t->hasStartDate()) { 155 if (t->hasStartDate()) {
156 mItem->setText(1,t->dtStartDateStr()); 156 mItem->setText(1,t->dtStartDateStr());
157 if (t->doesFloat()) { 157 if (t->doesFloat()) {
158 mItem->setText(2,"---"); 158 mItem->setText(2,"---");
159 } else { 159 } else {
160 mItem->setText(2,t->dtStartTimeStr()); 160 mItem->setText(2,t->dtStartTimeStr());
161 } 161 }
162 } else { 162 } else {
163 mItem->setText(1,"---"); 163 mItem->setText(1,"---");
164 mItem->setText(2,"---"); 164 mItem->setText(2,"---");
165 } 165 }
166 mItem->setText(3,"---"); 166 mItem->setText(3,"---");
167 mItem->setText(4,"---"); 167 mItem->setText(4,"---");
168 if ( t->isAlarmEnabled() ) { 168 if ( t->isAlarmEnabled() ) {
169 mItem->setText(5,t->alarms().first()->offsetText() ); 169 mItem->setText(5,t->alarms().first()->offsetText() );
170 } else { 170 } else {
171 mItem->setText(5, i18n("No")); 171 mItem->setText(5, i18n("No"));
172 } 172 }
173 mItem->setText(6, t->recurrence()->recurrenceText()); 173 mItem->setText(6, t->recurrence()->recurrenceText());
174 if( ! t->doesRecur() ) 174 if( ! t->doesRecur() )
175 mItem->setSortKey( 6, "-" ); 175 mItem->setSortKey( 6, "-" );
176 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
177 mItem->setText(7,t->dtDueDateStr()); 177 mItem->setText(7,t->dtDueDateStr());
178 if (t->doesFloat()) { 178 if (t->doesFloat()) {
179 mItem->setText(8,"---"); 179 mItem->setText(8,"---");
180 } else { 180 } else {
181 mItem->setText(8,t->dtDueTimeStr()); 181 mItem->setText(8,t->dtDueTimeStr());
182 } 182 }
183 } else { 183 } else {
184 mItem->setText(7,"---"); 184 mItem->setText(7,"---");
185 mItem->setText(8,"---"); 185 mItem->setText(8,"---");
186 } 186 }
187 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 187 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
188 mItem->setText(10,t->categoriesStr()); 188 mItem->setText(10,t->categoriesStr());
189 189
190 QString key; 190 QString key;
191 QDate d; 191 QDate d;
192 if (t->hasDueDate()) { 192 if (t->hasDueDate()) {
193 d = t->dtDue().date(); 193 d = t->dtDue().date();
194 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 194 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
196 mItem->setSortKey(7,key); 196 mItem->setSortKey(7,key);
197 } 197 }
198 if ( t->hasStartDate() ) { 198 if ( t->hasStartDate() ) {
199 d = t->dtStart().date(); 199 d = t->dtStart().date();
200 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 200 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
201 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 201 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
202 mItem->setSortKey(1,key); 202 mItem->setSortKey(1,key);
203 } 203 }
204 return true; 204 return true;
205} 205}
206 206
207bool ListItemVisitor::visit(Journal * j) 207bool ListItemVisitor::visit(Journal * j)
208{ 208{
209 QString des = j->description().left(30); 209 QString des = j->description().left(30);
210 des = des.simplifyWhiteSpace (); 210 des = des.simplifyWhiteSpace ();
211 des.replace (QRegExp ("\\n"),"" ); 211 des.replace (QRegExp ("\\n"),"" );
212 des.replace (QRegExp ("\\r"),"" ); 212 des.replace (QRegExp ("\\r"),"" );
213 mItem->setText(0,i18n("Journal: ")+des.left(25)); 213 mItem->setText(0,i18n("Journal: ")+des.left(25));
214 mItem->setText(1,j->dtStartDateStr()); 214 mItem->setText(1,j->dtStartDateStr());
215 mItem->setText(2,"---"); 215 mItem->setText(2,"---");
216 mItem->setText(3,"---"); 216 mItem->setText(3,"---");
217 mItem->setText(4,"---"); 217 mItem->setText(4,"---");
218 mItem->setText(5,"---"); 218 mItem->setText(5,"---");
219 mItem->setText(6,"---"); 219 mItem->setText(6,"---");
220 mItem->setText(7,j->dtStartDateStr()); 220 mItem->setText(7,j->dtStartDateStr());
221 mItem->setText(8,"---"); 221 mItem->setText(8,"---");
222 mItem->setText(9,"---"); 222 mItem->setText(9,"---");
223 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 223 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
224 224
225 QString key; 225 QString key;
226 QDate d = j->dtStart().date(); 226 QDate d = j->dtStart().date();
227 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 227 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
228 mItem->setSortKey(1,key); 228 mItem->setSortKey(1,key);
229 mItem->setSortKey(7,key); 229 mItem->setSortKey(7,key);
230 230
231 return true; 231 return true;
232} 232}
233 233
234KOListView::KOListView(Calendar *calendar, QWidget *parent, 234KOListView::KOListView(Calendar *calendar, QWidget *parent,
235 const char *name) 235 const char *name)
236 : KOEventView(calendar, parent, name) 236 : KOEventView(calendar, parent, name)
237{ 237{
238 mActiveItem = 0; 238 mActiveItem = 0;
239 mListView = new KOListViewListView(this); 239 mListView = new KOListViewListView(this);
240 mListView->addColumn(i18n("Summary")); 240 mListView->addColumn(i18n("Summary"));
241 mListView->addColumn(i18n("Start Date")); 241 mListView->addColumn(i18n("Start Date"));
242 mListView->addColumn(i18n("Start Time")); 242 mListView->addColumn(i18n("Start Time"));
243 mListView->addColumn(i18n("End Date")); 243 mListView->addColumn(i18n("End Date"));
244 mListView->addColumn(i18n("End Time")); 244 mListView->addColumn(i18n("End Time"));
245 mListView->addColumn(i18n("Alarm")); // alarm set? 245 mListView->addColumn(i18n("Alarm")); // alarm set?
246 mListView->addColumn(i18n("Recurs")); // recurs? 246 mListView->addColumn(i18n("Recurs")); // recurs?
247 mListView->addColumn(i18n("Due Date")); 247 mListView->addColumn(i18n("Due Date"));
248 mListView->addColumn(i18n("Due Time")); 248 mListView->addColumn(i18n("Due Time"));
249 mListView->addColumn(i18n("Cancelled")); 249 mListView->addColumn(i18n("Cancelled"));
250 mListView->addColumn(i18n("Categories")); 250 mListView->addColumn(i18n("Categories"));
251 251
252 mListView->setColumnAlignment(0,AlignLeft); 252 mListView->setColumnAlignment(0,AlignLeft);
253 mListView->setColumnAlignment(1,AlignLeft); 253 mListView->setColumnAlignment(1,AlignLeft);
254 mListView->setColumnAlignment(2,AlignHCenter); 254 mListView->setColumnAlignment(2,AlignHCenter);
255 mListView->setColumnAlignment(3,AlignLeft); 255 mListView->setColumnAlignment(3,AlignLeft);
256 mListView->setColumnAlignment(4,AlignHCenter); 256 mListView->setColumnAlignment(4,AlignHCenter);
257 mListView->setColumnAlignment(5,AlignLeft); 257 mListView->setColumnAlignment(5,AlignLeft);
258 mListView->setColumnAlignment(6,AlignLeft); 258 mListView->setColumnAlignment(6,AlignLeft);
259 mListView->setColumnAlignment(7,AlignLeft); 259 mListView->setColumnAlignment(7,AlignLeft);
260 mListView->setColumnAlignment(8,AlignLeft); 260 mListView->setColumnAlignment(8,AlignLeft);
261 mListView->setColumnAlignment(9,AlignLeft); 261 mListView->setColumnAlignment(9,AlignLeft);
262 mListView->setColumnAlignment(10,AlignLeft); 262 mListView->setColumnAlignment(10,AlignLeft);
263 mListView->setColumnWidthMode(10, QListView::Manual); 263 mListView->setColumnWidthMode(10, QListView::Manual);
264 new KOListViewWhatsThis(mListView->viewport(),this); 264 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
265 265
266 int iii = 0; 266 int iii = 0;
267 for ( iii = 0; iii< 10 ; ++iii ) 267 for ( iii = 0; iii< 10 ; ++iii )
268 mListView->setColumnWidthMode( iii, QListView::Manual ); 268 mListView->setColumnWidthMode( iii, QListView::Manual );
269 269
270 QBoxLayout *layoutTop = new QVBoxLayout(this); 270 QBoxLayout *layoutTop = new QVBoxLayout(this);
271 layoutTop->addWidget(mListView); 271 layoutTop->addWidget(mListView);
272 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 272 mListView->setFont ( KOPrefs::instance()->mListViewFont );
273 mPopupMenu = eventPopup(); 273 mPopupMenu = eventPopup();
274 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 274 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
275 i18n("Select all"),this, 275 i18n("Select all"),this,
276 SLOT(allSelection()),true); 276 SLOT(allSelection()),true);
277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
278 i18n("Deselect all"),this, 278 i18n("Deselect all"),this,
279 SLOT(clearSelection()),true); 279 SLOT(clearSelection()),true);
280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
281 i18n("Delete all selected"),this, 281 i18n("Delete all selected"),this,
282 SLOT(deleteAll()),true); 282 SLOT(deleteAll()),true);
283 mPopupMenu->insertSeparator(); 283 mPopupMenu->insertSeparator();
284 QPopupMenu * exportPO = new QPopupMenu ( this ); 284 QPopupMenu * exportPO = new QPopupMenu ( this );
285 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 285 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
286 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 286 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
287 SLOT(saveToFile())); 287 SLOT(saveToFile()));
288 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 288 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
289 SLOT(saveToFileVCS())); 289 SLOT(saveToFileVCS()));
290 exportPO->insertItem( i18n("Journal/Details..."),this, 290 exportPO->insertItem( i18n("Journal/Details..."),this,
291 SLOT(saveDescriptionToFile())); 291 SLOT(saveDescriptionToFile()));
292 // mPopupMenu->insertSeparator(); 292 // mPopupMenu->insertSeparator();
293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
294 i18n("Add Categ. to selected..."),this, 294 i18n("Add Categ. to selected..."),this,
295 SLOT(addCat()),true); 295 SLOT(addCat()),true);
296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
297 i18n("Set Categ. for selected..."),this, 297 i18n("Set Categ. for selected..."),this,
298 SLOT(setCat()),true); 298 SLOT(setCat()),true);
299 //mPopupMenu->insertSeparator(); 299 //mPopupMenu->insertSeparator();
300 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 300 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
301 i18n("Set alarm for selected..."),this, 301 i18n("Set alarm for selected..."),this,
302 SLOT(setAlarm()),true); 302 SLOT(setAlarm()),true);
303 303
304 304
305#ifndef DESKTOP_VERSION 305#ifndef DESKTOP_VERSION
306 mPopupMenu->insertSeparator(); 306 mPopupMenu->insertSeparator();
307 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 307 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
308 i18n("Beam selected via IR"),this, 308 i18n("Beam selected via IR"),this,
309 SLOT(beamSelected()),true); 309 SLOT(beamSelected()),true);
310#endif 310#endif
311 /* 311 /*
312 mPopupMenu = new QPopupMenu; 312 mPopupMenu = new QPopupMenu;
313 mPopupMenu->insertItem(i18n("Edit Event"), this, 313 mPopupMenu->insertItem(i18n("Edit Event"), this,
314 SLOT (editEvent())); 314 SLOT (editEvent()));
315 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 315 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
316 SLOT (deleteEvent())); 316 SLOT (deleteEvent()));
317 mPopupMenu->insertSeparator(); 317 mPopupMenu->insertSeparator();
318 mPopupMenu->insertItem(i18n("Show Dates"), this, 318 mPopupMenu->insertItem(i18n("Show Dates"), this,
319 SLOT(showDates())); 319 SLOT(showDates()));
320 mPopupMenu->insertItem(i18n("Hide Dates"), this, 320 mPopupMenu->insertItem(i18n("Hide Dates"), this,
321 SLOT(hideDates())); 321 SLOT(hideDates()));
322 */ 322 */
323 QObject::connect(mListView,SIGNAL( newEvent()), 323 QObject::connect(mListView,SIGNAL( newEvent()),
324 this,SIGNAL(signalNewEvent())); 324 this,SIGNAL(signalNewEvent()));
325 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 325 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
326 this,SLOT(defaultItemAction(QListViewItem *))); 326 this,SLOT(defaultItemAction(QListViewItem *)));
327 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 327 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
328 const QPoint &, int )), 328 const QPoint &, int )),
329 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 329 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
330 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 330 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
331 SLOT(processSelectionChange(QListViewItem *))); 331 SLOT(processSelectionChange(QListViewItem *)));
332 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 332 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
333 SIGNAL(showIncidenceSignal(Incidence *)) ); 333 SIGNAL(showIncidenceSignal(Incidence *)) );
334 334
335 readSettings(KOGlobals::config(),"KOListView Layout"); 335 readSettings(KOGlobals::config(),"KOListView Layout");
336} 336}
337 337
338KOListView::~KOListView() 338KOListView::~KOListView()
339{ 339{
340 delete mPopupMenu; 340 delete mPopupMenu;
341#if QT_VERSION >= 0x030000
342
343#else
344 delete mKOListViewWhatsThis;
345#endif
341} 346}
342 347
343QString KOListView::getWhatsThisText(QPoint p) 348QString KOListView::getWhatsThisText(QPoint p)
344{ 349{
345 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 350 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
346 if ( item ) 351 if ( item )
347 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 352 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
348 KOPrefs::instance()->mWTshowDetails, 353 KOPrefs::instance()->mWTshowDetails,
349 KOPrefs::instance()->mWTshowCreated, 354 KOPrefs::instance()->mWTshowCreated,
350 KOPrefs::instance()->mWTshowChanged); 355 KOPrefs::instance()->mWTshowChanged);
351 return i18n("That is the list view" ); 356 return i18n("That is the list view" );
352 357
353} 358}
354 359
355void KOListView::updateList() 360void KOListView::updateList()
356{ 361{
357 // qDebug(" KOListView::updateList() "); 362 // qDebug(" KOListView::updateList() ");
358 363
359} 364}
360 365
361void KOListView::addCat( ) 366void KOListView::addCat( )
362{ 367{
363 setCategories( false ); 368 setCategories( false );
364} 369}
365void KOListView::setCat() 370void KOListView::setCat()
366{ 371{
367 setCategories( true ); 372 setCategories( true );
368} 373}
369void KOListView::setAlarm() 374void KOListView::setAlarm()
370{ 375{
371 KOAlarmPrefs kap( this); 376 KOAlarmPrefs kap( this);
372 if ( !kap.exec() ) 377 if ( !kap.exec() )
373 return; 378 return;
374 QStringList itemList; 379 QStringList itemList;
375 QPtrList<KOListViewItem> sel ; 380 QPtrList<KOListViewItem> sel ;
376 QListViewItem *qitem = mListView->firstChild (); 381 QListViewItem *qitem = mListView->firstChild ();
377 while ( qitem ) { 382 while ( qitem ) {
378 if ( qitem->isSelected() ) { 383 if ( qitem->isSelected() ) {
379 Incidence* inc = ((KOListViewItem *) qitem)->data(); 384 Incidence* inc = ((KOListViewItem *) qitem)->data();
380 if ( inc->type() != "Journal" ) { 385 if ( inc->type() != "Journal" ) {
381 if ( inc->type() == "Todo" ) { 386 if ( inc->type() == "Todo" ) {
382 if ( ((Todo*)inc)->hasDueDate() ) 387 if ( ((Todo*)inc)->hasDueDate() )
383 sel.append(((KOListViewItem *)qitem)); 388 sel.append(((KOListViewItem *)qitem));
384 } else 389 } else
385 sel.append(((KOListViewItem *)qitem)); 390 sel.append(((KOListViewItem *)qitem));
386 } 391 }
387 } 392 }
388 qitem = qitem->nextSibling(); 393 qitem = qitem->nextSibling();
389 } 394 }
390 int count = 0; 395 int count = 0;
391 KOListViewItem * item, *temp; 396 KOListViewItem * item, *temp;
392 item = sel.first(); 397 item = sel.first();
393 Incidence* inc; 398 Incidence* inc;
394 while ( item ) { 399 while ( item ) {
395 inc = item->data(); 400 inc = item->data();
396 ++count; 401 ++count;
397 if (kap.mAlarmButton->isChecked()) { 402 if (kap.mAlarmButton->isChecked()) {
398 if (inc->alarms().count() == 0) 403 if (inc->alarms().count() == 0)
399 inc->newAlarm(); 404 inc->newAlarm();
400 QPtrList<Alarm> alarms = inc->alarms(); 405 QPtrList<Alarm> alarms = inc->alarms();
401 Alarm *alarm; 406 Alarm *alarm;
402 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 407 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
403 alarm->setEnabled(true); 408 alarm->setEnabled(true);
404 int j = kap.mAlarmTimeEdit->value()* -60; 409 int j = kap.mAlarmTimeEdit->value()* -60;
405 if (kap.mAlarmIncrCombo->currentItem() == 1) 410 if (kap.mAlarmIncrCombo->currentItem() == 1)
406 j = j * 60; 411 j = j * 60;
407 else if (kap.mAlarmIncrCombo->currentItem() == 2) 412 else if (kap.mAlarmIncrCombo->currentItem() == 2)
408 j = j * (60 * 24); 413 j = j * (60 * 24);
409 alarm->setStartOffset( j ); 414 alarm->setStartOffset( j );
410 415
411 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 416 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
412 alarm->setProcedureAlarm(kap.mAlarmProgram); 417 alarm->setProcedureAlarm(kap.mAlarmProgram);
413 } 418 }
414 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 419 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
415 alarm->setAudioAlarm(kap.mAlarmSound); 420 alarm->setAudioAlarm(kap.mAlarmSound);
416 else 421 else
417 alarm->setType(Alarm::Invalid); 422 alarm->setType(Alarm::Invalid);
418 //alarm->setAudioAlarm("default"); 423 //alarm->setAudioAlarm("default");
419 // TODO: Deal with multiple alarms 424 // TODO: Deal with multiple alarms
420 break; // For now, stop after the first alarm 425 break; // For now, stop after the first alarm
421 } 426 }
422 } else { 427 } else {
423 Alarm* alarm = inc->alarms().first(); 428 Alarm* alarm = inc->alarms().first();
424 if ( alarm ) { 429 if ( alarm ) {
425 alarm->setEnabled(false); 430 alarm->setEnabled(false);
426 alarm->setType(Alarm::Invalid); 431 alarm->setType(Alarm::Invalid);
427 } 432 }
428 } 433 }
429 ListItemVisitor v(item, mStartDate ); 434 ListItemVisitor v(item, mStartDate );
430 inc->accept(v); 435 inc->accept(v);
431 item = sel.next(); 436 item = sel.next();
432 } 437 }
433 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 438 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
434 qDebug("KO: Set alarm for %d items", count); 439 qDebug("KO: Set alarm for %d items", count);
435 calendar()->reInitAlarmSettings(); 440 calendar()->reInitAlarmSettings();
436 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 441 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
437} 442}
438void KOListView::setCategories( bool removeOld ) 443void KOListView::setCategories( bool removeOld )
439{ 444{
440 445
441 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 446 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
442 csd->setColorEnabled(); 447 csd->setColorEnabled();
443 if (! csd->exec()) { 448 if (! csd->exec()) {
444 delete csd; 449 delete csd;
445 return; 450 return;
446 } 451 }
447 QStringList catList = csd->selectedCategories(); 452 QStringList catList = csd->selectedCategories();
448 delete csd; 453 delete csd;
449 // if ( catList.count() == 0 ) 454 // if ( catList.count() == 0 )
450 // return; 455 // return;
451 //catList.sort(); 456 //catList.sort();
452 QString categoriesStr = catList.join(","); 457 QString categoriesStr = catList.join(",");
453 int i; 458 int i;
454 QStringList itemList; 459 QStringList itemList;
455 QPtrList<KOListViewItem> sel ; 460 QPtrList<KOListViewItem> sel ;
456 QListViewItem *qitem = mListView->firstChild (); 461 QListViewItem *qitem = mListView->firstChild ();
457 while ( qitem ) { 462 while ( qitem ) {
458 if ( qitem->isSelected() ) { 463 if ( qitem->isSelected() ) {
459 sel.append(((KOListViewItem *)qitem)); 464 sel.append(((KOListViewItem *)qitem));
460 } 465 }
461 qitem = qitem->nextSibling(); 466 qitem = qitem->nextSibling();
462 } 467 }
463 KOListViewItem * item, *temp; 468 KOListViewItem * item, *temp;
464 item = sel.first(); 469 item = sel.first();
465 if( item ) { 470 if( item ) {
466 Incidence* inc = item->data() ; 471 Incidence* inc = item->data() ;
467 bool setSub = false; 472 bool setSub = false;
468 if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) { 473 if( inc->type() == "Todo" && sel.count() == 1 && inc->relations().count() > 0 ) {
469 int result = KMessageBox::warningYesNoCancel(this, 474 int result = KMessageBox::warningYesNoCancel(this,
470 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), 475 i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ),
471 i18n("Todo has subtodos"), 476 i18n("Todo has subtodos"),
472 i18n("Yes"), 477 i18n("Yes"),
473 i18n("No")); 478 i18n("No"));
474 if (result == KMessageBox::Cancel) item = 0; 479 if (result == KMessageBox::Cancel) item = 0;
475 if (result == KMessageBox::Yes) setSub = true; 480 if (result == KMessageBox::Yes) setSub = true;
476 } 481 }
477 while ( item ) { 482 while ( item ) {
478 inc = item->data(); 483 inc = item->data();
479 if ( removeOld ) { 484 if ( removeOld ) {
480 inc->setCategories( catList, setSub ); 485 inc->setCategories( catList, setSub );
481 } else { 486 } else {
482 inc->addCategories( catList, setSub ); 487 inc->addCategories( catList, setSub );
483 } 488 }
484 ListItemVisitor v(item, mStartDate ); 489 ListItemVisitor v(item, mStartDate );
485 inc->accept(v); 490 inc->accept(v);
486 item = sel.next(); 491 item = sel.next();
487 } 492 }
488 } 493 }
489 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 494 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
490} 495}
491 496
492void KOListView::beamSelected() 497void KOListView::beamSelected()
493{ 498{
494 int icount = 0; 499 int icount = 0;
495 QPtrList<Incidence> delSel ; 500 QPtrList<Incidence> delSel ;
496 QListViewItem *item = mListView->firstChild (); 501 QListViewItem *item = mListView->firstChild ();
497 while ( item ) { 502 while ( item ) {
498 if ( item->isSelected() ) { 503 if ( item->isSelected() ) {
499 delSel.append(((KOListViewItem *)item)->data()); 504 delSel.append(((KOListViewItem *)item)->data());
500 ++icount; 505 ++icount;
501 } 506 }
502 507
503 item = item->nextSibling(); 508 item = item->nextSibling();
504 } 509 }
505 if ( icount ) { 510 if ( icount ) {
506 emit beamIncidenceList( delSel ); 511 emit beamIncidenceList( delSel );
507 return; 512 return;
508 QString fn ; 513 QString fn ;
509 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 514 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
510 QString mes; 515 QString mes;
511 bool createbup = true; 516 bool createbup = true;
512 if ( createbup ) { 517 if ( createbup ) {
513 QString description = "\n"; 518 QString description = "\n";
514 CalendarLocal* cal = new CalendarLocal(); 519 CalendarLocal* cal = new CalendarLocal();
515 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 520 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
516 Incidence *incidence = delSel.first(); 521 Incidence *incidence = delSel.first();
517 while ( incidence ) { 522 while ( incidence ) {
518 Incidence *in = incidence->clone(); 523 Incidence *in = incidence->clone();
519 description += in->summary() + "\n"; 524 description += in->summary() + "\n";
520 cal->addIncidence( in ); 525 cal->addIncidence( in );
521 incidence = delSel.next(); 526 incidence = delSel.next();
522 } 527 }
523 FileStorage storage( cal, fn, new VCalFormat ); 528 FileStorage storage( cal, fn, new VCalFormat );
524 storage.save(); 529 storage.save();
525 delete cal; 530 delete cal;
526 mes = i18n("KO/Pi: Ready for beaming"); 531 mes = i18n("KO/Pi: Ready for beaming");
527 topLevelWidget()->setCaption(mes); 532 topLevelWidget()->setCaption(mes);
528 533
529#ifndef DESKTOP_VERSION 534#ifndef DESKTOP_VERSION
530 Ir *ir = new Ir( this ); 535 Ir *ir = new Ir( this );
531 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 536 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
532 ir->send( fn, description, "text/x-vCalendar" ); 537 ir->send( fn, description, "text/x-vCalendar" );
@@ -992,276 +997,277 @@ void KOListView::defaultItemAction(QListViewItem *i)
992 if ( item ) defaultAction( item->data() ); 997 if ( item ) defaultAction( item->data() );
993 998
994} 999}
995 1000
996void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 1001void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
997{ 1002{
998 mActiveItem = (KOListViewItem *)item; 1003 mActiveItem = (KOListViewItem *)item;
999 if (mActiveItem) { 1004 if (mActiveItem) {
1000 Incidence *incidence = mActiveItem->data(); 1005 Incidence *incidence = mActiveItem->data();
1001 mPopupMenu->showIncidencePopup(incidence); 1006 mPopupMenu->showIncidencePopup(incidence);
1002 1007
1003 /* 1008 /*
1004 if ( incidence && incidence->type() == "Event" ) { 1009 if ( incidence && incidence->type() == "Event" ) {
1005 Event *event = static_cast<Event *>( incidence ); 1010 Event *event = static_cast<Event *>( incidence );
1006 mPopupMenu->showEventPopup(event); 1011 mPopupMenu->showEventPopup(event);
1007 } 1012 }
1008 */ 1013 */
1009 } 1014 }
1010} 1015}
1011 1016
1012void KOListView::readSettings(KConfig *config, QString setting) 1017void KOListView::readSettings(KConfig *config, QString setting)
1013{ 1018{
1014 // qDebug("KOListView::readSettings "); 1019 // qDebug("KOListView::readSettings ");
1015 mListView->restoreLayout(config,setting); 1020 mListView->restoreLayout(config,setting);
1016} 1021}
1017 1022
1018void KOListView::writeSettings(KConfig *config, QString setting) 1023void KOListView::writeSettings(KConfig *config, QString setting)
1019{ 1024{
1020 // qDebug("KOListView::writeSettings "); 1025 // qDebug("KOListView::writeSettings ");
1021 mListView->saveLayout(config, setting); 1026 mListView->saveLayout(config, setting);
1022} 1027}
1023 1028
1024void KOListView::processSelectionChange(QListViewItem *) 1029void KOListView::processSelectionChange(QListViewItem *)
1025{ 1030{
1026 1031
1027 KOListViewItem *item = 1032 KOListViewItem *item =
1028 static_cast<KOListViewItem *>( mListView->currentItem() ); 1033 static_cast<KOListViewItem *>( mListView->currentItem() );
1029 1034
1030 if ( !item ) { 1035 if ( !item ) {
1031 emit incidenceSelected( 0 ); 1036 emit incidenceSelected( 0 );
1032 } else { 1037 } else {
1033 emit incidenceSelected( item->data() ); 1038 emit incidenceSelected( item->data() );
1034 } 1039 }
1035} 1040}
1036 1041
1037void KOListView::clearSelection() 1042void KOListView::clearSelection()
1038{ 1043{
1039 mListView->selectAll( false ); 1044 mListView->selectAll( false );
1040} 1045}
1041void KOListView::allSelection() 1046void KOListView::allSelection()
1042{ 1047{
1043 mListView->selectAll( true ); 1048 mListView->selectAll( true );
1044} 1049}
1045 1050
1046void KOListView::clear() 1051void KOListView::clear()
1047{ 1052{
1048 mListView->clear(); 1053 mListView->clear();
1049 mUidDict.clear(); 1054 mUidDict.clear();
1050} 1055}
1051 1056
1052Incidence* KOListView::currentItem() 1057Incidence* KOListView::currentItem()
1053{ 1058{
1054 if ( mListView->currentItem() ) 1059 if ( mListView->currentItem() )
1055 return ((KOListViewItem*) mListView->currentItem())->data(); 1060 return ((KOListViewItem*) mListView->currentItem())->data();
1056 return 0; 1061 return 0;
1057} 1062}
1058void KOListView::keyPressEvent ( QKeyEvent *e) 1063void KOListView::keyPressEvent ( QKeyEvent *e)
1059{ 1064{
1060 1065
1061 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { 1066 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
1062 deleteAll(); 1067 deleteAll();
1063 return; 1068 return;
1064 } 1069 }
1065 1070
1066 e->ignore(); 1071 e->ignore();
1067} 1072}
1068void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1073void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1069{ 1074{
1070 1075
1071 switch ( e->key() ) { 1076 switch ( e->key() ) {
1072 case Qt::Key_Down: 1077 case Qt::Key_Down:
1073 if ( e->state() == ShiftButton ) { 1078 if ( e->state() == ShiftButton ) {
1074 QListViewItem* cn = currentItem(); 1079 QListViewItem* cn = currentItem();
1075 if ( !cn ) 1080 if ( !cn )
1076 cn = firstChild(); 1081 cn = firstChild();
1077 if ( !cn ) 1082 if ( !cn )
1078 return; 1083 return;
1079 while ( cn->nextSibling() ) 1084 while ( cn->nextSibling() )
1080 cn = cn->nextSibling(); 1085 cn = cn->nextSibling();
1081 setCurrentItem ( cn ); 1086 setCurrentItem ( cn );
1082 ensureItemVisible ( cn ); 1087 ensureItemVisible ( cn );
1083 1088
1084 e->accept(); 1089 e->accept();
1085 return; 1090 return;
1086 } 1091 }
1087 if ( e->state() == ControlButton ) { 1092 if ( e->state() == ControlButton ) {
1088 int count = childCount (); 1093 int count = childCount ();
1089 int jump = count / 5; 1094 int jump = count / 5;
1090 QListViewItem* cn; 1095 QListViewItem* cn;
1091 cn = currentItem(); 1096 cn = currentItem();
1092 if ( ! cn ) 1097 if ( ! cn )
1093 return; 1098 return;
1094 if ( jump == 0 ) 1099 if ( jump == 0 )
1095 jump = 1; 1100 jump = 1;
1096 while ( jump && cn->nextSibling() ) { 1101 while ( jump && cn->nextSibling() ) {
1097 cn = cn->nextSibling(); 1102 cn = cn->nextSibling();
1098 --jump; 1103 --jump;
1099 } 1104 }
1100 setCurrentItem ( cn ); 1105 setCurrentItem ( cn );
1101 ensureItemVisible ( cn ); 1106 ensureItemVisible ( cn );
1102 1107
1103 } else 1108 } else
1104 QListView::keyPressEvent ( e ) ; 1109 QListView::keyPressEvent ( e ) ;
1105 e->accept(); 1110 e->accept();
1106 break; 1111 break;
1107 1112
1108 case Qt::Key_Up: 1113 case Qt::Key_Up:
1109 if ( e->state() == ShiftButton ) { 1114 if ( e->state() == ShiftButton ) {
1110 QListViewItem* cn = firstChild(); 1115 QListViewItem* cn = firstChild();
1111 if ( cn ) { 1116 if ( cn ) {
1112 setCurrentItem ( cn ); 1117 setCurrentItem ( cn );
1113 ensureItemVisible ( cn ); 1118 ensureItemVisible ( cn );
1114 } 1119 }
1115 e->accept(); 1120 e->accept();
1116 return; 1121 return;
1117 } 1122 }
1118 if ( e->state() == ControlButton ) { 1123 if ( e->state() == ControlButton ) {
1119 int count = childCount (); 1124 int count = childCount ();
1120 int jump = count / 5; 1125 int jump = count / 5;
1121 QListViewItem* cn; 1126 QListViewItem* cn;
1122 cn = currentItem(); 1127 cn = currentItem();
1123 if ( ! cn ) 1128 if ( ! cn )
1124 return; 1129 return;
1125 if ( jump == 0 ) 1130 if ( jump == 0 )
1126 jump = 1; 1131 jump = 1;
1127 while ( jump && cn->itemAbove ()) { 1132 while ( jump && cn->itemAbove ()) {
1128 cn = cn->itemAbove (); 1133 cn = cn->itemAbove ();
1129 --jump; 1134 --jump;
1130 } 1135 }
1131 setCurrentItem ( cn ); 1136 setCurrentItem ( cn );
1132 ensureItemVisible ( cn ); 1137 ensureItemVisible ( cn );
1133 } else 1138 } else
1134 QListView::keyPressEvent ( e ) ; 1139 QListView::keyPressEvent ( e ) ;
1135 e->accept(); 1140 e->accept();
1136 break; 1141 break;
1137 case Qt::Key_I: { 1142 case Qt::Key_I: {
1138 QListViewItem* cn; 1143 QListViewItem* cn;
1139 cn = currentItem(); 1144 cn = currentItem();
1140 if ( cn ) { 1145 if ( cn ) {
1141 KOListViewItem* ci = (KOListViewItem*)( cn ); 1146 KOListViewItem* ci = (KOListViewItem*)( cn );
1142 if ( ci ){ 1147 if ( ci ){
1143 //emit showIncidence( ci->data()); 1148 //emit showIncidence( ci->data());
1144 cn = cn->nextSibling(); 1149 cn = cn->nextSibling();
1145 if ( cn ) { 1150 if ( cn ) {
1146 setCurrentItem ( cn ); 1151 setCurrentItem ( cn );
1147 ensureItemVisible ( cn ); 1152 ensureItemVisible ( cn );
1148 } 1153 }
1149 emit showIncidence( ci->data()); 1154 emit showIncidence( ci->data());
1150 } 1155 }
1151 } 1156 }
1152 e->accept(); 1157 e->accept();
1153 } 1158 }
1154 break; 1159 break;
1155 case Qt::Key_Return: 1160 case Qt::Key_Return:
1156 case Qt::Key_Enter: 1161 case Qt::Key_Enter:
1157 { 1162 {
1158 QListViewItem* cn; 1163 QListViewItem* cn;
1159 cn = currentItem(); 1164 cn = currentItem();
1160 if ( cn ) { 1165 if ( cn ) {
1161 KOListViewItem* ci = (KOListViewItem*)( cn ); 1166 KOListViewItem* ci = (KOListViewItem*)( cn );
1162 if ( ci ){ 1167 if ( ci ){
1163 if ( e->state() == ShiftButton ) 1168 if ( e->state() == ShiftButton )
1164 ci->setSelected( false ); 1169 ci->setSelected( false );
1165 else 1170 else
1166 ci->setSelected( true ); 1171 ci->setSelected( true );
1167 cn = cn->nextSibling(); 1172 cn = cn->nextSibling();
1168 if ( cn ) { 1173 if ( cn ) {
1169 setCurrentItem ( cn ); 1174 setCurrentItem ( cn );
1170 ensureItemVisible ( cn ); 1175 ensureItemVisible ( cn );
1171 } 1176 }
1172 } 1177 }
1173 } 1178 }
1174 e->accept(); 1179 e->accept();
1175 } 1180 }
1176 break; 1181 break;
1177 default: 1182 default:
1178 e->ignore(); 1183 e->ignore();
1179 } 1184 }
1180} 1185}
1181KOListViewListView::KOListViewListView(KOListView * lv ) 1186KOListViewListView::KOListViewListView(KOListView * lv )
1182 : KListView( lv, "kolistlistview", false ) 1187 : KListView( lv, "kolistlistview", false )
1183{ 1188{
1189 mYMousePos = 0;
1184 mPopupTimer = new QTimer(this); 1190 mPopupTimer = new QTimer(this);
1185 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 1191 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
1186#ifndef DESKTOP_VERSION 1192#ifndef DESKTOP_VERSION
1187 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1193 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1188#endif 1194#endif
1189 setSelectionMode( QListView::Multi ); 1195 setSelectionMode( QListView::Multi );
1190 setMultiSelection( true); 1196 setMultiSelection( true);
1191} 1197}
1192void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1198void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1193{ 1199{
1194 if (!e) return; 1200 if (!e) return;
1195 QPoint vp = contentsToViewport(e->pos()); 1201 QPoint vp = contentsToViewport(e->pos());
1196 QListViewItem *item = itemAt(vp); 1202 QListViewItem *item = itemAt(vp);
1197 if (!item) { 1203 if (!item) {
1198 emit newEvent(); 1204 emit newEvent();
1199 return; 1205 return;
1200 } 1206 }
1201 KListView::contentsMouseDoubleClickEvent(e); 1207 KListView::contentsMouseDoubleClickEvent(e);
1202} 1208}
1203#if 0 1209#if 0
1204void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1210void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1205{ 1211{
1206 //qDebug("contentsMousePressEvent++++ "); 1212 //qDebug("contentsMousePressEvent++++ ");
1207 KListView::contentsMousePressEvent( e ); 1213 KListView::contentsMousePressEvent( e );
1208 if ( e->button() == RightButton ) { 1214 if ( e->button() == RightButton ) {
1209 QListViewItem* ci = currentItem(); 1215 QListViewItem* ci = currentItem();
1210 clearSelection () ; 1216 clearSelection () ;
1211 if ( ci ) 1217 if ( ci )
1212 ci->setSelected( true ); 1218 ci->setSelected( true );
1213 } 1219 }
1214} 1220}
1215void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1221void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1216{ 1222{
1217 KListView::contentsMouseReleaseEvent(e); 1223 KListView::contentsMouseReleaseEvent(e);
1218} 1224}
1219void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1225void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1220{ 1226{
1221 KListView::contentsMouseMoveEvent(e); 1227 KListView::contentsMouseMoveEvent(e);
1222} 1228}
1223#endif 1229#endif
1224void KOListViewListView::popupMenu() 1230void KOListViewListView::popupMenu()
1225{ 1231{
1226 mPopupTimer->stop(); 1232 mPopupTimer->stop();
1227 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); 1233 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton );
1228 QApplication::postEvent( this->viewport(), e ); 1234 QApplication::postEvent( this->viewport(), e );
1229 1235
1230} 1236}
1231void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1237void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1232{ 1238{
1233 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); 1239 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
1234 mYMousePos = mapToGlobal( (e->pos())).y(); 1240 mYMousePos = mapToGlobal( (e->pos())).y();
1235 if ( e->button() == LeftButton ) { 1241 if ( e->button() == LeftButton ) {
1236 mPopupTimer->start( 600 ); 1242 mPopupTimer->start( 600 );
1237 mEventPos = contentsToViewport(e->pos()); 1243 mEventPos = contentsToViewport(e->pos());
1238 mEventGlobalPos = e->globalPos(); 1244 mEventGlobalPos = e->globalPos();
1239 } 1245 }
1240 KListView::contentsMousePressEvent( e ); 1246 KListView::contentsMousePressEvent( e );
1241 if ( e->button() == RightButton ) { 1247 if ( e->button() == RightButton ) {
1242 QListViewItem* ci = currentItem(); 1248 QListViewItem* ci = currentItem();
1243 //clearSelection(); 1249 //clearSelection();
1244 if ( ci ) 1250 if ( ci )
1245 ci->setSelected( true ); 1251 ci->setSelected( true );
1246 } 1252 }
1247} 1253}
1248void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1254void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1249{ 1255{
1250 mPopupTimer->stop(); 1256 mPopupTimer->stop();
1251 KListView::contentsMouseReleaseEvent(e); 1257 KListView::contentsMouseReleaseEvent(e);
1252} 1258}
1253void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1259void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1254{ 1260{
1255 // qDebug("contentsMouseMoveEv....... "); 1261 // qDebug("contentsMouseMoveEv....... ");
1256 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1262 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1257 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1263 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1258 if ( diff < 0 ) diff = -diff; 1264 if ( diff < 0 ) diff = -diff;
1259 if ( diff > 15 ) 1265 if ( diff > 15 )
1260 mPopupTimer->stop(); 1266 mPopupTimer->stop();
1261 else { 1267 else {
1262 mEventPos = contentsToViewport(e->pos()); 1268 mEventPos = contentsToViewport(e->pos());
1263 mEventGlobalPos = e->globalPos(); 1269 mEventGlobalPos = e->globalPos();
1264 } 1270 }
1265 KListView::contentsMouseMoveEvent(e); 1271 KListView::contentsMouseMoveEvent(e);
1266} 1272}
1267 1273
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index eb5bb6e..2051d60 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -1,311 +1,312 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 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#ifndef _KOLISTVIEW_H 24#ifndef _KOLISTVIEW_H
25#define _KOLISTVIEW_H 25#define _KOLISTVIEW_H
26 26
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qmap.h> 28#include <qmap.h>
29#include <qdict.h> 29#include <qdict.h>
30 30
31#include <klistview.h> 31#include <klistview.h>
32 32
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/incidence.h> 38#include <libkcal/incidence.h>
39 39
40#include "koeventview.h" 40#include "koeventview.h"
41#include "customlistviewitem.h" 41#include "customlistviewitem.h"
42 42
43using namespace KCal; 43using namespace KCal;
44 44
45 45class KOListViewWhatsThis;
46 46
47#include <qpushbutton.h> 47#include <qpushbutton.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qdialog.h> 49#include <qdialog.h>
50#include <qtimer.h> 50#include <qtimer.h>
51#include <qcombobox.h> 51#include <qcombobox.h>
52#include <qspinbox.h> 52#include <qspinbox.h>
53#include <qtooltip.h> 53#include <qtooltip.h>
54#include <qcheckbox.h> 54#include <qcheckbox.h>
55#include <qhbox.h> 55#include <qhbox.h>
56#include <qlabel.h> 56#include <qlabel.h>
57#include <kiconloader.h> 57#include <kiconloader.h>
58#include "kfiledialog.h" 58#include "kfiledialog.h"
59#include "koprefs.h" 59#include "koprefs.h"
60class KOAlarmPrefs : public QDialog 60class KOAlarmPrefs : public QDialog
61{ 61{
62 Q_OBJECT 62 Q_OBJECT
63 public: 63 public:
64 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) : 64 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) :
65 QDialog( par, name, true ) 65 QDialog( par, name, true )
66 { 66 {
67 setCaption( i18n("Alarm Options") ); 67 setCaption( i18n("Alarm Options") );
68 QVBoxLayout* alarmLayout = new QVBoxLayout( this ); 68 QVBoxLayout* alarmLayout = new QVBoxLayout( this );
69 alarmLayout->setSpacing( 3 ); 69 alarmLayout->setSpacing( 3 );
70 alarmLayout->setMargin( 3 ); 70 alarmLayout->setMargin( 3 );
71 QWidget *parent = this; 71 QWidget *parent = this;
72 mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent); 72 mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent);
73 alarmLayout->addWidget(mAlarmButton); 73 alarmLayout->addWidget(mAlarmButton);
74 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 74 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
75 mAlarmTimeEdit->setValue( 15 ); 75 mAlarmTimeEdit->setValue( 15 );
76 alarmLayout->addWidget(mAlarmTimeEdit); 76 alarmLayout->addWidget(mAlarmTimeEdit);
77 mAlarmIncrCombo = new QComboBox(false, parent); 77 mAlarmIncrCombo = new QComboBox(false, parent);
78 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 78 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
79 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 79 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
80 mAlarmIncrCombo->insertItem(i18n("day(s)")); 80 mAlarmIncrCombo->insertItem(i18n("day(s)"));
81 alarmLayout->addWidget(mAlarmIncrCombo); 81 alarmLayout->addWidget(mAlarmIncrCombo);
82 QHBox * hb = new QHBox ( parent ); 82 QHBox * hb = new QHBox ( parent );
83 alarmLayout->addWidget(hb); 83 alarmLayout->addWidget(hb);
84 mAlarmSoundButton = new QPushButton(hb); 84 mAlarmSoundButton = new QPushButton(hb);
85 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 85 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
86 mAlarmSoundButton->setToggleButton(true); 86 mAlarmSoundButton->setToggleButton(true);
87 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 87 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
88 mAlarmProgramButton = new QPushButton(hb); 88 mAlarmProgramButton = new QPushButton(hb);
89 mAlarmProgramButton->setPixmap(SmallIcon("run")); 89 mAlarmProgramButton->setPixmap(SmallIcon("run"));
90 mAlarmProgramButton->setToggleButton(true); 90 mAlarmProgramButton->setToggleButton(true);
91 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 91 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
92 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 92 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
93 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 93 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
94 mAlarmLabel = new QLabel( this ); 94 mAlarmLabel = new QLabel( this );
95 alarmLayout->addWidget( mAlarmLabel ); 95 alarmLayout->addWidget( mAlarmLabel );
96 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); 96 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) );
97 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 97 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
98 mAlarmSoundButton->setOn( true ); 98 mAlarmSoundButton->setOn( true );
99 QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this ); 99 QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this );
100 alarmLayout->addWidget( ok ); 100 alarmLayout->addWidget( ok );
101 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 101 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
102 alarmLayout->addWidget( cancel ); 102 alarmLayout->addWidget( cancel );
103 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 103 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
104 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 104 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
105 resize( 200, 200 ); 105 resize( 200, 200 );
106 106
107 } 107 }
108 108
109 109
110 110
111 QString mAlarmSound, mAlarmProgram ; 111 QString mAlarmSound, mAlarmProgram ;
112 QCheckBox* mAlarmButton; 112 QCheckBox* mAlarmButton;
113 QSpinBox* mAlarmTimeEdit; 113 QSpinBox* mAlarmTimeEdit;
114 QLabel* mAlarmLabel; 114 QLabel* mAlarmLabel;
115 QComboBox* mAlarmIncrCombo ; 115 QComboBox* mAlarmIncrCombo ;
116 QPushButton* mAlarmSoundButton ,*mAlarmProgramButton; 116 QPushButton* mAlarmSoundButton ,*mAlarmProgramButton;
117private slots: 117private slots:
118 118
119void pickAlarmSound() 119void pickAlarmSound()
120{ 120{
121 //QString prefix = mAlarmSound; 121 //QString prefix = mAlarmSound;
122 if (!mAlarmSoundButton->isOn()) { 122 if (!mAlarmSoundButton->isOn()) {
123 //mAlarmSound = ""; 123 //mAlarmSound = "";
124 QToolTip::remove(mAlarmSoundButton); 124 QToolTip::remove(mAlarmSoundButton);
125 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 125 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
126 mAlarmProgramButton->setOn(true); 126 mAlarmProgramButton->setOn(true);
127 mAlarmSoundButton->setOn(false); 127 mAlarmSoundButton->setOn(false);
128 } else { 128 } else {
129 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 129 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
130 i18n("*.wav|Wav Files"), 0)); 130 i18n("*.wav|Wav Files"), 0));
131 if (!fileName.isEmpty()) { 131 if (!fileName.isEmpty()) {
132 mAlarmSound = fileName; 132 mAlarmSound = fileName;
133 mAlarmLabel->setText( "..."+fileName.right( 30 ) ); 133 mAlarmLabel->setText( "..."+fileName.right( 30 ) );
134 QToolTip::remove(mAlarmSoundButton); 134 QToolTip::remove(mAlarmSoundButton);
135 QString dispStr = i18n("Playing '%1'").arg(fileName); 135 QString dispStr = i18n("Playing '%1'").arg(fileName);
136 QToolTip::add(mAlarmSoundButton, dispStr); 136 QToolTip::add(mAlarmSoundButton, dispStr);
137 mAlarmProgramButton->setOn(false); 137 mAlarmProgramButton->setOn(false);
138 mAlarmSoundButton->setOn(true); 138 mAlarmSoundButton->setOn(true);
139 } else { 139 } else {
140 mAlarmProgramButton->setOn(true); 140 mAlarmProgramButton->setOn(true);
141 mAlarmSoundButton->setOn(false); 141 mAlarmSoundButton->setOn(false);
142 142
143 } 143 }
144 } 144 }
145}; 145};
146 146
147void pickAlarmProgram() 147void pickAlarmProgram()
148{ 148{
149 if (!mAlarmProgramButton->isOn()) { 149 if (!mAlarmProgramButton->isOn()) {
150 //mAlarmProgram = ""; 150 //mAlarmProgram = "";
151 QToolTip::remove(mAlarmProgramButton); 151 QToolTip::remove(mAlarmProgramButton);
152 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 152 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
153 mAlarmProgramButton->setOn(false); 153 mAlarmProgramButton->setOn(false);
154 mAlarmSoundButton->setOn(true); 154 mAlarmSoundButton->setOn(true);
155 } else { 155 } else {
156 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0)); 156 QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm.: ") , 0));
157 if (!fileName.isEmpty()) { 157 if (!fileName.isEmpty()) {
158 mAlarmProgram = fileName; 158 mAlarmProgram = fileName;
159 mAlarmLabel->setText( "..."+fileName.right( 30 ) ); 159 mAlarmLabel->setText( "..."+fileName.right( 30 ) );
160 QToolTip::remove(mAlarmProgramButton); 160 QToolTip::remove(mAlarmProgramButton);
161 QString dispStr = i18n("Running '%1'").arg(fileName); 161 QString dispStr = i18n("Running '%1'").arg(fileName);
162 QToolTip::add(mAlarmProgramButton, dispStr); 162 QToolTip::add(mAlarmProgramButton, dispStr);
163 mAlarmSoundButton->setOn(false); 163 mAlarmSoundButton->setOn(false);
164 mAlarmProgramButton->setOn(true); 164 mAlarmProgramButton->setOn(true);
165 } else { 165 } else {
166 mAlarmProgramButton->setOn(false); 166 mAlarmProgramButton->setOn(false);
167 mAlarmSoundButton->setOn(true); 167 mAlarmSoundButton->setOn(true);
168 } 168 }
169 } 169 }
170}; 170};
171 171
172}; 172};
173 173
174 174
175 175
176 176
177 177
178 178
179 179
180typedef CustomListViewItem<Incidence *> KOListViewItem; 180typedef CustomListViewItem<Incidence *> KOListViewItem;
181 181
182/** 182/**
183 This class provides the initialisation of a KOListViewItem for calendar 183 This class provides the initialisation of a KOListViewItem for calendar
184 components using the Incidence::Visitor. 184 components using the Incidence::Visitor.
185*/ 185*/
186class ListItemVisitor : public Incidence::Visitor 186class ListItemVisitor : public Incidence::Visitor
187{ 187{
188 public: 188 public:
189 ListItemVisitor(KOListViewItem *, QDate d); 189 ListItemVisitor(KOListViewItem *, QDate d);
190 ~ListItemVisitor(); 190 ~ListItemVisitor();
191 191
192 bool visit(Event *); 192 bool visit(Event *);
193 bool visit(Todo *); 193 bool visit(Todo *);
194 bool visit(Journal *); 194 bool visit(Journal *);
195 195
196 private: 196 private:
197 KOListViewItem *mItem; 197 KOListViewItem *mItem;
198 QDate mDate; 198 QDate mDate;
199}; 199};
200 200
201/** 201/**
202 This class provides a multi-column list view of events. It can 202 This class provides a multi-column list view of events. It can
203 display events from one particular day or several days, it doesn't 203 display events from one particular day or several days, it doesn't
204 matter. To use a view that only handles one day at a time, use 204 matter. To use a view that only handles one day at a time, use
205 KODayListView. 205 KODayListView.
206 206
207 @short multi-column list view of various events. 207 @short multi-column list view of various events.
208 @author Preston Brown <pbrown@kde.org> 208 @author Preston Brown <pbrown@kde.org>
209 @see KOBaseView, KODayListView 209 @see KOBaseView, KODayListView
210*/ 210*/
211class KOListView; 211class KOListView;
212 212
213class KOListViewListView : public KListView 213class KOListViewListView : public KListView
214{ 214{
215 Q_OBJECT 215 Q_OBJECT
216 public: 216 public:
217 KOListViewListView(KOListView * lv ); 217 KOListViewListView(KOListView * lv );
218 signals: 218 signals:
219 void newEvent(); 219 void newEvent();
220 void showIncidence( Incidence* ); 220 void showIncidence( Incidence* );
221 public slots: 221 public slots:
222 void popupMenu(); 222 void popupMenu();
223 private: 223 private:
224 QPoint mEventPos; 224 QPoint mEventPos;
225 QPoint mEventGlobalPos; 225 QPoint mEventGlobalPos;
226 QTimer* mPopupTimer; 226 QTimer* mPopupTimer;
227 int mYMousePos; 227 int mYMousePos;
228 void keyPressEvent ( QKeyEvent * ) ; 228 void keyPressEvent ( QKeyEvent * ) ;
229 void contentsMouseDoubleClickEvent(QMouseEvent *e); 229 void contentsMouseDoubleClickEvent(QMouseEvent *e);
230 void contentsMousePressEvent(QMouseEvent *e); 230 void contentsMousePressEvent(QMouseEvent *e);
231 void contentsMouseReleaseEvent(QMouseEvent *e); 231 void contentsMouseReleaseEvent(QMouseEvent *e);
232 void contentsMouseMoveEvent(QMouseEvent *e); 232 void contentsMouseMoveEvent(QMouseEvent *e);
233 bool mMouseDown; 233 bool mMouseDown;
234}; 234};
235 235
236class KOListView : public KOEventView 236class KOListView : public KOEventView
237{ 237{
238 Q_OBJECT 238 Q_OBJECT
239 public: 239 public:
240 KOListView(Calendar *calendar, QWidget *parent = 0, 240 KOListView(Calendar *calendar, QWidget *parent = 0,
241 const char *name = 0); 241 const char *name = 0);
242 ~KOListView(); 242 ~KOListView();
243 243
244 virtual int maxDatesHint(); 244 virtual int maxDatesHint();
245 virtual int currentDateCount(); 245 virtual int currentDateCount();
246 virtual QPtrList<Incidence> selectedIncidences(); 246 virtual QPtrList<Incidence> selectedIncidences();
247 virtual DateList selectedDates(); 247 virtual DateList selectedDates();
248 248
249 void showDates(bool show); 249 void showDates(bool show);
250 Incidence* currentItem(); 250 Incidence* currentItem();
251 void addTodos(QPtrList<Todo> eventList); 251 void addTodos(QPtrList<Todo> eventList);
252 void addJournals(QPtrList<Journal> eventList); 252 void addJournals(QPtrList<Journal> eventList);
253 virtual void printPreview(CalPrinter *calPrinter, 253 virtual void printPreview(CalPrinter *calPrinter,
254 const QDate &, const QDate &); 254 const QDate &, const QDate &);
255 255
256 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 256 void readSettings(KConfig *config, QString setting = "KOListView Layout");
257 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 257 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
258 void updateList(); 258 void updateList();
259 void setStartDate(const QDate &start); 259 void setStartDate(const QDate &start);
260 int count(); 260 int count();
261 QString getWhatsThisText(QPoint p); 261 QString getWhatsThisText(QPoint p);
262 signals: 262 signals:
263 void signalNewEvent(); 263 void signalNewEvent();
264 void beamIncidenceList(QPtrList<Incidence>); 264 void beamIncidenceList(QPtrList<Incidence>);
265 265
266 public slots: 266 public slots:
267 void resetFocus(); 267 void resetFocus();
268 virtual void updateView(); 268 virtual void updateView();
269 virtual void showDates(const QDate &start, const QDate &end); 269 virtual void showDates(const QDate &start, const QDate &end);
270 virtual void showEvents(QPtrList<Event> eventList); 270 virtual void showEvents(QPtrList<Event> eventList);
271 void clearSelection(); 271 void clearSelection();
272 void allSelection(); 272 void allSelection();
273 273
274 void clear(); 274 void clear();
275 void beamDone( Ir *ir ); 275 void beamDone( Ir *ir );
276 void showDates(); 276 void showDates();
277 void hideDates(); 277 void hideDates();
278 void deleteAll(); 278 void deleteAll();
279 void saveToFile(); 279 void saveToFile();
280 void saveToFileVCS(); 280 void saveToFileVCS();
281 void saveDescriptionToFile(); 281 void saveDescriptionToFile();
282 void beamSelected(); 282 void beamSelected();
283 void updateConfig(); 283 void updateConfig();
284 void addCat(); 284 void addCat();
285 void setCat(); 285 void setCat();
286 void setAlarm(); 286 void setAlarm();
287 void setCategories( bool removeOld ); 287 void setCategories( bool removeOld );
288 void changeEventDisplay(Event *, int); 288 void changeEventDisplay(Event *, int);
289 289
290 void defaultItemAction(QListViewItem *item); 290 void defaultItemAction(QListViewItem *item);
291 void popupMenu(QListViewItem *item,const QPoint &,int); 291 void popupMenu(QListViewItem *item,const QPoint &,int);
292 292
293 protected slots: 293 protected slots:
294 void processSelectionChange(QListViewItem *); 294 void processSelectionChange(QListViewItem *);
295 295
296 protected: 296 protected:
297 void writeToFile( bool iCal ); 297 void writeToFile( bool iCal );
298 void addEvents(QPtrList<Event> eventList); 298 void addEvents(QPtrList<Event> eventList);
299 void addIncidence(Incidence *); 299 void addIncidence(Incidence *);
300 KOListViewItem *getItemForEvent(Event *event); 300 KOListViewItem *getItemForEvent(Event *event);
301 301
302 private: 302 private:
303 KOListViewWhatsThis *mKOListViewWhatsThis;
303 KOListViewListView *mListView; 304 KOListViewListView *mListView;
304 KOEventPopupMenu *mPopupMenu; 305 KOEventPopupMenu *mPopupMenu;
305 KOListViewItem *mActiveItem; 306 KOListViewItem *mActiveItem;
306 QDict<Incidence> mUidDict; 307 QDict<Incidence> mUidDict;
307 QDate mStartDate; 308 QDate mStartDate;
308 void keyPressEvent ( QKeyEvent * ) ; 309 void keyPressEvent ( QKeyEvent * ) ;
309}; 310};
310 311
311#endif 312#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index ae61db6..7927307 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,284 +1,288 @@
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 <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qkeycode.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32#ifndef DESKTOP_VERSION 32#ifndef DESKTOP_VERSION
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#else 34#else
35#include <qapplication.h> 35#include <qapplication.h>
36#endif 36#endif
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kglobal.h> 40#include <kglobal.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <kiconloader.h> 42#include <kiconloader.h>
43 43
44#include <kcalendarsystem.h> 44#include <kcalendarsystem.h>
45 45
46#ifndef KORG_NOPRINTER 46#ifndef KORG_NOPRINTER
47#include "calprinter.h" 47#include "calprinter.h"
48#endif 48#endif
49#include "koprefs.h" 49#include "koprefs.h"
50#ifndef KORG_NOPLUGINS 50#ifndef KORG_NOPLUGINS
51#include "kocore.h" 51#include "kocore.h"
52#endif 52#endif
53#include "koglobals.h" 53#include "koglobals.h"
54#include <libkcal/kincidenceformatter.h> 54#include <libkcal/kincidenceformatter.h>
55 55
56#include "komonthview.h" 56#include "komonthview.h"
57 57
58#define PIXMAP_SIZE 5 58#define PIXMAP_SIZE 5
59#ifdef DESKTOP_VERSION 59#ifdef DESKTOP_VERSION
60QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 60QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
61#endif 61#endif
62class KNOWhatsThis :public QWhatsThis 62class KNOWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; 66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p) 69 virtual QString text( const QPoint& p)
70 { 70 {
71 return _wid->getWhatsThisText(p) ; 71 return _wid->getWhatsThisText(p) ;
72 }; 72 };
73private: 73private:
74 KNoScrollListBox* _wid; 74 KNoScrollListBox* _wid;
75 75
76}; 76};
77 77
78 78
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 80 : QListBox(parent, name, WRepaintNoErase)
81{ 81{
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 84#endif
85 mWT = new KNOWhatsThis(this); 85 mWT = new KNOWhatsThis(this);
86 resetOnFocusIn = true; 86 resetOnFocusIn = true;
87 setVScrollBarMode(QScrollView::AlwaysOff); 87 setVScrollBarMode(QScrollView::AlwaysOff);
88 setHScrollBarMode(QScrollView::AlwaysOff); 88 setHScrollBarMode(QScrollView::AlwaysOff);
89} 89}
90KNoScrollListBox::~KNoScrollListBox() 90KNoScrollListBox::~KNoScrollListBox()
91{ 91{
92 92#if QT_VERSION >= 0x030000
93
94#else
95 delete mWT;
96#endif
93} 97}
94 98
95 99
96void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 100void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
97{ 101{
98 QListBox::focusInEvent ( e ); 102 QListBox::focusInEvent ( e );
99 if ( count() ){ 103 if ( count() ){
100 int ci = currentItem(); 104 int ci = currentItem();
101 if ( ci < 0 ) ci = 0; 105 if ( ci < 0 ) ci = 0;
102 106
103 setCurrentItem( ci ); 107 setCurrentItem( ci );
104 setSelected ( ci, true ); 108 setSelected ( ci, true );
105 emit highlighted( item ( ci ) ); 109 emit highlighted( item ( ci ) );
106 110
107 resetOnFocusIn = true; 111 resetOnFocusIn = true;
108 112
109 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 113 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
110 QListBoxItem *fi = firstItem (); 114 QListBoxItem *fi = firstItem ();
111 if (fi ) { 115 if (fi ) {
112 int ihei = fi->height( this ); 116 int ihei = fi->height( this );
113 int hei = numRows () * ihei; 117 int hei = numRows () * ihei;
114 if ( hei < height() - horizontalScrollBar()->height () ) { 118 if ( hei < height() - horizontalScrollBar()->height () ) {
115 setVScrollBarMode(QScrollView::AlwaysOff); 119 setVScrollBarMode(QScrollView::AlwaysOff);
116 } 120 }
117 else 121 else
118 setVScrollBarMode(QScrollView::Auto); 122 setVScrollBarMode(QScrollView::Auto);
119 if ( ihei *3 > height() ) { 123 if ( ihei *3 > height() ) {
120 setHScrollBarMode(QScrollView::AlwaysOff); 124 setHScrollBarMode(QScrollView::AlwaysOff);
121 } 125 }
122 else { 126 else {
123 setHScrollBarMode(QScrollView::Auto); 127 setHScrollBarMode(QScrollView::Auto);
124 } 128 }
125 } else { 129 } else {
126 setVScrollBarMode(QScrollView::Auto); 130 setVScrollBarMode(QScrollView::Auto);
127 setHScrollBarMode(QScrollView::Auto); 131 setHScrollBarMode(QScrollView::Auto);
128 } 132 }
129 } 133 }
130 } 134 }
131} 135}
132void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 136void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
133{ 137{
134 int i = currentItem (); 138 int i = currentItem ();
135 if ( i >= 0 ) { 139 if ( i >= 0 ) {
136 setSelected ( i, false ); 140 setSelected ( i, false );
137 } 141 }
138 QListBox::focusOutEvent ( e ); 142 QListBox::focusOutEvent ( e );
139 setVScrollBarMode(QScrollView::AlwaysOff); 143 setVScrollBarMode(QScrollView::AlwaysOff);
140 setHScrollBarMode(QScrollView::AlwaysOff); 144 setHScrollBarMode(QScrollView::AlwaysOff);
141} 145}
142 146
143QString KNoScrollListBox::getWhatsThisText(QPoint p) 147QString KNoScrollListBox::getWhatsThisText(QPoint p)
144{ 148{
145 QListBoxItem* item = itemAt ( p ); 149 QListBoxItem* item = itemAt ( p );
146 if ( ! item ) { 150 if ( ! item ) {
147 return i18n("Click in the cell\nto add an event!"); 151 return i18n("Click in the cell\nto add an event!");
148 } 152 }
149 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 153 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
150 KOPrefs::instance()->mWTshowDetails, 154 KOPrefs::instance()->mWTshowDetails,
151 KOPrefs::instance()->mWTshowCreated, 155 KOPrefs::instance()->mWTshowCreated,
152 KOPrefs::instance()->mWTshowChanged); 156 KOPrefs::instance()->mWTshowChanged);
153} 157}
154void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 158void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
155{ 159{
156 //qDebug("KNoScrollListBox::keyPressEvent "); 160 //qDebug("KNoScrollListBox::keyPressEvent ");
157 switch(e->key()) { 161 switch(e->key()) {
158 case Key_Right: 162 case Key_Right:
159 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 163 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
160 { 164 {
161 e->ignore(); 165 e->ignore();
162 return; 166 return;
163 } 167 }
164 scrollBy(10,0); 168 scrollBy(10,0);
165 break; 169 break;
166 case Key_Left: 170 case Key_Left:
167 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 171 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
168 { 172 {
169 e->ignore(); 173 e->ignore();
170 return; 174 return;
171 } 175 }
172 scrollBy(-10,0); 176 scrollBy(-10,0);
173 break; 177 break;
174 case Key_Up: 178 case Key_Up:
175 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 179 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
176 e->ignore(); 180 e->ignore();
177 break; 181 break;
178 } 182 }
179 if ( count() ) { 183 if ( count() ) {
180 if ( currentItem() == 0 ) { 184 if ( currentItem() == 0 ) {
181 emit prevCell(); 185 emit prevCell();
182 } else { 186 } else {
183 setCurrentItem((currentItem()+count()-1)%count()); 187 setCurrentItem((currentItem()+count()-1)%count());
184 if(!itemVisible(currentItem())) { 188 if(!itemVisible(currentItem())) {
185 if((unsigned int) currentItem() == (count()-1)) { 189 if((unsigned int) currentItem() == (count()-1)) {
186 setTopItem(currentItem()-numItemsVisible()+1); 190 setTopItem(currentItem()-numItemsVisible()+1);
187 } else { 191 } else {
188 setTopItem(topItem()-1); 192 setTopItem(topItem()-1);
189 } 193 }
190 } 194 }
191 } 195 }
192 } 196 }
193 break; 197 break;
194 case Key_Down: 198 case Key_Down:
195 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 199 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
196 e->ignore(); 200 e->ignore();
197 break; 201 break;
198 } 202 }
199 if ( count () ) { 203 if ( count () ) {
200 if ( currentItem()+1 == count () ) { 204 if ( currentItem()+1 == count () ) {
201 emit nextCell(); 205 emit nextCell();
202 } else { 206 } else {
203 setCurrentItem((currentItem()+1)%count()); 207 setCurrentItem((currentItem()+1)%count());
204 if(!itemVisible(currentItem())) { 208 if(!itemVisible(currentItem())) {
205 if(currentItem() == 0) { 209 if(currentItem() == 0) {
206 setTopItem(0); 210 setTopItem(0);
207 } else { 211 } else {
208 setTopItem(topItem()+1); 212 setTopItem(topItem()+1);
209 } 213 }
210 } 214 }
211 } 215 }
212 } 216 }
213 break; 217 break;
214 case Key_I: 218 case Key_I:
215 QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); 219 QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
216 e->ignore(); 220 e->ignore();
217 break; 221 break;
218 case Key_Return: 222 case Key_Return:
219 case Key_Enter: 223 case Key_Enter:
220 { 224 {
221 if ( currentItem() >= 0 ) { 225 if ( currentItem() >= 0 ) {
222 emit doubleClicked( item( currentItem() ) ); 226 emit doubleClicked( item( currentItem() ) );
223 e->accept(); 227 e->accept();
224 } else { 228 } else {
225 e->ignore(); 229 e->ignore();
226 } 230 }
227 } 231 }
228 break; 232 break;
229 case Key_Shift: 233 case Key_Shift:
230 emit shiftDown(); 234 emit shiftDown();
231 break; 235 break;
232 default: 236 default:
233 e->ignore(); 237 e->ignore();
234 break; 238 break;
235 } 239 }
236} 240}
237 241
238void KNoScrollListBox::oneDown() 242void KNoScrollListBox::oneDown()
239{ 243{
240 if ( count () ) { 244 if ( count () ) {
241 if ( currentItem()+1 == count () ) { 245 if ( currentItem()+1 == count () ) {
242 emit nextCell(); 246 emit nextCell();
243 } else { 247 } else {
244 resetOnFocusIn = false; 248 resetOnFocusIn = false;
245 setCurrentItem((currentItem()+1)%count()); 249 setCurrentItem((currentItem()+1)%count());
246 if(!itemVisible(currentItem())) { 250 if(!itemVisible(currentItem())) {
247 if(currentItem() == 0) { 251 if(currentItem() == 0) {
248 setTopItem(0); 252 setTopItem(0);
249 } else { 253 } else {
250 setTopItem(topItem()+1); 254 setTopItem(topItem()+1);
251 } 255 }
252 } 256 }
253 } 257 }
254 } 258 }
255} 259}
256void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 260void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
257{ 261{
258 switch(e->key()) { 262 switch(e->key()) {
259 case Key_Shift: 263 case Key_Shift:
260 emit shiftUp(); 264 emit shiftUp();
261 break; 265 break;
262 default: 266 default:
263 break; 267 break;
264 } 268 }
265} 269}
266 270
267void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 271void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
268{ 272{
269 QListBox::mousePressEvent(e); 273 QListBox::mousePressEvent(e);
270 274
271 if(e->button() == RightButton) { 275 if(e->button() == RightButton) {
272 emit rightClick(); 276 emit rightClick();
273 } 277 }
274} 278}
275 279
276MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 280MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
277 : QListBoxItem() 281 : QListBoxItem()
278{ 282{
279 mblockRepaint = true; 283 mblockRepaint = true;
280 setText( s ); 284 setText( s );
281 mMultiday = 0; 285 mMultiday = 0;
282 mIncidence = incidence; 286 mIncidence = incidence;
283 mDate = qd; 287 mDate = qd;
284 mRecur = false; 288 mRecur = false;
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index f26d16d..e95039d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -399,385 +399,391 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
399 topLayout->addWidget(mQuickAdd); 399 topLayout->addWidget(mQuickAdd);
400 400
401 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 401 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
402 402
403 mTodoListView = new KOTodoListView(calendar,this, name ); 403 mTodoListView = new KOTodoListView(calendar,this, name );
404 topLayout->addWidget(mTodoListView); 404 topLayout->addWidget(mTodoListView);
405 //mTodoListView->header()->setMaximumHeight(30); 405 //mTodoListView->header()->setMaximumHeight(30);
406 mTodoListView->setRootIsDecorated(true); 406 mTodoListView->setRootIsDecorated(true);
407 mTodoListView->setAllColumnsShowFocus(true); 407 mTodoListView->setAllColumnsShowFocus(true);
408 408
409 mTodoListView->setShowSortIndicator(true); 409 mTodoListView->setShowSortIndicator(true);
410 410
411 mTodoListView->addColumn(i18n("Todo")); 411 mTodoListView->addColumn(i18n("Todo"));
412 mTodoListView->addColumn(i18n("Prio")); 412 mTodoListView->addColumn(i18n("Prio"));
413 mTodoListView->setColumnAlignment(1,AlignHCenter); 413 mTodoListView->setColumnAlignment(1,AlignHCenter);
414 mTodoListView->addColumn(i18n("Complete")); 414 mTodoListView->addColumn(i18n("Complete"));
415 mTodoListView->setColumnAlignment(2,AlignCenter); 415 mTodoListView->setColumnAlignment(2,AlignCenter);
416 416
417 mTodoListView->addColumn(i18n("Due Date")); 417 mTodoListView->addColumn(i18n("Due Date"));
418 mTodoListView->setColumnAlignment(3,AlignLeft); 418 mTodoListView->setColumnAlignment(3,AlignLeft);
419 mTodoListView->addColumn(i18n("Due Time")); 419 mTodoListView->addColumn(i18n("Due Time"));
420 mTodoListView->setColumnAlignment(4,AlignHCenter); 420 mTodoListView->setColumnAlignment(4,AlignHCenter);
421 421
422 mTodoListView->addColumn(i18n("Start Date")); 422 mTodoListView->addColumn(i18n("Start Date"));
423 mTodoListView->setColumnAlignment(5,AlignLeft); 423 mTodoListView->setColumnAlignment(5,AlignLeft);
424 mTodoListView->addColumn(i18n("Start Time")); 424 mTodoListView->addColumn(i18n("Start Time"));
425 mTodoListView->setColumnAlignment(6,AlignHCenter); 425 mTodoListView->setColumnAlignment(6,AlignHCenter);
426 426
427 mTodoListView->addColumn(i18n("Cancelled")); 427 mTodoListView->addColumn(i18n("Cancelled"));
428 mTodoListView->addColumn(i18n("Categories")); 428 mTodoListView->addColumn(i18n("Categories"));
429#if 0 429#if 0
430 mTodoListView->addColumn(i18n("Sort Id")); 430 mTodoListView->addColumn(i18n("Sort Id"));
431 mTodoListView->setColumnAlignment(4,AlignHCenter); 431 mTodoListView->setColumnAlignment(4,AlignHCenter);
432#endif 432#endif
433 433
434 mTodoListView->setMinimumHeight( 60 ); 434 mTodoListView->setMinimumHeight( 60 );
435 mTodoListView->setItemsRenameable( true ); 435 mTodoListView->setItemsRenameable( true );
436 mTodoListView->setRenameable( 0 ); 436 mTodoListView->setRenameable( 0 );
437 mTodoListView->setColumnWidth( 0, 120 ); 437 mTodoListView->setColumnWidth( 0, 120 );
438 mTodoListView->setColumnWidthMode(0, QListView::Manual); 438 mTodoListView->setColumnWidthMode(0, QListView::Manual);
439 mTodoListView->setColumnWidthMode(1, QListView::Manual); 439 mTodoListView->setColumnWidthMode(1, QListView::Manual);
440 mTodoListView->setColumnWidthMode(2, QListView::Manual); 440 mTodoListView->setColumnWidthMode(2, QListView::Manual);
441 mTodoListView->setColumnWidthMode(3, QListView::Manual); 441 mTodoListView->setColumnWidthMode(3, QListView::Manual);
442 mTodoListView->setColumnWidthMode(4, QListView::Manual); 442 mTodoListView->setColumnWidthMode(4, QListView::Manual);
443 mTodoListView->setColumnWidthMode(5, QListView::Manual); 443 mTodoListView->setColumnWidthMode(5, QListView::Manual);
444 mTodoListView->setColumnWidthMode(6, QListView::Manual); 444 mTodoListView->setColumnWidthMode(6, QListView::Manual);
445 mTodoListView->setColumnWidthMode(7, QListView::Manual); 445 mTodoListView->setColumnWidthMode(7, QListView::Manual);
446 mTodoListView->setColumnWidthMode(8, QListView::Manual); 446 mTodoListView->setColumnWidthMode(8, QListView::Manual);
447 447
448 448
449 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 449 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
450 450
451 mPriorityPopupMenu = new QPopupMenu(this); 451 mPriorityPopupMenu = new QPopupMenu(this);
452 for (int i = 1; i <= 5; i++) { 452 for (int i = 1; i <= 5; i++) {
453 QString label = QString ("%1").arg (i); 453 QString label = QString ("%1").arg (i);
454 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 454 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
455 } 455 }
456 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 456 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
457 457
458 mPercentageCompletedPopupMenu = new QPopupMenu(this); 458 mPercentageCompletedPopupMenu = new QPopupMenu(this);
459 for (int i = 0; i <= 100; i+=20) { 459 for (int i = 0; i <= 100; i+=20) {
460 QString label = QString ("%1 %").arg (i); 460 QString label = QString ("%1 %").arg (i);
461 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 461 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
462 } 462 }
463 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 463 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
464 464
465 465
466 466
467 mItemPopupMenu = new QPopupMenu(this); 467 mItemPopupMenu = new QPopupMenu(this);
468 mItemPopupMenu->insertItem(i18n("Show..."), this, 468 mItemPopupMenu->insertItem(i18n("Show..."), this,
469 SLOT (showTodo())); 469 SLOT (showTodo()));
470 mItemPopupMenu->insertItem(i18n("Edit..."), this, 470 mItemPopupMenu->insertItem(i18n("Edit..."), this,
471 SLOT (editTodo())); 471 SLOT (editTodo()));
472 mItemPopupMenu->insertItem( i18n("Delete"), this, 472 mItemPopupMenu->insertItem( i18n("Delete"), this,
473 SLOT (deleteTodo())); 473 SLOT (deleteTodo()));
474 mItemPopupMenu->insertItem( i18n("Clone..."), this, 474 mItemPopupMenu->insertItem( i18n("Clone..."), this,
475 SLOT (cloneTodo())); 475 SLOT (cloneTodo()));
476 mItemPopupMenu->insertItem( i18n("Move..."), this, 476 mItemPopupMenu->insertItem( i18n("Move..."), this,
477 SLOT (moveTodo())); 477 SLOT (moveTodo()));
478 mItemPopupMenu->insertItem( i18n("Beam..."), this, 478 mItemPopupMenu->insertItem( i18n("Beam..."), this,
479 SLOT (beamTodo())); 479 SLOT (beamTodo()));
480 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 480 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
481 SLOT (cancelTodo())); 481 SLOT (cancelTodo()));
482 mItemPopupMenu->insertSeparator(); 482 mItemPopupMenu->insertSeparator();
483 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, 483 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
484 SLOT (toggleRunningItem())); 484 SLOT (toggleRunningItem()));
485 mItemPopupMenu->insertSeparator(); 485 mItemPopupMenu->insertSeparator();
486 /* 486 /*
487 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 487 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
488 SLOT (newTodo())); 488 SLOT (newTodo()));
489 */ 489 */
490 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 490 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
491 SLOT (newSubTodo())); 491 SLOT (newSubTodo()));
492 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 492 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
493 SLOT (unparentTodo()),0,21); 493 SLOT (unparentTodo()),0,21);
494 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 494 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
495 SLOT (reparentTodo()),0,22); 495 SLOT (reparentTodo()),0,22);
496 mItemPopupMenu->insertSeparator(); 496 mItemPopupMenu->insertSeparator();
497#if 0 497#if 0
498 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 498 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
499 this, SLOT( purgeCompleted() ) ); 499 this, SLOT( purgeCompleted() ) );
500 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 500 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
501 this, SLOT( toggleCompleted() ),0, 33 ); 501 this, SLOT( toggleCompleted() ),0, 33 );
502 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 502 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
503 this, SLOT( toggleQuickTodo() ),0, 34 ); 503 this, SLOT( toggleQuickTodo() ),0, 34 );
504 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 504 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
505 this, SLOT( toggleRunning() ),0, 35 ); 505 this, SLOT( toggleRunning() ),0, 35 );
506 506
507#endif 507#endif
508 mPopupMenu = new QPopupMenu(this); 508 mPopupMenu = new QPopupMenu(this);
509 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 509 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
510 SLOT (newTodo()),0,1); 510 SLOT (newTodo()),0,1);
511 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 511 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
512 this, SLOT(purgeCompleted()),0,2); 512 this, SLOT(purgeCompleted()),0,2);
513 mPopupMenu->insertItem(i18n("Show Completed"), 513 mPopupMenu->insertItem(i18n("Show Completed"),
514 this, SLOT( toggleCompleted() ),0,3 ); 514 this, SLOT( toggleCompleted() ),0,3 );
515 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 515 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
516 this, SLOT( toggleRunning() ),0,5 ); 516 this, SLOT( toggleRunning() ),0,5 );
517 mPopupMenu->insertItem(i18n(" set all open","Display all opened"), 517 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
518 this, SLOT( setAllOpen() ),0,6 ); 518 this, SLOT( setAllOpen() ),0,6 );
519 mPopupMenu->insertItem(i18n(" set all close","Display all closed"), 519 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
520 this, SLOT( setAllClose() ),0,7 ); 520 this, SLOT( setAllClose() ),0,7 );
521 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), 521 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
522 this, SLOT( setAllFlat() ),0,8 ); 522 this, SLOT( setAllFlat() ),0,8 );
523 mPopupMenu->insertSeparator(); 523 mPopupMenu->insertSeparator();
524 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 524 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
525 this, SLOT( toggleQuickTodo() ),0,4 ); 525 this, SLOT( toggleQuickTodo() ),0,4 );
526 mDocPrefs = new DocPrefs( name ); 526 mDocPrefs = new DocPrefs( name );
527 527
528 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); 528 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
529 mPopupMenu->setCheckable( true ); 529 mPopupMenu->setCheckable( true );
530 mItemPopupMenu->setCheckable( true ); 530 mItemPopupMenu->setCheckable( true );
531 531
532 532
533 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 533 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
534 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 534 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
535 535
536 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 536 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
537 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 537 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
538 538
539 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 539 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
540 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 540 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
541 541
542 542
543 // Double clicking conflicts with opening/closing the subtree 543 // Double clicking conflicts with opening/closing the subtree
544 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 544 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
545 SLOT( editItem( QListViewItem *) ) ); 545 SLOT( editItem( QListViewItem *) ) );
546 /* 546 /*
547 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 547 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
548 const QPoint &,int ) ), 548 const QPoint &,int ) ),
549 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 549 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
550 */ 550 */
551 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 551 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
552 const QPoint &,int ) ), 552 const QPoint &,int ) ),
553 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 553 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
554 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 554 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
555 SLOT( itemClicked( QListViewItem * ) ) ); 555 SLOT( itemClicked( QListViewItem * ) ) );
556 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 556 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
557 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 557 SLOT( itemDoubleClicked( QListViewItem * ) ) );
558 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 558 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
559 SLOT( updateView() ) ); 559 SLOT( updateView() ) );
560 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 560 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
561 SLOT( todoModified(Todo *, int) ) ); 561 SLOT( todoModified(Todo *, int) ) );
562 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 562 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
563 SLOT( itemStateChanged( QListViewItem * ) ) ); 563 SLOT( itemStateChanged( QListViewItem * ) ) );
564 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 564 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
565 SLOT( itemStateChanged( QListViewItem * ) ) ); 565 SLOT( itemStateChanged( QListViewItem * ) ) );
566 connect( mTodoListView, SIGNAL( paintNeeded() ), 566 connect( mTodoListView, SIGNAL( paintNeeded() ),
567 SLOT( paintNeeded()) ); 567 SLOT( paintNeeded()) );
568 568
569#if 0 569#if 0
570 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 570 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
571 SLOT(selectionChanged(QListViewItem *))); 571 SLOT(selectionChanged(QListViewItem *)));
572 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 572 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
573 SLOT(selectionChanged(QListViewItem *))); 573 SLOT(selectionChanged(QListViewItem *)));
574 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 574 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
575 SLOT(selectionChanged(QListViewItem *))); 575 SLOT(selectionChanged(QListViewItem *)));
576#endif 576#endif
577 577
578 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 578 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
579 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 579 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
580 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 580 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
581 581
582 connect( mTodoListView, SIGNAL(selectionChanged() ), 582 connect( mTodoListView, SIGNAL(selectionChanged() ),
583 SLOT( processSelectionChange() ) ); 583 SLOT( processSelectionChange() ) );
584 connect( mQuickAdd, SIGNAL( returnPressed () ), 584 connect( mQuickAdd, SIGNAL( returnPressed () ),
585 SLOT( addQuickTodo() ) ); 585 SLOT( addQuickTodo() ) );
586 586
587} 587}
588 588
589KOTodoView::~KOTodoView() 589KOTodoView::~KOTodoView()
590{ 590{
591 // delete mKOTodoViewWhatsThis; 591
592#if QT_VERSION >= 0x030000
593
594#else
595 delete mKOTodoViewWhatsThis;
596#endif
597
592 delete mDocPrefs; 598 delete mDocPrefs;
593} 599}
594QString KOTodoView::getWhatsThisText(QPoint p) 600QString KOTodoView::getWhatsThisText(QPoint p)
595{ 601{
596 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 602 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
597 if ( item ) 603 if ( item )
598 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 604 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
599 KOPrefs::instance()->mWTshowDetails, 605 KOPrefs::instance()->mWTshowDetails,
600 KOPrefs::instance()->mWTshowCreated, 606 KOPrefs::instance()->mWTshowCreated,
601 KOPrefs::instance()->mWTshowChanged); 607 KOPrefs::instance()->mWTshowChanged);
602 return i18n("That is the todo view" ); 608 return i18n("That is the todo view" );
603 609
604} 610}
605 611
606void KOTodoView::jumpToDate () 612void KOTodoView::jumpToDate ()
607{ 613{
608 // if (mActiveItem) { 614 // if (mActiveItem) {
609// mActiveItem->todo()); 615// mActiveItem->todo());
610// if ( mActiveItem->todo()->hasDueDate() ) 616// if ( mActiveItem->todo()->hasDueDate() )
611// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 617// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
612} 618}
613void KOTodoView::paintNeeded() 619void KOTodoView::paintNeeded()
614{ 620{
615 if ( mPendingUpdateBeforeRepaint ) { 621 if ( mPendingUpdateBeforeRepaint ) {
616 updateView(); 622 updateView();
617 mPendingUpdateBeforeRepaint = false; 623 mPendingUpdateBeforeRepaint = false;
618 } 624 }
619} 625}
620void KOTodoView::paintEvent(QPaintEvent * pevent) 626void KOTodoView::paintEvent(QPaintEvent * pevent)
621{ 627{
622 if ( mPendingUpdateBeforeRepaint ) { 628 if ( mPendingUpdateBeforeRepaint ) {
623 updateView(); 629 updateView();
624 mPendingUpdateBeforeRepaint = false; 630 mPendingUpdateBeforeRepaint = false;
625 } 631 }
626 KOrg::BaseView::paintEvent( pevent); 632 KOrg::BaseView::paintEvent( pevent);
627} 633}
628 634
629void KOTodoView::updateView() 635void KOTodoView::updateView()
630{ 636{
631 pendingSubtodo = 0; 637 pendingSubtodo = 0;
632 if ( mBlockUpdate ) { 638 if ( mBlockUpdate ) {
633 return; 639 return;
634 } 640 }
635 if ( !isVisible() ) { 641 if ( !isVisible() ) {
636 mPendingUpdateBeforeRepaint = true; 642 mPendingUpdateBeforeRepaint = true;
637 return; 643 return;
638 } 644 }
639 storeCurrentItem(); 645 storeCurrentItem();
640 //qDebug("KOTodoView::updateView() %x", this); 646 //qDebug("KOTodoView::updateView() %x", this);
641 if ( isFlatDisplay ) { 647 if ( isFlatDisplay ) {
642 displayAllFlat(); 648 displayAllFlat();
643 resetCurrentItem(); 649 resetCurrentItem();
644 return; 650 return;
645 } 651 }
646 //qDebug("update "); 652 //qDebug("update ");
647// kdDebug() << "KOTodoView::updateView()" << endl; 653// kdDebug() << "KOTodoView::updateView()" << endl;
648 QFont fo = KOPrefs::instance()->mTodoViewFont; 654 QFont fo = KOPrefs::instance()->mTodoViewFont;
649 655
650 656
651 mTodoListView->clear(); 657 mTodoListView->clear();
652 if ( mName == "todolistsmall" ) { 658 if ( mName == "todolistsmall" ) {
653 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 659 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
654 int ps = fo.pointSize() -2; 660 int ps = fo.pointSize() -2;
655 if ( ps > 12 ) 661 if ( ps > 12 )
656 ps -= 2; 662 ps -= 2;
657 fo.setPointSize( ps ); 663 fo.setPointSize( ps );
658 } 664 }
659 } 665 }
660 666
661 mTodoListView->setFont( fo ); 667 mTodoListView->setFont( fo );
662 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 668 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
663 //mTodoListView->header()->setMaximumHeight(fm.height()); 669 //mTodoListView->header()->setMaximumHeight(fm.height());
664 QPtrList<Todo> todoList = calendar()->todos(); 670 QPtrList<Todo> todoList = calendar()->todos();
665 671
666/* 672/*
667 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 673 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
668 Event *t; 674 Event *t;
669 for(t = todoList.first(); t; t = todoList.next()) { 675 for(t = todoList.first(); t; t = todoList.next()) {
670 kdDebug() << " " << t->getSummary() << endl; 676 kdDebug() << " " << t->getSummary() << endl;
671 677
672 if (t->getRelatedTo()) { 678 if (t->getRelatedTo()) {
673 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 679 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
674 } 680 }
675 681
676 QPtrList<Event> l = t->getRelations(); 682 QPtrList<Event> l = t->getRelations();
677 Event *c; 683 Event *c;
678 for(c=l.first();c;c=l.next()) { 684 for(c=l.first();c;c=l.next()) {
679 kdDebug() << " - relation: " << c->getSummary() << endl; 685 kdDebug() << " - relation: " << c->getSummary() << endl;
680 } 686 }
681 } 687 }
682*/ 688*/
683 689
684 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 690 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
685 // specific order of events. That means that we have to generate parent items 691 // specific order of events. That means that we have to generate parent items
686 // recursively for proper hierarchical display of Todos. 692 // recursively for proper hierarchical display of Todos.
687 mTodoMap.clear(); 693 mTodoMap.clear();
688 Todo *todo; 694 Todo *todo;
689 todo = todoList.first();// todo; todo = todoList.next()) { 695 todo = todoList.first();// todo; todo = todoList.next()) {
690 while ( todo ) { 696 while ( todo ) {
691 bool next = true; 697 bool next = true;
692 // qDebug("todo %s ", todo->summary().latin1()); 698 // qDebug("todo %s ", todo->summary().latin1());
693 Incidence *incidence = todo->relatedTo(); 699 Incidence *incidence = todo->relatedTo();
694 while ( incidence ) { 700 while ( incidence ) {
695 if ( incidence->type() == "Todo") { 701 if ( incidence->type() == "Todo") {
696 //qDebug("related %s ",incidence->summary().latin1() ); 702 //qDebug("related %s ",incidence->summary().latin1() );
697 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 703 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
698 //qDebug("related not found "); 704 //qDebug("related not found ");
699 todoList.remove( ); 705 todoList.remove( );
700 todo = todoList.current(); 706 todo = todoList.current();
701 next = false; 707 next = false;
702 incidence = 0; 708 incidence = 0;
703 709
704 } else { 710 } else {
705 //qDebug("related found "); 711 //qDebug("related found ");
706 incidence = incidence->relatedTo(); 712 incidence = incidence->relatedTo();
707 } 713 }
708 } else 714 } else
709 incidence = 0; 715 incidence = 0;
710 } 716 }
711 if ( next ) 717 if ( next )
712 todo = todoList.next(); 718 todo = todoList.next();
713 } 719 }
714 720
715 for(todo = todoList.first(); todo; todo = todoList.next()) { 721 for(todo = todoList.first(); todo; todo = todoList.next()) {
716 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 722 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
717 { 723 {
718 insertTodoItem(todo); 724 insertTodoItem(todo);
719 } 725 }
720 } 726 }
721 // Restore opened/closed state 727 // Restore opened/closed state
722 mTodoListView->blockSignals( true ); 728 mTodoListView->blockSignals( true );
723 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 729 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
724 mTodoListView->blockSignals( false ); 730 mTodoListView->blockSignals( false );
725 resetCurrentItem(); 731 resetCurrentItem();
726 processSelectionChange(); 732 processSelectionChange();
727} 733}
728 734
729void KOTodoView::storeCurrentItem() 735void KOTodoView::storeCurrentItem()
730{ 736{
731 mCurItem = 0; 737 mCurItem = 0;
732 mCurItemRootParent = 0; 738 mCurItemRootParent = 0;
733 mCurItemParent = 0; 739 mCurItemParent = 0;
734 mCurItemAbove = 0; 740 mCurItemAbove = 0;
735 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 741 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
736 if (mActiveItem) { 742 if (mActiveItem) {
737 mCurItem = mActiveItem->todo(); 743 mCurItem = mActiveItem->todo();
738 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 744 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
739 if ( activeItemAbove ) 745 if ( activeItemAbove )
740 mCurItemAbove = activeItemAbove->todo(); 746 mCurItemAbove = activeItemAbove->todo();
741 mCurItemRootParent = mCurItem; 747 mCurItemRootParent = mCurItem;
742 mCurItemParent = mCurItemRootParent->relatedTo(); 748 mCurItemParent = mCurItemRootParent->relatedTo();
743 while ( mCurItemRootParent->relatedTo() != 0 ) 749 while ( mCurItemRootParent->relatedTo() != 0 )
744 mCurItemRootParent = mCurItemRootParent->relatedTo(); 750 mCurItemRootParent = mCurItemRootParent->relatedTo();
745 } 751 }
746 mActiveItem = 0; 752 mActiveItem = 0;
747} 753}
748 754
749void KOTodoView::resetCurrentItem() 755void KOTodoView::resetCurrentItem()
750{ 756{
751 mTodoListView->setFocus(); 757 mTodoListView->setFocus();
752 KOTodoViewItem* foundItem = 0; 758 KOTodoViewItem* foundItem = 0;
753 KOTodoViewItem* foundItemRoot = 0; 759 KOTodoViewItem* foundItemRoot = 0;
754 KOTodoViewItem* foundItemParent = 0; 760 KOTodoViewItem* foundItemParent = 0;
755 KOTodoViewItem* foundItemAbove = 0; 761 KOTodoViewItem* foundItemAbove = 0;
756 if ( mTodoListView->firstChild () ) { 762 if ( mTodoListView->firstChild () ) {
757 if ( mCurItem ) { 763 if ( mCurItem ) {
758 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 764 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
759 while ( item ) { 765 while ( item ) {
760 if ( item->todo() == mCurItem ) { 766 if ( item->todo() == mCurItem ) {
761 foundItem = item; 767 foundItem = item;
762 break; 768 break;
763 } else if ( item->todo() == mCurItemAbove ) { 769 } else if ( item->todo() == mCurItemAbove ) {
764 foundItemAbove = item; 770 foundItemAbove = item;
765 771
766 } 772 }
767 if ( item->todo() == mCurItemRootParent ) { 773 if ( item->todo() == mCurItemRootParent ) {
768 foundItemRoot = item; 774 foundItemRoot = item;
769 } 775 }
770 if ( item->todo() == mCurItemParent ) { 776 if ( item->todo() == mCurItemParent ) {
771 foundItemParent = item; 777 foundItemParent = item;
772 } 778 }
773 item = (KOTodoViewItem*)item->itemBelow(); 779 item = (KOTodoViewItem*)item->itemBelow();
774 } 780 }
775 if ( ! foundItem ) { 781 if ( ! foundItem ) {
776 if ( foundItemParent ) { 782 if ( foundItemParent ) {
777 foundItem = foundItemParent; 783 foundItem = foundItemParent;
778 } else { 784 } else {
779 if ( foundItemRoot ) 785 if ( foundItemRoot )
780 foundItem = foundItemRoot; 786 foundItem = foundItemRoot;
781 else 787 else
782 foundItem = foundItemAbove; 788 foundItem = foundItemAbove;
783 } 789 }
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 87cef20..68e5e5a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -401,384 +401,390 @@ void MainWindow::disableBR(bool b)
401 //makes no sense,because other cal ap is probably running 401 //makes no sense,because other cal ap is probably running
402 // toggleBeamReceive(); 402 // toggleBeamReceive();
403 } 403 }
404 } 404 }
405#endif 405#endif
406 406
407} 407}
408bool MainWindow::beamReceiveEnabled() 408bool MainWindow::beamReceiveEnabled()
409{ 409{
410#ifndef DESKTOP_VERSION 410#ifndef DESKTOP_VERSION
411 return ( infrared != 0 ); 411 return ( infrared != 0 );
412#endif 412#endif
413 return false; 413 return false;
414} 414}
415 415
416void MainWindow::toggleBeamReceive() 416void MainWindow::toggleBeamReceive()
417{ 417{
418 if ( mBRdisabled ) 418 if ( mBRdisabled )
419 return; 419 return;
420#ifndef DESKTOP_VERSION 420#ifndef DESKTOP_VERSION
421 if ( infrared ) { 421 if ( infrared ) {
422 qDebug("KO: Disable BeamReceive "); 422 qDebug("KO: Disable BeamReceive ");
423 delete infrared; 423 delete infrared;
424 infrared = 0; 424 infrared = 0;
425 brAction->setOn(false); 425 brAction->setOn(false);
426 return; 426 return;
427 } 427 }
428 qDebug("KO: Enable BeamReceive "); 428 qDebug("KO: Enable BeamReceive ");
429 brAction->setOn(true); 429 brAction->setOn(true);
430 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 430 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
431 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 431 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
432#endif 432#endif
433} 433}
434void MainWindow::showMaximized () 434void MainWindow::showMaximized ()
435{ 435{
436#ifndef DESKTOP_VERSION 436#ifndef DESKTOP_VERSION
437 if ( ! globalFlagBlockStartup ) 437 if ( ! globalFlagBlockStartup )
438 if ( mClosed ) 438 if ( mClosed )
439 mView->goToday(); 439 mView->goToday();
440#endif 440#endif
441 QWidget::showMaximized () ; 441 QWidget::showMaximized () ;
442 mClosed = false; 442 mClosed = false;
443} 443}
444void MainWindow::closeEvent( QCloseEvent* ce ) 444void MainWindow::closeEvent( QCloseEvent* ce )
445{ 445{
446 446
447 447
448 448
449 if ( ! KOPrefs::instance()->mAskForQuit ) { 449 if ( ! KOPrefs::instance()->mAskForQuit ) {
450 saveOnClose(); 450 saveOnClose();
451 mClosed = true; 451 mClosed = true;
452 ce->accept(); 452 ce->accept();
453 return; 453 return;
454 454
455 } 455 }
456 456
457 switch( QMessageBox::information( this, "KO/Pi", 457 switch( QMessageBox::information( this, "KO/Pi",
458 i18n("Do you really want\nto close KO/Pi?"), 458 i18n("Do you really want\nto close KO/Pi?"),
459 i18n("Close"), i18n("No"), 459 i18n("Close"), i18n("No"),
460 0, 0 ) ) { 460 0, 0 ) ) {
461 case 0: 461 case 0:
462 saveOnClose(); 462 saveOnClose();
463 mClosed = true; 463 mClosed = true;
464 ce->accept(); 464 ce->accept();
465 break; 465 break;
466 case 1: 466 case 1:
467 ce->ignore(); 467 ce->ignore();
468 break; 468 break;
469 case 2: 469 case 2:
470 470
471 default: 471 default:
472 break; 472 break;
473 } 473 }
474 474
475 475
476} 476}
477 477
478void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 478void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
479{ 479{
480 QDataStream stream( data, IO_ReadOnly ); 480 QDataStream stream( data, IO_ReadOnly );
481 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 481 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
482 //QString datamess; 482 //QString datamess;
483 //qDebug("message "); 483 //qDebug("message ");
484 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 484 qDebug("KO: QCOP message received: %s ", cmsg.data() );
485 485
486 if ( cmsg == "setDocument(QString)" ) { 486 if ( cmsg == "setDocument(QString)" ) {
487 QDataStream stream( data, IO_ReadOnly ); 487 QDataStream stream( data, IO_ReadOnly );
488 QString fileName; 488 QString fileName;
489 stream >> fileName; 489 stream >> fileName;
490 //qDebug("filename %s ", fileName.latin1()); 490 //qDebug("filename %s ", fileName.latin1());
491 showMaximized(); 491 showMaximized();
492 raise(); 492 raise();
493 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 493 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
494 mSyncManager->slotSyncMenu( 1002 ); 494 mSyncManager->slotSyncMenu( 1002 );
495 return; 495 return;
496 } 496 }
497 497
498 if ( cmsg == "-writeFile" ) { 498 if ( cmsg == "-writeFile" ) {
499 // I made from the "-writeFile" an "-writeAlarm" 499 // I made from the "-writeFile" an "-writeAlarm"
500 mView->viewManager()->showWhatsNextView(); 500 mView->viewManager()->showWhatsNextView();
501 mCalendar->checkAlarmForIncidence( 0, true); 501 mCalendar->checkAlarmForIncidence( 0, true);
502 showMaximized(); 502 showMaximized();
503 raise(); 503 raise();
504 return; 504 return;
505 505
506 } 506 }
507 if ( cmsg == "-writeFileSilent" ) { 507 if ( cmsg == "-writeFileSilent" ) {
508 // I made from the "-writeFile" an "-writeAlarm" 508 // I made from the "-writeFile" an "-writeAlarm"
509 // mView->viewManager()->showWhatsNextView(); 509 // mView->viewManager()->showWhatsNextView();
510 mCalendar->checkAlarmForIncidence( 0, true); 510 mCalendar->checkAlarmForIncidence( 0, true);
511 //showMaximized(); 511 //showMaximized();
512 //raise(); 512 //raise();
513 hide(); 513 hide();
514 return; 514 return;
515 } 515 }
516 if ( cmsg == "-newCountdown" ) { 516 if ( cmsg == "-newCountdown" ) {
517 qDebug("newCountdown "); 517 qDebug("newCountdown ");
518 518
519 } 519 }
520 QString msg ; 520 QString msg ;
521 QString allmsg = cmsg; 521 QString allmsg = cmsg;
522 while ( allmsg.length() > 0 ) { 522 while ( allmsg.length() > 0 ) {
523 int nextC = allmsg.find( "-", 1 ); 523 int nextC = allmsg.find( "-", 1 );
524 if ( nextC == -1 ) { 524 if ( nextC == -1 ) {
525 msg = allmsg; 525 msg = allmsg;
526 allmsg = ""; 526 allmsg = "";
527 } else{ 527 } else{
528 msg = allmsg.left( nextC ); 528 msg = allmsg.left( nextC );
529 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 529 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
530 } 530 }
531 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 531 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
532 if ( msg == "-newEvent" ) { 532 if ( msg == "-newEvent" ) {
533 mView->newEvent(); 533 mView->newEvent();
534 } 534 }
535 if ( msg == "-newTodo" ) { 535 if ( msg == "-newTodo" ) {
536 mView->newTodo(); 536 mView->newTodo();
537 537
538 } 538 }
539 if ( msg == "-showWN" ) { 539 if ( msg == "-showWN" ) {
540 mView->viewManager()->showWhatsNextView(); 540 mView->viewManager()->showWhatsNextView();
541 } 541 }
542 if ( msg == "-showTodo" ) { 542 if ( msg == "-showTodo" ) {
543 mView->viewManager()->showTodoView(); 543 mView->viewManager()->showTodoView();
544 } 544 }
545 if ( msg == "-showList" ) { 545 if ( msg == "-showList" ) {
546 mView->viewManager()->showListView(); 546 mView->viewManager()->showListView();
547 } 547 }
548 else if ( msg == "-showDay" ) { 548 else if ( msg == "-showDay" ) {
549 mView->viewManager()->showDayView(); 549 mView->viewManager()->showDayView();
550 } 550 }
551 else if ( msg == "-showWWeek" ) { 551 else if ( msg == "-showWWeek" ) {
552 mView->viewManager()->showWorkWeekView(); 552 mView->viewManager()->showWorkWeekView();
553 } 553 }
554 else if ( msg == "-ringSync" ) { 554 else if ( msg == "-ringSync" ) {
555 mSyncManager->multiSync( false ); 555 mSyncManager->multiSync( false );
556 } 556 }
557 else if ( msg == "-showWeek" ) { 557 else if ( msg == "-showWeek" ) {
558 mView->viewManager()->showWeekView(); 558 mView->viewManager()->showWeekView();
559 } 559 }
560 else if ( msg == "-showTodo" ) { 560 else if ( msg == "-showTodo" ) {
561 mView->viewManager()->showTodoView(); 561 mView->viewManager()->showTodoView();
562 } 562 }
563 else if ( msg == "-showJournal" ) { 563 else if ( msg == "-showJournal" ) {
564 mView->dateNavigator()->selectDates( 1 ); 564 mView->dateNavigator()->selectDates( 1 );
565 mView->dateNavigator()->selectToday(); 565 mView->dateNavigator()->selectToday();
566 mView->viewManager()->showJournalView(); 566 mView->viewManager()->showJournalView();
567 } 567 }
568 else if ( msg == "-showKO" ) { 568 else if ( msg == "-showKO" ) {
569 mView->viewManager()->showNextXView(); 569 mView->viewManager()->showNextXView();
570 } 570 }
571 else if ( msg == "-showWNext" ) { 571 else if ( msg == "-showWNext" ) {
572 mView->viewManager()->showWhatsNextView(); 572 mView->viewManager()->showWhatsNextView();
573 } 573 }
574 else if ( msg == "nextView()" ) { 574 else if ( msg == "nextView()" ) {
575 mView->viewManager()->showNextView(); 575 mView->viewManager()->showNextView();
576 } 576 }
577 else if ( msg == "-showNextXView" ) { 577 else if ( msg == "-showNextXView" ) {
578 mView->viewManager()->showNextXView(); 578 mView->viewManager()->showNextXView();
579 } 579 }
580 580
581 581
582 } 582 }
583 583
584 showMaximized(); 584 showMaximized();
585 raise(); 585 raise();
586} 586}
587 587
588QPixmap MainWindow::loadPixmap( QString name ) 588QPixmap MainWindow::loadPixmap( QString name )
589{ 589{
590 return SmallIcon( name ); 590 return SmallIcon( name );
591 591
592} 592}
593void MainWindow::setUsesBigPixmaps ( bool b )
594{
595 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
596 if ( b )
597 qDebug("KO: BigPixmaps are not supported ");
598}
593void MainWindow::initActions() 599void MainWindow::initActions()
594{ 600{
595 //KOPrefs::instance()->mShowFullMenu 601 //KOPrefs::instance()->mShowFullMenu
596 iconToolBar->clear(); 602 iconToolBar->clear();
597 KOPrefs *p = KOPrefs::instance(); 603 KOPrefs *p = KOPrefs::instance();
598 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 604 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
599 605
600 QPopupMenu *viewMenu = new QPopupMenu( this ); 606 QPopupMenu *viewMenu = new QPopupMenu( this );
601 QPopupMenu *actionMenu = new QPopupMenu( this ); 607 QPopupMenu *actionMenu = new QPopupMenu( this );
602 QPopupMenu *importMenu = new QPopupMenu( this ); 608 QPopupMenu *importMenu = new QPopupMenu( this );
603 QPopupMenu *importMenu_X = new QPopupMenu( this ); 609 QPopupMenu *importMenu_X = new QPopupMenu( this );
604 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 610 QPopupMenu *exportMenu_X = new QPopupMenu( this );
605 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 611 QPopupMenu *beamMenu_X = new QPopupMenu( this );
606 selectFilterMenu = new QPopupMenu( this ); 612 selectFilterMenu = new QPopupMenu( this );
607 selectFilterMenu->setCheckable( true ); 613 selectFilterMenu->setCheckable( true );
608 syncMenu = new QPopupMenu( this ); 614 syncMenu = new QPopupMenu( this );
609 configureAgendaMenu = new QPopupMenu( this ); 615 configureAgendaMenu = new QPopupMenu( this );
610 configureToolBarMenu = new QPopupMenu( this ); 616 configureToolBarMenu = new QPopupMenu( this );
611 QPopupMenu *helpMenu = new QPopupMenu( this ); 617 QPopupMenu *helpMenu = new QPopupMenu( this );
612 QIconSet icon; 618 QIconSet icon;
613 int pixWid = 22, pixHei = 22; 619 int pixWid = 22, pixHei = 22;
614 QString pathString = ""; 620 QString pathString = "";
615 if ( !p->mToolBarMiniIcons ) { 621 if ( !p->mToolBarMiniIcons ) {
616 if ( QApplication::desktop()->width() < 480 ) { 622 if ( QApplication::desktop()->width() < 480 ) {
617 pathString += "icons16/"; 623 pathString += "icons16/";
618 pixWid = 18; pixHei = 16; 624 pixWid = 18; pixHei = 16;
619 } 625 }
620 } else { 626 } else {
621 pathString += "iconsmini/"; 627 pathString += "iconsmini/";
622 pixWid = 18; pixHei = 16; 628 pixWid = 18; pixHei = 16;
623 } 629 }
624 if ( KOPrefs::instance()->mShowFullMenu ) { 630 if ( KOPrefs::instance()->mShowFullMenu ) {
625 QMenuBar *menuBar1; 631 QMenuBar *menuBar1;
626 menuBar1 = menuBar(); 632 menuBar1 = menuBar();
627 menuBar1->insertItem( i18n("File"), importMenu ); 633 menuBar1->insertItem( i18n("File"), importMenu );
628 menuBar1->insertItem( i18n("View"), viewMenu ); 634 menuBar1->insertItem( i18n("View"), viewMenu );
629 menuBar1->insertItem( i18n("Actions"), actionMenu ); 635 menuBar1->insertItem( i18n("Actions"), actionMenu );
630#ifdef DESKTOP_VERSION 636#ifdef DESKTOP_VERSION
631 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 637 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
632 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 638 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
633#else 639#else
634 menuBar1->insertItem( i18n("Sync"), syncMenu ); 640 menuBar1->insertItem( i18n("Sync"), syncMenu );
635 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 641 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
636#endif 642#endif
637 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 643 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
638 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 644 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
639 menuBar1->insertItem( i18n("Help"), helpMenu ); 645 menuBar1->insertItem( i18n("Help"), helpMenu );
640 } else { 646 } else {
641 QPEMenuBar *menuBar1; 647 QPEMenuBar *menuBar1;
642 menuBar1 = new QPEMenuBar( iconToolBar ); 648 menuBar1 = new QPEMenuBar( iconToolBar );
643 QPopupMenu *menuBar = new QPopupMenu( this ); 649 QPopupMenu *menuBar = new QPopupMenu( this );
644 icon = loadPixmap( pathString + "z_menu" ); 650 icon = loadPixmap( pathString + "z_menu" );
645 menuBar1->insertItem( icon.pixmap(), menuBar); 651 menuBar1->insertItem( icon.pixmap(), menuBar);
646 //menuBar1->insertItem( i18n("ME"), menuBar); 652 //menuBar1->insertItem( i18n("ME"), menuBar);
647 menuBar->insertItem( i18n("File"), importMenu ); 653 menuBar->insertItem( i18n("File"), importMenu );
648 menuBar->insertItem( i18n("View"), viewMenu ); 654 menuBar->insertItem( i18n("View"), viewMenu );
649 menuBar->insertItem( i18n("Actions"), actionMenu ); 655 menuBar->insertItem( i18n("Actions"), actionMenu );
650 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 656 menuBar->insertItem( i18n("Synchronize"), syncMenu );
651 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 657 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
652 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 658 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
653 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 659 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
654 menuBar->insertItem( i18n("Help"), helpMenu ); 660 menuBar->insertItem( i18n("Help"), helpMenu );
655 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 661 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
656 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 662 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
657 } 663 }
658 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 664 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
659 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 665 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
660 666
661 667
662 mWeekBgColor = iconToolBar->backgroundColor(); 668 mWeekBgColor = iconToolBar->backgroundColor();
663 mWeekPixmap.resize( pixWid , pixHei ); 669 mWeekPixmap.resize( pixWid , pixHei );
664 mWeekPixmap.fill( mWeekBgColor ); 670 mWeekPixmap.fill( mWeekBgColor );
665 icon = mWeekPixmap; 671 icon = mWeekPixmap;
666 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 672 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
667 if ( p-> mShowIconWeekNum ) 673 if ( p-> mShowIconWeekNum )
668 mWeekAction->addTo( iconToolBar ); 674 mWeekAction->addTo( iconToolBar );
669 mWeekFont = font(); 675 mWeekFont = font();
670 676
671 int fontPoint = mWeekFont.pointSize(); 677 int fontPoint = mWeekFont.pointSize();
672 QFontMetrics f( mWeekFont ); 678 QFontMetrics f( mWeekFont );
673 int fontWid = f.width( "30" ); 679 int fontWid = f.width( "30" );
674 while ( fontWid > pixWid ) { 680 while ( fontWid > pixWid ) {
675 --fontPoint; 681 --fontPoint;
676 mWeekFont.setPointSize( fontPoint ); 682 mWeekFont.setPointSize( fontPoint );
677 QFontMetrics f( mWeekFont ); 683 QFontMetrics f( mWeekFont );
678 fontWid = f.width( "30" ); 684 fontWid = f.width( "30" );
679 //qDebug("dec-- "); 685 //qDebug("dec-- ");
680 } 686 }
681 687
682 connect( mWeekAction, SIGNAL( activated() ), 688 connect( mWeekAction, SIGNAL( activated() ),
683 this, SLOT( weekAction() ) ); 689 this, SLOT( weekAction() ) );
684 690
685 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 691 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
686 if ( p->mShowIconFilterview ) { 692 if ( p->mShowIconFilterview ) {
687 icon = loadPixmap( pathString + "filter" ); 693 icon = loadPixmap( pathString + "filter" );
688 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 694 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
689 connect( actionFilterMenuTB, SIGNAL( activated() ), 695 connect( actionFilterMenuTB, SIGNAL( activated() ),
690 this, SLOT( fillFilterMenuTB() ) ); 696 this, SLOT( fillFilterMenuTB() ) );
691 actionFilterMenuTB->addTo( iconToolBar ); 697 actionFilterMenuTB->addTo( iconToolBar );
692 selectFilterMenuTB = new QPopupMenu( this ); 698 selectFilterMenuTB = new QPopupMenu( this );
693 selectFilterMenuTB->setCheckable( true ); 699 selectFilterMenuTB->setCheckable( true );
694 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 700 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
695 } 701 }
696 702
697 //#endif 703 //#endif
698 // ****************** 704 // ******************
699 QAction *action; 705 QAction *action;
700 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 706 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
701 configureToolBarMenu->setCheckable( true ); 707 configureToolBarMenu->setCheckable( true );
702 708
703 709
704 configureAgendaMenu->setCheckable( true ); 710 configureAgendaMenu->setCheckable( true );
705 int iii ; 711 int iii ;
706 for ( iii = 1;iii<= 10 ;++iii ){ 712 for ( iii = 1;iii<= 10 ;++iii ){
707 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 713 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
708 } 714 }
709 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 715 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
710 716
711 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 717 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
712 this, SLOT( showConfigureAgenda( ) ) ); 718 this, SLOT( showConfigureAgenda( ) ) );
713 719
714 icon = loadPixmap( pathString + "configure" ); 720 icon = loadPixmap( pathString + "configure" );
715 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 721 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
716 action->addTo( actionMenu ); 722 action->addTo( actionMenu );
717 connect( action, SIGNAL( activated() ), 723 connect( action, SIGNAL( activated() ),
718 mView, SLOT( edit_options() ) ); 724 mView, SLOT( edit_options() ) );
719 actionMenu->insertSeparator(); 725 actionMenu->insertSeparator();
720 726
721 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 727 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
722 action->addTo( actionMenu ); 728 action->addTo( actionMenu );
723 connect( action, SIGNAL( activated() ), 729 connect( action, SIGNAL( activated() ),
724 mView, SLOT( undo_delete() ) ); 730 mView, SLOT( undo_delete() ) );
725 actionMenu->insertSeparator(); 731 actionMenu->insertSeparator();
726 732
727 icon = loadPixmap( pathString + "newevent" ); 733 icon = loadPixmap( pathString + "newevent" );
728 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 734 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
729 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 735 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
730 configureToolBarMenu->insertSeparator(); 736 configureToolBarMenu->insertSeparator();
731 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 737 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
732 configureToolBarMenu->insertSeparator(); 738 configureToolBarMenu->insertSeparator();
733 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 739 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
734 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 740 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
735 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 741 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
736 ne_action->addTo( actionMenu ); 742 ne_action->addTo( actionMenu );
737 connect( ne_action, SIGNAL( activated() ), 743 connect( ne_action, SIGNAL( activated() ),
738 mView, SLOT( newEvent() ) ); 744 mView, SLOT( newEvent() ) );
739 icon = loadPixmap( pathString + "newtodo" ); 745 icon = loadPixmap( pathString + "newtodo" );
740 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 746 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
741 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 747 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
742 nt_action->addTo( actionMenu ); 748 nt_action->addTo( actionMenu );
743 connect( nt_action, SIGNAL( activated() ), 749 connect( nt_action, SIGNAL( activated() ),
744 mView, SLOT( newTodo() ) ); 750 mView, SLOT( newTodo() ) );
745 751
746 icon = loadPixmap( pathString + "today" ); 752 icon = loadPixmap( pathString + "today" );
747 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 753 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
748 today_action->addTo( viewMenu ); 754 today_action->addTo( viewMenu );
749 connect( today_action, SIGNAL( activated() ), 755 connect( today_action, SIGNAL( activated() ),
750 mView, SLOT( goToday() ) ); 756 mView, SLOT( goToday() ) );
751 viewMenu->insertSeparator(); 757 viewMenu->insertSeparator();
752 758
753 // *********************** 759 // ***********************
754 if ( KOPrefs::instance()->mVerticalScreen ) { 760 if ( KOPrefs::instance()->mVerticalScreen ) {
755 icon = SmallIcon( "1updownarrow" ); 761 icon = SmallIcon( "1updownarrow" );
756 } else { 762 } else {
757 icon = SmallIcon("1leftrightarrow" ); 763 icon = SmallIcon("1leftrightarrow" );
758 } 764 }
759 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 765 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
760 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 766 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
761 FSaction->addTo( viewMenu ); 767 FSaction->addTo( viewMenu );
762 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 768 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
763 769
764 icon = loadPixmap( pathString + "navi" ); 770 icon = loadPixmap( pathString + "navi" );
765 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 771 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
766 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 772 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
767 action->addTo( viewMenu ); 773 action->addTo( viewMenu );
768 connect( action, SIGNAL( activated() ), 774 connect( action, SIGNAL( activated() ),
769 mView, SLOT( toggleDateNavigatorWidget() ) ); 775 mView, SLOT( toggleDateNavigatorWidget() ) );
770 mToggleNav = action ; 776 mToggleNav = action ;
771 icon = loadPixmap( pathString + "filter" ); 777 icon = loadPixmap( pathString + "filter" );
772 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 778 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
773 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 779 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
774 action->addTo( viewMenu ); 780 action->addTo( viewMenu );
775 connect( action, SIGNAL( activated() ), 781 connect( action, SIGNAL( activated() ),
776 mView, SLOT( toggleFilter() ) ); 782 mView, SLOT( toggleFilter() ) );
777 mToggleFilter = action; 783 mToggleFilter = action;
778 icon = loadPixmap( pathString + "allday" ); 784 icon = loadPixmap( pathString + "allday" );
779 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 785 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
780 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 786 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
781 action->addTo( viewMenu ); 787 action->addTo( viewMenu );
782 connect( action, SIGNAL( activated() ), 788 connect( action, SIGNAL( activated() ),
783 mView, SLOT( toggleAllDaySize() ) ); 789 mView, SLOT( toggleAllDaySize() ) );
784 mToggleAllday = action; 790 mToggleAllday = action;
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 8fd3d24..6895e36 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,166 +1,167 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar; 26class QPEMenuBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
40 ~MainWindow(); 40 ~MainWindow();
41 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
42 static QString defaultFileName(); 42 static QString defaultFileName();
43 static QString syncFileName(); 43 static QString syncFileName();
44 static QString resourcePath(); 44 static QString resourcePath();
45 public slots: 45 public slots:
46 void setUsesBigPixmaps ( bool );
46 void setCaption ( const QString & ); 47 void setCaption ( const QString & );
47 void updateWeekNum(const KCal::DateList &); 48 void updateWeekNum(const KCal::DateList &);
48 void updateWeek(QDate); 49 void updateWeek(QDate);
49 void updateFilterToolbar(); 50 void updateFilterToolbar();
50 virtual void showMaximized (); 51 virtual void showMaximized ();
51 void configureAgenda( int ); 52 void configureAgenda( int );
52 void recieve( const QCString& msg, const QByteArray& data ); 53 void recieve( const QCString& msg, const QByteArray& data );
53 protected slots: 54 protected slots:
54 void setCaptionToDates(); 55 void setCaptionToDates();
55 void weekAction(); 56 void weekAction();
56 void about(); 57 void about();
57 void licence(); 58 void licence();
58 void faq(); 59 void faq();
59 void usertrans(); 60 void usertrans();
60 void features(); 61 void features();
61 void synchowto(); 62 void synchowto();
62 void storagehowto(); 63 void storagehowto();
63 void timetrackinghowto(); 64 void timetrackinghowto();
64 void kdesynchowto(); 65 void kdesynchowto();
65 void multisynchowto(); 66 void multisynchowto();
66 void whatsNew(); 67 void whatsNew();
67 void keyBindings(); 68 void keyBindings();
68 void aboutAutoSaving();; 69 void aboutAutoSaving();;
69 void aboutKnownBugs(); 70 void aboutKnownBugs();
70 71
71 void processIncidenceSelection( Incidence * ); 72 void processIncidenceSelection( Incidence * );
72 73
73 void importQtopia(); 74 void importQtopia();
74 void importBday(); 75 void importBday();
75 void importOL(); 76 void importOL();
76 void importIcal(); 77 void importIcal();
77 void importFile( QString, bool ); 78 void importFile( QString, bool );
78 void quickImportIcal(); 79 void quickImportIcal();
79 80
80 void slotModifiedChanged( bool ); 81 void slotModifiedChanged( bool );
81 82
82 void save(); 83 void save();
83 void saveStopTimer(); 84 void saveStopTimer();
84 void configureToolBar( int ); 85 void configureToolBar( int );
85 void printSel(); 86 void printSel();
86 void printCal(); 87 void printCal();
87 void saveCalendar(); 88 void saveCalendar();
88 void loadCalendar(); 89 void loadCalendar();
89 void exportVCalendar(); 90 void exportVCalendar();
90 void fillFilterMenu(); 91 void fillFilterMenu();
91 void fillFilterMenuTB(); 92 void fillFilterMenuTB();
92 void selectFilter( int ); 93 void selectFilter( int );
93 void fillFilterMenuPopup(); 94 void fillFilterMenuPopup();
94 void selectFilterPopup( int ); 95 void selectFilterPopup( int );
95 void exportToPhone( int ); 96 void exportToPhone( int );
96 void toggleBeamReceive(); 97 void toggleBeamReceive();
97 void disableBR(bool); 98 void disableBR(bool);
98 signals: 99 signals:
99 void selectWeek ( int ); 100 void selectWeek ( int );
100 private slots: 101 private slots:
101 void showConfigureAgenda(); 102 void showConfigureAgenda();
102 void getFile( bool ); 103 void getFile( bool );
103 void syncFileRequest(); 104 void syncFileRequest();
104 105
105 protected: 106 protected:
106 void hideEvent ( QHideEvent * ); 107 void hideEvent ( QHideEvent * );
107 QString sentSyncFile(); 108 QString sentSyncFile();
108 void displayText( QString, QString); 109 void displayText( QString, QString);
109 void enableIncidenceActions( bool ); 110 void enableIncidenceActions( bool );
110 111
111 private: 112 private:
112 bool mBRdisabled; 113 bool mBRdisabled;
113#ifndef DESKTOP_VERSION 114#ifndef DESKTOP_VERSION
114 QCopChannel* infrared; 115 QCopChannel* infrared;
115#endif 116#endif
116 QAction* brAction; 117 QAction* brAction;
117 KSyncManager* mSyncManager; 118 KSyncManager* mSyncManager;
118 bool mClosed; 119 bool mClosed;
119 void saveOnClose(); 120 void saveOnClose();
120 bool mFlagKeyPressed; 121 bool mFlagKeyPressed;
121 bool mBlockAtStartup; 122 bool mBlockAtStartup;
122 QPEToolBar *iconToolBar; 123 QPEToolBar *iconToolBar;
123 QPEToolBar *viewToolBar; 124 QPEToolBar *viewToolBar;
124 QPEToolBar *navigatorToolBar; 125 QPEToolBar *navigatorToolBar;
125 QPEToolBar *filterToolBar; 126 QPEToolBar *filterToolBar;
126 QMenuBar *filterMenubar; 127 QMenuBar *filterMenubar;
127 QPopupMenu * filterPopupMenu; 128 QPopupMenu * filterPopupMenu;
128 void initActions(); 129 void initActions();
129 void setDefaultPreferences(); 130 void setDefaultPreferences();
130 void resizeEvent( QResizeEvent* e); 131 void resizeEvent( QResizeEvent* e);
131 void keyPressEvent ( QKeyEvent * ) ; 132 void keyPressEvent ( QKeyEvent * ) ;
132 void keyReleaseEvent ( QKeyEvent * ) ; 133 void keyReleaseEvent ( QKeyEvent * ) ;
133 QPopupMenu *configureToolBarMenu; 134 QPopupMenu *configureToolBarMenu;
134 QPopupMenu *selectFilterMenu; 135 QPopupMenu *selectFilterMenu;
135 QPopupMenu *selectFilterMenuTB; 136 QPopupMenu *selectFilterMenuTB;
136 QPopupMenu *configureAgendaMenu, *syncMenu; 137 QPopupMenu *configureAgendaMenu, *syncMenu;
137 CalendarLocal *mCalendar; 138 CalendarLocal *mCalendar;
138 CalendarView *mView; 139 CalendarView *mView;
139 QAction *mNewSubTodoAction; 140 QAction *mNewSubTodoAction;
140 QAction *mWeekAction; 141 QAction *mWeekAction;
141 QFont mWeekFont; 142 QFont mWeekFont;
142 QPixmap mWeekPixmap; 143 QPixmap mWeekPixmap;
143 QColor mWeekBgColor; 144 QColor mWeekBgColor;
144 145
145 QAction *mShowAction; 146 QAction *mShowAction;
146 QAction *mEditAction; 147 QAction *mEditAction;
147 QAction *mDeleteAction; 148 QAction *mDeleteAction;
148 QAction *mCloneAction; 149 QAction *mCloneAction;
149 QAction *mMoveAction; 150 QAction *mMoveAction;
150 QAction *mBeamAction; 151 QAction *mBeamAction;
151 QAction *mCancelAction; 152 QAction *mCancelAction;
152 153
153 QAction *mToggleNav; 154 QAction *mToggleNav;
154 QAction *mToggleFilter; 155 QAction *mToggleFilter;
155 QAction *mToggleAllday; 156 QAction *mToggleAllday;
156 QAction *actionFilterMenuTB; 157 QAction *actionFilterMenuTB;
157 158
158 void closeEvent( QCloseEvent* ce ); 159 void closeEvent( QCloseEvent* ce );
159 QTimer mSaveTimer; 160 QTimer mSaveTimer;
160 //bool mBlockSaveFlag; 161 //bool mBlockSaveFlag;
161 bool mCalendarModifiedFlag; 162 bool mCalendarModifiedFlag;
162 QPixmap loadPixmap( QString ); 163 QPixmap loadPixmap( QString );
163}; 164};
164 165
165 166
166#endif 167#endif