summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-30 19:13:02 (UTC)
committer zautrix <zautrix>2005-03-30 19:13:02 (UTC)
commitb9ec42913b1dc7fc39848f245e55c7b36d7c2fa6 (patch) (unidiff)
tree1ef705404ced1d9616f5334923d8d1db446766c9
parent5e354884787756ceaf663ea48167c5193dad6bf1 (diff)
downloadkdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.zip
kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.tar.gz
kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.tar.bz2
more fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp55
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koviewmanager.cpp2
3 files changed, 48 insertions, 17 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 940d288..ca35a86 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -98,13 +98,13 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p)
98 KOPrefs::instance()->mWTshowDetails, 98 KOPrefs::instance()->mWTshowDetails,
99 KOPrefs::instance()->mWTshowCreated, 99 KOPrefs::instance()->mWTshowCreated,
100 KOPrefs::instance()->mWTshowChanged); 100 KOPrefs::instance()->mWTshowChanged);
101} 101}
102void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 102void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
103{ 103{
104 104 //qDebug("KNoScrollListBox::keyPressEvent ");
105 switch(e->key()) { 105 switch(e->key()) {
106 case Key_Right: 106 case Key_Right:
107 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 107 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
108 { 108 {
109 e->ignore(); 109 e->ignore();
110 return; 110 return;
@@ -151,12 +151,23 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
151 } 151 }
152 } 152 }
153 break; 153 break;
154 case Key_I: 154 case Key_I:
155 QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); 155 QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
156 e->ignore(); 156 e->ignore();
157 break;
158 case Key_Return:
159 case Key_Enter:
160 {
161 if ( currentItem() >= 0 ) {
162 emit doubleClicked( item( currentItem() ) );
163 e->accept();
164 } else {
165 e->ignore();
166 }
167 }
157 break; 168 break;
158 case Key_Shift: 169 case Key_Shift:
159 emit shiftDown(); 170 emit shiftDown();
160 break; 171 break;
161 default: 172 default:
162 e->ignore(); 173 e->ignore();
@@ -310,14 +321,14 @@ void MonthViewItem::paint(QPainter *p)
310 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 321 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
311 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 322 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
312 x += half+half + 4; 323 x += half+half + 4;
313 324
314 } else { 325 } else {
315 int val = td->percentComplete()/20; 326 int val = td->percentComplete()/20;
316 p->fillRect ( x+1, y-1, val ,size+2,Qt::black ); 327 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
317 p->drawRect ( x, y-1,7,size+2); 328 p->drawRect ( x, y-2,7,size+4);
318 x += size + 3; 329 x += size + 3;
319 } 330 }
320 } 331 }
321 QFontMetrics fm = p->fontMetrics(); 332 QFontMetrics fm = p->fontMetrics();
322 int yPos; 333 int yPos;
323 int pmheight = size; 334 int pmheight = size;
@@ -1049,12 +1060,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1049 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1060 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1050 //label->setLineWidth(1); 1061 //label->setLineWidth(1);
1051 //label->setAlignment(AlignCenter); 1062 //label->setAlignment(AlignCenter);
1052 mWeekLabels.insert( i, label ); 1063 mWeekLabels.insert( i, label );
1053 } 1064 }
1054 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1065 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1066 mWeekLabels[0]->setFocusPolicy(WheelFocus);
1055 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1067 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1056 1068
1057 for( i = 0; i < 1+1; i++ ) { 1069 for( i = 0; i < 1+1; i++ ) {
1058 KOWeekButton *label = new KOWeekButton( mWeekView ); 1070 KOWeekButton *label = new KOWeekButton( mWeekView );
1059 label->setFocusPolicy(NoFocus); 1071 label->setFocusPolicy(NoFocus);
1060 label->setFont(bfont); 1072 label->setFont(bfont);
@@ -1064,12 +1076,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1064 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1076 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1065 //label->setLineWidth(1); 1077 //label->setLineWidth(1);
1066 //label->setAlignment(AlignCenter); 1078 //label->setAlignment(AlignCenter);
1067 mWeekLabelsW.insert( i, label ); 1079 mWeekLabelsW.insert( i, label );
1068 } 1080 }
1069 mWeekLabelsW[1]->setText( i18n("W")); 1081 mWeekLabelsW[1]->setText( i18n("W"));
1082 mWeekLabelsW[0]->setFocusPolicy(WheelFocus);
1070 1083
1071 1084
1072 int row, col; 1085 int row, col;
1073 mCells.resize( mNumCells ); 1086 mCells.resize( mNumCells );
1074 for( row = 0; row < mNumWeeks; ++row ) { 1087 for( row = 0; row < mNumWeeks; ++row ) {
1075 for( col = 0; col < mDaysPerWeek; ++col ) { 1088 for( col = 0; col < mDaysPerWeek; ++col ) {
@@ -1463,15 +1476,13 @@ void KOMonthView::updateView()
1463 } 1476 }
1464 processSelectionChange(); 1477 processSelectionChange();
1465 //qApp->processEvents(); 1478 //qApp->processEvents();
1466 for( i = 0; i < timeSpan+1; ++i ) { 1479 for( i = 0; i < timeSpan+1; ++i ) {
1467 (*cells)[i]->repaintfinishUpdateCell(); 1480 (*cells)[i]->repaintfinishUpdateCell();
1468 } 1481 }
1469 (*cells)[0]->setFocus(); 1482 setKeyBFocus();
1470
1471
1472#else 1483#else
1473 // old code 1484 // old code
1474 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1485 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1475 int i; 1486 int i;
1476 for( i = 0; i < (*cells).count(); ++i ) { 1487 for( i = 0; i < (*cells).count(); ++i ) {
1477 (*cells)[i]->updateCell(); 1488 (*cells)[i]->updateCell();
@@ -1483,12 +1494,32 @@ void KOMonthView::updateView()
1483 (*cells)[0]->setFocus(); 1494 (*cells)[0]->setFocus();
1484#endif 1495#endif
1485 1496
1486 //qDebug("update time %d ", ti.elapsed()); 1497 //qDebug("update time %d ", ti.elapsed());
1487} 1498}
1488 1499
1500void KOMonthView::setKeyBoardFocus()
1501{
1502 bool shootAgain = false;
1503 if ( mShowWeekView ) {
1504 shootAgain = !mWeekLabelsW[0]->hasFocus();
1505 mWeekLabelsW[0]->setFocus();
1506 }
1507 else {
1508 shootAgain = !mWeekLabels[0]->hasFocus();
1509 mWeekLabels[0]->setFocus();
1510 }
1511 if ( shootAgain ) {
1512 QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) );
1513 }
1514}
1515void KOMonthView::setKeyBFocus()
1516{
1517 //qDebug("KOMonthView::setKeyBFocus() ");
1518 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
1519}
1489void KOMonthView::resizeEvent(QResizeEvent * e) 1520void KOMonthView::resizeEvent(QResizeEvent * e)
1490{ 1521{
1491 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1522 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1492 if ( isVisible() ) { 1523 if ( isVisible() ) {
1493 //qDebug("KOMonthView::isVisible "); 1524 //qDebug("KOMonthView::isVisible ");
1494 slotComputeLayout(); 1525 slotComputeLayout();
@@ -1498,18 +1529,14 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
1498 1529
1499void KOMonthView::slotComputeLayout() 1530void KOMonthView::slotComputeLayout()
1500{ 1531{
1501 mComputeLayoutTimer->stop(); 1532 mComputeLayoutTimer->stop();
1502 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1533 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1503 computeLayout(); 1534 computeLayout();
1504 clPending = true; 1535 clPending = true;
1505 if ( mShowWeekView ) 1536 setKeyBFocus();
1506 mCellsW[0]->setFocus();
1507 else
1508 mCells[0]->setFocus();
1509
1510} 1537}
1511void KOMonthView::computeLayoutWeek() 1538void KOMonthView::computeLayoutWeek()
1512{ 1539{
1513 static int lastWid = 0; 1540 static int lastWid = 0;
1514 static int lastHei = 0; 1541 static int lastHei = 0;
1515 int daysToShow; 1542 int daysToShow;
@@ -1814,30 +1841,26 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
1814{ 1841{
1815 //qDebug("KOMonthView::keyPressEvent "); 1842 //qDebug("KOMonthView::keyPressEvent ");
1816 switch(e->key()) { 1843 switch(e->key()) {
1817 case Key_Up: 1844 case Key_Up:
1818 { 1845 {
1819 if ( mShowWeekView ) { 1846 if ( mShowWeekView ) {
1820 mCellsW[0]->setFocus();
1821 emit selectWeekNum ( currentWeek() - 1 ); 1847 emit selectWeekNum ( currentWeek() - 1 );
1822 } 1848 }
1823 else { 1849 else {
1824 mCells[0]->setFocus();
1825 emit prevMonth(); 1850 emit prevMonth();
1826 } 1851 }
1827 } 1852 }
1828 e->accept(); 1853 e->accept();
1829 break; 1854 break;
1830 case Key_Down: 1855 case Key_Down:
1831 { 1856 {
1832 if ( mShowWeekView ) { 1857 if ( mShowWeekView ) {
1833 mCellsW[0]->setFocus();
1834 emit selectWeekNum ( currentWeek() +1); 1858 emit selectWeekNum ( currentWeek() +1);
1835 } 1859 }
1836 else { 1860 else {
1837 mCells[0]->setFocus();
1838 emit nextMonth(); 1861 emit nextMonth();
1839 } 1862 }
1840 1863
1841 } 1864 }
1842 e->accept(); 1865 e->accept();
1843 break; 1866 break;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 9e724c7..c1ca3d4 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -58,12 +58,17 @@ class KOWeekButton : public QPushButton
58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
59 int getWeekNum() { return mNumber;} 59 int getWeekNum() { return mNumber;}
60 signals: 60 signals:
61 void selectWeekNum ( int ); 61 void selectWeekNum ( int );
62private: 62private:
63 int mNumber; 63 int mNumber;
64 void keyPressEvent ( QKeyEvent * e )
65 {
66 e->ignore();
67 }
68
64private slots : 69private slots :
65 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 70 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
66}; 71};
67 72
68class KNoScrollListBox: public QListBox 73class KNoScrollListBox: public QListBox
69{ 74{
@@ -160,13 +165,12 @@ class MonthViewCell : public KNoScrollListBox
160 Incidence *selectedIncidence(); 165 Incidence *selectedIncidence();
161 QDate selectedIncidenceDate(); 166 QDate selectedIncidenceDate();
162 QPushButton * dateLabel() { return mLabel; } 167 QPushButton * dateLabel() { return mLabel; }
163 168
164 void deselect(); 169 void deselect();
165 void select(); 170 void select();
166
167#ifdef DESKTOP_VERSION 171#ifdef DESKTOP_VERSION
168 static QToolTipGroup *toolTipGroup(); 172 static QToolTipGroup *toolTipGroup();
169#endif 173#endif
170 signals: 174 signals:
171 void defaultAction( Incidence * ); 175 void defaultAction( Incidence * );
172 void newEventSignal( QDateTime ); 176 void newEventSignal( QDateTime );
@@ -254,12 +258,14 @@ class KOMonthView: public KOEventView
254 void clearSelection(); 258 void clearSelection();
255 259
256 void showContextMenu( Incidence * ); 260 void showContextMenu( Incidence * );
257 261
258 void setSelectedCell( MonthViewCell * ); 262 void setSelectedCell( MonthViewCell * );
259 void switchView(); 263 void switchView();
264 void setKeyBoardFocus();
265 void setKeyBFocus();
260 266
261 protected slots: 267 protected slots:
262 void slotComputeLayout(); 268 void slotComputeLayout();
263 void selectInternalWeekNum ( int ); 269 void selectInternalWeekNum ( int );
264 void processSelectionChange(); 270 void processSelectionChange();
265 signals: 271 signals:
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 53cd011..548ffd3 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -644,12 +644,13 @@ void KOViewManager::showMonthViewWeek()
644 full = false; 644 full = false;
645 else 645 else
646 full = true; 646 full = true;
647 } 647 }
648 mMainView->dateNavigator()->selectWeek(); 648 mMainView->dateNavigator()->selectWeek();
649 showView(mMonthView, full ); 649 showView(mMonthView, full );
650 mMonthView->setKeyBFocus();
650} 651}
651 652
652void KOViewManager::showMonth( const QDate & date ) 653void KOViewManager::showMonth( const QDate & date )
653{ 654{
654 mMainView->dateNavigator()->blockSignals( true ); 655 mMainView->dateNavigator()->blockSignals( true );
655 mMainView->dateNavigator()->selectDate( date ); 656 mMainView->dateNavigator()->selectDate( date );
@@ -673,12 +674,13 @@ void KOViewManager::showMonthView()
673 else 674 else
674 full = true; 675 full = true;
675 } 676 }
676 mMainView->dateNavigator()->selectMonth(); 677 mMainView->dateNavigator()->selectMonth();
677 678
678 showView(mMonthView, full ); 679 showView(mMonthView, full );
680 mMonthView->setKeyBFocus();
679 681
680} 682}
681 683
682void KOViewManager::showTodoView() 684void KOViewManager::showTodoView()
683{ 685{
684 //mFlagShowNextxDays = false; 686 //mFlagShowNextxDays = false;