summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp52
1 files changed, 42 insertions, 10 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index dfa89e2..df5e060 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -99,25 +99,25 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
{
switch(e->key()) {
case Key_Right:
- // if ( e->state() == Qt::ControlButton )
+ if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
{
e->ignore();
return;
}
- scrollBy(4,0);
+ scrollBy(10,0);
break;
case Key_Left:
- // if ( e->state() == Qt::ControlButton )
+ if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
{
e->ignore();
return;
}
- scrollBy(-4,0);
+ scrollBy(-10,0);
break;
case Key_Up:
- if(count() < 2) {
+ if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
e->ignore();
break;
}
setCurrentItem((currentItem()+count()-1)%count());
@@ -129,9 +129,9 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
}
}
break;
case Key_Down:
- if(count() < 2) {
+ if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
e->ignore();
break;
}
setCurrentItem((currentItem()+1)%count());
@@ -142,8 +142,12 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
setTopItem(topItem()+1);
}
}
break;
+ case Key_I:
+ QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
+ e->ignore();
+ break;
case Key_Shift:
emit shiftDown();
break;
default:
@@ -151,8 +155,19 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
break;
}
}
+void KNoScrollListBox::oneDown()
+{
+ setCurrentItem((currentItem()+1)%count());
+ if(!itemVisible(currentItem())) {
+ if(currentItem() == 0) {
+ setTopItem(0);
+ } else {
+ setTopItem(topItem()+1);
+ }
+ }
+}
void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
{
switch(e->key()) {
case Key_Shift:
@@ -281,8 +296,9 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
//mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
//mLabel->setLineWidth( 1 );
//mLabel->setAlignment( AlignCenter );
mLabel->setFlat( true );
+ mLabel->setFocusPolicy(NoFocus);
mItemList = new KNoScrollListBox( this );
mItemList->setMinimumSize( 10, 10 );
mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain );
mItemList->setLineWidth( 1 );
@@ -400,10 +416,12 @@ void MonthViewCell::clear()
void MonthViewCell::startUpdateCell()
{
+ mItemList->setFocusPolicy(NoFocus);
if ( !mMonthView->isUpdatePossible() )
return;
+
/*
if ( !isVisible() ){
return;
}
@@ -432,8 +450,10 @@ void MonthViewCell::startUpdateCell()
}
void MonthViewCell::insertEvent(Event *event)
{
+
+ mItemList->setFocusPolicy(WheelFocus);
if ( !(event->doesRecur() == Recurrence::rNone) ) {
if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
return;
else
@@ -537,9 +557,9 @@ void MonthViewCell::insertTodo(Todo *todo)
text += KGlobal::locale()->formatTime(todo->dtDue().time());
text += " ";
}
}
- text += i18n("To-Do: %1").arg(todo->summary());
+ text += i18n("Td: %1").arg(todo->summary());
MonthViewItem *item = new MonthViewItem( todo, mDate, text );
//item->setPalette( mStandardPalette );
QPalette pal;
@@ -825,8 +845,9 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
mWeekLabels.resize( mNumWeeks+1 );
mWeekLabelsW.resize( 2 );
for( i = 0; i < mNumWeeks+1; i++ ) {
KOWeekButton *label = new KOWeekButton( mMonthView );
+ label->setFocusPolicy(NoFocus);
label->setFont(bfont);
connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
label->setFlat(true);
QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
@@ -839,8 +860,9 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
for( i = 0; i < 1+1; i++ ) {
KOWeekButton *label = new KOWeekButton( mWeekView );
+ label->setFocusPolicy(NoFocus);
label->setFont(bfont);
connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
label->setFlat(true);
QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
@@ -902,18 +924,21 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
KOMonthView::~KOMonthView()
{
delete mContextMenu;
}
-void KOMonthView::selectDateWeekNum ( int )
-{
-}
void KOMonthView::selectInternalWeekNum ( int n )
{
switchView();
emit selectWeekNum ( n );
}
+int KOMonthView::currentWeek()
+{
+ if ( mShowWeekView )
+ return mWeekLabelsW[0]->getWeekNum();
+ return mWeekLabels[0]->getWeekNum();
+}
void KOMonthView::switchView()
{
if ( selectedCell( ) )
@@ -1538,8 +1563,15 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
}
e->accept();
break;
+ case Key_Return:
+ case Key_Enter:
+ {
+ selectInternalWeekNum ( currentWeek() );
+ }
+ e->accept();
+ break;
default:
e->ignore();
break;
}