summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-30 19:13:02 (UTC)
committer zautrix <zautrix>2005-03-30 19:13:02 (UTC)
commitb9ec42913b1dc7fc39848f245e55c7b36d7c2fa6 (patch) (side-by-side diff)
tree1ef705404ced1d9616f5334923d8d1db446766c9 /korganizer
parent5e354884787756ceaf663ea48167c5193dad6bf1 (diff)
downloadkdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.zip
kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.tar.gz
kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.tar.bz2
more fixes
Diffstat (limited to 'korganizer') (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)
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
}
void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
{
-
+ //qDebug("KNoScrollListBox::keyPressEvent ");
switch(e->key()) {
case Key_Right:
if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
{
e->ignore();
return;
@@ -151,12 +151,23 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
}
}
break;
case Key_I:
QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
e->ignore();
+ break;
+ case Key_Return:
+ case Key_Enter:
+ {
+ if ( currentItem() >= 0 ) {
+ emit doubleClicked( item( currentItem() ) );
+ e->accept();
+ } else {
+ e->ignore();
+ }
+ }
break;
case Key_Shift:
emit shiftDown();
break;
default:
e->ignore();
@@ -310,14 +321,14 @@ void MonthViewItem::paint(QPainter *p)
p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
x += half+half + 4;
} else {
int val = td->percentComplete()/20;
- p->fillRect ( x+1, y-1, val ,size+2,Qt::black );
- p->drawRect ( x, y-1,7,size+2);
+ p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
+ p->drawRect ( x, y-2,7,size+4);
x += size + 3;
}
}
QFontMetrics fm = p->fontMetrics();
int yPos;
int pmheight = size;
@@ -1049,12 +1060,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
//label->setFrameStyle(QFrame::Panel|QFrame::Raised);
//label->setLineWidth(1);
//label->setAlignment(AlignCenter);
mWeekLabels.insert( i, label );
}
mWeekLabels[mNumWeeks]->setText( i18n("W"));
+ mWeekLabels[0]->setFocusPolicy(WheelFocus);
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);
@@ -1064,12 +1076,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
//label->setFrameStyle(QFrame::Panel|QFrame::Raised);
//label->setLineWidth(1);
//label->setAlignment(AlignCenter);
mWeekLabelsW.insert( i, label );
}
mWeekLabelsW[1]->setText( i18n("W"));
+ mWeekLabelsW[0]->setFocusPolicy(WheelFocus);
int row, col;
mCells.resize( mNumCells );
for( row = 0; row < mNumWeeks; ++row ) {
for( col = 0; col < mDaysPerWeek; ++col ) {
@@ -1463,15 +1476,13 @@ void KOMonthView::updateView()
}
processSelectionChange();
//qApp->processEvents();
for( i = 0; i < timeSpan+1; ++i ) {
(*cells)[i]->repaintfinishUpdateCell();
}
- (*cells)[0]->setFocus();
-
-
+ setKeyBFocus();
#else
// old code
//qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
int i;
for( i = 0; i < (*cells).count(); ++i ) {
(*cells)[i]->updateCell();
@@ -1483,12 +1494,32 @@ void KOMonthView::updateView()
(*cells)[0]->setFocus();
#endif
//qDebug("update time %d ", ti.elapsed());
}
+void KOMonthView::setKeyBoardFocus()
+{
+ bool shootAgain = false;
+ if ( mShowWeekView ) {
+ shootAgain = !mWeekLabelsW[0]->hasFocus();
+ mWeekLabelsW[0]->setFocus();
+ }
+ else {
+ shootAgain = !mWeekLabels[0]->hasFocus();
+ mWeekLabels[0]->setFocus();
+ }
+ if ( shootAgain ) {
+ QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) );
+ }
+}
+void KOMonthView::setKeyBFocus()
+{
+ //qDebug("KOMonthView::setKeyBFocus() ");
+ QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
+}
void KOMonthView::resizeEvent(QResizeEvent * e)
{
//qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
if ( isVisible() ) {
//qDebug("KOMonthView::isVisible ");
slotComputeLayout();
@@ -1498,18 +1529,14 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
void KOMonthView::slotComputeLayout()
{
mComputeLayoutTimer->stop();
//qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
computeLayout();
- clPending = true;
- if ( mShowWeekView )
- mCellsW[0]->setFocus();
- else
- mCells[0]->setFocus();
-
+ clPending = true;
+ setKeyBFocus();
}
void KOMonthView::computeLayoutWeek()
{
static int lastWid = 0;
static int lastHei = 0;
int daysToShow;
@@ -1814,30 +1841,26 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
{
//qDebug("KOMonthView::keyPressEvent ");
switch(e->key()) {
case Key_Up:
{
if ( mShowWeekView ) {
- mCellsW[0]->setFocus();
emit selectWeekNum ( currentWeek() - 1 );
}
else {
- mCells[0]->setFocus();
emit prevMonth();
}
}
e->accept();
break;
case Key_Down:
{
if ( mShowWeekView ) {
- mCellsW[0]->setFocus();
emit selectWeekNum ( currentWeek() +1);
}
else {
- mCells[0]->setFocus();
emit nextMonth();
}
}
e->accept();
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
void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
int getWeekNum() { return mNumber;}
signals:
void selectWeekNum ( int );
private:
int mNumber;
+ void keyPressEvent ( QKeyEvent * e )
+ {
+ e->ignore();
+ }
+
private slots :
void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
};
class KNoScrollListBox: public QListBox
{
@@ -160,13 +165,12 @@ class MonthViewCell : public KNoScrollListBox
Incidence *selectedIncidence();
QDate selectedIncidenceDate();
QPushButton * dateLabel() { return mLabel; }
void deselect();
void select();
-
#ifdef DESKTOP_VERSION
static QToolTipGroup *toolTipGroup();
#endif
signals:
void defaultAction( Incidence * );
void newEventSignal( QDateTime );
@@ -254,12 +258,14 @@ class KOMonthView: public KOEventView
void clearSelection();
void showContextMenu( Incidence * );
void setSelectedCell( MonthViewCell * );
void switchView();
+ void setKeyBoardFocus();
+ void setKeyBFocus();
protected slots:
void slotComputeLayout();
void selectInternalWeekNum ( int );
void processSelectionChange();
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()
full = false;
else
full = true;
}
mMainView->dateNavigator()->selectWeek();
showView(mMonthView, full );
+ mMonthView->setKeyBFocus();
}
void KOViewManager::showMonth( const QDate & date )
{
mMainView->dateNavigator()->blockSignals( true );
mMainView->dateNavigator()->selectDate( date );
@@ -673,12 +674,13 @@ void KOViewManager::showMonthView()
else
full = true;
}
mMainView->dateNavigator()->selectMonth();
showView(mMonthView, full );
+ mMonthView->setKeyBFocus();
}
void KOViewManager::showTodoView()
{
//mFlagShowNextxDays = false;