author | zautrix <zautrix> | 2005-02-04 22:22:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-04 22:22:10 (UTC) |
commit | 936b4b2aa37e699052a2517dc2d928d717398cf6 (patch) (side-by-side diff) | |
tree | 964ac33783c2126ecbaea0a2ee72b83ae6475b52 /korganizer | |
parent | 4659ee80518c7d5108c21ba04a12a25eab783113 (diff) | |
download | kdepimpi-936b4b2aa37e699052a2517dc2d928d717398cf6.zip kdepimpi-936b4b2aa37e699052a2517dc2d928d717398cf6.tar.gz kdepimpi-936b4b2aa37e699052a2517dc2d928d717398cf6.tar.bz2 |
fifi
-rw-r--r-- | korganizer/kdatenavigator.cpp | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 52 | ||||
-rw-r--r-- | korganizer/komonthview.h | 4 |
3 files changed, 46 insertions, 12 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index f31e50a..c08f44f 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -58,7 +58,7 @@ KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar, QGridLayout *topLayout = new QGridLayout(this,8,8); if (! startDate.isValid()) { - kdDebug() << "KDateNavigator::KDateNavigator(): an invalid date was passed as a parameter!" << endl; + qDebug("KDateNavigator::invalid startdate "); startDate = QDate::currentDate(); } diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index dfa89e2..df5e060 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -100,23 +100,23 @@ 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; } @@ -130,7 +130,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) } break; case Key_Down: - if(count() < 2) { + if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { e->ignore(); break; } @@ -143,6 +143,10 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) } } break; + case Key_I: + QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); + e->ignore(); + break; case Key_Shift: emit shiftDown(); break; @@ -152,6 +156,17 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) } } +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()) { @@ -282,6 +297,7 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) //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 ); @@ -401,8 +417,10 @@ void MonthViewCell::clear() void MonthViewCell::startUpdateCell() { + mItemList->setFocusPolicy(NoFocus); if ( !mMonthView->isUpdatePossible() ) return; + /* if ( !isVisible() ){ return; @@ -433,6 +451,8 @@ 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; @@ -538,7 +558,7 @@ void MonthViewCell::insertTodo(Todo *todo) 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 ); @@ -826,6 +846,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 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); @@ -840,6 +861,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 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); @@ -903,16 +925,19 @@ 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() { @@ -1539,6 +1564,13 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) } e->accept(); break; + case Key_Return: + case Key_Enter: + { + selectInternalWeekNum ( currentWeek() ); + } + e->accept(); + break; default: e->ignore(); break; diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 700f098..51eb9e6 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -54,6 +54,7 @@ class KOWeekButton : public QPushButton mNumber = -1; } void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} + int getWeekNum() { return mNumber;} signals: void selectWeekNum ( int ); private: @@ -76,6 +77,7 @@ class KNoScrollListBox: public QListBox void rightClick(); protected slots: + void oneDown(); void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void mousePressEvent(QMouseEvent *); @@ -241,7 +243,6 @@ class KOMonthView: public KOEventView void setSelectedCell( MonthViewCell * ); protected slots: - void selectDateWeekNum ( int ); void selectInternalWeekNum ( int ); void switchView(); void processSelectionChange(); @@ -257,6 +258,7 @@ class KOMonthView: public KOEventView void updateDayLabels(); private: + int currentWeek(); bool clPending; QWidgetStack * mWidStack; QWidget* mMonthView; |