summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-31 11:47:44 (UTC)
committer zautrix <zautrix>2005-01-31 11:47:44 (UTC)
commit0ee7cc932ca9c973b086f847a38d29531a815712 (patch) (unidiff)
treec16662cdcfffb31d517ff700aa6dcd13f2f8c643 /korganizer
parent3e0b1c7cd48903b6886e081210cd83b7441b48ac (diff)
downloadkdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.zip
kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.tar.gz
kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.tar.bz2
many fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/komonthview.cpp1
-rw-r--r--korganizer/kotodoview.cpp17
-rw-r--r--korganizer/kotodoview.h2
-rw-r--r--korganizer/koviewmanager.cpp13
-rw-r--r--korganizer/koviewmanager.h2
6 files changed, 28 insertions, 8 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index db33017..cca73f2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2115,97 +2115,96 @@ void CalendarView::changeTodoDisplay(Todo *which, int action)
2115 changeIncidenceDisplay((Incidence *)which, action); 2115 changeIncidenceDisplay((Incidence *)which, action);
2116 mDateNavigator->updateView(); //LR 2116 mDateNavigator->updateView(); //LR
2117 //mDialogManager->updateSearchDialog(); 2117 //mDialogManager->updateSearchDialog();
2118 2118
2119 if (which) { 2119 if (which) {
2120 mViewManager->updateWNview(); 2120 mViewManager->updateWNview();
2121 //mTodoList->updateView(); 2121 //mTodoList->updateView();
2122 } 2122 }
2123 2123
2124} 2124}
2125 2125
2126void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2126void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2127{ 2127{
2128 updateUnmanagedViews(); 2128 updateUnmanagedViews();
2129 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2129 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2130 if ( action == KOGlobals::EVENTDELETED ) { //delete 2130 if ( action == KOGlobals::EVENTDELETED ) { //delete
2131 mCalendar->checkAlarmForIncidence( 0, true ); 2131 mCalendar->checkAlarmForIncidence( 0, true );
2132 if ( mEventViewerDialog ) 2132 if ( mEventViewerDialog )
2133 mEventViewerDialog->hide(); 2133 mEventViewerDialog->hide();
2134 } 2134 }
2135 else 2135 else
2136 mCalendar->checkAlarmForIncidence( which , false ); 2136 mCalendar->checkAlarmForIncidence( which , false );
2137} 2137}
2138 2138
2139// most of the changeEventDisplays() right now just call the view's 2139// most of the changeEventDisplays() right now just call the view's
2140// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2140// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2141void CalendarView::changeEventDisplay(Event *which, int action) 2141void CalendarView::changeEventDisplay(Event *which, int action)
2142{ 2142{
2143 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2143 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2144 changeIncidenceDisplay((Incidence *)which, action); 2144 changeIncidenceDisplay((Incidence *)which, action);
2145 mDateNavigator->updateView(); 2145 mDateNavigator->updateView();
2146 //mDialogManager->updateSearchDialog(); 2146 //mDialogManager->updateSearchDialog();
2147 2147
2148 if (which) { 2148 if (which) {
2149 // If there is an event view visible update the display 2149 // If there is an event view visible update the display
2150 mViewManager->currentView()->changeEventDisplay(which,action); 2150 mViewManager->currentView()->changeEventDisplay(which,action);
2151 // TODO: check, if update needed 2151 // TODO: check, if update needed
2152 // if (which->getTodoStatus()) { 2152 // if (which->getTodoStatus()) {
2153 mTodoList->updateView(); 2153 mTodoList->updateView();
2154 // } 2154 // }
2155 } else { 2155 } else {
2156 mViewManager->currentView()->updateView(); 2156 mViewManager->currentView()->updateView();
2157 } 2157 }
2158} 2158}
2159 2159
2160 2160
2161void CalendarView::updateTodoViews() 2161void CalendarView::updateTodoViews()
2162{ 2162{
2163
2164 mTodoList->updateView(); 2163 mTodoList->updateView();
2165 mViewManager->currentView()->updateView(); 2164 mViewManager->currentView()->updateView();
2166 2165
2167} 2166}
2168 2167
2169 2168
2170void CalendarView::updateView(const QDate &start, const QDate &end) 2169void CalendarView::updateView(const QDate &start, const QDate &end)
2171{ 2170{
2172 mTodoList->updateView(); 2171 mTodoList->updateView();
2173 mViewManager->updateView(start, end); 2172 mViewManager->updateView(start, end);
2174 //mDateNavigator->updateView(); 2173 //mDateNavigator->updateView();
2175} 2174}
2176 2175
2177void CalendarView::updateView() 2176void CalendarView::updateView()
2178{ 2177{
2179 DateList tmpList = mNavigator->selectedDates(); 2178 DateList tmpList = mNavigator->selectedDates();
2180 2179
2181 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2180 if ( KOPrefs::instance()->mHideNonStartedTodos )
2182 mTodoList->updateView(); 2181 mTodoList->updateView();
2183 // We assume that the navigator only selects consecutive days. 2182 // We assume that the navigator only selects consecutive days.
2184 updateView( tmpList.first(), tmpList.last() ); 2183 updateView( tmpList.first(), tmpList.last() );
2185} 2184}
2186 2185
2187void CalendarView::updateUnmanagedViews() 2186void CalendarView::updateUnmanagedViews()
2188{ 2187{
2189 mDateNavigator->updateDayMatrix(); 2188 mDateNavigator->updateDayMatrix();
2190} 2189}
2191 2190
2192int CalendarView::msgItemDelete(const QString name) 2191int CalendarView::msgItemDelete(const QString name)
2193{ 2192{
2194 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2193 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2195 i18n("This item will be\npermanently deleted."), 2194 i18n("This item will be\npermanently deleted."),
2196 i18n("KO/Pi Confirmation"),i18n("Delete")); 2195 i18n("KO/Pi Confirmation"),i18n("Delete"));
2197} 2196}
2198 2197
2199 2198
2200void CalendarView::edit_cut() 2199void CalendarView::edit_cut()
2201{ 2200{
2202 Event *anEvent=0; 2201 Event *anEvent=0;
2203 2202
2204 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2203 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2205 2204
2206 if (mViewManager->currentView()->isEventView()) { 2205 if (mViewManager->currentView()->isEventView()) {
2207 if ( incidence && incidence->type() == "Event" ) { 2206 if ( incidence && incidence->type() == "Event" ) {
2208 anEvent = static_cast<Event *>(incidence); 2207 anEvent = static_cast<Event *>(incidence);
2209 } 2208 }
2210 } 2209 }
2211 2210
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 4cefb26..770a42b 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -928,96 +928,97 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
928 for( i = 0; i < 6; ++i ) { 928 for( i = 0; i < 6; ++i ) {
929 int wno; 929 int wno;
930 // remember, according to ISO 8601, the first week of the year is the 930 // remember, according to ISO 8601, the first week of the year is the
931 // first week that contains a thursday. Thus we must subtract off 4, 931 // first week that contains a thursday. Thus we must subtract off 4,
932 // not just 1. 932 // not just 1.
933 int dayOfYear = date.dayOfYear(); 933 int dayOfYear = date.dayOfYear();
934 if (dayOfYear % 7 != 0) 934 if (dayOfYear % 7 != 0)
935 wno = dayOfYear / 7 + 1; 935 wno = dayOfYear / 7 + 1;
936 else 936 else
937 wno =dayOfYear / 7; 937 wno =dayOfYear / 7;
938 mWeekLabels[i]->setWeekNum( wno ); 938 mWeekLabels[i]->setWeekNum( wno );
939 date = date.addDays( 7 ); 939 date = date.addDays( 7 );
940 } 940 }
941 updateView(); 941 updateView();
942} 942}
943 943
944void KOMonthView::showEvents(QPtrList<Event>) 944void KOMonthView::showEvents(QPtrList<Event>)
945{ 945{
946 qDebug("KOMonthView::selectEvents is not implemented yet. "); 946 qDebug("KOMonthView::selectEvents is not implemented yet. ");
947} 947}
948 948
949void KOMonthView::changeEventDisplay(Event *, int) 949void KOMonthView::changeEventDisplay(Event *, int)
950{ 950{
951 // this should be re-written to be much more efficient, but this 951 // this should be re-written to be much more efficient, but this
952 // quick-and-dirty-hack gets the job done for right now. 952 // quick-and-dirty-hack gets the job done for right now.
953 updateView(); 953 updateView();
954} 954}
955 955
956void KOMonthView::updateView() 956void KOMonthView::updateView()
957{ 957{
958 958
959 if ( !updatePossible ) 959 if ( !updatePossible )
960 return; 960 return;
961 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 961 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
962 int i; 962 int i;
963 for( i = 0; i < mCells.count(); ++i ) { 963 for( i = 0; i < mCells.count(); ++i ) {
964 mCells[i]->updateCell(); 964 mCells[i]->updateCell();
965 } 965 }
966 966
967 //qDebug("KOMonthView::updateView() "); 967 //qDebug("KOMonthView::updateView() ");
968 processSelectionChange(); 968 processSelectionChange();
969 // qDebug("---------------------------------------------------------------------+ "); 969 // qDebug("---------------------------------------------------------------------+ ");
970 mCells[0]->setFocus(); 970 mCells[0]->setFocus();
971} 971}
972 972
973void KOMonthView::resizeEvent(QResizeEvent * e) 973void KOMonthView::resizeEvent(QResizeEvent * e)
974{ 974{
975 computeLayout(); 975 computeLayout();
976 mCells[0]->setFocus();
976} 977}
977void KOMonthView::computeLayout() 978void KOMonthView::computeLayout()
978{ 979{
979 // select the appropriate heading string size. E.g. "Wednesday" or "Wed". 980 // select the appropriate heading string size. E.g. "Wednesday" or "Wed".
980 // note this only changes the text if the requested size crosses the 981 // note this only changes the text if the requested size crosses the
981 // threshold between big enough to support the full name and not big 982 // threshold between big enough to support the full name and not big
982 // enough. 983 // enough.
983 984
984 int daysToShow = 7; 985 int daysToShow = 7;
985 bool combinedSatSun = false; 986 bool combinedSatSun = false;
986 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 987 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
987 daysToShow = 6; 988 daysToShow = 6;
988 combinedSatSun = true; 989 combinedSatSun = true;
989 } 990 }
990 int tWid = topLevelWidget()->size().width(); 991 int tWid = topLevelWidget()->size().width();
991 int tHei = topLevelWidget()->size().height(); 992 int tHei = topLevelWidget()->size().height();
992 993
993 int wid = size().width();//e 994 int wid = size().width();//e
994 int hei = size().height()-1; 995 int hei = size().height()-1;
995 996
996 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 997 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
997 return; 998 return;
998 //qDebug("KOMonthView::computeLayout()------------------------------------ "); 999 //qDebug("KOMonthView::computeLayout()------------------------------------ ");
999 QFontMetrics fm ( mWeekLabels[0]->font() ); 1000 QFontMetrics fm ( mWeekLabels[0]->font() );
1000 int weeklabelwid = fm.width( "888" ); 1001 int weeklabelwid = fm.width( "888" );
1001 wid -= weeklabelwid; 1002 wid -= weeklabelwid;
1002 1003
1003 int colWid = wid / daysToShow; 1004 int colWid = wid / daysToShow;
1004 int lastCol = wid - ( colWid*6 ); 1005 int lastCol = wid - ( colWid*6 );
1005 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1006 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1006 int cellHei = (hei - dayLabelHei) /6; 1007 int cellHei = (hei - dayLabelHei) /6;
1007 int colModulo = wid % daysToShow; 1008 int colModulo = wid % daysToShow;
1008 int rowModulo = (hei- dayLabelHei) % 6; 1009 int rowModulo = (hei- dayLabelHei) % 6;
1009 //qDebug("rowmod %d ", rowModulo); 1010 //qDebug("rowmod %d ", rowModulo);
1010 int i; 1011 int i;
1011 int x,y,w,h; 1012 int x,y,w,h;
1012 x= 0; 1013 x= 0;
1013 y= 0; 1014 y= 0;
1014 w = colWid; 1015 w = colWid;
1015 h = dayLabelHei ; 1016 h = dayLabelHei ;
1016 for ( i = 0; i < 7; i++) { 1017 for ( i = 0; i < 7; i++) {
1017 if ( i == daysToShow-colModulo ) 1018 if ( i == daysToShow-colModulo )
1018 ++w; 1019 ++w;
1019 if ( combinedSatSun ) { 1020 if ( combinedSatSun ) {
1020 if ( i >= daysToShow-1 ) { 1021 if ( i >= daysToShow-1 ) {
1021 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1022 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1022 x -= w/2 ; 1023 x -= w/2 ;
1023 } 1024 }
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8d8fc2a..82437d8 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -289,96 +289,97 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
289 e->ignore(); 289 e->ignore();
290} 290}
291void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 291void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
292{ 292{
293 QListView::contentsMouseReleaseEvent(e); 293 QListView::contentsMouseReleaseEvent(e);
294 mMousePressed = false; 294 mMousePressed = false;
295} 295}
296 296
297void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 297void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
298{ 298{
299 if (!e) return; 299 if (!e) return;
300 300
301 QPoint vp = contentsToViewport(e->pos()); 301 QPoint vp = contentsToViewport(e->pos());
302 302
303 QListViewItem *item = itemAt(vp); 303 QListViewItem *item = itemAt(vp);
304 304
305 emit double_Clicked(item); 305 emit double_Clicked(item);
306 if (!item) return; 306 if (!item) return;
307 307
308 emit doubleClicked(item,vp,0); 308 emit doubleClicked(item,vp,0);
309} 309}
310 310
311///////////////////////////////////////////////////////////////////////////// 311/////////////////////////////////////////////////////////////////////////////
312 312
313KOQuickTodo::KOQuickTodo(QWidget *parent) : 313KOQuickTodo::KOQuickTodo(QWidget *parent) :
314 QLineEdit(parent) 314 QLineEdit(parent)
315{ 315{
316 setText(i18n("Click to add a new Todo")); 316 setText(i18n("Click to add a new Todo"));
317} 317}
318 318
319void KOQuickTodo::focusInEvent(QFocusEvent *ev) 319void KOQuickTodo::focusInEvent(QFocusEvent *ev)
320{ 320{
321 if ( text()==i18n("Click to add a new Todo") ) 321 if ( text()==i18n("Click to add a new Todo") )
322 setText(""); 322 setText("");
323 QLineEdit::focusInEvent(ev); 323 QLineEdit::focusInEvent(ev);
324} 324}
325 325
326void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 326void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
327{ 327{
328 setText(i18n("Click to add a new Todo")); 328 setText(i18n("Click to add a new Todo"));
329 QLineEdit::focusOutEvent(ev); 329 QLineEdit::focusOutEvent(ev);
330} 330}
331 331
332///////////////////////////////////////////////////////////////////////////// 332/////////////////////////////////////////////////////////////////////////////
333 333
334KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 334KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
335 KOrg::BaseView(calendar,parent,name) 335 KOrg::BaseView(calendar,parent,name)
336{ 336{
337 mPendingUpdateBeforeRepaint = false;
337 isFlatDisplay = false; 338 isFlatDisplay = false;
338 mNavigator = 0; 339 mNavigator = 0;
339 QBoxLayout *topLayout = new QVBoxLayout(this); 340 QBoxLayout *topLayout = new QVBoxLayout(this);
340 mName = QString ( name ); 341 mName = QString ( name );
341 mBlockUpdate = false; 342 mBlockUpdate = false;
342 mQuickAdd = new KOQuickTodo(this); 343 mQuickAdd = new KOQuickTodo(this);
343 topLayout->addWidget(mQuickAdd); 344 topLayout->addWidget(mQuickAdd);
344 345
345 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 346 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
346 347
347 mTodoListView = new KOTodoListView(calendar,this, name ); 348 mTodoListView = new KOTodoListView(calendar,this, name );
348 topLayout->addWidget(mTodoListView); 349 topLayout->addWidget(mTodoListView);
349 //mTodoListView->header()->setMaximumHeight(30); 350 //mTodoListView->header()->setMaximumHeight(30);
350 mTodoListView->setRootIsDecorated(true); 351 mTodoListView->setRootIsDecorated(true);
351 mTodoListView->setAllColumnsShowFocus(true); 352 mTodoListView->setAllColumnsShowFocus(true);
352 353
353 mTodoListView->setShowSortIndicator(true); 354 mTodoListView->setShowSortIndicator(true);
354 355
355 mTodoListView->addColumn(i18n("Todo")); 356 mTodoListView->addColumn(i18n("Todo"));
356 mTodoListView->addColumn(i18n("Prio")); 357 mTodoListView->addColumn(i18n("Prio"));
357 mTodoListView->setColumnAlignment(1,AlignHCenter); 358 mTodoListView->setColumnAlignment(1,AlignHCenter);
358 mTodoListView->addColumn(i18n("Complete")); 359 mTodoListView->addColumn(i18n("Complete"));
359 mTodoListView->setColumnAlignment(2,AlignCenter); 360 mTodoListView->setColumnAlignment(2,AlignCenter);
360 361
361 mTodoListView->addColumn(i18n("Due Date")); 362 mTodoListView->addColumn(i18n("Due Date"));
362 mTodoListView->setColumnAlignment(3,AlignLeft); 363 mTodoListView->setColumnAlignment(3,AlignLeft);
363 mTodoListView->addColumn(i18n("Due Time")); 364 mTodoListView->addColumn(i18n("Due Time"));
364 mTodoListView->setColumnAlignment(4,AlignHCenter); 365 mTodoListView->setColumnAlignment(4,AlignHCenter);
365 366
366 mTodoListView->addColumn(i18n("Start Date")); 367 mTodoListView->addColumn(i18n("Start Date"));
367 mTodoListView->setColumnAlignment(5,AlignLeft); 368 mTodoListView->setColumnAlignment(5,AlignLeft);
368 mTodoListView->addColumn(i18n("Start Time")); 369 mTodoListView->addColumn(i18n("Start Time"));
369 mTodoListView->setColumnAlignment(6,AlignHCenter); 370 mTodoListView->setColumnAlignment(6,AlignHCenter);
370 371
371 mTodoListView->addColumn(i18n("Cancelled")); 372 mTodoListView->addColumn(i18n("Cancelled"));
372 mTodoListView->addColumn(i18n("Categories")); 373 mTodoListView->addColumn(i18n("Categories"));
373#if 0 374#if 0
374 mTodoListView->addColumn(i18n("Sort Id")); 375 mTodoListView->addColumn(i18n("Sort Id"));
375 mTodoListView->setColumnAlignment(4,AlignHCenter); 376 mTodoListView->setColumnAlignment(4,AlignHCenter);
376#endif 377#endif
377 378
378 mTodoListView->setMinimumHeight( 60 ); 379 mTodoListView->setMinimumHeight( 60 );
379 mTodoListView->setItemsRenameable( true ); 380 mTodoListView->setItemsRenameable( true );
380 mTodoListView->setRenameable( 0 ); 381 mTodoListView->setRenameable( 0 );
381 mTodoListView->setColumnWidth( 0, 120 ); 382 mTodoListView->setColumnWidth( 0, 120 );
382 mTodoListView->setColumnWidthMode(0, QListView::Manual); 383 mTodoListView->setColumnWidthMode(0, QListView::Manual);
383 mTodoListView->setColumnWidthMode(1, QListView::Manual); 384 mTodoListView->setColumnWidthMode(1, QListView::Manual);
384 mTodoListView->setColumnWidthMode(2, QListView::Manual); 385 mTodoListView->setColumnWidthMode(2, QListView::Manual);
@@ -488,104 +489,116 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
488 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 489 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
489 const QPoint &,int ) ), 490 const QPoint &,int ) ),
490 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 491 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
491 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 492 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
492 SLOT( itemClicked( QListViewItem * ) ) ); 493 SLOT( itemClicked( QListViewItem * ) ) );
493 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 494 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
494 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 495 SLOT( itemDoubleClicked( QListViewItem * ) ) );
495 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 496 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
496 SLOT( updateView() ) ); 497 SLOT( updateView() ) );
497 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 498 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
498 SLOT( todoModified(Todo *, int) ) ); 499 SLOT( todoModified(Todo *, int) ) );
499 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 500 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
500 SLOT( itemStateChanged( QListViewItem * ) ) ); 501 SLOT( itemStateChanged( QListViewItem * ) ) );
501 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 502 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
502 SLOT( itemStateChanged( QListViewItem * ) ) ); 503 SLOT( itemStateChanged( QListViewItem * ) ) );
503 504
504#if 0 505#if 0
505 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 506 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
506 SLOT(selectionChanged(QListViewItem *))); 507 SLOT(selectionChanged(QListViewItem *)));
507 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 508 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
508 SLOT(selectionChanged(QListViewItem *))); 509 SLOT(selectionChanged(QListViewItem *)));
509 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 510 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
510 SLOT(selectionChanged(QListViewItem *))); 511 SLOT(selectionChanged(QListViewItem *)));
511#endif 512#endif
512 513
513 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 514 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
514 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 515 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
515 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 516 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
516 517
517 connect( mTodoListView, SIGNAL(selectionChanged() ), 518 connect( mTodoListView, SIGNAL(selectionChanged() ),
518 SLOT( processSelectionChange() ) ); 519 SLOT( processSelectionChange() ) );
519 connect( mQuickAdd, SIGNAL( returnPressed () ), 520 connect( mQuickAdd, SIGNAL( returnPressed () ),
520 SLOT( addQuickTodo() ) ); 521 SLOT( addQuickTodo() ) );
521 522
522} 523}
523 524
524KOTodoView::~KOTodoView() 525KOTodoView::~KOTodoView()
525{ 526{
526 delete mDocPrefs; 527 delete mDocPrefs;
527} 528}
528 529
529void KOTodoView::jumpToDate () 530void KOTodoView::jumpToDate ()
530{ 531{
531 // if (mActiveItem) { 532 // if (mActiveItem) {
532// mActiveItem->todo()); 533// mActiveItem->todo());
533// if ( mActiveItem->todo()->hasDueDate() ) 534// if ( mActiveItem->todo()->hasDueDate() )
534// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 535// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
535} 536}
536 537void KOTodoView::paintEvent(QPaintEvent * pevent)
538{
539 if ( mPendingUpdateBeforeRepaint ) {
540 updateView();
541 mPendingUpdateBeforeRepaint = false;
542 }
543 KOrg::BaseView::paintEvent( pevent);
544}
545 bool mPendingUpdateBeforeRepaint;
537void KOTodoView::updateView() 546void KOTodoView::updateView()
538{ 547{
539 pendingSubtodo = 0; 548 pendingSubtodo = 0;
540 if ( mBlockUpdate ) { 549 if ( mBlockUpdate ) {
541 //qDebug("blocked ");
542 return; 550 return;
543 } 551 }
552 if ( !isVisible() ) {
553 mPendingUpdateBeforeRepaint = true;
554 return;
555 }
556 //qDebug("KOTodoView::updateView() %x", this);
544 if ( isFlatDisplay ) { 557 if ( isFlatDisplay ) {
545 setAllFlat(); 558 setAllFlat();
546 return; 559 return;
547 } 560 }
548 //qDebug("update "); 561 //qDebug("update ");
549// kdDebug() << "KOTodoView::updateView()" << endl; 562// kdDebug() << "KOTodoView::updateView()" << endl;
550 QFont fo = KOPrefs::instance()->mTodoViewFont; 563 QFont fo = KOPrefs::instance()->mTodoViewFont;
551 mTodoListView->clear(); 564 mTodoListView->clear();
552 if ( mName == "todolistsmall" ) { 565 if ( mName == "todolistsmall" ) {
553 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 566 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
554 int ps = fo.pointSize() -2; 567 int ps = fo.pointSize() -2;
555 if ( ps > 12 ) 568 if ( ps > 12 )
556 ps -= 2; 569 ps -= 2;
557 fo.setPointSize( ps ); 570 fo.setPointSize( ps );
558 } 571 }
559 } 572 }
560 573
561 mTodoListView->setFont( fo ); 574 mTodoListView->setFont( fo );
562 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 575 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
563 //mTodoListView->header()->setMaximumHeight(fm.height()); 576 //mTodoListView->header()->setMaximumHeight(fm.height());
564 QPtrList<Todo> todoList = calendar()->todos(); 577 QPtrList<Todo> todoList = calendar()->todos();
565 578
566/* 579/*
567 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 580 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
568 Event *t; 581 Event *t;
569 for(t = todoList.first(); t; t = todoList.next()) { 582 for(t = todoList.first(); t; t = todoList.next()) {
570 kdDebug() << " " << t->getSummary() << endl; 583 kdDebug() << " " << t->getSummary() << endl;
571 584
572 if (t->getRelatedTo()) { 585 if (t->getRelatedTo()) {
573 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 586 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
574 } 587 }
575 588
576 QPtrList<Event> l = t->getRelations(); 589 QPtrList<Event> l = t->getRelations();
577 Event *c; 590 Event *c;
578 for(c=l.first();c;c=l.next()) { 591 for(c=l.first();c;c=l.next()) {
579 kdDebug() << " - relation: " << c->getSummary() << endl; 592 kdDebug() << " - relation: " << c->getSummary() << endl;
580 } 593 }
581 } 594 }
582*/ 595*/
583 596
584 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 597 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
585 // specific order of events. That means that we have to generate parent items 598 // specific order of events. That means that we have to generate parent items
586 // recursively for proper hierarchical display of Todos. 599 // recursively for proper hierarchical display of Todos.
587 mTodoMap.clear(); 600 mTodoMap.clear();
588 Todo *todo; 601 Todo *todo;
589 todo = todoList.first();// todo; todo = todoList.next()) { 602 todo = todoList.first();// todo; todo = todoList.next()) {
590 while ( todo ) { 603 while ( todo ) {
591 bool next = true; 604 bool next = true;
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 68e29bb..16bc133 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -168,80 +168,82 @@ class KOTodoView : public KOrg::BaseView
168 void setAllClose(); 168 void setAllClose();
169 void setAllFlat(); 169 void setAllFlat();
170 170
171 void purgeCompleted(); 171 void purgeCompleted();
172 void toggleCompleted(); 172 void toggleCompleted();
173 void toggleRunning(); 173 void toggleRunning();
174 void toggleQuickTodo(); 174 void toggleQuickTodo();
175 void updateTodo( Todo *, int ); 175 void updateTodo( Todo *, int );
176 176
177 void itemClicked(QListViewItem *); 177 void itemClicked(QListViewItem *);
178 void itemStateChanged(QListViewItem *); 178 void itemStateChanged(QListViewItem *);
179 void modified(bool); 179 void modified(bool);
180 void itemDoubleClicked(QListViewItem *item); 180 void itemDoubleClicked(QListViewItem *item);
181 181
182 signals: 182 signals:
183 void newTodoSignal(); 183 void newTodoSignal();
184 void newSubTodoSignal(Todo *); 184 void newSubTodoSignal(Todo *);
185 void unparentTodoSignal(Todo *); 185 void unparentTodoSignal(Todo *);
186 void reparentTodoSignal( Todo *,Todo * ); 186 void reparentTodoSignal( Todo *,Todo * );
187 void showTodoSignal(Todo *); 187 void showTodoSignal(Todo *);
188 188
189 void editTodoSignal(Todo *); 189 void editTodoSignal(Todo *);
190 void deleteTodoSignal(Todo *); 190 void deleteTodoSignal(Todo *);
191 void todoModifiedSignal (Todo *, int); 191 void todoModifiedSignal (Todo *, int);
192 192
193 void isModified(bool); 193 void isModified(bool);
194 void cloneTodoSignal( Incidence * ); 194 void cloneTodoSignal( Incidence * );
195 void cancelTodoSignal( Incidence * ); 195 void cancelTodoSignal( Incidence * );
196 void moveTodoSignal( Incidence * ); 196 void moveTodoSignal( Incidence * );
197 void beamTodoSignal( Incidence * ); 197 void beamTodoSignal( Incidence * );
198 void purgeCompletedSignal(); 198 void purgeCompletedSignal();
199 199
200 protected slots: 200 protected slots:
201 void processSelectionChange(); 201 void processSelectionChange();
202 void addQuickTodo(); 202 void addQuickTodo();
203 void setTodoModified( Todo* ); 203 void setTodoModified( Todo* );
204 void todoModified(Todo *, int ); 204 void todoModified(Todo *, int );
205 205
206 private: 206 private:
207 /* 207 /*
208 * the TodoEditor approach is rather unscaling in the long 208 * the TodoEditor approach is rather unscaling in the long
209 * run. 209 * run.
210 * Korganizer keeps it in memory and we need to update 210 * Korganizer keeps it in memory and we need to update
211 * 1. make KOTodoViewItem a QObject again? 211 * 1. make KOTodoViewItem a QObject again?
212 * 2. add a public method for setting one todo modified? 212 * 2. add a public method for setting one todo modified?
213 * 3. add a private method for setting a todo modified + friend here? 213 * 3. add a private method for setting a todo modified + friend here?
214 * -- zecke 2002-07-08 214 * -- zecke 2002-07-08
215 */ 215 */
216 void paintEvent(QPaintEvent * pevent);
217 bool mPendingUpdateBeforeRepaint;
216 friend class KOTodoViewItem; 218 friend class KOTodoViewItem;
217 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 219 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
218 void restoreItemState( QListViewItem * ); 220 void restoreItemState( QListViewItem * );
219 221
220 bool checkTodo( Todo * ); 222 bool checkTodo( Todo * );
221 bool isFlatDisplay; 223 bool isFlatDisplay;
222 void setOpen( QListViewItem*, bool setOpen); 224 void setOpen( QListViewItem*, bool setOpen);
223 KOTodoListView *mTodoListView; 225 KOTodoListView *mTodoListView;
224 QPopupMenu *mItemPopupMenu; 226 QPopupMenu *mItemPopupMenu;
225 QPopupMenu *mPopupMenu; 227 QPopupMenu *mPopupMenu;
226 QPopupMenu *mPriorityPopupMenu; 228 QPopupMenu *mPriorityPopupMenu;
227 QPopupMenu *mPercentageCompletedPopupMenu; 229 QPopupMenu *mPercentageCompletedPopupMenu;
228 QPopupMenu *mCategoryPopupMenu; 230 QPopupMenu *mCategoryPopupMenu;
229 231
230 QMap<int, int> mPercentage; 232 QMap<int, int> mPercentage;
231 QMap<int, int> mPriority; 233 QMap<int, int> mPriority;
232 QMap<int, QString> mCategory; 234 QMap<int, QString> mCategory;
233 KOTodoViewItem *mActiveItem; 235 KOTodoViewItem *mActiveItem;
234 236
235 QMap<Todo *,KOTodoViewItem *> mTodoMap; 237 QMap<Todo *,KOTodoViewItem *> mTodoMap;
236 QString mName; 238 QString mName;
237 239
238 DocPrefs *mDocPrefs; 240 DocPrefs *mDocPrefs;
239 QString mCurrentDoc; 241 QString mCurrentDoc;
240 KOQuickTodo *mQuickAdd; 242 KOQuickTodo *mQuickAdd;
241 bool mBlockUpdate; 243 bool mBlockUpdate;
242 void keyPressEvent ( QKeyEvent * ) ; 244 void keyPressEvent ( QKeyEvent * ) ;
243 KOTodoViewItem * pendingSubtodo; 245 KOTodoViewItem * pendingSubtodo;
244 DateNavigator* mNavigator; 246 DateNavigator* mNavigator;
245}; 247};
246 248
247#endif 249#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 35774d6..2cd8792 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -159,165 +159,168 @@ void KOViewManager::writeSettings(KConfig *config)
159 else if (mCurrentView == mJournalView) view = "Journal"; 159 else if (mCurrentView == mJournalView) view = "Journal";
160 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 160 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
161 else if (mCurrentView == mTodoView) view = "Todo"; 161 else if (mCurrentView == mTodoView) view = "Todo";
162 else view = "Agenda"; 162 else view = "Agenda";
163 163
164 config->writeEntry("Current View",view); 164 config->writeEntry("Current View",view);
165 165
166 if (mAgendaView) { 166 if (mAgendaView) {
167 mAgendaView->writeSettings(config); 167 mAgendaView->writeSettings(config);
168 } 168 }
169 if (mTimeSpanView) { 169 if (mTimeSpanView) {
170 mTimeSpanView->writeSettings(config); 170 mTimeSpanView->writeSettings(config);
171 } 171 }
172 if (mListView) { 172 if (mListView) {
173 mListView->writeSettings(config); 173 mListView->writeSettings(config);
174 } 174 }
175 if (mTodoView) { 175 if (mTodoView) {
176 mTodoView->saveLayout(config,"Todo View"); 176 mTodoView->saveLayout(config,"Todo View");
177 } 177 }
178} 178}
179 179
180void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 180void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
181{ 181{
182 182
183 //mFlagShowNextxDays = false; 183 //mFlagShowNextxDays = false;
184 //if(view == mCurrentView) return; 184 //if(view == mCurrentView) return;
185 if ( view == 0 ) { 185 if ( view == 0 ) {
186 view = mCurrentView; 186 view = mCurrentView;
187 if ( view == 0 ) 187 if ( view == 0 )
188 return; 188 return;
189 } 189 }
190 bool full = fullScreen; 190 bool full = fullScreen;
191 if(view == mCurrentView && view != mWhatsNextView ) { 191 if(view == mCurrentView && view != mWhatsNextView ) {
192 if ( mCurrentAgendaView < 0 ) 192 if ( mCurrentAgendaView < 0 )
193 return; 193 return;
194 full = mMainView->leftFrame()->isVisible(); 194 full = mMainView->leftFrame()->isVisible();
195 } else { 195 } else {
196 mCurrentView = view; 196 mCurrentView = view;
197 // bool full = fullScreen; 197 // bool full = fullScreen;
198 bool isFull = !mMainView->leftFrame()->isVisible(); 198 bool isFull = !mMainView->leftFrame()->isVisible();
199 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 199 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
200 full = true; 200 full = true;
201 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 201 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
202 full = false; 202 full = false;
203 } 203 }
204 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 204 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
205 //raiseCurrentView( full ); 205 //raiseCurrentView( full );
206 mMainView->processIncidenceSelection( 0 ); 206 mMainView->processIncidenceSelection( 0 );
207 mMainView->updateView(); 207 //mMainView->updateView();
208 raiseCurrentView( full ); 208 raiseCurrentView( full, true );
209 mMainView->adaptNavigationUnits(); 209 mMainView->adaptNavigationUnits();
210} 210}
211 211
212void KOViewManager::raiseCurrentView( bool fullScreen ) 212void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
213{ 213{
214 mCurrentAgendaView = 0; 214 mCurrentAgendaView = 0;
215 int wid = mMainView->width() ; 215 int wid = mMainView->width() ;
216 int hei = mMainView->height(); 216 int hei = mMainView->height();
217 if ( mCurrentView == mMonthView ) { 217 if ( mCurrentView == mMonthView ) {
218 mMainView->navigatorBar()->show(); 218 mMainView->navigatorBar()->show();
219 hei -= mMainView->navigatorBar()->sizeHint().height(); 219 hei -= mMainView->navigatorBar()->sizeHint().height();
220 //mMainView->navigatorBar()->hide(); 220 //mMainView->navigatorBar()->hide();
221 } else { 221 } else {
222 mMainView->navigatorBar()->hide(); 222 mMainView->navigatorBar()->hide();
223 } 223 }
224 if ( fullScreen ) { 224 if ( fullScreen ) {
225 mMainView->leftFrame()->hide(); 225 mMainView->leftFrame()->hide();
226 } else { 226 } else {
227 mMainView->leftFrame()->show(); 227 mMainView->leftFrame()->show();
228 if ( KOPrefs::instance()->mVerticalScreen ) 228 if ( KOPrefs::instance()->mVerticalScreen )
229 hei -= mMainView->leftFrame()->height(); 229 hei -= mMainView->leftFrame()->height();
230 else 230 else
231 wid -= mMainView->leftFrame()->width(); 231 wid -= mMainView->leftFrame()->width();
232 } 232 }
233 emit signalFullScreen( !fullScreen ); 233 emit signalFullScreen( !fullScreen );
234 if ( callUpdateView )
235 mMainView->updateView();
236
234 if ( globalFlagBlockAgenda == 5 ) { 237 if ( globalFlagBlockAgenda == 5 ) {
235 globalFlagBlockAgenda = 4; 238 globalFlagBlockAgenda = 4;
236 globalFlagBlockAgendaItemPaint = 1; 239 globalFlagBlockAgendaItemPaint = 1;
237 } 240 }
238 mMainView->viewStack()->raiseWidget(mCurrentView); 241 mMainView->viewStack()->raiseWidget(mCurrentView);
239 if ( globalFlagBlockAgenda == 4 ) { 242 if ( globalFlagBlockAgenda == 4 ) {
240 if ( mCurrentView == mAgendaView ) { 243 if ( mCurrentView == mAgendaView ) {
241 //globalFlagBlockAgenda =1 ; 244 //globalFlagBlockAgenda =1 ;
242 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 245 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
243 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 246 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
244 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 247 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
245 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 248 mAgendaView->setStartHour( QTime::currentTime ().hour() );
246 qApp->processEvents(); 249 qApp->processEvents();
247 //qDebug("qApp->processEvents() "); 250 //qDebug("qApp->processEvents() ");
248 globalFlagBlockAgenda = 0; 251 globalFlagBlockAgenda = 0;
249 mAgendaView->repaintAgenda(); 252 mAgendaView->repaintAgenda();
250 253
251 } 254 }
252 globalFlagBlockAgenda = 0; 255 globalFlagBlockAgenda = 0;
253 } 256 }
254 emit signalAgendaView( mCurrentView == mAgendaView ); 257 emit signalAgendaView( mCurrentView == mAgendaView );
255 //qDebug("raiseCurrentView ende "); 258 //qDebug("raiseCurrentView ende ");
256 259
257} 260}
258 261
259void KOViewManager::updateView() 262void KOViewManager::updateView()
260{ 263{
261 // qDebug("KOViewManager::updateView() "); 264 // qDebug("KOViewManager::updateView() ");
262 // if we are updating mTodoView, we get endless recursion 265 // if we are updating mTodoView, we get endless recursion
263 if ( mTodoView == mCurrentView ) 266 if ( mTodoView == mCurrentView )
264 return; 267 return;
265 if ( mCurrentView ) mCurrentView->updateView(); 268 if ( mCurrentView ) mCurrentView->updateView();
266 269
267} 270}
268 271
269void KOViewManager::updateView(const QDate &start, const QDate &end) 272void KOViewManager::updateView(const QDate &start, const QDate &end)
270{ 273{
271 // kdDebug() << "KOViewManager::updateView()" << endl; 274 // kdDebug() << "KOViewManager::updateView()" << endl;
272 275
273 if (mCurrentView) mCurrentView->showDates(start, end); 276 if (mCurrentView) mCurrentView->showDates(start, end);
274 277
275 if (mTodoView) mTodoView->updateView(); 278 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
276} 279}
277 280
278 281
279void KOViewManager::updateWNview() 282void KOViewManager::updateWNview()
280{ 283{
281 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 284 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
282 mWhatsNextView->updateView(); 285 mWhatsNextView->updateView();
283 286
284} 287}
285void KOViewManager::showWhatsNextView() 288void KOViewManager::showWhatsNextView()
286{ 289{
287 if (!mWhatsNextView) { 290 if (!mWhatsNextView) {
288 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 291 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
289 "KOViewManager::WhatsNextView"); 292 "KOViewManager::WhatsNextView");
290 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 293 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
291 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 294 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
292 addView(mWhatsNextView); 295 addView(mWhatsNextView);
293 connect(this, SIGNAL( printWNV() ), 296 connect(this, SIGNAL( printWNV() ),
294 mWhatsNextView, SLOT( printMe() ) ); 297 mWhatsNextView, SLOT( printMe() ) );
295 } 298 }
296 globalFlagBlockAgenda = 1; 299 globalFlagBlockAgenda = 1;
297 showView(mWhatsNextView, true ); 300 showView(mWhatsNextView, true );
298 //mWhatsNextView->updateView(); 301 //mWhatsNextView->updateView();
299 302
300} 303}
301 304
302void KOViewManager::showListView() 305void KOViewManager::showListView()
303{ 306{
304 if (!mListView) { 307 if (!mListView) {
305 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 308 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
306 addView(mListView); 309 addView(mListView);
307 310
308 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 311 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
309 mMainView, SLOT(showIncidence(Incidence *))); 312 mMainView, SLOT(showIncidence(Incidence *)));
310 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 313 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
311 mMainView, SLOT(editIncidence(Incidence *))); 314 mMainView, SLOT(editIncidence(Incidence *)));
312 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 315 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
313 mMainView, SLOT(deleteIncidence(Incidence *))); 316 mMainView, SLOT(deleteIncidence(Incidence *)));
314 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 317 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
315 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 318 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
316 connect( mListView, SIGNAL( signalNewEvent() ), 319 connect( mListView, SIGNAL( signalNewEvent() ),
317 mMainView, SLOT( newEvent() ) ); 320 mMainView, SLOT( newEvent() ) );
318 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 321 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
319 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 322 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
320 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 323 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
321 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 324 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
322 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 325 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
323 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 326 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
@@ -475,97 +478,99 @@ void KOViewManager::showNextXView()
475bool KOViewManager::showsNextDays() 478bool KOViewManager::showsNextDays()
476{ 479{
477 return mFlagShowNextxDays; 480 return mFlagShowNextxDays;
478} 481}
479void KOViewManager::showMonthView() 482void KOViewManager::showMonthView()
480{ 483{
481 if (!mMonthView) { 484 if (!mMonthView) {
482 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 485 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
483 486
484 addView(mMonthView); 487 addView(mMonthView);
485 // mMonthView->show(); 488 // mMonthView->show();
486 // SIGNALS/SLOTS FOR MONTH VIEW 489 // SIGNALS/SLOTS FOR MONTH VIEW
487 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 490 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
488 mMainView, SLOT(newEvent(QDateTime))); 491 mMainView, SLOT(newEvent(QDateTime)));
489 492
490 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 493 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
491 mMainView, SLOT(showIncidence(Incidence *))); 494 mMainView, SLOT(showIncidence(Incidence *)));
492 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 495 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
493 mMainView, SLOT(editIncidence(Incidence *))); 496 mMainView, SLOT(editIncidence(Incidence *)));
494 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 497 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
495 mMainView, SLOT(deleteIncidence(Incidence *))); 498 mMainView, SLOT(deleteIncidence(Incidence *)));
496 499
497 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 500 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
498 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 501 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
499 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 502 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
500 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 503 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
501 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 504 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
502 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 505 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
503 506
504 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 507 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
505 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 508 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
506 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 509 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
507 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 510 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
508 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 511 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
509 mMainView, SLOT ( selectWeekNum( int ) ) ); 512 mMainView, SLOT ( selectWeekNum( int ) ) );
510 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 513 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
511 mMainView, SLOT ( showDay( QDate ) ) ); 514 mMainView, SLOT ( showDay( QDate ) ) );
512 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 515 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
513 connect( mMonthView, SIGNAL(nextMonth() ), 516 connect( mMonthView, SIGNAL(nextMonth() ),
514 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); 517 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) );
515 connect( mMonthView, SIGNAL(prevMonth() ), 518 connect( mMonthView, SIGNAL(prevMonth() ),
516 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 519 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) );
517 mMonthView->updateConfig(); 520 mMonthView->updateConfig();
518 } 521 }
519 522
520 globalFlagBlockAgenda = 1; 523 globalFlagBlockAgenda = 1;
521 //mFlagShowNextxDays = false; 524 //mFlagShowNextxDays = false;
522 // if(mMonthView == mCurrentView) return; 525 // if(mMonthView == mCurrentView) return;
526 mMainView->dateNavigator()->blockSignals( true );
523 mMainView->dateNavigator()->selectMonth(); 527 mMainView->dateNavigator()->selectMonth();
528 mMainView->dateNavigator()->blockSignals( false);
524 // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); 529 // DateList tmpList = mMainView->dateNavigator()->selectedDates( );
525 //mMonthView->showDates(tmpList.first(), tmpList.last()); 530 //mMonthView->showDates(tmpList.first(), tmpList.last());
526 531
527 showView(mMonthView, true ); 532 showView(mMonthView, true );
528 533
529} 534}
530 535
531void KOViewManager::showTodoView() 536void KOViewManager::showTodoView()
532{ 537{
533 //mFlagShowNextxDays = false; 538 //mFlagShowNextxDays = false;
534 if ( !mTodoView ) { 539 if ( !mTodoView ) {
535 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 540 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
536 "KOViewManager::TodoView" ); 541 "KOViewManager::TodoView" );
537 542
538 addView( mTodoView ); 543 addView( mTodoView );
539 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 544 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
540 545
541 // SIGNALS/SLOTS FOR TODO VIEW 546 // SIGNALS/SLOTS FOR TODO VIEW
542 connect( mTodoView, SIGNAL( newTodoSignal() ), 547 connect( mTodoView, SIGNAL( newTodoSignal() ),
543 mMainView, SLOT( newTodo() ) ); 548 mMainView, SLOT( newTodo() ) );
544 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 549 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
545 mMainView, SLOT( newSubTodo( Todo *) ) ); 550 mMainView, SLOT( newSubTodo( Todo *) ) );
546 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 551 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
547 mMainView, SLOT( showTodo( Todo * ) ) ); 552 mMainView, SLOT( showTodo( Todo * ) ) );
548 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 553 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
549 mMainView, SLOT( editTodo( Todo * ) ) ); 554 mMainView, SLOT( editTodo( Todo * ) ) );
550 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 555 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
551 mMainView, SLOT( deleteTodo( Todo * ) ) ); 556 mMainView, SLOT( deleteTodo( Todo * ) ) );
552 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 557 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
553 mMainView, SLOT( purgeCompleted() ) ); 558 mMainView, SLOT( purgeCompleted() ) );
554 559
555 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 560 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
556 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 561 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
557 562
558 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 563 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
559 SLOT( updateConfig() ) ); 564 SLOT( updateConfig() ) );
560 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 565 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
561 SLOT( updateTodo( Todo *, int ) ) ); 566 SLOT( updateTodo( Todo *, int ) ) );
562 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 567 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
563 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 568 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
564 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 569 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
565 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 570 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
566 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 571 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
567 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 572 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
568 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 573 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
569 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 574 mMainView, SLOT ( todo_unsub( Todo * ) ) );
570 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 575 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
571 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 576 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 137eb2d..66ab138 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -23,96 +23,96 @@
23*/ 23*/
24#ifndef KOVIEWMANAGER_H 24#ifndef KOVIEWMANAGER_H
25#define KOVIEWMANAGER_H 25#define KOVIEWMANAGER_H
26 26
27#include <qobject.h> 27#include <qobject.h>
28 28
29#include <korganizer/baseview.h> 29#include <korganizer/baseview.h>
30 30
31class CalendarView; 31class CalendarView;
32 32
33class KOListView; 33class KOListView;
34class KOAgendaView; 34class KOAgendaView;
35class KOMonthView; 35class KOMonthView;
36class KOTimeSpanView; 36class KOTimeSpanView;
37class KOTodoView; 37class KOTodoView;
38class KOWhatsNextView; 38class KOWhatsNextView;
39class KOJournalView; 39class KOJournalView;
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43/** 43/**
44 This class manages the views of the calendar. It owns the objects and handles 44 This class manages the views of the calendar. It owns the objects and handles
45 creation and selection. 45 creation and selection.
46*/ 46*/
47class KOViewManager : public QObject 47class KOViewManager : public QObject
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOViewManager( CalendarView * ); 51 KOViewManager( CalendarView * );
52 virtual ~KOViewManager(); 52 virtual ~KOViewManager();
53 53
54 /** changes the view to be the currently selected view */ 54 /** changes the view to be the currently selected view */
55 void showView(KOrg::BaseView *, bool fullScreen = false ); 55 void showView(KOrg::BaseView *, bool fullScreen = false );
56 void updateWNview(); 56 void updateWNview();
57 void readSettings(KConfig *config); 57 void readSettings(KConfig *config);
58 void writeSettings(KConfig *config); 58 void writeSettings(KConfig *config);
59 bool showsNextDays(); 59 bool showsNextDays();
60 /** Read which view was shown last from config file */ 60 /** Read which view was shown last from config file */
61 void readCurrentView(KConfig *); 61 void readCurrentView(KConfig *);
62 /** Write which view is currently shown to config file */ 62 /** Write which view is currently shown to config file */
63 void writeCurrentView(KConfig *); 63 void writeCurrentView(KConfig *);
64 64
65 KOrg::BaseView *currentView(); 65 KOrg::BaseView *currentView();
66 66
67 void setDocumentId( const QString & ); 67 void setDocumentId( const QString & );
68 68
69 void updateView( const QDate &start, const QDate &end ); 69 void updateView( const QDate &start, const QDate &end );
70 70
71 void raiseCurrentView( bool fullScreen = false ); 71 void raiseCurrentView( bool fullScreen = false , bool updateView = false);
72 72
73 void addView(KOrg::BaseView *); 73 void addView(KOrg::BaseView *);
74 74
75 Incidence *currentSelection(); 75 Incidence *currentSelection();
76 QDate currentSelectionDate(); 76 QDate currentSelectionDate();
77 77
78 KOAgendaView *agendaView() const { return mAgendaView; } 78 KOAgendaView *agendaView() const { return mAgendaView; }
79 79
80 signals: 80 signals:
81 void printWNV(); 81 void printWNV();
82 void signalFullScreen( bool ); 82 void signalFullScreen( bool );
83 void signalAgendaView( bool ); 83 void signalAgendaView( bool );
84 public slots: 84 public slots:
85 void showDateView( int, QDate ); 85 void showDateView( int, QDate );
86 void updateView(); 86 void updateView();
87 void showWhatsNextView(); 87 void showWhatsNextView();
88 void showListView(); 88 void showListView();
89 void showAgendaView( bool fullScreen = false ); 89 void showAgendaView( bool fullScreen = false );
90 void showDayView(); 90 void showDayView();
91 void showWorkWeekView(); 91 void showWorkWeekView();
92 void showWeekView(); 92 void showWeekView();
93 void showNextXView(); 93 void showNextXView();
94 void showMonthView(); 94 void showMonthView();
95 void showTodoView(); 95 void showTodoView();
96 void showJournalView(); 96 void showJournalView();
97 void showTimeSpanView(); 97 void showTimeSpanView();
98 98
99 private: 99 private:
100 CalendarView *mMainView; 100 CalendarView *mMainView;
101 101
102 int mCurrentAgendaView; 102 int mCurrentAgendaView;
103 KOAgendaView *mAgendaView; 103 KOAgendaView *mAgendaView;
104 KOListView *mListView; 104 KOListView *mListView;
105 KOMonthView *mMonthView; 105 KOMonthView *mMonthView;
106 KOTodoView *mTodoView; 106 KOTodoView *mTodoView;
107 KOWhatsNextView *mWhatsNextView; 107 KOWhatsNextView *mWhatsNextView;
108 KOJournalView *mJournalView; 108 KOJournalView *mJournalView;
109 KOTimeSpanView *mTimeSpanView; 109 KOTimeSpanView *mTimeSpanView;
110 110
111 KOrg::BaseView *mCurrentView; // currently active event view 111 KOrg::BaseView *mCurrentView; // currently active event view
112 112
113 int mAgendaViewMode; 113 int mAgendaViewMode;
114 bool mFlagShowNextxDays; 114 bool mFlagShowNextxDays;
115 115
116}; 116};
117 117
118#endif 118#endif