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 | |
parent | 8734ae4789ed411cb546edd304816a77c431a2bf (diff) | |
download | kdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.zip kdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.tar.gz kdepimpi-6add774cf9841377f32613c7aa23161a823aa1da.tar.bz2 |
fix
-rw-r--r-- | korganizer/komonthview.cpp | 60 | ||||
-rw-r--r-- | korganizer/komonthview.h | 5 |
2 files changed, 47 insertions, 18 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index e66ddce..4dfb9df 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -98,7 +98,10 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) QListBox::focusInEvent ( e ); - QListBoxItem * i = item ( 0 ); - if ( i && resetOnFocusIn ) { - setCurrentItem( i ); - setSelected ( 0, true ); - } + if ( count() ){ + int ci = currentItem(); + if ( ci < 0 ) ci = 0; + + setCurrentItem( ci ); + setSelected ( ci, true ); + emit highlighted( item ( ci ) ); + resetOnFocusIn = true; @@ -127,2 +130,3 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) } +} void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) @@ -175,2 +179,5 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) if ( count() ) { + if ( currentItem() == 0 ) { + emit prevCell(); + } else { setCurrentItem((currentItem()+count()-1)%count()); @@ -184,2 +191,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) } + } break; @@ -191,2 +199,5 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) if ( count () ) { + if ( currentItem()+1 == count () ) { + emit nextCell(); + } else { setCurrentItem((currentItem()+1)%count()); @@ -200,2 +211,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) } + } break; @@ -228,2 +240,5 @@ void KNoScrollListBox::oneDown() if ( count () ) { + if ( currentItem()+1 == count () ) { + emit nextCell(); + } else { resetOnFocusIn = false; @@ -239,2 +254,3 @@ void KNoScrollListBox::oneDown() } +} void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) @@ -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(); |