author | zautrix <zautrix> | 2005-07-09 14:48:54 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 14:48:54 (UTC) |
commit | 875884b2517f9b82153a14852c0f1676f985494f (patch) (side-by-side diff) | |
tree | 89e1c773a2fdae7a4f2e2fb9ba9d4c59e921d60f | |
parent | fa7a30172aa502aaa9e81868e5960efba76cbb0d (diff) | |
download | kdepimpi-875884b2517f9b82153a14852c0f1676f985494f.zip kdepimpi-875884b2517f9b82153a14852c0f1676f985494f.tar.gz kdepimpi-875884b2517f9b82153a14852c0f1676f985494f.tar.bz2 |
layout fixes
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index b5a59af..498d9b0 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1465,769 +1465,769 @@ void KOMonthView::switchView() int KOMonthView::maxDatesHint() { return mNumCells; } int KOMonthView::currentDateCount() { return mNumCells; } QPtrList<Incidence> KOMonthView::selectedIncidences() { QPtrList<Incidence> selected; if ( mSelectedCell ) { Incidence *incidence = mSelectedCell->selectedIncidence(); if ( incidence ) selected.append( incidence ); } return selected; } DateList KOMonthView::selectedDates() { DateList selected; if ( mSelectedCell ) { QDate qd = mSelectedCell->selectedIncidenceDate(); if ( qd.isValid() ) selected.append( qd ); } return selected; } #if 0 void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { #ifndef KORG_NOPRINTER calPrinter->preview(CalPrinter::Month, fd, td); #endif } #endif void KOMonthView::updateConfig() { int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { mWeekStartsMonday = true; } QFontMetrics fontmetric(mDayLabels[0]->font()); mWidthLongDayLabel = 0; for (int i = 0; i < 7; i++) { int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; } bool temp = mShowSatSunComp ; mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; if ( ! mShowWeekView ) { if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) computeLayout(); } else doComputeLayoutWeek(); updateDayLabels(); //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; //resizeEvent( 0 ); for (uint i = 0; i < mCells.count(); ++i) { mCells[i]->updateConfig(); } for (uint i = 0; i < mCellsW.count(); ++i) { mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); } #ifdef DESKTOP_VERSION MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); #endif updateView(); } void KOMonthView::updateDayLabels() { QPtrVector<QLabel> *mDayLabelsT; mDayLabelsT = &mDayLabelsW; for (int i = 0; i < 7; i++) { { bool show = mShortDayLabelsW; if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) show = true; (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); } } mDayLabelsT = &mDayLabels; for (int i = 0; i < 7; i++) { if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { bool show = mShortDayLabelsM; if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) show = true; (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); } else { if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); } } } void KOMonthView::clearList() { unsigned int i; for( i = 0; i < mCells.size(); ++i ) { mCells[i]->clear(); } for( i = 0; i < mCellsW.size(); ++i ) { mCellsW[i]->clear(); } } void KOMonthView::showDates(const QDate &start, const QDate &) { // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; QPtrVector<MonthViewCell> *cells; QPtrVector<QLabel> *dayLabels; QPtrVector<KOWeekButton> *weekLabels; uint weekNum = 6; mStartDate = start; if ( mShowWeekView ) { weekNum = 1; cells = &mCellsW; dayLabels = &mDayLabelsW; weekLabels = &mWeekLabelsW; if ( !KGlobal::locale()->weekStartsMonday() ) { mStartDate = mStartDate.addDays( 1 ); } } else { cells = &mCells; dayLabels = &mDayLabels; weekLabels = &mWeekLabels; } int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { mWeekStartsMonday = true; } int startWeekDay = mWeekStartsMonday ? 1 : 7; while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { mStartDate = mStartDate.addDays( -1 ); } uint i; for( i = 0; i < (*cells).size(); ++i ) { QDate date = mStartDate.addDays( i ); (*cells)[i]->setDate( date ); #ifndef KORG_NOPLUGINS // add holiday, if present QString hstring(KOCore::self()->holiday(date)); (*cells)[i]->setHoliday( hstring ); #endif } QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); for( i = 0; i < weekNum; ++i ) { int wno; // remember, according to ISO 8601, the first week of the year is the // first week that contains a thursday. Thus we must subtract off 4, // not just 1. int dayOfYear = date.dayOfYear(); if (dayOfYear % 7 != 0) wno = dayOfYear / 7 + 1; else wno =dayOfYear / 7; (*weekLabels)[i]->setWeekNum( wno ); date = date.addDays( 7 ); } updateView(); } void KOMonthView::showEvents(QPtrList<Event>) { qDebug("KOMonthView::selectEvents is not implemented yet. "); } void KOMonthView::changeEventDisplay(Event *, int) { // this should be re-written to be much more efficient, but this // quick-and-dirty-hack gets the job done for right now. //qDebug("KOMonthView::changeEventDisplay "); updateView(); } void KOMonthView::updateView() { if ( !updatePossible ) return; //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); //QTime ti; //ti.start(); clearSelection(); QPtrVector<MonthViewCell> *cells; if ( mShowWeekView ) { cells = &mCellsW; } else { cells = &mCells; } #if 1 int i; int timeSpan = (*cells).size()-1; if ( KOPrefs::instance()->mMonthViewWeek ) timeSpan = 6; for( i = 0; i < timeSpan + 1; ++i ) { (*cells)[i]->startUpdateCell(); } QPtrList<Event> events = calendar()->events(); Event *event; QDateTime dt; QDate endDate = mStartDate.addDays( timeSpan ); for( event = events.first(); event; event = events.next() ) { // for event if ( event->doesRecur() ) { bool last; QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); QDateTime incidenceEnd; int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); bool invalid = false; while( true ) { if ( incidenceStart.isValid() ) { incidenceEnd = incidenceStart.addDays( eventlen ); int st = incidenceStart.date().daysTo( endDate ); if ( st >= 0 ) { // start before timeend int end = mStartDate.daysTo( incidenceEnd.date() ); if ( end >= 0 ) { // end after timestart --- got one! //normalize st = timeSpan - st; if ( st < 0 ) st = 0; if ( end > timeSpan ) end = timeSpan; int iii; //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); for ( iii = st;iii<= end;++iii) (*cells)[iii]->insertEvent( event ); } } } else { if ( invalid ) break; invalid = true; //qDebug("invalid %s", event->summary().latin1()); incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; } if ( last ) break; bool ok; incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); if ( ! ok ) break; if ( incidenceStart.date() > endDate ) break; } } else { // no recur if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) if ( event->uid().left(15) == QString("last-syncEvent-") ) continue; int st = event->dtStart().date().daysTo( endDate ); if ( st >= 0 ) { // start before timeend int end = mStartDate.daysTo( event->dtEnd().date() ); if ( end >= 0 ) { // end after timestart --- got one! //normalize st = timeSpan - st; if ( st < 0 ) st = 0; if ( end > timeSpan ) end = timeSpan; int iii; for ( iii = st;iii<= end;++iii) (*cells)[iii]->insertEvent( event ); } } } } // insert due todos QPtrList<Todo> todos = calendar()->todos( ); Todo *todo; for(todo = todos.first(); todo; todo = todos.next()) { //insertTodo( todo ); if ( todo->hasDueDate() ) { int day = mStartDate.daysTo( todo->dtDue().date() ); if ( day >= 0 && day < timeSpan + 1) { (*cells)[day]->insertTodo( todo ); } } } for( i = 0; i < timeSpan+1; ++i ) { (*cells)[i]->finishUpdateCell(); } processSelectionChange(); //qApp->processEvents(); for( i = 0; i < timeSpan+1; ++i ) { //(*cells)[i]->repaintfinishUpdateCell(); QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); } setKeyBFocus(); #else // old code //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); int i; for( i = 0; i < (*cells).count(); ++i ) { (*cells)[i]->updateCell(); } //qDebug("KOMonthView::updateView() "); processSelectionChange(); // qDebug("---------------------------------------------------------------------+ "); (*cells)[0]->setFocus(); #endif //qDebug("update time %d ", ti.elapsed()); } void KOMonthView::setKeyBoardFocus() { //qDebug("KOMonthView::setKeyBoardFocus() "); bool shootAgain = false; if ( mShowWeekView ) { shootAgain = !mWeekLabelsW[1]->hasFocus(); mWeekLabelsW[1]->setFocus(); } else { shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); mWeekLabels[mNumWeeks]->setFocus(); } --mKBFcounter; if ( shootAgain && mKBFcounter > 0 ) { QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) ); } } void KOMonthView::setKeyBFocus() { //qDebug("KOMonthView::setKeyBFocus() "); mKBFcounter = 10; QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); } void KOMonthView::resizeEvent(QResizeEvent * e) { //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); if ( isVisible() ) { //qDebug("KOMonthView::isVisible "); slotComputeLayout(); } else mComputeLayoutTimer->start( 100 ); if ( e ) KOEventView::resizeEvent( e ); } void KOMonthView::slotComputeLayout() { mComputeLayoutTimer->stop(); //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); computeLayout(); clPending = true; setKeyBFocus(); } void KOMonthView::doComputeLayoutWeek() { int daysToShow; bool combinedSatSun = false; if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { daysToShow = 6; combinedSatSun = true; } int wid = width();//e int hei = height()-1-mNavigatorBar->height(); #ifdef DESKTOP_VERSION if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) { daysToShow = 2; } else #endif { - if ( wid < hei ) + if ( wid < hei + 40 ) daysToShow = 2; else daysToShow = 3; } bool landscape = (daysToShow == 3); mShowSatSunComp = true; combinedSatSun = true; //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); wid -= weeklabelwid; int colWid = wid / daysToShow; int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); int colModulo = wid % daysToShow; int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; //qDebug("rowmod %d ", rowModulo); int i; int x,y,w,h; x= 0; y= 0; w = colWid; h = dayLabelHei ; for ( i = 0; i < 7; i++) { if ( i && !( i % daysToShow) && i < 6) { y += hei/(5-daysToShow); x = 0; w = colWid; } if ( ((i) % daysToShow) >= daysToShow-colModulo ) { ++w; } int xC,yC,wC,hC; if ( i >= 5 ) { int wi = width() - x - weeklabelwid; if ( i == 5 ) { xC = x+weeklabelwid; yC = y; wC = wi/2+wi%2; hC = h; } else { xC = x+weeklabelwid; yC = y; wC = wi; hC = h; } x = x - w + wi - (wi/2 ); } else { int wi = w; if ( !(( i+1) % daysToShow)) { wi = width() - x - weeklabelwid; } xC = x+weeklabelwid; yC = y; wC = wi; hC = h; } mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC); x += w; } x= 0; y= dayLabelHei; w = colWid; h = cellHei; int max = 0; int w_count = mCellsW.count(); for ( i = 0; i < w_count; ++i) { if ( i > 6 ) { mCellsW[i]->hide(); continue; } w = colWid; if ( ((i) % daysToShow) >= daysToShow-colModulo ) { ++w; } if ( i == (daysToShow-1-rowModulo)*7) ++h; int xC,yC,wC,hC; if ( i >= 5 ) { if ( i ==5 ) { max = h/2; xC = x+weeklabelwid; yC = y; wC = w; hC = max; x -= w ;y += h/2; } else { if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { ++w; } max = h-h/2; xC = x+weeklabelwid; yC = y; wC = w; hC = max; y -= h/2; } } else { max = h; xC = x+weeklabelwid; yC = y; wC = w; hC = h; } mCellsW[mapWeekLayout(i,landscape)]->setGeometry ( xC,yC,wC,hC ); x += w; if ( x + w/2 > wid ) { x = 0; y += h+dayLabelHei ; } //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); } y= dayLabelHei; h = cellHei ; mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; updateDayLabels(); //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("M")); //if ( forceUpdate ) // updateView(); } void KOMonthView::computeLayoutWeek() { static int lastWid = 0; static int lastHei = 0; int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); int wid = width();//e int hei = height()-1-mNavigatorBar->height(); if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) return; if ( lastWid == width() && lastHei == height() ) { //qDebug("KOListWeekView::No compute layout needed "); return; } lastWid = width(); lastHei = height(); doComputeLayoutWeek(); } int KOMonthView::mapWeekLayout( int index, bool landscape ) { if ( KOPrefs::instance()->mMonthViewWeekRowlayout ) return index; int diff = 0; if ( !landscape ) diff = 1; switch( index ) { case 0: case 5: case 6: return index; break; case 1: return 2+diff; break; case 2: return 4-(3*diff); break; case 3: return 1+(3*diff); break; case 4: return 3-diff; break; default: qDebug("KO: Error in mapping week layout "); return index; break; } return index; } void KOMonthView::computeLayout() { static int lastWid = 0; static int lastHei = 0; if ( mShowWeekView ){ computeLayoutWeek(); return; } int daysToShow = 7; bool combinedSatSun = false; if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { daysToShow = 6; combinedSatSun = true; } int tWid = topLevelWidget()->size().width(); int tHei = topLevelWidget()->size().height(); int wid = width();//e int hei = height()-1-mNavigatorBar->height(); if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { return; } if ( lastWid == width() && lastHei == height() ){ //qDebug("KOMonthview::No compute layout needed "); return; } lastWid = width(); lastHei = height(); //qDebug("KOMonthView::computeLayout() MMM ------------------- "); QFontMetrics fm ( mWeekLabels[0]->font() ); int weeklabelwid = fm.width( "888" ); wid -= weeklabelwid; int colWid = wid / daysToShow; int dayLabelHei = mDayLabels[0]->sizeHint().height(); int cellHei = (hei - dayLabelHei) /6; int colModulo = wid % daysToShow; int rowModulo = (hei- dayLabelHei) % 6; //qDebug("rowmod %d ", rowModulo); int i; int x,y,w,h; x= 0; y= 0; w = colWid; h = dayLabelHei ; for ( i = 0; i < 7; i++) { if ( i == daysToShow-colModulo ) ++w; if ( combinedSatSun ) { if ( i >= daysToShow-1 ) { if ( i == 6 ) mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); else mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); x -= w/2 ; } else mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); } else mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); x += w; } x= 0; y= dayLabelHei; w = colWid; h = cellHei ; int max = 0; int mc_count = mCells.count(); for ( i = 0; i < mc_count; ++i) { //qDebug("iii %d ", i); w = colWid; if ( ((i) % 7) >= 7-colModulo ) { ++w; } if ( i == (6-rowModulo)*7) ++h; if ( combinedSatSun ) { if ( (i)%7 >= daysToShow-1 ) { if ( (i)%7 == daysToShow-1 ) { w = width()-x-weeklabelwid; max = h/2; mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); x -= w ;y += h/2; } else { w = width()-x-weeklabelwid; max = h-h/2; mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); y -= h/2; } } else { max = h; mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); } } else { max = h; mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); } x += w; if ( x + w/2 > wid ) { x = 0; y += h; } //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); } y= dayLabelHei; h = cellHei ; for ( i = 0; i < 6; i++) { if ( i == (6-rowModulo)) ++h; mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); y += h; } mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; updateDayLabels(); //bool forceUpdate = !updatePossible; updatePossible = true; //mWeekLabels[mNumWeeks]->setText( i18n("W")); } void KOMonthView::showContextMenu( Incidence *incidence ) { if( incidence ) mContextMenu->showIncidencePopup(incidence); else { //qDebug("KOMonthView::showContextMenu "); mNewItemMenu->popup(QCursor::pos()); } /* if( incidence && incidence->typeID() == eventID ) { Event *event = static_cast<Event *>(incidence); mContextMenu->showEventPopup(event); } else { kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; } */ } MonthViewCell * KOMonthView::selectedCell( ) { return mSelectedCell; } void KOMonthView::setSelectedCell( MonthViewCell *cell ) { //qDebug("KOMonthView::setSelectedCell %d", cell); if ( mSelectedCell && mSelectedCell != cell ) { MonthViewCell * mvc = mSelectedCell; mSelectedCell = cell; mvc->deselect(); } else mSelectedCell = cell; // if ( mSelectedCell ) // mSelectedCell->select(); if ( !mSelectedCell ) emit incidenceSelected( 0 ); else emit incidenceSelected( mSelectedCell->selectedIncidence() ); } void KOMonthView::processSelectionChange() { QPtrList<Incidence> incidences = selectedIncidences(); if (incidences.count() > 0) { emit incidenceSelected( incidences.first() ); } else { emit incidenceSelected( 0 ); clearSelection(); } } void KOMonthView::clearSelection() { if ( mSelectedCell ) { mSelectedCell->deselect(); mSelectedCell = 0; } } void KOMonthView::keyReleaseEvent ( QKeyEvent * e) { if ( !e->isAutoRepeat() ) { mFlagKeyPressed = false; } } void KOMonthView::keyPressEvent ( QKeyEvent * e ) { qApp->processEvents(); if ( e->isAutoRepeat() && !mFlagKeyPressed ) { diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index c2ad886..add1819 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -135,769 +135,769 @@ KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); lay->addWidget( ok ); if (QApplication::desktop()->width() < 320 ) resize( 240, sizeHint().height() ); else resize( 320, sizeHint().height() ); } void KOStopTodoPrefs::accept() { QDateTime start = QDateTime( sde->date(), ste->getTime() ); QDateTime stop = QDateTime( ede->date(), ete->getTime() ); if ( start > stop ) { KMessageBox::sorry(this, i18n("The start time is\nafter the end time!"), i18n("Time mismatch!")); return; } mTodo->saveRunningInfo( mComment->text(), start, stop ); QDialog::accept(); } void KOStopTodoPrefs::doNotSave() { int result = KMessageBox::warningContinueCancel(this, i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); if (result != KMessageBox::Continue) return; mTodo->stopRunning(); QDialog::accept(); } class KOTodoViewWhatsThis :public QWhatsThis { public: KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; protected: virtual QString text( const QPoint& p) { return _view->getWhatsThisText(p) ; } private: QWidget* _wid; KOTodoView * _view; }; KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, const char *name) : KListView(parent,name) { mName = QString ( name ); mCalendar = calendar; #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); #endif mOldCurrent = 0; mMousePressed = false; setAcceptDrops(true); viewport()->setAcceptDrops(true); int size = 16; if (qApp->desktop()->width() < 300 ) size = 12; setTreeStepSize( size + 6 ); } void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { e->ignore(); return; } mOldCurrent = currentItem(); #endif } void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { e->ignore(); return; } e->accept(); #endif } void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; setCurrentItem(mOldCurrent); setSelected(mOldCurrent,true); #endif } void KOTodoListView::contentsDropEvent(QDropEvent *e) { #ifndef KORG_NODND // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && !QTextDrag::canDecode( e ) ) { e->ignore(); return; } DndFactory factory( mCalendar ); Todo *todo = factory.createDropTodo(e); if (todo) { e->acceptAction(); KOTodoViewItem *destination = (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); Todo *destinationEvent = 0; if (destination) destinationEvent = destination->todo(); Todo *existingTodo = mCalendar->todo(todo->uid()); if(existingTodo) { Incidence *to = destinationEvent; while(to) { if (to->uid() == todo->uid()) { KMessageBox::sorry(this, i18n("Cannot move Todo to itself\nor a child of itself"), i18n("Drop Todo")); delete todo; return; } to = to->relatedTo(); } internalDrop = true; if ( destinationEvent ) reparentTodoSignal( destinationEvent, existingTodo ); else unparentTodoSignal(existingTodo); delete todo; } else { mCalendar->addTodo(todo); emit todoDropped(todo, KOGlobals::EVENTADDED); if ( destinationEvent ) reparentTodoSignal( destinationEvent, todo ); } } else { QString text; if (QTextDrag::decode(e,text)) { //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); qDebug("Dropped : " + text); QStringList emails = QStringList::split(",",text); for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { int pos = (*it).find("<"); QString name = (*it).left(pos); QString email = (*it).mid(pos); if (!email.isEmpty() && todoi) { todoi->todo()->addAttendee(new Attendee(name,email)); } } } else { qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); e->ignore(); } } #endif } void KOTodoListView::wheelEvent (QWheelEvent *e) { QListView::wheelEvent (e); } void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) { QPoint p(contentsToViewport(e->pos())); QListViewItem *i = itemAt(p); bool rootClicked = true; if (i) { // if the user clicked into the root decoration of the item, don't // try to start a drag! int X = p.x(); //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); if (X > header()->sectionPos(0) + treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + itemMargin() +i->height()|| X < header()->sectionPos(0)) { rootClicked = false; } } else { rootClicked = false; } #ifndef KORG_NODND mMousePressed = false; if (! rootClicked && !( e->button() == RightButton) ) { mPressPos = e->pos(); mMousePressed = true; } else { mMousePressed = false; } #endif //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); #ifndef DESKTOP_VERSION if (!( e->button() == RightButton && rootClicked) ) QListView::contentsMousePressEvent(e); #else QListView::contentsMousePressEvent(e); #endif } void KOTodoListView::paintEvent(QPaintEvent* e) { emit paintNeeded(); QListView::paintEvent( e); } void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) { #ifndef KORG_NODND //QListView::contentsMouseMoveEvent(e); if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > QApplication::startDragDistance()*3) { mMousePressed = false; QListViewItem *item = itemAt(contentsToViewport(mPressPos)); if (item) { DndFactory factory( mCalendar ); ICalDrag *vd = factory.createDrag( ((KOTodoViewItem *)item)->todo(),viewport()); internalDrop = false; // we cannot do any senseful here, because the DnD is still broken in Qt if (vd->drag()) { if ( !internalDrop ) { //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); qDebug("Dnd: External move: Delete drag source "); } else qDebug("Dnd: Internal move "); } else { if ( !internalDrop ) { qDebug("Dnd: External Copy"); } else qDebug("DnD: Internal copy: Copy pending"); } } } #endif } void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) { if ( !e->isAutoRepeat() ) { mFlagKeyPressed = false; } } void KOTodoListView::keyPressEvent ( QKeyEvent * e ) { qApp->processEvents(); if ( !isVisible() ) { e->ignore(); return; } if ( e->isAutoRepeat() && !mFlagKeyPressed ) { e->ignore(); // qDebug(" ignore %d",e->isAutoRepeat() ); return; } if (! e->isAutoRepeat() ) mFlagKeyPressed = true; QListViewItem* cn; if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { cn = currentItem(); if ( cn ) { KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); if ( ci ){ if ( e->state() == ShiftButton ) ci->setOn( false ); else ci->setOn( true ); cn = cn->itemBelow(); if ( cn ) { setCurrentItem ( cn ); ensureItemVisible ( cn ); } } } return; } if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { switch ( e->key() ) { case Qt::Key_Down: case Qt::Key_Up: QListView::keyPressEvent ( e ); break; case Qt::Key_Left: case Qt::Key_Right: QListView::keyPressEvent ( e ); e->accept(); return; break; default: e->ignore(); break; } return; } e->ignore(); } void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) { QListView::contentsMouseReleaseEvent(e); mMousePressed = false; } void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) { if (!e) return; QPoint vp = contentsToViewport(e->pos()); QListViewItem *item = itemAt(vp); emit double_Clicked(item); if (!item) return; emit doubleClicked(item,vp,0); } ///////////////////////////////////////////////////////////////////////////// KOQuickTodo::KOQuickTodo(QWidget *parent) : QLineEdit(parent) { setText(i18n("Click to add new Todo")); } void KOQuickTodo::focusInEvent(QFocusEvent *ev) { if ( text()==i18n("Click to add new Todo") ) setText(""); QLineEdit::focusInEvent(ev); } void KOQuickTodo::focusOutEvent(QFocusEvent *ev) { setText(i18n("Click to add new Todo")); QLineEdit::focusOutEvent(ev); } ///////////////////////////////////////////////////////////////////////////// KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : KOrg::BaseView(calendar,parent,name) { mCategoryPopupMenu = 0; mPendingUpdateBeforeRepaint = false; isFlatDisplay = false; mNavigator = 0; QBoxLayout *topLayout = new QVBoxLayout(this); mName = QString ( name ); mBlockUpdate = false; mQuickBar = new QWidget( this ); topLayout->addWidget(mQuickBar); mQuickAdd = new KOQuickTodo(mQuickBar); QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); quickLayout->addWidget( mQuickAdd ); QPushButton * flat = new QPushButton( "F",mQuickBar ); int fixwid = flat->sizeHint().height(); - if ( QApplication::desktop()->width() > 320 ) + if ( QApplication::desktop()->width() >= 800 ) fixwid *= 2; flat->setFixedWidth( fixwid ); connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); QPushButton * allopen = new QPushButton( "O",mQuickBar ); allopen->setFixedWidth( fixwid ); connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); QPushButton * allclose = new QPushButton( "C",mQuickBar ); allclose->setFixedWidth( fixwid ); connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); QPushButton * s_done = new QPushButton( "D",mQuickBar ); s_done->setPixmap( SmallIcon("greenhook16")); s_done->setFixedWidth( fixwid ); s_done->setFixedHeight( flat->sizeHint().height() ); connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); QPushButton * s_run = new QPushButton( "R",mQuickBar ); s_run->setPixmap( SmallIcon("ko16old")); s_run->setFixedWidth( fixwid ); s_run->setFixedHeight( flat->sizeHint().height() ); connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); mNewSubBut = new QPushButton( "sub",mQuickBar ); mNewSubBut->setFixedWidth( fixwid*3/2 ); connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); mNewSubBut->setEnabled( false ); quickLayout->addWidget( mNewSubBut ); quickLayout->addWidget( s_done ); quickLayout->addWidget( s_run ); quickLayout->addWidget( allopen ); quickLayout->addWidget( allclose ); quickLayout->addWidget( flat ); if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); mTodoListView = new KOTodoListView(calendar,this, name ); topLayout->addWidget(mTodoListView); //mTodoListView->header()->setMaximumHeight(30); mTodoListView->setRootIsDecorated(true); mTodoListView->setAllColumnsShowFocus(true); mTodoListView->setShowSortIndicator(true); mTodoListView->addColumn(i18n("Todo")); mTodoListView->addColumn(i18n("Prio")); mTodoListView->setColumnAlignment(1,AlignHCenter); mTodoListView->addColumn(i18n("Complete")); mTodoListView->setColumnAlignment(2,AlignCenter); mTodoListView->addColumn(i18n("Due Date")); mTodoListView->setColumnAlignment(3,AlignLeft); mTodoListView->addColumn(i18n("Due Time")); mTodoListView->setColumnAlignment(4,AlignHCenter); mTodoListView->addColumn(i18n("Start Date")); mTodoListView->setColumnAlignment(5,AlignLeft); mTodoListView->addColumn(i18n("Start Time")); mTodoListView->setColumnAlignment(6,AlignHCenter); mTodoListView->addColumn(i18n("Cancelled")); mTodoListView->addColumn(i18n("Categories")); mTodoListView->addColumn(i18n("Calendar")); #if 0 mTodoListView->addColumn(i18n("Sort Id")); mTodoListView->setColumnAlignment(4,AlignHCenter); #endif mTodoListView->setMinimumHeight( 60 ); mTodoListView->setItemsRenameable( true ); mTodoListView->setRenameable( 0 ); mTodoListView->setColumnWidth( 0, 120 ); int iii = 0; for ( iii = 0; iii< 10 ; ++iii ) mTodoListView->setColumnWidthMode( iii, QListView::Manual ); mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); mPriorityPopupMenu = new QPopupMenu(this); for (int i = 1; i <= 5; i++) { QString label = QString ("%1").arg (i); mPriority[mPriorityPopupMenu->insertItem (label)] = i; } connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); mPercentageCompletedPopupMenu = new QPopupMenu(this); for (int i = 0; i <= 100; i+=20) { QString label = QString ("%1 %").arg (i); mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; } connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); mCategoryPopupMenu = new QPopupMenu (this); mCategoryPopupMenu->setCheckable (true); connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); mCalPopupMenu = new QPopupMenu (this); mCalPopupMenu->setCheckable (true); connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); mItemPopupMenu = new QPopupMenu(this); mItemPopupMenu->insertItem(i18n("Show"), this, SLOT (showTodo())); mItemPopupMenu->insertItem(i18n("Edit..."), this, SLOT (editTodo())); mItemPopupMenu->insertItem( i18n("Delete..."), this, SLOT (deleteTodo())); mItemPopupMenu->insertItem( i18n("Clone..."), this, SLOT (cloneTodo())); mItemPopupMenu->insertItem( i18n("Move..."), this, SLOT (moveTodo())); #ifndef DESKTOP_VERSION mItemPopupMenu->insertItem( i18n("Beam..."), this, SLOT (beamTodo())); #endif mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, SLOT (cancelTodo())); mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); mItemPopupMenu->insertSeparator(); mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, SLOT (toggleRunningItem())); mItemPopupMenu->insertSeparator(); /* mItemPopupMenu->insertItem( i18n("New Todo..."), this, SLOT (newTodo())); */ mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, SLOT (newSubTodo())); mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, SLOT (unparentTodo()),0,21); mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, SLOT (reparentTodo()),0,22); mItemPopupMenu->insertSeparator(); #if 0 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), this, SLOT( purgeCompleted() ) ); mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), this, SLOT( toggleCompleted() ),0, 33 ); mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), this, SLOT( toggleQuickTodo() ),0, 34 ); mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), this, SLOT( toggleRunning() ),0, 35 ); #endif mPopupMenu = new QPopupMenu(this); mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, SLOT (newTodo()),0,1); mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), this, SLOT(purgeCompleted()),0,2); mPopupMenu->insertItem(i18n("Show Completed"), this, SLOT( toggleCompleted() ),0,3 ); mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), this, SLOT( toggleRunning() ),0,5 ); mPopupMenu->insertItem(i18n(" set all open","Display all opened"), this, SLOT( setAllOpen() ),0,6 ); mPopupMenu->insertItem(i18n(" set all close","Display all closed"), this, SLOT( setAllClose() ),0,7 ); mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), this, SLOT( setAllFlat() ),0,8 ); mPopupMenu->insertSeparator(); mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), this, SLOT( toggleQuickTodo() ),0,4 ); mDocPrefs = new DocPrefs( name ); mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); mPopupMenu->setCheckable( true ); mItemPopupMenu->setCheckable( true ); mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); // Double clicking conflicts with opening/closing the subtree connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), SLOT( editItem( QListViewItem *) ) ); /* connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, const QPoint &,int ) ), SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); */ connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, const QPoint &,int ) ), SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), SLOT( itemClicked( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), SLOT( itemDoubleClicked( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), SLOT( updateView() ) ); connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), SLOT( todoModified(Todo *, int) ) ); connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), SLOT( itemStateChanged( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), SLOT( itemStateChanged( QListViewItem * ) ) ); connect( mTodoListView, SIGNAL( paintNeeded() ), SLOT( paintNeeded()) ); #if 0 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(selectionChanged(QListViewItem *))); connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), SLOT(selectionChanged(QListViewItem *))); connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), SLOT(selectionChanged(QListViewItem *))); #endif connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); connect( mTodoListView, SIGNAL(selectionChanged() ), SLOT( processSelectionChange() ) ); connect( mQuickAdd, SIGNAL( returnPressed () ), SLOT( addQuickTodo() ) ); } KOTodoView::~KOTodoView() { #if QT_VERSION >= 0x030000 #else delete mKOTodoViewWhatsThis; #endif delete mDocPrefs; } QString KOTodoView::getWhatsThisText(QPoint p) { KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); if ( item ) return KIncidenceFormatter::instance()->getFormattedText( item->todo(), KOPrefs::instance()->mWTshowDetails, KOPrefs::instance()->mWTshowCreated, KOPrefs::instance()->mWTshowChanged); return i18n("That is the todo view" ); } void KOTodoView::jumpToDate () { // if (mActiveItem) { // mActiveItem->todo()); // if ( mActiveItem->todo()->hasDueDate() ) // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); } void KOTodoView::paintNeeded() { if ( mPendingUpdateBeforeRepaint ) { updateView(); mPendingUpdateBeforeRepaint = false; } } void KOTodoView::paintEvent(QPaintEvent * pevent) { if ( mPendingUpdateBeforeRepaint ) { updateView(); mPendingUpdateBeforeRepaint = false; } KOrg::BaseView::paintEvent( pevent); } void KOTodoView::updateView() { pendingSubtodo = 0; if ( mBlockUpdate ) { return; } if ( !isVisible() ) { mPendingUpdateBeforeRepaint = true; return; } //qDebug("KOTodoView::updateView() %x", this); if ( isFlatDisplay ) { displayAllFlat(); return; } storeCurrentItem(); //qDebug("update "); // kdDebug() << "KOTodoView::updateView()" << endl; QFont fo = KOPrefs::instance()->mTodoViewFont; mTodoListView->clear(); if ( mName == "todolistsmall" ) { if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { int ps = fo.pointSize() -2; if ( ps > 12 ) ps -= 2; fo.setPointSize( ps ); } } mTodoListView->setFont( fo ); // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); //mTodoListView->header()->setMaximumHeight(fm.height()); QPtrList<Todo> todoList = calendar()->todos(); /* kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; Event *t; for(t = todoList.first(); t; t = todoList.next()) { kdDebug() << " " << t->getSummary() << endl; if (t->getRelatedTo()) { kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; } QPtrList<Event> l = t->getRelations(); Event *c; for(c=l.first();c;c=l.next()) { kdDebug() << " - relation: " << c->getSummary() << endl; } } */ // Put for each Event a KOTodoViewItem in the list view. Don't rely on a // specific order of events. That means that we have to generate parent items // recursively for proper hierarchical display of Todos. mTodoMap.clear(); Todo *todo; todo = todoList.first();// todo; todo = todoList.next()) { while ( todo ) { bool next = true; // qDebug("todo %s ", todo->summary().latin1()); Incidence *incidence = todo->relatedTo(); while ( incidence ) { if ( incidence->typeID() == todoID ) { //qDebug("related %s ",incidence->summary().latin1() ); if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { //qDebug("related not found "); todoList.remove( ); todo = todoList.current(); next = false; incidence = 0; } else { //qDebug("related found "); incidence = incidence->relatedTo(); } } else incidence = 0; } if ( next ) todo = todoList.next(); } for(todo = todoList.first(); todo; todo = todoList.next()) { if (!mTodoMap.contains(todo) && checkTodo( todo ) ) { insertTodoItem(todo); } } // Restore opened/closed state mTodoListView->blockSignals( true ); if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); mTodoListView->blockSignals( false ); resetCurrentItem(); } void KOTodoView::storeCurrentItem() { mCurItem = 0; mCurItemRootParent = 0; mCurItemParent = 0; mCurItemAbove = 0; mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); if (mActiveItem) { mCurItem = mActiveItem->todo(); |