summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp60
-rw-r--r--korganizer/komonthview.h5
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
@@ -97,9 +97,12 @@ 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;
@@ -126,4 +129,5 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
}
}
+}
void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
{
@@ -174,4 +178,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
}
if ( count() ) {
+ if ( currentItem() == 0 ) {
+ emit prevCell();
+ } else {
setCurrentItem((currentItem()+count()-1)%count());
if(!itemVisible(currentItem())) {
@@ -183,4 +190,5 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
}
}
+ }
break;
case Key_Down:
@@ -190,4 +198,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
}
if ( count () ) {
+ if ( currentItem()+1 == count () ) {
+ emit nextCell();
+ } else {
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
@@ -199,4 +210,5 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
}
}
+ }
break;
case Key_I:
@@ -227,4 +239,7 @@ void KNoScrollListBox::oneDown()
{
if ( count () ) {
+ if ( currentItem()+1 == count () ) {
+ emit nextCell();
+ } else {
resetOnFocusIn = false;
setCurrentItem((currentItem()+1)%count());
@@ -238,4 +253,5 @@ void KNoScrollListBox::oneDown()
}
}
+}
void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
{
@@ -474,8 +490,9 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
connect( this, SIGNAL( highlighted( QListBoxItem *) ),
SLOT( selection( QListBoxItem * ) ) );
- connect( this, SIGNAL( clicked( QListBoxItem * ) ),
- SLOT( cellClicked( QListBoxItem * ) ) );
+
+ /*
connect( this, SIGNAL( clicked( QListBoxItem * ) ),
SLOT( selection( QListBoxItem * ) ) );
+ */
}
#ifdef DESKTOP_VERSION
@@ -990,4 +1007,5 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
void MonthViewCell::defaultAction( QListBoxItem *item )
{
+
if ( !item ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
@@ -1011,4 +1029,5 @@ void MonthViewCell::newEvent()
void MonthViewCell::cellClicked( QListBoxItem *item )
{
+ qDebug("CELL ");
if ( item == 0 ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
@@ -1016,15 +1035,5 @@ void MonthViewCell::cellClicked( QListBoxItem *item )
return;
}
- /*
- 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();
}
@@ -1152,4 +1161,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
connect( cell, SIGNAL( showDaySignal( QDate ) ),
SIGNAL( showDaySignal( QDate ) ) );
+ connect( cell, SIGNAL( nextCell() ),
+ SLOT( nextCell() ) );
+ connect( cell, SIGNAL( prevCell() ),
+ SLOT( prevCell() ) );
}
}
@@ -1165,4 +1178,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
connect( cell, SIGNAL( showDaySignal( QDate ) ),
SIGNAL( showDaySignal( QDate ) ) );
+ connect( cell, SIGNAL( nextCell() ),
+ SLOT( nextCell() ) );
+ connect( cell, SIGNAL( prevCell() ),
+ SLOT( prevCell() ) );
cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
}
@@ -1975,2 +1992,11 @@ 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
@@ -84,4 +84,6 @@ class KNoScrollListBox: public QListBox
void shiftUp();
void rightClick();
+ void nextCell();
+ void prevCell();
protected slots:
@@ -189,5 +191,4 @@ class MonthViewCell : public KNoScrollListBox
void resizeEvent( QResizeEvent * );
-
public slots:
void showDay();
@@ -257,4 +258,6 @@ class KOMonthView: public KOEventView
NavigatorBar* navigatorBar() { return mNavigatorBar ;}
public slots:
+ void nextCell();
+ void prevCell();
virtual void updateView();
virtual void updateConfig();