summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/kotodoview.cpp19
-rw-r--r--korganizer/kotodoview.h1
3 files changed, 13 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 0c35bb3..1f2c6da 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -121,385 +121,385 @@
121#include <qtopia/alarmserver.h> 121#include <qtopia/alarmserver.h>
122#endif 122#endif
123#ifndef _WIN32_ 123#ifndef _WIN32_
124#include <stdlib.h> 124#include <stdlib.h>
125#include <stdio.h> 125#include <stdio.h>
126#include <unistd.h> 126#include <unistd.h>
127#else 127#else
128#include <qprocess.h> 128#include <qprocess.h>
129#endif 129#endif
130 130
131#ifdef DESKTOP_VERSION 131#ifdef DESKTOP_VERSION
132#include <kabc/stdaddressbook.h> 132#include <kabc/stdaddressbook.h>
133#endif 133#endif
134using namespace KOrg; 134using namespace KOrg;
135using namespace KCal; 135using namespace KCal;
136extern int globalFlagBlockAgenda; 136extern int globalFlagBlockAgenda;
137extern int globalFlagBlockStartup; 137extern int globalFlagBlockStartup;
138 138
139 139
140 140
141class KOBeamPrefs : public QDialog 141class KOBeamPrefs : public QDialog
142{ 142{
143 public: 143 public:
144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
145 QDialog( parent, name, true ) 145 QDialog( parent, name, true )
146 { 146 {
147 setCaption( i18n("Beam Options") ); 147 setCaption( i18n("Beam Options") );
148 QVBoxLayout* lay = new QVBoxLayout( this ); 148 QVBoxLayout* lay = new QVBoxLayout( this );
149 lay->setSpacing( 3 ); 149 lay->setSpacing( 3 );
150 lay->setMargin( 3 ); 150 lay->setMargin( 3 );
151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
152 lay->addWidget( format ); 152 lay->addWidget( format );
153 format->setExclusive ( true ) ; 153 format->setExclusive ( true ) ;
154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
155 lay->addWidget( time ); time->setExclusive ( true ) ; 155 lay->addWidget( time ); time->setExclusive ( true ) ;
156 vcal = new QRadioButton(" vCalendar ", format ); 156 vcal = new QRadioButton(" vCalendar ", format );
157 ical = new QRadioButton(" iCalendar ", format ); 157 ical = new QRadioButton(" iCalendar ", format );
158 vcal->setChecked( true ); 158 vcal->setChecked( true );
159 tz = new QRadioButton(i18n(" With timezone "), time ); 159 tz = new QRadioButton(i18n(" With timezone "), time );
160 local = new QRadioButton(i18n(" Local time "), time ); 160 local = new QRadioButton(i18n(" Local time "), time );
161 tz->setChecked( true ); 161 tz->setChecked( true );
162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
163 lay->addWidget( ok ); 163 lay->addWidget( ok );
164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
165 lay->addWidget( cancel ); 165 lay->addWidget( cancel );
166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
168 resize( 200, 200 ); 168 resize( 200, 200 );
169 } 169 }
170 170
171 bool beamVcal() { return vcal->isChecked(); } 171 bool beamVcal() { return vcal->isChecked(); }
172 bool beamLocal() { return local->isChecked(); } 172 bool beamLocal() { return local->isChecked(); }
173private: 173private:
174 QRadioButton* vcal, *ical, *local, *tz; 174 QRadioButton* vcal, *ical, *local, *tz;
175}; 175};
176class KOCatPrefs : public QDialog 176class KOCatPrefs : public QDialog
177{ 177{
178 public: 178 public:
179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
180 QDialog( parent, name, true ) 180 QDialog( parent, name, true )
181 { 181 {
182 setCaption( i18n("Manage new Categories") ); 182 setCaption( i18n("Manage new Categories") );
183 QVBoxLayout* lay = new QVBoxLayout( this ); 183 QVBoxLayout* lay = new QVBoxLayout( this );
184 lay->setSpacing( 3 ); 184 lay->setSpacing( 3 );
185 lay->setMargin( 3 ); 185 lay->setMargin( 3 );
186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
187 lay->addWidget( lab ); 187 lay->addWidget( lab );
188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
189 lay->addWidget( format ); 189 lay->addWidget( format );
190 format->setExclusive ( true ) ; 190 format->setExclusive ( true ) ;
191 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 191 addCatBut = new QRadioButton(i18n("Add to category list"), format );
192 new QRadioButton(i18n("Remove from Events/Todos"), format ); 192 new QRadioButton(i18n("Remove from Events/Todos"), format );
193 addCatBut->setChecked( true ); 193 addCatBut->setChecked( true );
194 QPushButton * ok = new QPushButton( i18n("OK"), this ); 194 QPushButton * ok = new QPushButton( i18n("OK"), this );
195 lay->addWidget( ok ); 195 lay->addWidget( ok );
196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
197 lay->addWidget( cancel ); 197 lay->addWidget( cancel );
198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
200 resize( 200, 200 ); 200 resize( 200, 200 );
201 } 201 }
202 202
203 bool addCat() { return addCatBut->isChecked(); } 203 bool addCat() { return addCatBut->isChecked(); }
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 beamDialog = new KOBeamPrefs(); 236 beamDialog = new KOBeamPrefs();
237 mDatePickerMode = 0; 237 mDatePickerMode = 0;
238 mCurrentSyncDevice = ""; 238 mCurrentSyncDevice = "";
239 writeLocale(); 239 writeLocale();
240 mViewManager = new KOViewManager( this ); 240 mViewManager = new KOViewManager( this );
241 mDialogManager = new KODialogManager( this ); 241 mDialogManager = new KODialogManager( this );
242 mEventViewerDialog = 0; 242 mEventViewerDialog = 0;
243 mModified = false; 243 mModified = false;
244 mReadOnly = false; 244 mReadOnly = false;
245 mSelectedIncidence = 0; 245 mSelectedIncidence = 0;
246 mCalPrinter = 0; 246 mCalPrinter = 0;
247 mFilters.setAutoDelete(true); 247 mFilters.setAutoDelete(true);
248 248
249 mCalendar->registerObserver( this ); 249 mCalendar->registerObserver( this );
250 // TODO: Make sure that view is updated, when calendar is changed. 250 // TODO: Make sure that view is updated, when calendar is changed.
251 251
252 mStorage = new FileStorage( mCalendar ); 252 mStorage = new FileStorage( mCalendar );
253 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 253 mNavigator = new DateNavigator( this, "datevav", mViewManager );
254 254
255 QBoxLayout *topLayout = (QBoxLayout*)layout(); 255 QBoxLayout *topLayout = (QBoxLayout*)layout();
256#ifndef KORG_NOSPLITTER 256#ifndef KORG_NOSPLITTER
257 // create the main layout frames. 257 // create the main layout frames.
258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
259 topLayout->addWidget(mPanner); 259 topLayout->addWidget(mPanner);
260 260
261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
262 "CalendarView::LeftFrame"); 262 "CalendarView::LeftFrame");
263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
264 264
265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
266 "CalendarView::DateNavigator", QDate::currentDate() ); 266 "CalendarView::DateNavigator", QDate::currentDate() );
267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
269 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 269 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
270 270
271#ifdef KORG_NORESOURCEVIEW 271#ifdef KORG_NORESOURCEVIEW
272 mResourceView = 0; 272 mResourceView = 0;
273#else 273#else
274 if ( mResourceManager ) { 274 if ( mResourceManager ) {
275 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 275 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
276 mResourceView->updateView(); 276 mResourceView->updateView();
277 connect( mResourceView, SIGNAL( resourcesChanged() ), 277 connect( mResourceView, SIGNAL( resourcesChanged() ),
278 SLOT( updateView() ) ); 278 SLOT( updateView() ) );
279 } else { 279 } else {
280 mResourceView = 0; 280 mResourceView = 0;
281 } 281 }
282#endif 282#endif
283 QWidget *rightBox = new QWidget( mPanner ); 283 QWidget *rightBox = new QWidget( mPanner );
284 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 284 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
285 285
286 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 286 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
287 rightLayout->addWidget( mNavigatorBar ); 287 rightLayout->addWidget( mNavigatorBar );
288 288
289 mRightFrame = new QWidgetStack( rightBox ); 289 mRightFrame = new QWidgetStack( rightBox );
290 rightLayout->addWidget( mRightFrame, 1 ); 290 rightLayout->addWidget( mRightFrame, 1 );
291 291
292 mLeftFrame = mLeftSplitter; 292 mLeftFrame = mLeftSplitter;
293#else 293#else
294 QWidget *mainBox = new QWidget( this ); 294 QWidget *mainBox = new QWidget( this );
295 QWidget *leftFrame = new QWidget( mainBox ); 295 QWidget *leftFrame = new QWidget( mainBox );
296 296
297 QBoxLayout * mainBoxLayout; 297 QBoxLayout * mainBoxLayout;
298 QBoxLayout * leftFrameLayout; 298 QBoxLayout * leftFrameLayout;
299 if ( KOPrefs::instance()->mVerticalScreen ) { 299 if ( KOPrefs::instance()->mVerticalScreen ) {
300 mainBoxLayout = new QVBoxLayout(mainBox); 300 mainBoxLayout = new QVBoxLayout(mainBox);
301 leftFrameLayout = new QHBoxLayout(leftFrame ); 301 leftFrameLayout = new QHBoxLayout(leftFrame );
302 } else { 302 } else {
303 mainBoxLayout = new QHBoxLayout(mainBox); 303 mainBoxLayout = new QHBoxLayout(mainBox);
304 leftFrameLayout = new QVBoxLayout(leftFrame ); 304 leftFrameLayout = new QVBoxLayout(leftFrame );
305 } 305 }
306 topLayout->addWidget( mainBox ); 306 topLayout->addWidget( mainBox );
307 mainBoxLayout->addWidget (leftFrame); 307 mainBoxLayout->addWidget (leftFrame);
308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
309 "CalendarView::DateNavigator", QDate::currentDate()); 309 "CalendarView::DateNavigator", QDate::currentDate());
310 // mDateNavigator->blockSignals( true ); 310 // mDateNavigator->blockSignals( true );
311 leftFrameLayout->addWidget( mDateNavigator ); 311 leftFrameLayout->addWidget( mDateNavigator );
312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); 313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
314 314
315 if ( QApplication::desktop()->width() < 480 ) { 315 if ( QApplication::desktop()->width() < 480 ) {
316 leftFrameLayout->addWidget(mFilterView); 316 leftFrameLayout->addWidget(mFilterView);
317 leftFrameLayout->addWidget(mTodoList, 2 ); 317 leftFrameLayout->addWidget(mTodoList, 2 );
318 318
319 } else { 319 } else {
320 leftFrameLayout->addWidget(mTodoList,2 ); 320 leftFrameLayout->addWidget(mTodoList,2 );
321 leftFrameLayout->addWidget(mFilterView ); 321 leftFrameLayout->addWidget(mFilterView );
322 } 322 }
323 mFilterView->hide(); 323 mFilterView->hide();
324 QWidget *rightBox = new QWidget( mainBox ); 324 QWidget *rightBox = new QWidget( mainBox );
325 mainBoxLayout->addWidget ( rightBox, 10 ); 325 mainBoxLayout->addWidget ( rightBox, 10 );
326 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 326 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
327 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 327 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
328 mRightFrame = new QWidgetStack( rightBox ); 328 mRightFrame = new QWidgetStack( rightBox );
329 rightLayout->addWidget( mNavigatorBar ); 329 rightLayout->addWidget( mNavigatorBar );
330 rightLayout->addWidget( mRightFrame, 10 ); 330 rightLayout->addWidget( mRightFrame, 10 );
331 331
332 mLeftFrame = leftFrame; 332 mLeftFrame = leftFrame;
333 if ( KOPrefs::instance()->mVerticalScreen ) { 333 if ( KOPrefs::instance()->mVerticalScreen ) {
334 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 334 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
335 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 335 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
336 } else { 336 } else {
337 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 337 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
338 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 338 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
339 } 339 }
340 340
341 //qDebug("Calendarview Size %d %d ", width(), height()); 341 //qDebug("Calendarview Size %d %d ", width(), height());
342#endif 342#endif
343 343
344 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 344 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
345 SLOT( showDates( const KCal::DateList & ) ) ); 345 SLOT( showDates( const KCal::DateList & ) ) );
346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
347 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 347 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
348 348
349 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 349 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
350 mNavigator, SLOT( selectPreviousYear() ) ); 350 mNavigator, SLOT( selectPreviousYear() ) );
351 connect( mNavigatorBar, SIGNAL( goNextYear() ), 351 connect( mNavigatorBar, SIGNAL( goNextYear() ),
352 mNavigator, SLOT( selectNextYear() ) ); 352 mNavigator, SLOT( selectNextYear() ) );
353 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 353 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
354 mNavigator, SLOT( selectPreviousMonth() ) ); 354 mNavigator, SLOT( selectPreviousMonth() ) );
355 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 355 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
356 mNavigator, SLOT( selectNextMonth() ) ); 356 mNavigator, SLOT( selectNextMonth() ) );
357 357
358 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 358 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
359 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 359 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
360 360
361 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 361 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
362 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 362 mNavigator, SLOT( selectWeek( const QDate & ) ) );
363 363
364 connect( mDateNavigator, SIGNAL( goPrevYear() ), 364 connect( mDateNavigator, SIGNAL( goPrevYear() ),
365 mNavigator, SLOT( selectPreviousYear() ) ); 365 mNavigator, SLOT( selectPreviousYear() ) );
366 connect( mDateNavigator, SIGNAL( goNextYear() ), 366 connect( mDateNavigator, SIGNAL( goNextYear() ),
367 mNavigator, SLOT( selectNextYear() ) ); 367 mNavigator, SLOT( selectNextYear() ) );
368 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 368 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
369 mNavigator, SLOT( selectPreviousMonth() ) ); 369 mNavigator, SLOT( selectPreviousMonth() ) );
370 connect( mDateNavigator, SIGNAL( goNextMonth() ), 370 connect( mDateNavigator, SIGNAL( goNextMonth() ),
371 mNavigator, SLOT( selectNextMonth() ) ); 371 mNavigator, SLOT( selectNextMonth() ) );
372 372
373 connect( mDateNavigator, SIGNAL( goPrevious() ), 373 connect( mDateNavigator, SIGNAL( goPrevious() ),
374 mNavigator, SLOT( selectPrevious() ) ); 374 mNavigator, SLOT( selectPrevious() ) );
375 connect( mDateNavigator, SIGNAL( goNext() ), 375 connect( mDateNavigator, SIGNAL( goNext() ),
376 mNavigator, SLOT( selectNext() ) ); 376 mNavigator, SLOT( selectNext() ) );
377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
378 mNavigator, SLOT( slotMonthSelect( int ) ) ); 378 mNavigator, SLOT( slotMonthSelect( int ) ) );
379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
380 mNavigator, SLOT( slotMonthSelect( int ) ) ); 380 mNavigator, SLOT( slotMonthSelect( int ) ) );
381 381
382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
384 384
385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
386 SLOT( eventAdded( Event *) ) ); 386 SLOT( eventAdded( Event *) ) );
387 387
388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
389 389
390 connect( this, SIGNAL( configChanged() ), 390 connect( this, SIGNAL( configChanged() ),
391 mDateNavigator, SLOT( updateConfig() ) ); 391 mDateNavigator, SLOT( updateConfig() ) );
392 392
393 connect( mTodoList, SIGNAL( newTodoSignal() ), 393 connect( mTodoList, SIGNAL( newTodoSignal() ),
394 SLOT( newTodo() ) ); 394 SLOT( newTodo() ) );
395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
396 SLOT( newSubTodo( Todo * ) ) ); 396 SLOT( newSubTodo( Todo * ) ) );
397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
398 SLOT( editTodo( Todo * ) ) ); 398 SLOT( editTodo( Todo * ) ) );
399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
400 SLOT( showTodo( Todo *) ) ); 400 SLOT( showTodo( Todo *) ) );
401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
402 SLOT( deleteTodo( Todo *) ) ); 402 SLOT( deleteTodo( Todo *) ) );
403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
405 SLOT( purgeCompleted() ) ); 405 SLOT( purgeCompleted() ) );
406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
407 SIGNAL( todoModified( Todo *, int ) ) ); 407 SIGNAL( todoModified( Todo *, int ) ) );
408 408
409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
410 this, SLOT ( cloneIncidence( Incidence * ) ) ); 410 this, SLOT ( cloneIncidence( Incidence * ) ) );
411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
412 this, SLOT (cancelIncidence( Incidence * ) ) ); 412 this, SLOT (cancelIncidence( Incidence * ) ) );
413 413
414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
415 this, SLOT ( moveIncidence( Incidence * ) ) ); 415 this, SLOT ( moveIncidence( Incidence * ) ) );
416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
417 this, SLOT ( beamIncidence( Incidence * ) ) ); 417 this, SLOT ( beamIncidence( Incidence * ) ) );
418 418
419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
420 this, SLOT ( todo_unsub( Todo * ) ) ); 420 this, SLOT ( todo_unsub( Todo * ) ) );
421 421
422 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 422 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
423 SLOT( updateTodo( Todo *, int ) ) ); 423 SLOT( updateTodo( Todo *, int ) ) );
424 connect( this, SIGNAL( todoModified( Todo *, int )), this, 424 connect( this, SIGNAL( todoModified( Todo *, int )), this,
425 SLOT( changeTodoDisplay( Todo *, int ) ) ); 425 SLOT( changeTodoDisplay( Todo *, int ) ) );
426 426
427 427
428 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 428 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
429 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 429 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
430 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 430 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
431 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 431 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
432 432
433 433
434 434
435 435
436 436
437 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 437 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
438 SLOT(checkClipboard())); 438 SLOT(checkClipboard()));
439 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 439 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
440 SLOT( processTodoListSelection( Incidence * ) ) ); 440 SLOT( processTodoListSelection( Incidence * ) ) );
441 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 441 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
442 442
443 // kdDebug() << "CalendarView::CalendarView() done" << endl; 443 // kdDebug() << "CalendarView::CalendarView() done" << endl;
444 444
445 mDateFrame = new QVBox(0,0,WType_Popup); 445 mDateFrame = new QVBox(0,0,WType_Popup);
446 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 446 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
447 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 447 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
448 mDateFrame->setLineWidth(3); 448 mDateFrame->setLineWidth(3);
449 mDateFrame->hide(); 449 mDateFrame->hide();
450 mDateFrame->setCaption( i18n( "Pick a date to display")); 450 mDateFrame->setCaption( i18n( "Pick a date to display"));
451 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 451 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
452 452
453 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 453 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
454 454
455 mEventEditor = mDialogManager->getEventEditor(); 455 mEventEditor = mDialogManager->getEventEditor();
456 mTodoEditor = mDialogManager->getTodoEditor(); 456 mTodoEditor = mDialogManager->getTodoEditor();
457 457
458 mFlagEditDescription = false; 458 mFlagEditDescription = false;
459 459
460 mSuspendTimer = new QTimer( this ); 460 mSuspendTimer = new QTimer( this );
461 mAlarmTimer = new QTimer( this ); 461 mAlarmTimer = new QTimer( this );
462 mRecheckAlarmTimer = new QTimer( this ); 462 mRecheckAlarmTimer = new QTimer( this );
463 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 463 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
464 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 464 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
465 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 465 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
466 mAlarmDialog = new AlarmDialog( this ); 466 mAlarmDialog = new AlarmDialog( this );
467 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 467 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
468 mAlarmDialog->setServerNotification( false ); 468 mAlarmDialog->setServerNotification( false );
469 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 469 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
470 470
471 471
472#ifndef DESKTOP_VERSION 472#ifndef DESKTOP_VERSION
473//US listen for arriving address resultsets 473//US listen for arriving address resultsets
474 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 474 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
475 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 475 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
476#endif 476#endif
477 477
478} 478}
479 479
480 480
481CalendarView::~CalendarView() 481CalendarView::~CalendarView()
482{ 482{
483 // kdDebug() << "~CalendarView()" << endl; 483 // kdDebug() << "~CalendarView()" << endl;
484 //qDebug("CalendarView::~CalendarView() "); 484 //qDebug("CalendarView::~CalendarView() ");
485 delete mDialogManager; 485 delete mDialogManager;
486 delete mViewManager; 486 delete mViewManager;
487 delete mStorage; 487 delete mStorage;
488 delete mDateFrame ; 488 delete mDateFrame ;
489 delete beamDialog; 489 delete beamDialog;
490 //kdDebug() << "~CalendarView() done" << endl; 490 //kdDebug() << "~CalendarView() done" << endl;
491} 491}
492void CalendarView::timerAlarm() 492void CalendarView::timerAlarm()
493{ 493{
494 //qDebug("CalendarView::timerAlarm() "); 494 //qDebug("CalendarView::timerAlarm() ");
495 computeAlarm(mAlarmNotification ); 495 computeAlarm(mAlarmNotification );
496} 496}
497 497
498void CalendarView::suspendAlarm() 498void CalendarView::suspendAlarm()
499{ 499{
500 //qDebug(" CalendarView::suspendAlarm() "); 500 //qDebug(" CalendarView::suspendAlarm() ");
501 computeAlarm(mSuspendAlarmNotification ); 501 computeAlarm(mSuspendAlarmNotification );
502 502
503} 503}
504 504
505void CalendarView::startAlarm( QString mess , QString filename) 505void CalendarView::startAlarm( QString mess , QString filename)
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index da46eca..ca5eadd 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,527 +1,532 @@
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 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27 27
28#include <qvbox.h> 28#include <qvbox.h>
29#include <kdebug.h> 29#include <kdebug.h>
30#include "koprefs.h" 30#include "koprefs.h"
31#include <klocale.h> 31#include <klocale.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kmessagebox.h> 34#include <kmessagebox.h>
35 35
36#include <libkcal/icaldrag.h> 36#include <libkcal/icaldrag.h>
37#include <libkcal/vcaldrag.h> 37#include <libkcal/vcaldrag.h>
38#include <libkcal/calfilter.h> 38#include <libkcal/calfilter.h>
39#include <libkcal/dndfactory.h> 39#include <libkcal/dndfactory.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42#include <kresources/resourceselectdialog.h> 42#include <kresources/resourceselectdialog.h>
43#ifndef DESKTOP_VERSION 43#ifndef DESKTOP_VERSION
44#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
45#else 45#else
46#include <qapplication.h> 46#include <qapplication.h>
47#endif 47#endif
48#ifndef KORG_NOPRINTER 48#ifndef KORG_NOPRINTER
49#include "calprinter.h" 49#include "calprinter.h"
50#endif 50#endif
51#include "docprefs.h" 51#include "docprefs.h"
52 52
53#include "kotodoview.h" 53#include "kotodoview.h"
54using namespace KOrg; 54using namespace KOrg;
55 55
56KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 56KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
57 const char *name) : 57 const char *name) :
58 KListView(parent,name) 58 KListView(parent,name)
59{ 59{
60 mName = QString ( name );
60 mCalendar = calendar; 61 mCalendar = calendar;
61#ifndef DESKTOP_VERSION 62#ifndef DESKTOP_VERSION
62 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 63 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
63#endif 64#endif
64 mOldCurrent = 0; 65 mOldCurrent = 0;
65 mMousePressed = false; 66 mMousePressed = false;
66 67
67 setAcceptDrops(true); 68 setAcceptDrops(true);
68 viewport()->setAcceptDrops(true); 69 viewport()->setAcceptDrops(true);
69 int size = 16; 70 int size = 16;
70 if (qApp->desktop()->width() < 300 ) 71 if (qApp->desktop()->width() < 300 )
71 size = 12; 72 size = 12;
72 setTreeStepSize( size + 6 ); 73 setTreeStepSize( size + 6 );
73 74
74} 75}
75 76
76void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 77void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
77{ 78{
78#ifndef KORG_NODND 79#ifndef KORG_NODND
79// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 80// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
80 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 81 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
81 !QTextDrag::canDecode( e ) ) { 82 !QTextDrag::canDecode( e ) ) {
82 e->ignore(); 83 e->ignore();
83 return; 84 return;
84 } 85 }
85 86
86 mOldCurrent = currentItem(); 87 mOldCurrent = currentItem();
87#endif 88#endif
88} 89}
89 90
90 91
91void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 92void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
92{ 93{
93#ifndef KORG_NODND 94#ifndef KORG_NODND
94// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 95// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
95 96
96 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 97 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
97 !QTextDrag::canDecode( e ) ) { 98 !QTextDrag::canDecode( e ) ) {
98 e->ignore(); 99 e->ignore();
99 return; 100 return;
100 } 101 }
101 102
102 e->accept(); 103 e->accept();
103#endif 104#endif
104} 105}
105 106
106void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 107void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
107{ 108{
108#ifndef KORG_NODND 109#ifndef KORG_NODND
109// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 110// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
110 111
111 setCurrentItem(mOldCurrent); 112 setCurrentItem(mOldCurrent);
112 setSelected(mOldCurrent,true); 113 setSelected(mOldCurrent,true);
113#endif 114#endif
114} 115}
115 116
116void KOTodoListView::contentsDropEvent(QDropEvent *e) 117void KOTodoListView::contentsDropEvent(QDropEvent *e)
117{ 118{
118#ifndef KORG_NODND 119#ifndef KORG_NODND
119// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 120// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
120 121
121 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 122 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
122 !QTextDrag::canDecode( e ) ) { 123 !QTextDrag::canDecode( e ) ) {
123 e->ignore(); 124 e->ignore();
124 return; 125 return;
125 } 126 }
126 127
127 DndFactory factory( mCalendar ); 128 DndFactory factory( mCalendar );
128 Todo *todo = factory.createDropTodo(e); 129 Todo *todo = factory.createDropTodo(e);
129 130
130 if (todo) { 131 if (todo) {
131 e->acceptAction(); 132 e->acceptAction();
132 133
133 KOTodoViewItem *destination = 134 KOTodoViewItem *destination =
134 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 135 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
135 Todo *destinationEvent = 0; 136 Todo *destinationEvent = 0;
136 if (destination) destinationEvent = destination->todo(); 137 if (destination) destinationEvent = destination->todo();
137 138
138 Todo *existingTodo = mCalendar->todo(todo->uid()); 139 Todo *existingTodo = mCalendar->todo(todo->uid());
139 140
140 if(existingTodo) { 141 if(existingTodo) {
141// kdDebug() << "Drop existing Todo" << endl; 142// kdDebug() << "Drop existing Todo" << endl;
142 Incidence *to = destinationEvent; 143 Incidence *to = destinationEvent;
143 while(to) { 144 while(to) {
144 if (to->uid() == todo->uid()) { 145 if (to->uid() == todo->uid()) {
145 KMessageBox::sorry(this, 146 KMessageBox::sorry(this,
146 i18n("Cannot move To-Do to itself or a child of itself"), 147 i18n("Cannot move To-Do to itself or a child of itself"),
147 i18n("Drop To-Do")); 148 i18n("Drop To-Do"));
148 delete todo; 149 delete todo;
149 return; 150 return;
150 } 151 }
151 to = to->relatedTo(); 152 to = to->relatedTo();
152 } 153 }
153 existingTodo->setRelatedTo(destinationEvent); 154 existingTodo->setRelatedTo(destinationEvent);
154 emit todoDropped(todo); 155 emit todoDropped(todo);
155 delete todo; 156 delete todo;
156 } else { 157 } else {
157// kdDebug() << "Drop new Todo" << endl; 158// kdDebug() << "Drop new Todo" << endl;
158 todo->setRelatedTo(destinationEvent); 159 todo->setRelatedTo(destinationEvent);
159 mCalendar->addTodo(todo); 160 mCalendar->addTodo(todo);
160 161
161 emit todoDropped(todo); 162 emit todoDropped(todo);
162 } 163 }
163 } 164 }
164 else { 165 else {
165 QString text; 166 QString text;
166 if (QTextDrag::decode(e,text)) { 167 if (QTextDrag::decode(e,text)) {
167 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 168 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
168 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 169 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
169 kdDebug() << "Dropped : " << text << endl; 170 kdDebug() << "Dropped : " << text << endl;
170 QStringList emails = QStringList::split(",",text); 171 QStringList emails = QStringList::split(",",text);
171 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 172 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
172 kdDebug() << " Email: " << (*it) << endl; 173 kdDebug() << " Email: " << (*it) << endl;
173 int pos = (*it).find("<"); 174 int pos = (*it).find("<");
174 QString name = (*it).left(pos); 175 QString name = (*it).left(pos);
175 QString email = (*it).mid(pos); 176 QString email = (*it).mid(pos);
176 if (!email.isEmpty() && todoi) { 177 if (!email.isEmpty() && todoi) {
177 todoi->todo()->addAttendee(new Attendee(name,email)); 178 todoi->todo()->addAttendee(new Attendee(name,email));
178 } 179 }
179 } 180 }
180 } 181 }
181 else { 182 else {
182 kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; 183 kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl;
183 e->ignore(); 184 e->ignore();
184 } 185 }
185 } 186 }
186#endif 187#endif
187} 188}
188 189
189void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
190{ 191{
191 QListView::contentsMousePressEvent(e); 192 QListView::contentsMousePressEvent(e);
192#ifndef KORG_NODND 193#ifndef KORG_NODND
193 QPoint p(contentsToViewport(e->pos())); 194 QPoint p(contentsToViewport(e->pos()));
194 QListViewItem *i = itemAt(p); 195 QListViewItem *i = itemAt(p);
195 if (i) { 196 if (i) {
196 // if the user clicked into the root decoration of the item, don't 197 // if the user clicked into the root decoration of the item, don't
197 // try to start a drag! 198 // try to start a drag!
198 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + 199 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
199 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 200 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
200 itemMargin() || 201 itemMargin() ||
201 p.x() < header()->sectionPos(header()->mapToIndex(0))) { 202 p.x() < header()->sectionPos(header()->mapToIndex(0))) {
202 if (e->button()==Qt::LeftButton) { 203 if (e->button()==Qt::LeftButton) {
203 mPressPos = e->pos(); 204 mPressPos = e->pos();
204 mMousePressed = true; 205 mMousePressed = true;
205 } 206 }
206 } 207 }
207 } 208 }
208#endif 209#endif
209} 210}
210 211
211void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 212void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
212{ 213{
213#ifndef KORG_NODND 214#ifndef KORG_NODND
214// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; 215// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl;
215 QListView::contentsMouseMoveEvent(e); 216 QListView::contentsMouseMoveEvent(e);
216 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 217 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
217 QApplication::startDragDistance()) { 218 QApplication::startDragDistance()) {
218 mMousePressed = false; 219 mMousePressed = false;
219 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 220 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
220 if (item) { 221 if (item) {
221// kdDebug() << "Start Drag for item " << item->text(0) << endl; 222// kdDebug() << "Start Drag for item " << item->text(0) << endl;
222 DndFactory factory( mCalendar ); 223 DndFactory factory( mCalendar );
223 ICalDrag *vd = factory.createDragTodo( 224 ICalDrag *vd = factory.createDragTodo(
224 ((KOTodoViewItem *)item)->todo(),viewport()); 225 ((KOTodoViewItem *)item)->todo(),viewport());
225 if (vd->drag()) { 226 if (vd->drag()) {
226 kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl; 227 kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl;
227 } 228 }
228/* 229/*
229 QString source = fullPath(item); 230 QString source = fullPath(item);
230 if ( QFile::exists(source) ) { 231 if ( QFile::exists(source) ) {
231 QUriDrag* ud = new QUriDrag(viewport()); 232 QUriDrag* ud = new QUriDrag(viewport());
232 ud->setFilenames( source ); 233 ud->setFilenames( source );
233 if ( ud->drag() ) 234 if ( ud->drag() )
234 QMessageBox::information( this, "Drag source", 235 QMessageBox::information( this, "Drag source",
235 QString("Delete ")+source, "Not implemented" ); 236 QString("Delete ")+source, "Not implemented" );
236*/ 237*/
237 } 238 }
238 } 239 }
239#endif 240#endif
240} 241}
241void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 242void KOTodoListView::keyPressEvent ( QKeyEvent * e )
242{ 243{
243 244
244 QListViewItem* cn; 245 QListViewItem* cn;
245 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 246 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
246 cn = currentItem(); 247 cn = currentItem();
247 if ( cn ) { 248 if ( cn ) {
248 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 249 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
249 if ( ci ){ 250 if ( ci ){
250 if ( e->state() == ShiftButton ) 251 if ( e->state() == ShiftButton )
251 ci->setOn( false ); 252 ci->setOn( false );
252 else 253 else
253 ci->setOn( true ); 254 ci->setOn( true );
254 cn = cn->nextSibling(); 255 cn = cn->nextSibling();
255 if ( cn ) { 256 if ( cn ) {
256 setCurrentItem ( cn ); 257 setCurrentItem ( cn );
257 ensureItemVisible ( cn ); 258 ensureItemVisible ( cn );
258 } 259 }
259 260
260 } 261 }
261 } 262 }
262 263
263 return; 264 return;
264 } 265 }
265 266
266 // qDebug("KOTodoListView::keyPressEvent "); 267 // qDebug("KOTodoListView::keyPressEvent ");
267 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || ( height() > 150 && width() > 200 ) ) { 268 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
268 switch ( e->key() ) { 269 switch ( e->key() ) {
269 case Qt::Key_Down: 270 case Qt::Key_Down:
270 case Qt::Key_Up: 271 case Qt::Key_Up:
271 QListView::keyPressEvent ( e ); 272 QListView::keyPressEvent ( e );
272 break; 273 break;
274 case Qt::Key_Left:
275 case Qt::Key_Right:
276 QListView::keyPressEvent ( e );
277 break;
273 default: 278 default:
274 e->ignore(); 279 e->ignore();
275 break; 280 break;
276 } 281 }
277 return; 282 return;
278 } 283 }
279 e->ignore(); 284 e->ignore();
280} 285}
281void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 286void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
282{ 287{
283 QListView::contentsMouseReleaseEvent(e); 288 QListView::contentsMouseReleaseEvent(e);
284 mMousePressed = false; 289 mMousePressed = false;
285} 290}
286 291
287void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 292void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
288{ 293{
289 if (!e) return; 294 if (!e) return;
290 295
291 QPoint vp = contentsToViewport(e->pos()); 296 QPoint vp = contentsToViewport(e->pos());
292 297
293 QListViewItem *item = itemAt(vp); 298 QListViewItem *item = itemAt(vp);
294 299
295 emit double_Clicked(item); 300 emit double_Clicked(item);
296 if (!item) return; 301 if (!item) return;
297 302
298 emit doubleClicked(item,vp,0); 303 emit doubleClicked(item,vp,0);
299} 304}
300 305
301///////////////////////////////////////////////////////////////////////////// 306/////////////////////////////////////////////////////////////////////////////
302 307
303KOQuickTodo::KOQuickTodo(QWidget *parent) : 308KOQuickTodo::KOQuickTodo(QWidget *parent) :
304 QLineEdit(parent) 309 QLineEdit(parent)
305{ 310{
306 setText(i18n("Click to add a new Todo")); 311 setText(i18n("Click to add a new Todo"));
307} 312}
308 313
309void KOQuickTodo::focusInEvent(QFocusEvent *ev) 314void KOQuickTodo::focusInEvent(QFocusEvent *ev)
310{ 315{
311 if ( text()==i18n("Click to add a new Todo") ) 316 if ( text()==i18n("Click to add a new Todo") )
312 setText(""); 317 setText("");
313 QLineEdit::focusInEvent(ev); 318 QLineEdit::focusInEvent(ev);
314} 319}
315 320
316void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 321void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
317{ 322{
318 setText(i18n("Click to add a new Todo")); 323 setText(i18n("Click to add a new Todo"));
319 QLineEdit::focusOutEvent(ev); 324 QLineEdit::focusOutEvent(ev);
320} 325}
321 326
322///////////////////////////////////////////////////////////////////////////// 327/////////////////////////////////////////////////////////////////////////////
323 328
324KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 329KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
325 KOrg::BaseView(calendar,parent,name) 330 KOrg::BaseView(calendar,parent,name)
326{ 331{
327 QBoxLayout *topLayout = new QVBoxLayout(this); 332 QBoxLayout *topLayout = new QVBoxLayout(this);
328 mName = QString ( name ); 333 mName = QString ( name );
329 mBlockUpdate = false; 334 mBlockUpdate = false;
330 mQuickAdd = new KOQuickTodo(this); 335 mQuickAdd = new KOQuickTodo(this);
331 topLayout->addWidget(mQuickAdd); 336 topLayout->addWidget(mQuickAdd);
332 337
333 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 338 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
334 339
335 mTodoListView = new KOTodoListView(calendar,this); 340 mTodoListView = new KOTodoListView(calendar,this, name );
336 topLayout->addWidget(mTodoListView); 341 topLayout->addWidget(mTodoListView);
337 //mTodoListView->header()->setMaximumHeight(30); 342 //mTodoListView->header()->setMaximumHeight(30);
338 mTodoListView->setRootIsDecorated(true); 343 mTodoListView->setRootIsDecorated(true);
339 mTodoListView->setAllColumnsShowFocus(true); 344 mTodoListView->setAllColumnsShowFocus(true);
340 345
341 mTodoListView->setShowSortIndicator(true); 346 mTodoListView->setShowSortIndicator(true);
342 347
343 mTodoListView->addColumn(i18n("Todo")); 348 mTodoListView->addColumn(i18n("Todo"));
344 mTodoListView->addColumn(i18n("Prio")); 349 mTodoListView->addColumn(i18n("Prio"));
345 mTodoListView->setColumnAlignment(1,AlignHCenter); 350 mTodoListView->setColumnAlignment(1,AlignHCenter);
346 mTodoListView->addColumn(i18n("Complete")); 351 mTodoListView->addColumn(i18n("Complete"));
347 mTodoListView->setColumnAlignment(2,AlignHCenter); 352 mTodoListView->setColumnAlignment(2,AlignHCenter);
348 mTodoListView->addColumn(i18n("Due Date")); 353 mTodoListView->addColumn(i18n("Due Date"));
349 mTodoListView->setColumnAlignment(3,AlignLeft); 354 mTodoListView->setColumnAlignment(3,AlignLeft);
350 mTodoListView->addColumn(i18n("Due Time")); 355 mTodoListView->addColumn(i18n("Due Time"));
351 mTodoListView->setColumnAlignment(4,AlignHCenter); 356 mTodoListView->setColumnAlignment(4,AlignHCenter);
352 mTodoListView->addColumn(i18n("Cancelled")); 357 mTodoListView->addColumn(i18n("Cancelled"));
353 mTodoListView->addColumn(i18n("Categories")); 358 mTodoListView->addColumn(i18n("Categories"));
354#if 0 359#if 0
355 mTodoListView->addColumn(i18n("Sort Id")); 360 mTodoListView->addColumn(i18n("Sort Id"));
356 mTodoListView->setColumnAlignment(4,AlignHCenter); 361 mTodoListView->setColumnAlignment(4,AlignHCenter);
357#endif 362#endif
358 363
359 mTodoListView->setMinimumHeight( 60 ); 364 mTodoListView->setMinimumHeight( 60 );
360 mTodoListView->setItemsRenameable( true ); 365 mTodoListView->setItemsRenameable( true );
361 mTodoListView->setRenameable( 0 ); 366 mTodoListView->setRenameable( 0 );
362 mTodoListView->setColumnWidth( 0, 120 ); 367 mTodoListView->setColumnWidth( 0, 120 );
363 mTodoListView->setColumnWidthMode(0, QListView::Manual); 368 mTodoListView->setColumnWidthMode(0, QListView::Manual);
364 mTodoListView->setColumnWidthMode(1, QListView::Manual); 369 mTodoListView->setColumnWidthMode(1, QListView::Manual);
365 mTodoListView->setColumnWidthMode(2, QListView::Manual); 370 mTodoListView->setColumnWidthMode(2, QListView::Manual);
366 mTodoListView->setColumnWidthMode(3, QListView::Manual); 371 mTodoListView->setColumnWidthMode(3, QListView::Manual);
367 mTodoListView->setColumnWidthMode(4, QListView::Manual); 372 mTodoListView->setColumnWidthMode(4, QListView::Manual);
368 mTodoListView->setColumnWidthMode(5, QListView::Manual); 373 mTodoListView->setColumnWidthMode(5, QListView::Manual);
369 mTodoListView->setColumnAlignment( 2, AlignCenter ); 374 mTodoListView->setColumnAlignment( 2, AlignCenter );
370#if 0 375#if 0
371 mTodoListView->setColumnWidthMode(6, QListView::Manual); 376 mTodoListView->setColumnWidthMode(6, QListView::Manual);
372#endif 377#endif
373 378
374 mPriorityPopupMenu = new QPopupMenu(this); 379 mPriorityPopupMenu = new QPopupMenu(this);
375 for (int i = 1; i <= 5; i++) { 380 for (int i = 1; i <= 5; i++) {
376 QString label = QString ("%1").arg (i); 381 QString label = QString ("%1").arg (i);
377 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 382 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
378 } 383 }
379 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 384 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
380 385
381 mPercentageCompletedPopupMenu = new QPopupMenu(this); 386 mPercentageCompletedPopupMenu = new QPopupMenu(this);
382 for (int i = 0; i <= 100; i+=20) { 387 for (int i = 0; i <= 100; i+=20) {
383 QString label = QString ("%1 %").arg (i); 388 QString label = QString ("%1 %").arg (i);
384 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 389 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
385 } 390 }
386 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 391 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
387 392
388 393
389 394
390 mItemPopupMenu = new QPopupMenu(this); 395 mItemPopupMenu = new QPopupMenu(this);
391 mItemPopupMenu->insertItem(i18n("Show..."), this, 396 mItemPopupMenu->insertItem(i18n("Show..."), this,
392 SLOT (showTodo())); 397 SLOT (showTodo()));
393 mItemPopupMenu->insertItem(i18n("Edit..."), this, 398 mItemPopupMenu->insertItem(i18n("Edit..."), this,
394 SLOT (editTodo())); 399 SLOT (editTodo()));
395 mItemPopupMenu->insertItem( i18n("Delete"), this, 400 mItemPopupMenu->insertItem( i18n("Delete"), this,
396 SLOT (deleteTodo())); 401 SLOT (deleteTodo()));
397 mItemPopupMenu->insertItem( i18n("Clone..."), this, 402 mItemPopupMenu->insertItem( i18n("Clone..."), this,
398 SLOT (cloneTodo())); 403 SLOT (cloneTodo()));
399 mItemPopupMenu->insertItem( i18n("Move..."), this, 404 mItemPopupMenu->insertItem( i18n("Move..."), this,
400 SLOT (moveTodo())); 405 SLOT (moveTodo()));
401 mItemPopupMenu->insertItem( i18n("Beam..."), this, 406 mItemPopupMenu->insertItem( i18n("Beam..."), this,
402 SLOT (beamTodo())); 407 SLOT (beamTodo()));
403 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 408 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
404 SLOT (cancelTodo())); 409 SLOT (cancelTodo()));
405 mItemPopupMenu->insertSeparator(); 410 mItemPopupMenu->insertSeparator();
406 411
407 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 412 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
408 SLOT (newTodo())); 413 SLOT (newTodo()));
409 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 414 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
410 SLOT (newSubTodo())); 415 SLOT (newSubTodo()));
411 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 416 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
412 SLOT (unparentTodo())); 417 SLOT (unparentTodo()));
413 mItemPopupMenu->insertSeparator(); 418 mItemPopupMenu->insertSeparator();
414 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 419 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
415 this, SLOT( purgeCompleted() ) ); 420 this, SLOT( purgeCompleted() ) );
416 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 421 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
417 this, SLOT( toggleCompleted() ),0, 33 ); 422 this, SLOT( toggleCompleted() ),0, 33 );
418 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 423 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
419 this, SLOT( toggleQuickTodo() ),0, 34 ); 424 this, SLOT( toggleQuickTodo() ),0, 34 );
420 425
421 mPopupMenu = new QPopupMenu(this); 426 mPopupMenu = new QPopupMenu(this);
422 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 427 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
423 SLOT (newTodo()),0,1); 428 SLOT (newTodo()),0,1);
424 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 429 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
425 this, SLOT(purgeCompleted()),0,2); 430 this, SLOT(purgeCompleted()),0,2);
426 mPopupMenu->insertItem(i18n("Show Completed"), 431 mPopupMenu->insertItem(i18n("Show Completed"),
427 this, SLOT( toggleCompleted() ),0,3 ); 432 this, SLOT( toggleCompleted() ),0,3 );
428 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 433 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
429 this, SLOT( toggleQuickTodo() ),0,4 ); 434 this, SLOT( toggleQuickTodo() ),0,4 );
430 mDocPrefs = new DocPrefs( name ); 435 mDocPrefs = new DocPrefs( name );
431 436
432 mPopupMenu->setCheckable( true ); 437 mPopupMenu->setCheckable( true );
433 mItemPopupMenu->setCheckable( true ); 438 mItemPopupMenu->setCheckable( true );
434 // Double clicking conflicts with opening/closing the subtree 439 // Double clicking conflicts with opening/closing the subtree
435 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 440 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
436 SLOT( editItem( QListViewItem *) ) ); 441 SLOT( editItem( QListViewItem *) ) );
437 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 442 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
438 const QPoint &,int ) ), 443 const QPoint &,int ) ),
439 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 444 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
440 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 445 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
441 SLOT( itemClicked( QListViewItem * ) ) ); 446 SLOT( itemClicked( QListViewItem * ) ) );
442 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 447 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
443 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 448 SLOT( itemDoubleClicked( QListViewItem * ) ) );
444 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), 449 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ),
445 SLOT( updateView() ) ); 450 SLOT( updateView() ) );
446 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 451 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
447 SLOT( itemStateChanged( QListViewItem * ) ) ); 452 SLOT( itemStateChanged( QListViewItem * ) ) );
448 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 453 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
449 SLOT( itemStateChanged( QListViewItem * ) ) ); 454 SLOT( itemStateChanged( QListViewItem * ) ) );
450 455
451#if 0 456#if 0
452 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 457 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
453 SLOT(selectionChanged(QListViewItem *))); 458 SLOT(selectionChanged(QListViewItem *)));
454 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 459 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
455 SLOT(selectionChanged(QListViewItem *))); 460 SLOT(selectionChanged(QListViewItem *)));
456 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 461 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
457 SLOT(selectionChanged(QListViewItem *))); 462 SLOT(selectionChanged(QListViewItem *)));
458#endif 463#endif
459 connect( mTodoListView, SIGNAL(selectionChanged() ), 464 connect( mTodoListView, SIGNAL(selectionChanged() ),
460 SLOT( processSelectionChange() ) ); 465 SLOT( processSelectionChange() ) );
461 connect( mQuickAdd, SIGNAL( returnPressed () ), 466 connect( mQuickAdd, SIGNAL( returnPressed () ),
462 SLOT( addQuickTodo() ) ); 467 SLOT( addQuickTodo() ) );
463// if ( QApplication::desktop()->width() < 480 ) { 468// if ( QApplication::desktop()->width() < 480 ) {
464// setNarrow(); 469// setNarrow();
465 // mTodoListView->setColumnWidth( 0, 100 ); 470 // mTodoListView->setColumnWidth( 0, 100 );
466 471
467 // } 472 // }
468 473
469} 474}
470 475
471KOTodoView::~KOTodoView() 476KOTodoView::~KOTodoView()
472{ 477{
473 delete mDocPrefs; 478 delete mDocPrefs;
474} 479}
475 480
476void KOTodoView::jumpToDate () 481void KOTodoView::jumpToDate ()
477{ 482{
478 // if (mActiveItem) { 483 // if (mActiveItem) {
479// mActiveItem->todo()); 484// mActiveItem->todo());
480// if ( mActiveItem->todo()->hasDueDate() ) 485// if ( mActiveItem->todo()->hasDueDate() )
481// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 486// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
482} 487}
483 488
484void KOTodoView::setNarrow() 489void KOTodoView::setNarrow()
485{ 490{
486 //mTodoListView->setColumnWidth( 0, 120 ); 491 //mTodoListView->setColumnWidth( 0, 120 );
487 mTodoListView->setColumnWidth( 1, 35 ); 492 mTodoListView->setColumnWidth( 1, 35 );
488 mTodoListView->setColumnWidth( 2, 40 ); 493 mTodoListView->setColumnWidth( 2, 40 );
489 mTodoListView->setColumnWidth( 3, 80 ); 494 mTodoListView->setColumnWidth( 3, 80 );
490 mTodoListView->setColumnWidth( 4, 40 ); 495 mTodoListView->setColumnWidth( 4, 40 );
491 mTodoListView->setColumnWidth( 5, 90 ); 496 mTodoListView->setColumnWidth( 5, 90 );
492 497
493} 498}
494void KOTodoView::updateView() 499void KOTodoView::updateView()
495{ 500{
496 501
497 if ( mBlockUpdate ) { 502 if ( mBlockUpdate ) {
498 //qDebug("blocked "); 503 //qDebug("blocked ");
499 return; 504 return;
500 } 505 }
501 //qDebug("update "); 506 //qDebug("update ");
502// kdDebug() << "KOTodoView::updateView()" << endl; 507// kdDebug() << "KOTodoView::updateView()" << endl;
503 QFont fo = KOPrefs::instance()->mTodoViewFont; 508 QFont fo = KOPrefs::instance()->mTodoViewFont;
504 mTodoListView->clear(); 509 mTodoListView->clear();
505 if ( mName == "todolistsmall" ) { 510 if ( mName == "todolistsmall" ) {
506 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 511 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
507 int ps = fo.pointSize() -2; 512 int ps = fo.pointSize() -2;
508 if ( ps > 12 ) 513 if ( ps > 12 )
509 ps -= 2; 514 ps -= 2;
510 fo.setPointSize( ps ); 515 fo.setPointSize( ps );
511 } 516 }
512 } 517 }
513 518
514 mTodoListView->setFont( fo ); 519 mTodoListView->setFont( fo );
515 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 520 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
516 //mTodoListView->header()->setMaximumHeight(fm.height()); 521 //mTodoListView->header()->setMaximumHeight(fm.height());
517 QPtrList<Todo> todoList = calendar()->todos(); 522 QPtrList<Todo> todoList = calendar()->todos();
518 523
519/* 524/*
520 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 525 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
521 Event *t; 526 Event *t;
522 for(t = todoList.first(); t; t = todoList.next()) { 527 for(t = todoList.first(); t; t = todoList.next()) {
523 kdDebug() << " " << t->getSummary() << endl; 528 kdDebug() << " " << t->getSummary() << endl;
524 529
525 if (t->getRelatedTo()) { 530 if (t->getRelatedTo()) {
526 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 531 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
527 } 532 }
@@ -782,252 +787,250 @@ void KOTodoView::setNewPriority(int index)
782 mActiveItem->todo()->setPriority(mPriority[index]); 787 mActiveItem->todo()->setPriority(mPriority[index]);
783 mActiveItem->construct(); 788 mActiveItem->construct();
784 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 789 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
785 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 790 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
786 } 791 }
787} 792}
788 793
789void KOTodoView::setNewPercentage(int index) 794void KOTodoView::setNewPercentage(int index)
790{ 795{
791 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 796 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
792 if (mPercentage[index] == 100) { 797 if (mPercentage[index] == 100) {
793 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 798 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
794 } else { 799 } else {
795 mActiveItem->todo()->setCompleted(false); 800 mActiveItem->todo()->setCompleted(false);
796 } 801 }
797 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 802 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
798 mActiveItem->construct(); 803 mActiveItem->construct();
799 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 804 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
800 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 805 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
801 } 806 }
802} 807}
803 808
804 809
805QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 810QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
806{ 811{
807 QPopupMenu* tempMenu = new QPopupMenu (this); 812 QPopupMenu* tempMenu = new QPopupMenu (this);
808 QStringList checkedCategories = todoItem->todo()->categories (); 813 QStringList checkedCategories = todoItem->todo()->categories ();
809 814
810 tempMenu->setCheckable (true); 815 tempMenu->setCheckable (true);
811 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 816 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
812 it != KOPrefs::instance()->mCustomCategories.end (); 817 it != KOPrefs::instance()->mCustomCategories.end ();
813 ++it) { 818 ++it) {
814 int index = tempMenu->insertItem (*it); 819 int index = tempMenu->insertItem (*it);
815 mCategory[index] = *it; 820 mCategory[index] = *it;
816 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 821 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
817 } 822 }
818 823
819 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 824 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
820 return tempMenu; 825 return tempMenu;
821 826
822 827
823} 828}
824void KOTodoView::changedCategories(int index) 829void KOTodoView::changedCategories(int index)
825{ 830{
826 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 831 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
827 QStringList categories = mActiveItem->todo()->categories (); 832 QStringList categories = mActiveItem->todo()->categories ();
828 if (categories.find (mCategory[index]) != categories.end ()) 833 if (categories.find (mCategory[index]) != categories.end ())
829 categories.remove (mCategory[index]); 834 categories.remove (mCategory[index]);
830 else 835 else
831 categories.insert (categories.end(), mCategory[index]); 836 categories.insert (categories.end(), mCategory[index]);
832 categories.sort (); 837 categories.sort ();
833 mActiveItem->todo()->setCategories (categories); 838 mActiveItem->todo()->setCategories (categories);
834 mActiveItem->construct(); 839 mActiveItem->construct();
835 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 840 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
836 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 841 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
837 } 842 }
838} 843}
839void KOTodoView::itemDoubleClicked(QListViewItem *item) 844void KOTodoView::itemDoubleClicked(QListViewItem *item)
840{ 845{
841 if (!item) { 846 if (!item) {
842 newTodo(); 847 newTodo();
843 return; 848 return;
844 } 849 }
845 if ( KOPrefs::instance()->mEditOnDoubleClick ) 850 if ( KOPrefs::instance()->mEditOnDoubleClick )
846 editItem( item ); 851 editItem( item );
847 else 852 else
848 showItem( item , QPoint(), 0 ); 853 showItem( item , QPoint(), 0 );
849} 854}
850void KOTodoView::itemClicked(QListViewItem *item) 855void KOTodoView::itemClicked(QListViewItem *item)
851{ 856{
852 if (!item) { 857 if (!item) {
853 return; 858 return;
854 } 859 }
855 860
856 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 861 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
857 int completed = todoItem->todo()->isCompleted(); // Completed or not? 862 int completed = todoItem->todo()->isCompleted(); // Completed or not?
858 863
859 if (todoItem->isOn()) { 864 if (todoItem->isOn()) {
860 if (!completed) { 865 if (!completed) {
861 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 866 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
862 } 867 }
863 } else { 868 } else {
864 if (completed) { 869 if (completed) {
865 todoItem->todo()->setCompleted(false); 870 todoItem->todo()->setCompleted(false);
866 } 871 }
867 } 872 }
868} 873}
869 874
870void KOTodoView::setDocumentId( const QString &id ) 875void KOTodoView::setDocumentId( const QString &id )
871{ 876{
872 kdDebug() << "KOTodoView::setDocumentId()" << endl; 877 kdDebug() << "KOTodoView::setDocumentId()" << endl;
873 878
874 mDocPrefs->setDoc( id ); 879 mDocPrefs->setDoc( id );
875} 880}
876 881
877void KOTodoView::itemStateChanged( QListViewItem *item ) 882void KOTodoView::itemStateChanged( QListViewItem *item )
878{ 883{
879 if (!item) return; 884 if (!item) return;
880 885
881 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 886 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
882 887
883// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 888// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
884 889
885 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 890 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
886} 891}
887 892
888void KOTodoView::saveLayout(KConfig *config, const QString &group) const 893void KOTodoView::saveLayout(KConfig *config, const QString &group) const
889{ 894{
890 mTodoListView->saveLayout(config,group); 895 mTodoListView->saveLayout(config,group);
891} 896}
892 897
893void KOTodoView::restoreLayout(KConfig *config, const QString &group) 898void KOTodoView::restoreLayout(KConfig *config, const QString &group)
894{ 899{
895 mTodoListView->restoreLayout(config,group); 900 mTodoListView->restoreLayout(config,group);
896} 901}
897 902
898void KOTodoView::processSelectionChange() 903void KOTodoView::processSelectionChange()
899{ 904{
900// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 905// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
901 906
902 KOTodoViewItem *item = 907 KOTodoViewItem *item =
903 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 908 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
904 909
905 if ( !item ) { 910 if ( !item ) {
906 emit incidenceSelected( 0 ); 911 emit incidenceSelected( 0 );
907 } else { 912 } else {
908 emit incidenceSelected( item->todo() ); 913 emit incidenceSelected( item->todo() );
909 } 914 }
910} 915}
911 916
912void KOTodoView::modified(bool b) 917void KOTodoView::modified(bool b)
913{ 918{
914 emit isModified(b); 919 emit isModified(b);
915} 920}
916void KOTodoView::setTodoModified( Todo* todo ) 921void KOTodoView::setTodoModified( Todo* todo )
917{ 922{
918 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 923 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
919} 924}
920void KOTodoView::clearSelection() 925void KOTodoView::clearSelection()
921{ 926{
922 mTodoListView->selectAll( false ); 927 mTodoListView->selectAll( false );
923} 928}
924 929
925void KOTodoView::purgeCompleted() 930void KOTodoView::purgeCompleted()
926{ 931{
927 emit purgeCompletedSignal(); 932 emit purgeCompletedSignal();
928} 933}
929void KOTodoView::toggleQuickTodo() 934void KOTodoView::toggleQuickTodo()
930{ 935{
931 if ( mQuickAdd->isVisible() ) { 936 if ( mQuickAdd->isVisible() ) {
932 mQuickAdd->hide(); 937 mQuickAdd->hide();
933 KOPrefs::instance()->mEnableQuickTodo = false; 938 KOPrefs::instance()->mEnableQuickTodo = false;
934 } 939 }
935 else { 940 else {
936 mQuickAdd->show(); 941 mQuickAdd->show();
937 KOPrefs::instance()->mEnableQuickTodo = true; 942 KOPrefs::instance()->mEnableQuickTodo = true;
938 } 943 }
939 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 944 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
940 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 945 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
941} 946}
942void KOTodoView::toggleCompleted() 947void KOTodoView::toggleCompleted()
943{ 948{
944 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 949 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
945 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 950 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
946 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 951 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
947 updateView(); 952 updateView();
948} 953}
949 954
950void KOTodoView::addQuickTodo() 955void KOTodoView::addQuickTodo()
951{ 956{
952 Todo *todo = new Todo(); 957 Todo *todo = new Todo();
953 todo->setSummary(mQuickAdd->text()); 958 todo->setSummary(mQuickAdd->text());
954 todo->setOrganizer(KOPrefs::instance()->email()); 959 todo->setOrganizer(KOPrefs::instance()->email());
955 CalFilter * cf = mCalendar->filter(); 960 CalFilter * cf = mCalendar->filter();
956 if ( cf ) { 961 if ( cf ) {
957 if ( cf->isEnabled()&& cf->showCategories()) { 962 if ( cf->isEnabled()&& cf->showCategories()) {
958 todo->setCategories(cf->categoryList()); 963 todo->setCategories(cf->categoryList());
959 } 964 }
960 if ( cf->isEnabled() ) 965 if ( cf->isEnabled() )
961 todo->setSecrecy( cf->getSecrecy()); 966 todo->setSecrecy( cf->getSecrecy());
962 } 967 }
963 mCalendar->addTodo(todo); 968 mCalendar->addTodo(todo);
964 mQuickAdd->setText(""); 969 mQuickAdd->setText("");
965 todoModified (todo, KOGlobals::EVENTADDED ); 970 todoModified (todo, KOGlobals::EVENTADDED );
966 updateView(); 971 updateView();
967} 972}
968void KOTodoView::keyPressEvent ( QKeyEvent * e ) 973void KOTodoView::keyPressEvent ( QKeyEvent * e )
969{ 974{
970 // e->ignore(); 975 // e->ignore();
971 //return; 976 //return;
972 switch ( e->key() ) { 977 switch ( e->key() ) {
973 case Qt::Key_Down: 978 case Qt::Key_Down:
974 QWidget::keyPressEvent ( e );
975 break;
976
977 case Qt::Key_Up: 979 case Qt::Key_Up:
978 QWidget::keyPressEvent ( e ); 980 QWidget::keyPressEvent ( e );
979 break; 981 break;
982
980 case Qt::Key_Q: 983 case Qt::Key_Q:
981 toggleQuickTodo(); 984 toggleQuickTodo();
982 break; 985 break;
983 986
984 default: 987 default:
985 e->ignore(); 988 e->ignore();
986 } 989 }
987 990
988 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || ( height() > 150 && width() > 200 ) ) { 991 if ( true ) {
989 if ( e->key() == Qt::Key_I ) { 992 if ( e->key() == Qt::Key_I ) {
990 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 993 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
991 if ( cn ) { 994 if ( cn ) {
992 mActiveItem = cn; 995 mActiveItem = cn;
993 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 996 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
994 if ( ci ){ 997 if ( ci ){
995 showTodo(); 998 showTodo();
996 cn = (KOTodoViewItem*)cn->itemBelow(); 999 cn = (KOTodoViewItem*)cn->itemBelow();
997 if ( cn ) { 1000 if ( cn ) {
998 mTodoListView->setCurrentItem ( cn ); 1001 mTodoListView->setCurrentItem ( cn );
999 mTodoListView->ensureItemVisible ( cn ); 1002 mTodoListView->ensureItemVisible ( cn );
1000 } 1003 }
1001 1004
1002 } 1005 }
1003 } 1006 }
1004 e->accept(); 1007 e->accept();
1005 1008
1006 } 1009 }
1007 1010
1008 } 1011 }
1009 1012
1010} 1013}
1011void KOTodoView::updateTodo( Todo * t, int type ) 1014void KOTodoView::updateTodo( Todo * t, int type )
1012{ 1015{
1013 if ( mBlockUpdate) 1016 if ( mBlockUpdate)
1014 return; 1017 return;
1015 1018
1016 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1019 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1017 itemIterator = mTodoMap.find(t); 1020 itemIterator = mTodoMap.find(t);
1018 if (itemIterator != mTodoMap.end()) { 1021 if (itemIterator != mTodoMap.end()) {
1019 (*itemIterator)->construct(); 1022 (*itemIterator)->construct();
1020 } else { 1023 } else {
1021 if ( type == KOGlobals::EVENTADDED ) { 1024 if ( type == KOGlobals::EVENTADDED ) {
1022 insertTodoItem( t ); 1025 insertTodoItem( t );
1023 } 1026 }
1024 } 1027 }
1025 1028
1026} 1029}
1027 1030
1028void KOTodoView::todoModified(Todo * t , int p ) 1031void KOTodoView::todoModified(Todo * t , int p )
1029{ 1032{
1030 mBlockUpdate = true; 1033 mBlockUpdate = true;
1031 emit todoModifiedSignal ( t, p ); 1034 emit todoModifiedSignal ( t, p );
1032 mBlockUpdate = false; 1035 mBlockUpdate = false;
1033} 1036}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 4495702..6bf0203 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -1,230 +1,231 @@
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 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOTODOVIEW_H 23#ifndef KOTODOVIEW_H
24#define KOTODOVIEW_H 24#define KOTODOVIEW_H
25 25
26#include <qfont.h> 26#include <qfont.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30#include <qstrlist.h> 30#include <qstrlist.h>
31#include <qlistbox.h> 31#include <qlistbox.h>
32#include <qpopupmenu.h> 32#include <qpopupmenu.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qmap.h> 34#include <qmap.h>
35#include <qlistview.h> 35#include <qlistview.h>
36#include <klistview.h> 36#include <klistview.h>
37 37
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40 40
41#include <korganizer/baseview.h> 41#include <korganizer/baseview.h>
42 42
43#include "kotodoviewitem.h" 43#include "kotodoviewitem.h"
44#include "koprefs.h" 44#include "koprefs.h"
45#include "koglobals.h" 45#include "koglobals.h"
46 46
47class QDragEnterEvent; 47class QDragEnterEvent;
48class QDragMoveEvent; 48class QDragMoveEvent;
49class QDragLeaveEvent; 49class QDragLeaveEvent;
50class QDropEvent; 50class QDropEvent;
51 51
52class DocPrefs; 52class DocPrefs;
53 53
54class KOTodoListView : public KListView 54class KOTodoListView : public KListView
55{ 55{
56 Q_OBJECT 56 Q_OBJECT
57 public: 57 public:
58 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 58 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
59 virtual ~KOTodoListView() {} 59 virtual ~KOTodoListView() {}
60 60
61 signals: 61 signals:
62 void todoDropped(Todo *); 62 void todoDropped(Todo *);
63 void double_Clicked(QListViewItem *item); 63 void double_Clicked(QListViewItem *item);
64 64
65 protected: 65 protected:
66 void contentsDragEnterEvent(QDragEnterEvent *); 66 void contentsDragEnterEvent(QDragEnterEvent *);
67 void contentsDragMoveEvent(QDragMoveEvent *); 67 void contentsDragMoveEvent(QDragMoveEvent *);
68 void contentsDragLeaveEvent(QDragLeaveEvent *); 68 void contentsDragLeaveEvent(QDragLeaveEvent *);
69 void contentsDropEvent(QDropEvent *); 69 void contentsDropEvent(QDropEvent *);
70 70
71 void contentsMousePressEvent(QMouseEvent *); 71 void contentsMousePressEvent(QMouseEvent *);
72 void contentsMouseMoveEvent(QMouseEvent *); 72 void contentsMouseMoveEvent(QMouseEvent *);
73 void contentsMouseReleaseEvent(QMouseEvent *); 73 void contentsMouseReleaseEvent(QMouseEvent *);
74 void contentsMouseDoubleClickEvent(QMouseEvent *); 74 void contentsMouseDoubleClickEvent(QMouseEvent *);
75 75
76 private: 76 private:
77 QString mName;
77 Calendar *mCalendar; 78 Calendar *mCalendar;
78 QPoint mPressPos; 79 QPoint mPressPos;
79 bool mMousePressed; 80 bool mMousePressed;
80 QListViewItem *mOldCurrent; 81 QListViewItem *mOldCurrent;
81 void keyPressEvent ( QKeyEvent * ) ; 82 void keyPressEvent ( QKeyEvent * ) ;
82}; 83};
83 84
84 85
85/** 86/**
86 This is the line-edit on top of the todoview for fast addition of new todos 87 This is the line-edit on top of the todoview for fast addition of new todos
87*/ 88*/
88class KOQuickTodo : public QLineEdit 89class KOQuickTodo : public QLineEdit
89{ 90{
90 public: 91 public:
91 KOQuickTodo(QWidget *parent=0); 92 KOQuickTodo(QWidget *parent=0);
92 protected: 93 protected:
93 void focusInEvent(QFocusEvent *ev); 94 void focusInEvent(QFocusEvent *ev);
94 void focusOutEvent(QFocusEvent *ev); 95 void focusOutEvent(QFocusEvent *ev);
95}; 96};
96 97
97 98
98/** 99/**
99 This class provides a multi-column list view of todo events. 100 This class provides a multi-column list view of todo events.
100 101
101 @short multi-column list view of todo events. 102 @short multi-column list view of todo events.
102 @author Cornelius Schumacher <schumacher@kde.org> 103 @author Cornelius Schumacher <schumacher@kde.org>
103*/ 104*/
104class KOTodoView : public KOrg::BaseView 105class KOTodoView : public KOrg::BaseView
105{ 106{
106 Q_OBJECT 107 Q_OBJECT
107 public: 108 public:
108 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 109 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
109 ~KOTodoView(); 110 ~KOTodoView();
110 111
111 QPtrList<Incidence> selectedIncidences(); 112 QPtrList<Incidence> selectedIncidences();
112 QPtrList<Todo> selectedTodos(); 113 QPtrList<Todo> selectedTodos();
113 114
114 DateList selectedDates() 115 DateList selectedDates()
115 {DateList q; 116 {DateList q;
116 return q;} 117 return q;}
117 118
118 /** Return number of shown dates. TodoView does not show dates, */ 119 /** Return number of shown dates. TodoView does not show dates, */
119 int currentDateCount() { return 0; } 120 int currentDateCount() { return 0; }
120 void setNarrow(); 121 void setNarrow();
121 122
122 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 123 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
123 124
124 void setDocumentId( const QString & ); 125 void setDocumentId( const QString & );
125 126
126 void saveLayout(KConfig *config, const QString &group) const; 127 void saveLayout(KConfig *config, const QString &group) const;
127 void restoreLayout(KConfig *config, const QString &group); 128 void restoreLayout(KConfig *config, const QString &group);
128 /** Create a popup menu to set categories */ 129 /** Create a popup menu to set categories */
129 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); 130 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
130 131
131 public slots: 132 public slots:
132 void updateView(); 133 void updateView();
133 void updateConfig(); 134 void updateConfig();
134 135
135 void changeEventDisplay(Event *, int); 136 void changeEventDisplay(Event *, int);
136 137
137 void showDates(const QDate &start, const QDate &end); 138 void showDates(const QDate &start, const QDate &end);
138 void showEvents(QPtrList<Event> eventList); 139 void showEvents(QPtrList<Event> eventList);
139 140
140 void clearSelection(); 141 void clearSelection();
141 void jumpToDate (); 142 void jumpToDate ();
142 143
143 void editItem(QListViewItem *item); 144 void editItem(QListViewItem *item);
144 void showItem(QListViewItem *item,const QPoint &,int); 145 void showItem(QListViewItem *item,const QPoint &,int);
145 void popupMenu(QListViewItem *item,const QPoint &,int); 146 void popupMenu(QListViewItem *item,const QPoint &,int);
146 void newTodo(); 147 void newTodo();
147 void newSubTodo(); 148 void newSubTodo();
148 void unparentTodo(); 149 void unparentTodo();
149 void showTodo(); 150 void showTodo();
150 void editTodo(); 151 void editTodo();
151 void cloneTodo(); 152 void cloneTodo();
152 void cancelTodo(); 153 void cancelTodo();
153 void moveTodo(); 154 void moveTodo();
154 void beamTodo(); 155 void beamTodo();
155 void deleteTodo(); 156 void deleteTodo();
156 157
157 void setNewPriority(int); 158 void setNewPriority(int);
158 void setNewPercentage(int); 159 void setNewPercentage(int);
159 void changedCategories(int); 160 void changedCategories(int);
160 161
161 void purgeCompleted(); 162 void purgeCompleted();
162 void toggleCompleted(); 163 void toggleCompleted();
163 void toggleQuickTodo(); 164 void toggleQuickTodo();
164 void updateTodo( Todo *, int ); 165 void updateTodo( Todo *, int );
165 166
166 void itemClicked(QListViewItem *); 167 void itemClicked(QListViewItem *);
167 void itemStateChanged(QListViewItem *); 168 void itemStateChanged(QListViewItem *);
168 void modified(bool); 169 void modified(bool);
169 void itemDoubleClicked(QListViewItem *item); 170 void itemDoubleClicked(QListViewItem *item);
170 171
171 signals: 172 signals:
172 void newTodoSignal(); 173 void newTodoSignal();
173 void newSubTodoSignal(Todo *); 174 void newSubTodoSignal(Todo *);
174 void unparentTodoSignal(Todo *); 175 void unparentTodoSignal(Todo *);
175 void showTodoSignal(Todo *); 176 void showTodoSignal(Todo *);
176 177
177 void editTodoSignal(Todo *); 178 void editTodoSignal(Todo *);
178 void deleteTodoSignal(Todo *); 179 void deleteTodoSignal(Todo *);
179 void todoModifiedSignal (Todo *, int); 180 void todoModifiedSignal (Todo *, int);
180 181
181 void isModified(bool); 182 void isModified(bool);
182 void cloneTodoSignal( Incidence * ); 183 void cloneTodoSignal( Incidence * );
183 void cancelTodoSignal( Incidence * ); 184 void cancelTodoSignal( Incidence * );
184 void moveTodoSignal( Incidence * ); 185 void moveTodoSignal( Incidence * );
185 void beamTodoSignal( Incidence * ); 186 void beamTodoSignal( Incidence * );
186 void purgeCompletedSignal(); 187 void purgeCompletedSignal();
187 188
188 protected slots: 189 protected slots:
189 void processSelectionChange(); 190 void processSelectionChange();
190 void addQuickTodo(); 191 void addQuickTodo();
191 192
192 private: 193 private:
193 /* 194 /*
194 * the TodoEditor approach is rather unscaling in the long 195 * the TodoEditor approach is rather unscaling in the long
195 * run. 196 * run.
196 * Korganizer keeps it in memory and we need to update 197 * Korganizer keeps it in memory and we need to update
197 * 1. make KOTodoViewItem a QObject again? 198 * 1. make KOTodoViewItem a QObject again?
198 * 2. add a public method for setting one todo modified? 199 * 2. add a public method for setting one todo modified?
199 * 3. add a private method for setting a todo modified + friend here? 200 * 3. add a private method for setting a todo modified + friend here?
200 * -- zecke 2002-07-08 201 * -- zecke 2002-07-08
201 */ 202 */
202 friend class KOTodoViewItem; 203 friend class KOTodoViewItem;
203 void setTodoModified( Todo* ); 204 void setTodoModified( Todo* );
204 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 205 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
205 void restoreItemState( QListViewItem * ); 206 void restoreItemState( QListViewItem * );
206 207
207 KOTodoListView *mTodoListView; 208 KOTodoListView *mTodoListView;
208 QPopupMenu *mItemPopupMenu; 209 QPopupMenu *mItemPopupMenu;
209 QPopupMenu *mPopupMenu; 210 QPopupMenu *mPopupMenu;
210 QPopupMenu *mPriorityPopupMenu; 211 QPopupMenu *mPriorityPopupMenu;
211 QPopupMenu *mPercentageCompletedPopupMenu; 212 QPopupMenu *mPercentageCompletedPopupMenu;
212 QPopupMenu *mCategoryPopupMenu; 213 QPopupMenu *mCategoryPopupMenu;
213 214
214 QMap<int, int> mPercentage; 215 QMap<int, int> mPercentage;
215 QMap<int, int> mPriority; 216 QMap<int, int> mPriority;
216 QMap<int, QString> mCategory; 217 QMap<int, QString> mCategory;
217 KOTodoViewItem *mActiveItem; 218 KOTodoViewItem *mActiveItem;
218 219
219 QMap<Todo *,KOTodoViewItem *> mTodoMap; 220 QMap<Todo *,KOTodoViewItem *> mTodoMap;
220 QString mName; 221 QString mName;
221 222
222 DocPrefs *mDocPrefs; 223 DocPrefs *mDocPrefs;
223 QString mCurrentDoc; 224 QString mCurrentDoc;
224 KOQuickTodo *mQuickAdd; 225 KOQuickTodo *mQuickAdd;
225 bool mBlockUpdate; 226 bool mBlockUpdate;
226 void todoModified(Todo *, int ); 227 void todoModified(Todo *, int );
227 void keyPressEvent ( QKeyEvent * ) ; 228 void keyPressEvent ( QKeyEvent * ) ;
228}; 229};
229 230
230#endif 231#endif