summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp18
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/komonthview.cpp11
-rw-r--r--korganizer/koviewmanager.cpp2
4 files changed, 27 insertions, 5 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index d4ff77a..aed9bae 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -332,193 +332,209 @@ void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
332void EventIndicator::changeColumns(int columns) 332void EventIndicator::changeColumns(int columns)
333{ 333{
334 mColumns = columns; 334 mColumns = columns;
335 mEnabled.resize(mColumns); 335 mEnabled.resize(mColumns);
336 336
337 update(); 337 update();
338} 338}
339 339
340void EventIndicator::enableColumn(int column, bool enable) 340void EventIndicator::enableColumn(int column, bool enable)
341{ 341{
342 mEnabled[column] = enable; 342 mEnabled[column] = enable;
343} 343}
344 344
345 345
346//////////////////////////////////////////////////////////////////////////// 346////////////////////////////////////////////////////////////////////////////
347//////////////////////////////////////////////////////////////////////////// 347////////////////////////////////////////////////////////////////////////////
348//////////////////////////////////////////////////////////////////////////// 348////////////////////////////////////////////////////////////////////////////
349 349
350KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 350KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
351 KOEventView (cal,parent,name) 351 KOEventView (cal,parent,name)
352{ 352{
353 mBlockUpdating = true; 353 mBlockUpdating = true;
354 mStartHour = 8; 354 mStartHour = 8;
355 mSelectedDates.append(QDate::currentDate()); 355 mSelectedDates.append(QDate::currentDate());
356 356
357 mLayoutDayLabels = 0; 357 mLayoutDayLabels = 0;
358 mDayLabelsFrame = 0; 358 mDayLabelsFrame = 0;
359 mDayLabels = 0; 359 mDayLabels = 0;
360 bool isRTL = KOGlobals::self()->reverseLayout(); 360 bool isRTL = KOGlobals::self()->reverseLayout();
361 361
362 if ( KOPrefs::instance()->mVerticalScreen ) { 362 if ( KOPrefs::instance()->mVerticalScreen ) {
363 mExpandedPixmap = SmallIcon( "1downarrow" ); 363 mExpandedPixmap = SmallIcon( "1downarrow" );
364 mNotExpandedPixmap = SmallIcon( "1uparrow" ); 364 mNotExpandedPixmap = SmallIcon( "1uparrow" );
365 } else { 365 } else {
366 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); 366 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" );
367 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); 367 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" );
368 } 368 }
369 369
370 QBoxLayout *topLayout = new QVBoxLayout(this); 370 QBoxLayout *topLayout = new QVBoxLayout(this);
371 371
372 // Create day name labels for agenda columns 372 // Create day name labels for agenda columns
373 mDayLabelsFrame = new QHBox(this); 373 mDayLabelsFrame = new QHBox(this);
374 topLayout->addWidget(mDayLabelsFrame); 374 topLayout->addWidget(mDayLabelsFrame);
375 mDayLabels = new QFrame (mDayLabelsFrame); 375 mDayLabels = new QFrame (mDayLabelsFrame);
376 mLayoutDayLabels = new QHBoxLayout(mDayLabels); 376 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
377 // Create agenda splitter 377 // Create agenda splitter
378#ifndef KORG_NOSPLITTER 378#ifndef KORG_NOSPLITTER
379 mSplitterAgenda = new QSplitter(Vertical,this); 379 mSplitterAgenda = new QSplitter(Vertical,this);
380 topLayout->addWidget(mSplitterAgenda); 380 topLayout->addWidget(mSplitterAgenda);
381 mSplitterAgenda->setOpaqueResize(); 381 mSplitterAgenda->setOpaqueResize();
382 382
383 mAllDayFrame = new QHBox(mSplitterAgenda); 383 mAllDayFrame = new QHBox(mSplitterAgenda);
384 384
385 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 385 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
386#else 386#else
387#if 0 387#if 0
388 QWidget *mainBox = new QWidget( this ); 388 QWidget *mainBox = new QWidget( this );
389 topLayout->addWidget( mainBox ); 389 topLayout->addWidget( mainBox );
390 QBoxLayout *mainLayout = new QVBoxLayout(mainBox); 390 QBoxLayout *mainLayout = new QVBoxLayout(mainBox);
391 mAllDayFrame = new QHBox(mainBox); 391 mAllDayFrame = new QHBox(mainBox);
392 mainLayout->addWidget(mAllDayFrame); 392 mainLayout->addWidget(mAllDayFrame);
393 mainLayout->setStretchFactor( mAllDayFrame, 0 ); 393 mainLayout->setStretchFactor( mAllDayFrame, 0 );
394 mAllDayFrame->setFocusPolicy(NoFocus); 394 mAllDayFrame->setFocusPolicy(NoFocus);
395 QWidget *agendaFrame = new QWidget(mainBox); 395 QWidget *agendaFrame = new QWidget(mainBox);
396 mainLayout->addWidget(agendaFrame); 396 mainLayout->addWidget(agendaFrame);
397 mainLayout->setStretchFactor( agendaFrame, 10 ); 397 mainLayout->setStretchFactor( agendaFrame, 10 );
398 398
399 agendaFrame->setFocusPolicy(NoFocus); 399 agendaFrame->setFocusPolicy(NoFocus);
400#endif 400#endif
401 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 401 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
402 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 402 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
403 topLayout->addWidget( mSplitterAgenda ); 403 topLayout->addWidget( mSplitterAgenda );
404 mAllDayFrame = new QHBox(mSplitterAgenda); 404 mAllDayFrame = new QHBox(mSplitterAgenda);
405 mAllDayFrame->setFocusPolicy(NoFocus); 405 mAllDayFrame->setFocusPolicy(NoFocus);
406 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 406 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
407 agendaFrame->setFocusPolicy(NoFocus); 407 agendaFrame->setFocusPolicy(NoFocus);
408 408
409#endif 409#endif
410 410
411 // Create all-day agenda widget 411 // Create all-day agenda widget
412 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 412 mDummyAllDayLeft = new QVBox( mAllDayFrame );
413 413
414 mExpandButton = new QPushButton(mDummyAllDayLeft); 414 mExpandButton = new QPushButton(mDummyAllDayLeft);
415 mExpandButton->setPixmap( mNotExpandedPixmap ); 415 mExpandButton->setPixmap( mNotExpandedPixmap );
416 int widebut = mExpandButton->sizeHint().width(); 416 int widebut = mExpandButton->sizeHint().width();
417 if ( QApplication::desktop()->width() < 480 ) 417 if ( QApplication::desktop()->width() < 480 )
418 widebut = widebut*2; 418 widebut = widebut*2;
419 else 419 else
420 widebut = (widebut*3) / 2; 420 widebut = (widebut*3) / 2;
421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
422 // QSizePolicy::Fixed ) ); 422 // QSizePolicy::Fixed ) );
423 mExpandButton->setFixedSize( widebut, widebut); 423 mExpandButton->setFixedSize( widebut, widebut);
424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
425 mExpandButton->setFocusPolicy(NoFocus); 425 mExpandButton->setFocusPolicy(NoFocus);
426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
427 mAllDayAgenda->setFocusPolicy(NoFocus); 427 mAllDayAgenda->setFocusPolicy(NoFocus);
428 QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); 428 QVBox *dummyAllDayRight = new QVBox(mAllDayFrame);
429
430 QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight);
431 QLabel * dummyAllDayRightL = new QLabel ( dummyAllDayRight );
432
433 dummyAllDayRightB->setFlat( true );
434 dummyAllDayRightB->setFocusPolicy(NoFocus);
435 // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding ));
436 //dummyAllDayRightB->setFixedHeight( dummyAllDayRightB->sizeHint().height()/2 );
437 QPopupMenu * wpo = new QPopupMenu (this);
438 wpo->insertItem( i18n("W#"), 0 );
439 int i;
440 for ( i = 1; i < 54; i++ )
441 wpo->insertItem( QString::number( i ),i );
442 dummyAllDayRightB->setPopup( wpo );
443
444 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) );
429 445
430 // Create event context menu for all day agenda 446 // Create event context menu for all day agenda
431 mAllDayAgendaPopup = eventPopup(); 447 mAllDayAgendaPopup = eventPopup();
432 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 448 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
433 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 449 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
434 450
435 // Create agenda frame 451 // Create agenda frame
436 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); 452 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3);
437 // QHBox *agendaFrame = new QHBox(splitterAgenda); 453 // QHBox *agendaFrame = new QHBox(splitterAgenda);
438 454
439 // create event indicator bars 455 // create event indicator bars
440 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 456 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
441 agendaLayout->addWidget(mEventIndicatorTop,0,1); 457 agendaLayout->addWidget(mEventIndicatorTop,0,1);
442 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 458 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
443 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 459 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
444 agendaFrame); 460 agendaFrame);
445 agendaLayout->addWidget(mEventIndicatorBottom,2,1); 461 agendaLayout->addWidget(mEventIndicatorBottom,2,1);
446 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 462 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
447 agendaLayout->addWidget(dummyAgendaRight,0,2); 463 agendaLayout->addWidget(dummyAgendaRight,0,2);
448 464
449 // Create time labels 465 // Create time labels
450 mTimeLabels = new TimeLabels(24,agendaFrame); 466 mTimeLabels = new TimeLabels(24,agendaFrame);
451 agendaLayout->addWidget(mTimeLabels,1,0); 467 agendaLayout->addWidget(mTimeLabels,1,0);
452 connect(mTimeLabels,SIGNAL( scaleChanged()), 468 connect(mTimeLabels,SIGNAL( scaleChanged()),
453 this,SLOT(updateConfig())); 469 this,SLOT(updateConfig()));
454 470
455 // Create agenda 471 // Create agenda
456 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 472 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
457 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); 473 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2);
458 agendaLayout->setColStretch(1,1); 474 agendaLayout->setColStretch(1,1);
459 mAgenda->setFocusPolicy(NoFocus); 475 mAgenda->setFocusPolicy(NoFocus);
460 // Create event context menu for agenda 476 // Create event context menu for agenda
461 mAgendaPopup = eventPopup(); 477 mAgendaPopup = eventPopup();
462 478
463 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 479 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
464 i18n("Toggle Alarm"),mAgenda, 480 i18n("Toggle Alarm"),mAgenda,
465 SLOT(popupAlarm()),true); 481 SLOT(popupAlarm()),true);
466 482
467 483
468 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 484 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
469 mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 485 mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
470 486
471 // make connections between dependent widgets 487 // make connections between dependent widgets
472 mTimeLabels->setAgenda(mAgenda); 488 mTimeLabels->setAgenda(mAgenda);
473 489
474 // Update widgets to reflect user preferences 490 // Update widgets to reflect user preferences
475 // updateConfig(); 491 // updateConfig();
476 492
477 // createDayLabels(); 493 // createDayLabels();
478 494
479 // these blank widgets make the All Day Event box line up with the agenda 495 // these blank widgets make the All Day Event box line up with the agenda
480 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 496 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
481 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 497 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
482 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 498 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
483 499
484 // Scrolling 500 // Scrolling
485 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 501 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
486 mTimeLabels, SLOT(positionChanged())); 502 mTimeLabels, SLOT(positionChanged()));
487 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 503 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
488 SLOT(setContentsPos(int))); 504 SLOT(setContentsPos(int)));
489 505
490 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 506 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
491 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 507 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
492 508
493 // Create/Show/Edit/Delete Event 509 // Create/Show/Edit/Delete Event
494 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 510 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
495 SLOT(newEvent(int,int))); 511 SLOT(newEvent(int,int)));
496 connect(mAgenda,SIGNAL(newTodoSignal(int,int)), 512 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
497 SLOT(newTodo(int,int))); 513 SLOT(newTodo(int,int)));
498 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 514 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
499 SLOT(newEvent(int,int,int,int))); 515 SLOT(newEvent(int,int,int,int)));
500 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 516 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
501 SLOT(newEventAllDay(int,int))); 517 SLOT(newEventAllDay(int,int)));
502 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), 518 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
503 SLOT(newTodoAllDay(int,int))); 519 SLOT(newTodoAllDay(int,int)));
504 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 520 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
505 SLOT(newEventAllDay(int,int))); 521 SLOT(newEventAllDay(int,int)));
506 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 522 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
507 SLOT(newTimeSpanSelected(int,int,int,int))); 523 SLOT(newTimeSpanSelected(int,int,int,int)));
508 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 524 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
509 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 525 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
510 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 526 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
511 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 527 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
512 528
513 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 529 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
514 SIGNAL(editIncidenceSignal(Incidence *))); 530 SIGNAL(editIncidenceSignal(Incidence *)));
515 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 531 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
516 SIGNAL(editIncidenceSignal(Incidence *))); 532 SIGNAL(editIncidenceSignal(Incidence *)));
517 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 533 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
518 SIGNAL(showIncidenceSignal(Incidence *))); 534 SIGNAL(showIncidenceSignal(Incidence *)));
519 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 535 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
520 SIGNAL(showIncidenceSignal(Incidence *))); 536 SIGNAL(showIncidenceSignal(Incidence *)));
521 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 537 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
522 SIGNAL(deleteIncidenceSignal(Incidence *))); 538 SIGNAL(deleteIncidenceSignal(Incidence *)));
523 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 539 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
524 SIGNAL(deleteIncidenceSignal(Incidence *))); 540 SIGNAL(deleteIncidenceSignal(Incidence *)));
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index e9e85cc..4a058ce 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -117,173 +117,174 @@ class EventIndicator : public QFrame {
117 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); 117 EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0);
118 virtual ~EventIndicator(); 118 virtual ~EventIndicator();
119 119
120 void changeColumns(int columns); 120 void changeColumns(int columns);
121 void setPaintWidget( KDGanttMinimizeSplitter* ); 121 void setPaintWidget( KDGanttMinimizeSplitter* );
122 void setXOffset( int ); 122 void setXOffset( int );
123 void enableColumn(int column, bool enable); 123 void enableColumn(int column, bool enable);
124 124
125 protected: 125 protected:
126 void drawContents(QPainter *); 126 void drawContents(QPainter *);
127 127
128 private: 128 private:
129 int mXOffset; 129 int mXOffset;
130 KDGanttMinimizeSplitter* mPaintWidget; 130 KDGanttMinimizeSplitter* mPaintWidget;
131 int mColumns; 131 int mColumns;
132 QHBox *mTopBox; 132 QHBox *mTopBox;
133 QBoxLayout *mTopLayout; 133 QBoxLayout *mTopLayout;
134 Location mLocation; 134 Location mLocation;
135 QPixmap mPixmap; 135 QPixmap mPixmap;
136 QMemArray<bool> mEnabled; 136 QMemArray<bool> mEnabled;
137}; 137};
138 138
139/** 139/**
140 KOAgendaView is the agenda-like view used to display events in an one or 140 KOAgendaView is the agenda-like view used to display events in an one or
141 multi-day view. 141 multi-day view.
142*/ 142*/
143class KOAgendaView : public KOEventView { 143class KOAgendaView : public KOEventView {
144 Q_OBJECT 144 Q_OBJECT
145 public: 145 public:
146 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); 146 KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
147 virtual ~KOAgendaView(); 147 virtual ~KOAgendaView();
148 void setStartHour( int ); 148 void setStartHour( int );
149 void toggleAllDay(); 149 void toggleAllDay();
150 150
151 151
152 /** Returns maximum number of days supported by the koagendaview */ 152 /** Returns maximum number of days supported by the koagendaview */
153 virtual int maxDatesHint(); 153 virtual int maxDatesHint();
154 154
155 /** Returns number of currently shown dates. */ 155 /** Returns number of currently shown dates. */
156 virtual int currentDateCount(); 156 virtual int currentDateCount();
157 157
158 /** returns the currently selected events */ 158 /** returns the currently selected events */
159 virtual QPtrList<Incidence> selectedIncidences(); 159 virtual QPtrList<Incidence> selectedIncidences();
160 160
161 /** returns the currently selected events */ 161 /** returns the currently selected events */
162 virtual DateList selectedDates(); 162 virtual DateList selectedDates();
163 163
164 /** Remove all events from view */ 164 /** Remove all events from view */
165 void clearView(); 165 void clearView();
166 KOAgenda *agenda() { return mAgenda;} 166 KOAgenda *agenda() { return mAgenda;}
167 virtual void printPreview(CalPrinter *calPrinter, 167 virtual void printPreview(CalPrinter *calPrinter,
168 const QDate &, const QDate &); 168 const QDate &, const QDate &);
169 169
170 /** start-datetime of selection */ 170 /** start-datetime of selection */
171 QDateTime selectionStart() {return mTimeSpanBegin;} 171 QDateTime selectionStart() {return mTimeSpanBegin;}
172 /** end-datetime of selection */ 172 /** end-datetime of selection */
173 QDateTime selectionEnd() {return mTimeSpanEnd;} 173 QDateTime selectionEnd() {return mTimeSpanEnd;}
174 /** returns true if selection is for whole day */ 174 /** returns true if selection is for whole day */
175 bool selectedIsAllDay() {return mTimeSpanInAllDay;} 175 bool selectedIsAllDay() {return mTimeSpanInAllDay;}
176 /** make selected start/end invalid */ 176 /** make selected start/end invalid */
177 void deleteSelectedDateTime(); 177 void deleteSelectedDateTime();
178 void repaintAgenda(); 178 void repaintAgenda();
179 public slots: 179 public slots:
180 virtual void updateView(); 180 virtual void updateView();
181 virtual void updateConfig(); 181 virtual void updateConfig();
182 virtual void showDates(const QDate &start, const QDate &end); 182 virtual void showDates(const QDate &start, const QDate &end);
183 virtual void showEvents(QPtrList<Event> eventList); 183 virtual void showEvents(QPtrList<Event> eventList);
184 184
185 void updateTodo( Todo *, int ); 185 void updateTodo( Todo *, int );
186 void changeEventDisplay(Event *, int); 186 void changeEventDisplay(Event *, int);
187 187
188 void clearSelection(); 188 void clearSelection();
189 189
190 void newTodo(int gx,int gy); 190 void newTodo(int gx,int gy);
191 void newEvent(int gx,int gy); 191 void newEvent(int gx,int gy);
192 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); 192 void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
193 void newEventAllDay(int gx, int gy); 193 void newEventAllDay(int gx, int gy);
194 void newTodoAllDay(int gx, int gy); 194 void newTodoAllDay(int gx, int gy);
195 195
196 void startDrag(Event *); 196 void startDrag(Event *);
197 197
198 void readSettings(); 198 void readSettings();
199 void readSettings(KConfig *); 199 void readSettings(KConfig *);
200 void writeSettings(KConfig *); 200 void writeSettings(KConfig *);
201 201
202 void setContentsPos(int y); 202 void setContentsPos(int y);
203 203
204 void setExpandedButton( bool expanded ); 204 void setExpandedButton( bool expanded );
205 void scrollOneHourUp(); 205 void scrollOneHourUp();
206 void scrollOneHourDown(); 206 void scrollOneHourDown();
207 void addToCalSlot(Incidence *, Incidence *); 207 void addToCalSlot(Incidence *, Incidence *);
208 208
209 signals: 209 signals:
210 void showDateView( int, QDate ); 210 void showDateView( int, QDate );
211 void newTodoSignal( QDateTime ,bool ); 211 void newTodoSignal( QDateTime ,bool );
212 void toggleExpand(); 212 void toggleExpand();
213 void selectWeekNum( int );
213 void todoMoved( Todo *, int ); 214 void todoMoved( Todo *, int );
214 void incidenceChanged(Incidence * , int ); 215 void incidenceChanged(Incidence * , int );
215 // void cloneIncidenceSignal(Incidence *); 216 // void cloneIncidenceSignal(Incidence *);
216 217
217 protected: 218 protected:
218 KOAgendaButton* getNewDaylabel(); 219 KOAgendaButton* getNewDaylabel();
219 bool mBlockUpdating; 220 bool mBlockUpdating;
220 int mUpcomingWidth; 221 int mUpcomingWidth;
221 /** Fill agenda beginning with date startDate */ 222 /** Fill agenda beginning with date startDate */
222 void fillAgenda(const QDate &startDate); 223 void fillAgenda(const QDate &startDate);
223 void resizeEvent( QResizeEvent* e ); 224 void resizeEvent( QResizeEvent* e );
224 /** Fill agenda using the current set value for the start date */ 225 /** Fill agenda using the current set value for the start date */
225 void fillAgenda(); 226 void fillAgenda();
226 227
227 /** Create labels for the selected dates. */ 228 /** Create labels for the selected dates. */
228 void createDayLabels(); 229 void createDayLabels();
229 230
230 /** 231 /**
231 Set the masks on the agenda widgets indicating, which days are holidays. 232 Set the masks on the agenda widgets indicating, which days are holidays.
232 */ 233 */
233 void setHolidayMasks(); 234 void setHolidayMasks();
234 235
235 protected slots: 236 protected slots:
236 void slotDaylabelClicked( int ); 237 void slotDaylabelClicked( int );
237 /** Update event belonging to agenda item */ 238 /** Update event belonging to agenda item */
238 void updateEventDates(KOAgendaItem *item, int mode = -1); 239 void updateEventDates(KOAgendaItem *item, int mode = -1);
239 //void updateMovedTodo(); 240 //void updateMovedTodo();
240 241
241 void updateEventIndicatorTop(int newY); 242 void updateEventIndicatorTop(int newY);
242 void updateEventIndicatorBottom(int newY); 243 void updateEventIndicatorBottom(int newY);
243 244
244 /** Updates data for selected timespan */ 245 /** Updates data for selected timespan */
245 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); 246 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
246 /** Updates data for selected timespan for all day event*/ 247 /** Updates data for selected timespan for all day event*/
247 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); 248 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
248 249
249 private: 250 private:
250 // view widgets 251 // view widgets
251 QFrame *mDayLabels; 252 QFrame *mDayLabels;
252 QHBox *mDayLabelsFrame; 253 QHBox *mDayLabelsFrame;
253 QBoxLayout *mLayoutDayLabels; 254 QBoxLayout *mLayoutDayLabels;
254 QFrame *mAllDayFrame; 255 QFrame *mAllDayFrame;
255 KOAgenda *mAllDayAgenda; 256 KOAgenda *mAllDayAgenda;
256 KOAgenda *mAgenda; 257 KOAgenda *mAgenda;
257 TimeLabels *mTimeLabels; 258 TimeLabels *mTimeLabels;
258 QWidget *mDummyAllDayLeft; 259 QWidget *mDummyAllDayLeft;
259 260
260 KDGanttMinimizeSplitter* mSplitterAgenda; 261 KDGanttMinimizeSplitter* mSplitterAgenda;
261 QPushButton *mExpandButton; 262 QPushButton *mExpandButton;
262 263
263 DateList mSelectedDates; // List of dates to be displayed 264 DateList mSelectedDates; // List of dates to be displayed
264 int mViewType; 265 int mViewType;
265 266
266 bool mWeekStartsMonday; 267 bool mWeekStartsMonday;
267 int mStartHour; 268 int mStartHour;
268 269
269 KOEventPopupMenu *mAgendaPopup; 270 KOEventPopupMenu *mAgendaPopup;
270 KOEventPopupMenu *mAllDayAgendaPopup; 271 KOEventPopupMenu *mAllDayAgendaPopup;
271 272
272 EventIndicator *mEventIndicatorTop; 273 EventIndicator *mEventIndicatorTop;
273 EventIndicator *mEventIndicatorBottom; 274 EventIndicator *mEventIndicatorBottom;
274 275
275 QMemArray<int> mMinY; 276 QMemArray<int> mMinY;
276 QMemArray<int> mMaxY; 277 QMemArray<int> mMaxY;
277 278
278 QMemArray<bool> mHolidayMask; 279 QMemArray<bool> mHolidayMask;
279 280
280 QPixmap mExpandedPixmap; 281 QPixmap mExpandedPixmap;
281 QPixmap mNotExpandedPixmap; 282 QPixmap mNotExpandedPixmap;
282 QPtrList<KOAgendaButton> mDayLabelsList; 283 QPtrList<KOAgendaButton> mDayLabelsList;
283 QDateTime mTimeSpanBegin; 284 QDateTime mTimeSpanBegin;
284 QDateTime mTimeSpanEnd; 285 QDateTime mTimeSpanEnd;
285 bool mTimeSpanInAllDay; 286 bool mTimeSpanInAllDay;
286 void keyPressEvent ( QKeyEvent * e ); 287 void keyPressEvent ( QKeyEvent * e );
287}; 288};
288 289
289#endif // KOAGENDAVIEW_H 290#endif // KOAGENDAVIEW_H
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index f2cfb75..ab96786 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -816,208 +816,211 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
816 mWeekLabels[mNumWeeks]->setPopup( wpo ); 816 mWeekLabels[mNumWeeks]->setPopup( wpo );
817 mCells.resize( mNumCells ); 817 mCells.resize( mNumCells );
818 for( row = 0; row < mNumWeeks; ++row ) { 818 for( row = 0; row < mNumWeeks; ++row ) {
819 for( col = 0; col < mDaysPerWeek; ++col ) { 819 for( col = 0; col < mDaysPerWeek; ++col ) {
820 MonthViewCell *cell = new MonthViewCell( this ); 820 MonthViewCell *cell = new MonthViewCell( this );
821 mCells.insert( row * mDaysPerWeek + col, cell ); 821 mCells.insert( row * mDaysPerWeek + col, cell );
822 822
823 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 823 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
824 SLOT( defaultAction( Incidence * ) ) ); 824 SLOT( defaultAction( Incidence * ) ) );
825 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 825 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
826 SIGNAL( newEventSignal( QDateTime ) ) ); 826 SIGNAL( newEventSignal( QDateTime ) ) );
827 connect( cell, SIGNAL( showDaySignal( QDate ) ), 827 connect( cell, SIGNAL( showDaySignal( QDate ) ),
828 SIGNAL( showDaySignal( QDate ) ) ); 828 SIGNAL( showDaySignal( QDate ) ) );
829 } 829 }
830 } 830 }
831 831
832 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 832 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
833 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); 833 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) );
834 mContextMenu = eventPopup(); 834 mContextMenu = eventPopup();
835 // updateConfig(); //useless here 835 // updateConfig(); //useless here
836 836
837 emit incidenceSelected( 0 ); 837 emit incidenceSelected( 0 );
838} 838}
839 839
840KOMonthView::~KOMonthView() 840KOMonthView::~KOMonthView()
841{ 841{
842 delete mContextMenu; 842 delete mContextMenu;
843} 843}
844void KOMonthView::selectDateWeekNum ( int ) 844void KOMonthView::selectDateWeekNum ( int )
845{ 845{
846 846
847} 847}
848void KOMonthView::selectInternalWeekNum ( int n ) 848void KOMonthView::selectInternalWeekNum ( int n )
849{ 849{
850 emit selectWeekNum ( n ); 850 emit selectWeekNum ( n );
851 switchView(); 851 switchView();
852} 852}
853 853
854void KOMonthView::switchView() 854void KOMonthView::switchView()
855{ 855{
856 if ( selectedCell( ) ) 856 if ( selectedCell( ) )
857 selectedCell()->deselect(); 857 selectedCell()->deselect();
858 mShowWeekView = !mShowWeekView; 858 mShowWeekView = !mShowWeekView;
859 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 859 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
860 //emit showNavigator( !mShowWeekView ); 860 //emit showNavigator( !mShowWeekView );
861 computeLayout(); 861 computeLayout();
862 updateConfig(); 862 updateConfig();
863} 863}
864 864
865int KOMonthView::maxDatesHint() 865int KOMonthView::maxDatesHint()
866{ 866{
867 return mNumCells; 867 return mNumCells;
868} 868}
869 869
870int KOMonthView::currentDateCount() 870int KOMonthView::currentDateCount()
871{ 871{
872 return mNumCells; 872 return mNumCells;
873} 873}
874 874
875QPtrList<Incidence> KOMonthView::selectedIncidences() 875QPtrList<Incidence> KOMonthView::selectedIncidences()
876{ 876{
877 QPtrList<Incidence> selected; 877 QPtrList<Incidence> selected;
878 878
879 if ( mSelectedCell ) { 879 if ( mSelectedCell ) {
880 Incidence *incidence = mSelectedCell->selectedIncidence(); 880 Incidence *incidence = mSelectedCell->selectedIncidence();
881 if ( incidence ) selected.append( incidence ); 881 if ( incidence ) selected.append( incidence );
882 } 882 }
883 883
884 return selected; 884 return selected;
885} 885}
886 886
887DateList KOMonthView::selectedDates() 887DateList KOMonthView::selectedDates()
888{ 888{
889 DateList selected; 889 DateList selected;
890 890
891 if ( mSelectedCell ) { 891 if ( mSelectedCell ) {
892 QDate qd = mSelectedCell->selectedIncidenceDate(); 892 QDate qd = mSelectedCell->selectedIncidenceDate();
893 if ( qd.isValid() ) selected.append( qd ); 893 if ( qd.isValid() ) selected.append( qd );
894 } 894 }
895 895
896 return selected; 896 return selected;
897} 897}
898 898
899void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 899void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
900 const QDate &td) 900 const QDate &td)
901{ 901{
902#ifndef KORG_NOPRINTER 902#ifndef KORG_NOPRINTER
903 calPrinter->preview(CalPrinter::Month, fd, td); 903 calPrinter->preview(CalPrinter::Month, fd, td);
904#endif 904#endif
905} 905}
906 906
907void KOMonthView::updateConfig() 907void KOMonthView::updateConfig()
908{ 908{
909 909
910 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 910 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
911 911
912 if ( mShowWeekView ) 912 if ( mShowWeekView ) {
913 mWeekStartsMonday = true; 913 mWeekStartsMonday = true;
914 }
914 QFontMetrics fontmetric(mDayLabels[0]->font()); 915 QFontMetrics fontmetric(mDayLabels[0]->font());
915 mWidthLongDayLabel = 0; 916 mWidthLongDayLabel = 0;
916 917
917 for (int i = 0; i < 7; i++) { 918 for (int i = 0; i < 7; i++) {
918 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 919 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
919 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 920 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
920 } 921 }
921 bool temp = mShowSatSunComp ; 922 bool temp = mShowSatSunComp ;
922 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 923 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
923 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 924 if ( ! mShowWeekView ) {
924 computeLayout(); 925 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
926 computeLayout();
927 }
925 updateDayLabels(); 928 updateDayLabels();
926 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 929 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
927 int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 930 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
928 //resizeEvent( 0 ); 931 //resizeEvent( 0 );
929 for (uint i = 0; i < mCells.count(); ++i) { 932 for (uint i = 0; i < mCells.count(); ++i) {
930 mCells[i]->updateConfig(); 933 mCells[i]->updateConfig();
931 } 934 }
932#ifdef DESKTOP_VERSION 935#ifdef DESKTOP_VERSION
933 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 936 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
934#endif 937#endif
935 updateView(); 938 updateView();
936} 939}
937 940
938void KOMonthView::updateDayLabels() 941void KOMonthView::updateDayLabels()
939{ 942{
940 943
941 for (int i = 0; i < 7; i++) { 944 for (int i = 0; i < 7; i++) {
942 if (mWeekStartsMonday) { 945 if (mWeekStartsMonday) {
943 bool show = mShortDayLabels; 946 bool show = mShortDayLabels;
944 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) 947 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() )
945 show = true; 948 show = true;
946 mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 949 mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
947 } else { 950 } else {
948 if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); 951 if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels));
949 else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); 952 else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels));
950 953
951 } 954 }
952 } 955 }
953} 956}
954 957
955void KOMonthView::showDates(const QDate &start, const QDate &) 958void KOMonthView::showDates(const QDate &start, const QDate &)
956{ 959{
957 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 960 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
958 961
959 962
960 mStartDate = start; 963 mStartDate = start;
961 964
962 int startWeekDay = mWeekStartsMonday ? 1 : 7; 965 int startWeekDay = mWeekStartsMonday ? 1 : 7;
963 966
964 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 967 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
965 mStartDate = mStartDate.addDays( -1 ); 968 mStartDate = mStartDate.addDays( -1 );
966 } 969 }
967 970
968 bool primary = false; 971 bool primary = false;
969 uint i; 972 uint i;
970 for( i = 0; i < mCells.size(); ++i ) { 973 for( i = 0; i < mCells.size(); ++i ) {
971 QDate date = mStartDate.addDays( i ); 974 QDate date = mStartDate.addDays( i );
972 mCells[i]->setDate( date ); 975 mCells[i]->setDate( date );
973 976
974#ifndef KORG_NOPLUGINS 977#ifndef KORG_NOPLUGINS
975 // add holiday, if present 978 // add holiday, if present
976 QString hstring(KOCore::self()->holiday(date)); 979 QString hstring(KOCore::self()->holiday(date));
977 mCells[i]->setHoliday( hstring ); 980 mCells[i]->setHoliday( hstring );
978#endif 981#endif
979 982
980 } 983 }
981 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 984 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
982 for( i = 0; i < 6; ++i ) { 985 for( i = 0; i < 6; ++i ) {
983 int wno; 986 int wno;
984 // remember, according to ISO 8601, the first week of the year is the 987 // remember, according to ISO 8601, the first week of the year is the
985 // first week that contains a thursday. Thus we must subtract off 4, 988 // first week that contains a thursday. Thus we must subtract off 4,
986 // not just 1. 989 // not just 1.
987 int dayOfYear = date.dayOfYear(); 990 int dayOfYear = date.dayOfYear();
988 if (dayOfYear % 7 != 0) 991 if (dayOfYear % 7 != 0)
989 wno = dayOfYear / 7 + 1; 992 wno = dayOfYear / 7 + 1;
990 else 993 else
991 wno =dayOfYear / 7; 994 wno =dayOfYear / 7;
992 mWeekLabels[i]->setWeekNum( wno ); 995 mWeekLabels[i]->setWeekNum( wno );
993 date = date.addDays( 7 ); 996 date = date.addDays( 7 );
994 } 997 }
995 updateView(); 998 updateView();
996} 999}
997 1000
998void KOMonthView::showEvents(QPtrList<Event>) 1001void KOMonthView::showEvents(QPtrList<Event>)
999{ 1002{
1000 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1003 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1001} 1004}
1002 1005
1003void KOMonthView::changeEventDisplay(Event *, int) 1006void KOMonthView::changeEventDisplay(Event *, int)
1004{ 1007{
1005 // this should be re-written to be much more efficient, but this 1008 // this should be re-written to be much more efficient, but this
1006 // quick-and-dirty-hack gets the job done for right now. 1009 // quick-and-dirty-hack gets the job done for right now.
1007 updateView(); 1010 updateView();
1008} 1011}
1009 1012
1010void KOMonthView::updateView() 1013void KOMonthView::updateView()
1011{ 1014{
1012 1015
1013 if ( !updatePossible ) 1016 if ( !updatePossible )
1014 return; 1017 return;
1015 //QTime ti; 1018 //QTime ti;
1016 //ti.start(); 1019 //ti.start();
1017#if 1 1020#if 1
1018 int i; 1021 int i;
1019 int timeSpan = mCells.size()-1; 1022 int timeSpan = mCells.size()-1;
1020 if ( KOPrefs::instance()->mMonthViewWeek ) 1023 if ( KOPrefs::instance()->mMonthViewWeek )
1021 timeSpan = 6; 1024 timeSpan = 6;
1022 for( i = 0; i < timeSpan + 1; ++i ) { 1025 for( i = 0; i < timeSpan + 1; ++i ) {
1023 mCells[i]->startUpdateCell(); 1026 mCells[i]->startUpdateCell();
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index ca3de59..a74c5fe 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -314,192 +314,194 @@ void KOViewManager::showWhatsNextView()
314void KOViewManager::showListView() 314void KOViewManager::showListView()
315{ 315{
316 if (!mListView) { 316 if (!mListView) {
317 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 317 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
318 addView(mListView); 318 addView(mListView);
319 319
320 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 320 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
321 mMainView, SLOT(showIncidence(Incidence *))); 321 mMainView, SLOT(showIncidence(Incidence *)));
322 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 322 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
323 mMainView, SLOT(editIncidence(Incidence *))); 323 mMainView, SLOT(editIncidence(Incidence *)));
324 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 324 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
325 mMainView, SLOT(deleteIncidence(Incidence *))); 325 mMainView, SLOT(deleteIncidence(Incidence *)));
326 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 326 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
327 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 327 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
328 connect( mListView, SIGNAL( signalNewEvent() ), 328 connect( mListView, SIGNAL( signalNewEvent() ),
329 mMainView, SLOT( newEvent() ) ); 329 mMainView, SLOT( newEvent() ) );
330 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 330 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
331 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 331 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
332 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 332 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
333 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 333 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
334 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 334 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
335 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 335 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
336 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 336 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
337 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 337 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
338 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 338 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
339 } 339 }
340 // bool temp = mFlagShowNextxDays; 340 // bool temp = mFlagShowNextxDays;
341 //globalFlagBlockPainting = true; 341 //globalFlagBlockPainting = true;
342 globalFlagBlockAgenda = 1; 342 globalFlagBlockAgenda = 1;
343 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 343 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
344 mMainView->setBlockShowDates( true ); 344 mMainView->setBlockShowDates( true );
345 mMainView->dateNavigator()->selectMonth(); 345 mMainView->dateNavigator()->selectMonth();
346 mMainView->setBlockShowDates( false ); 346 mMainView->setBlockShowDates( false );
347 } 347 }
348 showView(mListView, KOPrefs::instance()->mFullViewTodo); 348 showView(mListView, KOPrefs::instance()->mFullViewTodo);
349 //mFlagShowNextxDays = temp; 349 //mFlagShowNextxDays = temp;
350} 350}
351 351
352void KOViewManager::showAgendaView( bool fullScreen ) 352void KOViewManager::showAgendaView( bool fullScreen )
353{ 353{
354 354
355 mMainView->dialogManager()->hideSearchDialog(); 355 mMainView->dialogManager()->hideSearchDialog();
356 // qDebug("KOViewManager::showAgendaView "); 356 // qDebug("KOViewManager::showAgendaView ");
357 bool full; 357 bool full;
358 full = fullScreen; 358 full = fullScreen;
359 if (!mAgendaView) { 359 if (!mAgendaView) {
360 full = false; 360 full = false;
361 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 361 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
362 addView(mAgendaView); 362 addView(mAgendaView);
363#ifndef DESKTOP_VERSION 363#ifndef DESKTOP_VERSION
364 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 364 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
365#endif 365#endif
366 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 366 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
367 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 367 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
368 368
369 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 369 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
370 370
371 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 371 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
372 372
373 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 373 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
374 mMainView, SLOT(newTodoDateTime(QDateTime,bool))); 374 mMainView, SLOT(newTodoDateTime(QDateTime,bool)));
375 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 375 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
376 mMainView, SLOT(newEvent(QDateTime))); 376 mMainView, SLOT(newEvent(QDateTime)));
377 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 377 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
378 mMainView, SLOT(newEvent(QDateTime,QDateTime))); 378 mMainView, SLOT(newEvent(QDateTime,QDateTime)));
379 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 379 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
380 mMainView, SLOT(newEvent(QDate))); 380 mMainView, SLOT(newEvent(QDate)));
381 381
382 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 382 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
383 mMainView, SLOT(editIncidence(Incidence *))); 383 mMainView, SLOT(editIncidence(Incidence *)));
384 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 384 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
385 mMainView, SLOT(showIncidence(Incidence *))); 385 mMainView, SLOT(showIncidence(Incidence *)));
386 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 386 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
387 mMainView, SLOT(deleteIncidence(Incidence *))); 387 mMainView, SLOT(deleteIncidence(Incidence *)));
388 388
389 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 389 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
390 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 390 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
391 391
392 connect(mAgendaView, SIGNAL( toggleExpand() ), 392 connect(mAgendaView, SIGNAL( toggleExpand() ),
393 mMainView, SLOT( toggleExpand() ) ); 393 mMainView, SLOT( toggleExpand() ) );
394 394
395 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), 395 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ),
396 mAgendaView, SLOT( setExpandedButton( bool ) ) ); 396 mAgendaView, SLOT( setExpandedButton( bool ) ) );
397 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 397 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
398 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 398 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
399 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 399 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
400 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 400 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
401 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 401 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
402 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 402 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
403 SLOT( updateTodo( Todo *, int ) ) ); 403 SLOT( updateTodo( Todo *, int ) ) );
404 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 404 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
405 mMainView, SIGNAL( todoModified( Todo *, int ))); 405 mMainView, SIGNAL( todoModified( Todo *, int )));
406 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 406 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
407 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 407 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
408 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 408 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
409 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 409 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
410 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
411 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
410 mAgendaView->readSettings(); 412 mAgendaView->readSettings();
411 mAgendaView->updateConfig(); 413 mAgendaView->updateConfig();
412 } 414 }
413 415
414 showView( mAgendaView, full); 416 showView( mAgendaView, full);
415 417
416} 418}
417 419
418void KOViewManager::showDayView() 420void KOViewManager::showDayView()
419{ 421{
420 mFlagShowNextxDays = false; 422 mFlagShowNextxDays = false;
421 globalFlagBlockLabel = 1; 423 globalFlagBlockLabel = 1;
422 globalFlagBlockAgenda = 1; 424 globalFlagBlockAgenda = 1;
423 if ( mCurrentAgendaView != 1 ) 425 if ( mCurrentAgendaView != 1 )
424 mCurrentAgendaView = -1; 426 mCurrentAgendaView = -1;
425 showAgendaView(); 427 showAgendaView();
426 qApp->processEvents(); 428 qApp->processEvents();
427 globalFlagBlockAgenda = 2; 429 globalFlagBlockAgenda = 2;
428 globalFlagBlockLabel = 0; 430 globalFlagBlockLabel = 0;
429 mMainView->dateNavigator()->selectDates( 1 ); 431 mMainView->dateNavigator()->selectDates( 1 );
430 mCurrentAgendaView = 1 ; 432 mCurrentAgendaView = 1 ;
431 433
432} 434}
433 435
434void KOViewManager::showWorkWeekView() 436void KOViewManager::showWorkWeekView()
435{ 437{
436 mFlagShowNextxDays = false; 438 mFlagShowNextxDays = false;
437 globalFlagBlockAgenda = 1; 439 globalFlagBlockAgenda = 1;
438 globalFlagBlockLabel = 1; 440 globalFlagBlockLabel = 1;
439 if ( mCurrentAgendaView != 5 ) 441 if ( mCurrentAgendaView != 5 )
440 mCurrentAgendaView = -1; 442 mCurrentAgendaView = -1;
441 showAgendaView(); 443 showAgendaView();
442 qApp->processEvents(); 444 qApp->processEvents();
443 globalFlagBlockAgenda = 2; 445 globalFlagBlockAgenda = 2;
444 globalFlagBlockLabel = 0; 446 globalFlagBlockLabel = 0;
445 mMainView->dateNavigator()->selectWorkWeek(); 447 mMainView->dateNavigator()->selectWorkWeek();
446 mCurrentAgendaView = 5 ; 448 mCurrentAgendaView = 5 ;
447 449
448} 450}
449 451
450void KOViewManager::showWeekView() 452void KOViewManager::showWeekView()
451{ 453{
452 /* 454 /*
453 globalFlagBlockAgenda = 2; 455 globalFlagBlockAgenda = 2;
454 qDebug("4globalFlagBlockAgenda = 2; "); 456 qDebug("4globalFlagBlockAgenda = 2; ");
455 //globalFlagBlockPainting = true; 457 //globalFlagBlockPainting = true;
456 mMainView->dateNavigator()->selectWeek(); 458 mMainView->dateNavigator()->selectWeek();
457 showAgendaView(); 459 showAgendaView();
458 */ 460 */
459 461
460 462
461 mFlagShowNextxDays = false; 463 mFlagShowNextxDays = false;
462 globalFlagBlockAgenda = 1; 464 globalFlagBlockAgenda = 1;
463 globalFlagBlockLabel = 1; 465 globalFlagBlockLabel = 1;
464 if ( mCurrentAgendaView != 7 ) 466 if ( mCurrentAgendaView != 7 )
465 mCurrentAgendaView = -1; 467 mCurrentAgendaView = -1;
466 showAgendaView(); 468 showAgendaView();
467 qApp->processEvents(); 469 qApp->processEvents();
468 globalFlagBlockAgenda = 2; 470 globalFlagBlockAgenda = 2;
469 globalFlagBlockLabel = 0; 471 globalFlagBlockLabel = 0;
470 mMainView->dateNavigator()->selectWeek(); 472 mMainView->dateNavigator()->selectWeek();
471 mCurrentAgendaView = 7 ; 473 mCurrentAgendaView = 7 ;
472} 474}
473 475
474void KOViewManager::showNextXView() 476void KOViewManager::showNextXView()
475{ 477{
476 478
477 globalFlagBlockAgenda = 1; 479 globalFlagBlockAgenda = 1;
478 if ( mCurrentAgendaView != 3 ) 480 if ( mCurrentAgendaView != 3 )
479 mCurrentAgendaView = -1; 481 mCurrentAgendaView = -1;
480 showAgendaView(KOPrefs::instance()->mFullViewMonth); 482 showAgendaView(KOPrefs::instance()->mFullViewMonth);
481 globalFlagBlockAgenda = 2; 483 globalFlagBlockAgenda = 2;
482 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 484 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
483 KOPrefs::instance()->mNextXDays ); 485 KOPrefs::instance()->mNextXDays );
484 mFlagShowNextxDays = true; 486 mFlagShowNextxDays = true;
485 mCurrentAgendaView = 3 ; 487 mCurrentAgendaView = 3 ;
486} 488}
487bool KOViewManager::showsNextDays() 489bool KOViewManager::showsNextDays()
488{ 490{
489 return mFlagShowNextxDays; 491 return mFlagShowNextxDays;
490} 492}
491void KOViewManager::showMonthView() 493void KOViewManager::showMonthView()
492{ 494{
493 if (!mMonthView) { 495 if (!mMonthView) {
494 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 496 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
495 497
496 addView(mMonthView); 498 addView(mMonthView);
497 // mMonthView->show(); 499 // mMonthView->show();
498 // SIGNALS/SLOTS FOR MONTH VIEW 500 // SIGNALS/SLOTS FOR MONTH VIEW
499 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 501 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
500 mMainView, SLOT(newEvent(QDateTime))); 502 mMainView, SLOT(newEvent(QDateTime)));
501 503
502 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 504 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
503 mMainView, SLOT(showIncidence(Incidence *))); 505 mMainView, SLOT(showIncidence(Incidence *)));
504 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 506 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
505 mMainView, SLOT(editIncidence(Incidence *))); 507 mMainView, SLOT(editIncidence(Incidence *)));