author | zautrix <zautrix> | 2005-04-05 19:42:46 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-05 19:42:46 (UTC) |
commit | 6add774cf9841377f32613c7aa23161a823aa1da (patch) (side-by-side diff) | |
tree | 43631d25bdfff4eb9d9934bc604609c38717b000 /korganizer | |
parent | 8734ae4789ed411cb546edd304816a77c431a2bf (diff) | |
download | kdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.zip kdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.tar.gz kdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.tar.bz2 |
fix
-rw-r--r-- | korganizer/komonthview.cpp | 146 | ||||
-rw-r--r-- | korganizer/komonthview.h | 5 |
2 files changed, 90 insertions, 61 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index e66ddce..4dfb9df 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -98,30 +98,34 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) QListBox::focusInEvent ( e ); - QListBoxItem * i = item ( 0 ); - if ( i && resetOnFocusIn ) { - setCurrentItem( i ); - setSelected ( 0, true ); - } - resetOnFocusIn = true; - - if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { - QListBoxItem *fi = firstItem (); - if (fi ) { - int ihei = fi->height( this ); - int hei = numRows () * ihei; - if ( hei < height() - horizontalScrollBar()->height () ) { - setVScrollBarMode(QScrollView::AlwaysOff); - } - else + if ( count() ){ + int ci = currentItem(); + if ( ci < 0 ) ci = 0; + + setCurrentItem( ci ); + setSelected ( ci, true ); + emit highlighted( item ( ci ) ); + + resetOnFocusIn = true; + + if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { + QListBoxItem *fi = firstItem (); + if (fi ) { + int ihei = fi->height( this ); + int hei = numRows () * ihei; + if ( hei < height() - horizontalScrollBar()->height () ) { + setVScrollBarMode(QScrollView::AlwaysOff); + } + else + setVScrollBarMode(QScrollView::Auto); + if ( ihei *3 > height() ) { + setHScrollBarMode(QScrollView::AlwaysOff); + } + else { + setHScrollBarMode(QScrollView::Auto); + } + } else { setVScrollBarMode(QScrollView::Auto); - if ( ihei *3 > height() ) { - setHScrollBarMode(QScrollView::AlwaysOff); - } - else { setHScrollBarMode(QScrollView::Auto); } - } else { - setVScrollBarMode(QScrollView::Auto); - setHScrollBarMode(QScrollView::Auto); - } - } + } + } } @@ -174,9 +178,13 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) } - if ( count() ) { - setCurrentItem((currentItem()+count()-1)%count()); - if(!itemVisible(currentItem())) { - if((unsigned int) currentItem() == (count()-1)) { - setTopItem(currentItem()-numItemsVisible()+1); - } else { - setTopItem(topItem()-1); + if ( count() ) { + if ( currentItem() == 0 ) { + emit prevCell(); + } else { + setCurrentItem((currentItem()+count()-1)%count()); + if(!itemVisible(currentItem())) { + if((unsigned int) currentItem() == (count()-1)) { + setTopItem(currentItem()-numItemsVisible()+1); + } else { + setTopItem(topItem()-1); + } } @@ -190,9 +198,13 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) } - if ( count () ) { - setCurrentItem((currentItem()+1)%count()); - if(!itemVisible(currentItem())) { - if(currentItem() == 0) { - setTopItem(0); - } else { - setTopItem(topItem()+1); + if ( count () ) { + if ( currentItem()+1 == count () ) { + emit nextCell(); + } else { + setCurrentItem((currentItem()+1)%count()); + if(!itemVisible(currentItem())) { + if(currentItem() == 0) { + setTopItem(0); + } else { + setTopItem(topItem()+1); + } } @@ -227,10 +239,14 @@ void KNoScrollListBox::oneDown() { - if ( count () ) { - resetOnFocusIn = false; - setCurrentItem((currentItem()+1)%count()); - if(!itemVisible(currentItem())) { - if(currentItem() == 0) { - setTopItem(0); - } else { - setTopItem(topItem()+1); + if ( count () ) { + if ( currentItem()+1 == count () ) { + emit nextCell(); + } else { + resetOnFocusIn = false; + setCurrentItem((currentItem()+1)%count()); + if(!itemVisible(currentItem())) { + if(currentItem() == 0) { + setTopItem(0); + } else { + setTopItem(topItem()+1); + } } @@ -475,6 +491,7 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) SLOT( selection( QListBoxItem * ) ) ); - connect( this, SIGNAL( clicked( QListBoxItem * ) ), - SLOT( cellClicked( QListBoxItem * ) ) ); + + /* connect( this, SIGNAL( clicked( QListBoxItem * ) ), SLOT( selection( QListBoxItem * ) ) ); + */ } @@ -991,2 +1008,3 @@ void MonthViewCell::defaultAction( QListBoxItem *item ) { + if ( !item ) { @@ -1012,2 +1030,3 @@ void MonthViewCell::cellClicked( QListBoxItem *item ) { + qDebug("CELL "); if ( item == 0 ) { @@ -1017,13 +1036,3 @@ void MonthViewCell::cellClicked( QListBoxItem *item ) } - /* - if ( lastClicked ) - if ( ! item ) { - if ( lastClicked->listBox() != item->listBox() ) - lastClicked->listBox()->clearSelection(); - } - */ - - mMonthView->setSelectedCell( this ); - if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); - select(); + } @@ -1153,2 +1162,6 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) SIGNAL( showDaySignal( QDate ) ) ); + connect( cell, SIGNAL( nextCell() ), + SLOT( nextCell() ) ); + connect( cell, SIGNAL( prevCell() ), + SLOT( prevCell() ) ); } @@ -1166,2 +1179,6 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) SIGNAL( showDaySignal( QDate ) ) ); + connect( cell, SIGNAL( nextCell() ), + SLOT( nextCell() ) ); + connect( cell, SIGNAL( prevCell() ), + SLOT( prevCell() ) ); cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); @@ -1976 +1993,10 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) } + +void KOMonthView::nextCell() +{ + bool res = focusNextPrevChild ( true ); +} +void KOMonthView::prevCell() +{ + focusNextPrevChild ( false ); +} diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index e39eeb0..c6b6b5e 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -85,2 +85,4 @@ class KNoScrollListBox: public QListBox void rightClick(); + void nextCell(); + void prevCell(); @@ -190,3 +192,2 @@ class MonthViewCell : public KNoScrollListBox - public slots: @@ -258,2 +259,4 @@ class KOMonthView: public KOEventView public slots: + void nextCell(); + void prevCell(); virtual void updateView(); |