author | zautrix <zautrix> | 2005-02-04 22:22:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-04 22:22:10 (UTC) |
commit | 936b4b2aa37e699052a2517dc2d928d717398cf6 (patch) (unidiff) | |
tree | 964ac33783c2126ecbaea0a2ee72b83ae6475b52 /korganizer/komonthview.cpp | |
parent | 4659ee80518c7d5108c21ba04a12a25eab783113 (diff) | |
download | kdepimpi-936b4b2aa37e699052a2517dc2d928d717398cf6.zip kdepimpi-936b4b2aa37e699052a2517dc2d928d717398cf6.tar.gz kdepimpi-936b4b2aa37e699052a2517dc2d928d717398cf6.tar.bz2 |
fifi
-rw-r--r-- | korganizer/komonthview.cpp | 52 |
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 | |||
@@ -100,23 +100,23 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
100 | 100 | ||
101 | switch(e->key()) { | 101 | switch(e->key()) { |
102 | case Key_Right: | 102 | case Key_Right: |
103 | // if ( e->state() == Qt::ControlButton ) | 103 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
104 | { | 104 | { |
105 | e->ignore(); | 105 | e->ignore(); |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | scrollBy(4,0); | 108 | scrollBy(10,0); |
109 | break; | 109 | break; |
110 | case Key_Left: | 110 | case Key_Left: |
111 | // if ( e->state() == Qt::ControlButton ) | 111 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
112 | { | 112 | { |
113 | e->ignore(); | 113 | e->ignore(); |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | scrollBy(-4,0); | 116 | scrollBy(-10,0); |
117 | break; | 117 | break; |
118 | case Key_Up: | 118 | case Key_Up: |
119 | if(count() < 2) { | 119 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
120 | e->ignore(); | 120 | e->ignore(); |
121 | break; | 121 | break; |
122 | } | 122 | } |
@@ -130,7 +130,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
130 | } | 130 | } |
131 | break; | 131 | break; |
132 | case Key_Down: | 132 | case Key_Down: |
133 | if(count() < 2) { | 133 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
134 | e->ignore(); | 134 | e->ignore(); |
135 | break; | 135 | break; |
136 | } | 136 | } |
@@ -143,6 +143,10 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
143 | } | 143 | } |
144 | } | 144 | } |
145 | break; | 145 | break; |
146 | case Key_I: | ||
147 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | ||
148 | e->ignore(); | ||
149 | break; | ||
146 | case Key_Shift: | 150 | case Key_Shift: |
147 | emit shiftDown(); | 151 | emit shiftDown(); |
148 | break; | 152 | break; |
@@ -152,6 +156,17 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
152 | } | 156 | } |
153 | } | 157 | } |
154 | 158 | ||
159 | void KNoScrollListBox::oneDown() | ||
160 | { | ||
161 | setCurrentItem((currentItem()+1)%count()); | ||
162 | if(!itemVisible(currentItem())) { | ||
163 | if(currentItem() == 0) { | ||
164 | setTopItem(0); | ||
165 | } else { | ||
166 | setTopItem(topItem()+1); | ||
167 | } | ||
168 | } | ||
169 | } | ||
155 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 170 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
156 | { | 171 | { |
157 | switch(e->key()) { | 172 | switch(e->key()) { |
@@ -282,6 +297,7 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | |||
282 | //mLabel->setLineWidth( 1 ); | 297 | //mLabel->setLineWidth( 1 ); |
283 | //mLabel->setAlignment( AlignCenter ); | 298 | //mLabel->setAlignment( AlignCenter ); |
284 | mLabel->setFlat( true ); | 299 | mLabel->setFlat( true ); |
300 | mLabel->setFocusPolicy(NoFocus); | ||
285 | mItemList = new KNoScrollListBox( this ); | 301 | mItemList = new KNoScrollListBox( this ); |
286 | mItemList->setMinimumSize( 10, 10 ); | 302 | mItemList->setMinimumSize( 10, 10 ); |
287 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 303 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
@@ -401,8 +417,10 @@ void MonthViewCell::clear() | |||
401 | void MonthViewCell::startUpdateCell() | 417 | void MonthViewCell::startUpdateCell() |
402 | { | 418 | { |
403 | 419 | ||
420 | mItemList->setFocusPolicy(NoFocus); | ||
404 | if ( !mMonthView->isUpdatePossible() ) | 421 | if ( !mMonthView->isUpdatePossible() ) |
405 | return; | 422 | return; |
423 | |||
406 | /* | 424 | /* |
407 | if ( !isVisible() ){ | 425 | if ( !isVisible() ){ |
408 | return; | 426 | return; |
@@ -433,6 +451,8 @@ void MonthViewCell::startUpdateCell() | |||
433 | 451 | ||
434 | void MonthViewCell::insertEvent(Event *event) | 452 | void MonthViewCell::insertEvent(Event *event) |
435 | { | 453 | { |
454 | |||
455 | mItemList->setFocusPolicy(WheelFocus); | ||
436 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 456 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
437 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 457 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
438 | return; | 458 | return; |
@@ -538,7 +558,7 @@ void MonthViewCell::insertTodo(Todo *todo) | |||
538 | text += " "; | 558 | text += " "; |
539 | } | 559 | } |
540 | } | 560 | } |
541 | text += i18n("To-Do: %1").arg(todo->summary()); | 561 | text += i18n("Td: %1").arg(todo->summary()); |
542 | 562 | ||
543 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 563 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
544 | //item->setPalette( mStandardPalette ); | 564 | //item->setPalette( mStandardPalette ); |
@@ -826,6 +846,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
826 | mWeekLabelsW.resize( 2 ); | 846 | mWeekLabelsW.resize( 2 ); |
827 | for( i = 0; i < mNumWeeks+1; i++ ) { | 847 | for( i = 0; i < mNumWeeks+1; i++ ) { |
828 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 848 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
849 | label->setFocusPolicy(NoFocus); | ||
829 | label->setFont(bfont); | 850 | label->setFont(bfont); |
830 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 851 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
831 | label->setFlat(true); | 852 | label->setFlat(true); |
@@ -840,6 +861,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
840 | 861 | ||
841 | for( i = 0; i < 1+1; i++ ) { | 862 | for( i = 0; i < 1+1; i++ ) { |
842 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 863 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
864 | label->setFocusPolicy(NoFocus); | ||
843 | label->setFont(bfont); | 865 | label->setFont(bfont); |
844 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 866 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
845 | label->setFlat(true); | 867 | label->setFlat(true); |
@@ -903,16 +925,19 @@ KOMonthView::~KOMonthView() | |||
903 | { | 925 | { |
904 | delete mContextMenu; | 926 | delete mContextMenu; |
905 | } | 927 | } |
906 | void KOMonthView::selectDateWeekNum ( int ) | ||
907 | { | ||
908 | 928 | ||
909 | } | ||
910 | void KOMonthView::selectInternalWeekNum ( int n ) | 929 | void KOMonthView::selectInternalWeekNum ( int n ) |
911 | { | 930 | { |
912 | switchView(); | 931 | switchView(); |
913 | emit selectWeekNum ( n ); | 932 | emit selectWeekNum ( n ); |
914 | } | 933 | } |
915 | 934 | ||
935 | int KOMonthView::currentWeek() | ||
936 | { | ||
937 | if ( mShowWeekView ) | ||
938 | return mWeekLabelsW[0]->getWeekNum(); | ||
939 | return mWeekLabels[0]->getWeekNum(); | ||
940 | } | ||
916 | void KOMonthView::switchView() | 941 | void KOMonthView::switchView() |
917 | { | 942 | { |
918 | 943 | ||
@@ -1539,6 +1564,13 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) | |||
1539 | } | 1564 | } |
1540 | e->accept(); | 1565 | e->accept(); |
1541 | break; | 1566 | break; |
1567 | case Key_Return: | ||
1568 | case Key_Enter: | ||
1569 | { | ||
1570 | selectInternalWeekNum ( currentWeek() ); | ||
1571 | } | ||
1572 | e->accept(); | ||
1573 | break; | ||
1542 | default: | 1574 | default: |
1543 | e->ignore(); | 1575 | e->ignore(); |
1544 | break; | 1576 | break; |