summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (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
@@ -96,11 +96,14 @@ KNoScrollListBox::~KNoScrollListBox()
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;
if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
@@ -125,6 +128,7 @@ void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
}
}
}
+}
void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
{
int i = currentItem ();
@@ -173,6 +177,9 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
break;
}
if ( count() ) {
+ if ( currentItem() == 0 ) {
+ emit prevCell();
+ } else {
setCurrentItem((currentItem()+count()-1)%count());
if(!itemVisible(currentItem())) {
if((unsigned int) currentItem() == (count()-1)) {
@@ -182,6 +189,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
}
}
}
+ }
break;
case Key_Down:
if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
@@ -189,6 +197,9 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
break;
}
if ( count () ) {
+ if ( currentItem()+1 == count () ) {
+ emit nextCell();
+ } else {
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
if(currentItem() == 0) {
@@ -198,6 +209,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
}
}
}
+ }
break;
case Key_I:
QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
@@ -226,6 +238,9 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
void KNoScrollListBox::oneDown()
{
if ( count () ) {
+ if ( currentItem()+1 == count () ) {
+ emit nextCell();
+ } else {
resetOnFocusIn = false;
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
@@ -237,6 +252,7 @@ void KNoScrollListBox::oneDown()
}
}
}
+}
void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
{
switch(e->key()) {
@@ -473,10 +489,11 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
SLOT( contextMenu( QListBoxItem * ) ) );
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
QToolTipGroup *MonthViewCell::toolTipGroup()
@@ -989,6 +1006,7 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
void MonthViewCell::defaultAction( QListBoxItem *item )
{
+
if ( !item ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newEventSignal( dt );
@@ -1010,22 +1028,13 @@ void MonthViewCell::newEvent()
}
void MonthViewCell::cellClicked( QListBoxItem *item )
{
+ qDebug("CELL ");
if ( item == 0 ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newEventSignal( dt );
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();
}
void MonthViewCell::contextMenu( QListBoxItem *item )
@@ -1151,6 +1160,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
SIGNAL( newEventSignal( QDateTime ) ) );
connect( cell, SIGNAL( showDaySignal( QDate ) ),
SIGNAL( showDaySignal( QDate ) ) );
+ connect( cell, SIGNAL( nextCell() ),
+ SLOT( nextCell() ) );
+ connect( cell, SIGNAL( prevCell() ),
+ SLOT( prevCell() ) );
}
}
mCellsW.resize( mDaysPerWeek );
@@ -1164,6 +1177,10 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
SIGNAL( newEventSignal( QDateTime ) ) );
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 );
}
@@ -1974,3 +1991,12 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
break;
}
}
+
+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
@@ -83,6 +83,8 @@ class KNoScrollListBox: public QListBox
void shiftDown();
void shiftUp();
void rightClick();
+ void nextCell();
+ void prevCell();
protected slots:
void oneDown();
@@ -188,7 +190,6 @@ class MonthViewCell : public KNoScrollListBox
QStringList mToolTip;
void resizeEvent( QResizeEvent * );
-
public slots:
void showDay();
@@ -256,6 +257,8 @@ class KOMonthView: public KOEventView
bool skipResize;
NavigatorBar* navigatorBar() { return mNavigatorBar ;}
public slots:
+ void nextCell();
+ void prevCell();
virtual void updateView();
virtual void updateConfig();
virtual void showDates(const QDate &start, const QDate &end);