summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-04-04 13:27:55 (UTC)
committer zautrix <zautrix>2005-04-04 13:27:55 (UTC)
commit13fa1e5e1d5e4663bbbc79e0c68caf725ad2e31b (patch) (side-by-side diff)
tree956518730f29846d70544142b6875636713a8b9b /korganizer/komonthview.cpp
parent919f1060a9ef41e6c865f28132cf9e82c3f67409 (diff)
downloadkdepimpi-13fa1e5e1d5e4663bbbc79e0c68caf725ad2e31b.zip
kdepimpi-13fa1e5e1d5e4663bbbc79e0c68caf725ad2e31b.tar.gz
kdepimpi-13fa1e5e1d5e4663bbbc79e0c68caf725ad2e31b.tar.bz2
monthview fix
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index ab9a4b6..9f7db69 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -74,29 +74,51 @@ private:
KNoScrollListBox* _wid;
};
KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
: QListBox(parent, name, WRepaintNoErase)
{
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
mWT = new KNOWhatsThis(this);
+ resetOnFocusIn = true;
}
KNoScrollListBox::~KNoScrollListBox()
{
}
+
+
+void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
+{
+ QListBox::focusInEvent ( e );
+ QListBoxItem * i = item ( 0 );
+ if ( i && resetOnFocusIn ) {
+ setCurrentItem( i );
+ setSelected ( 0, true );
+ }
+ resetOnFocusIn = true;
+}
+void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
+{
+ int i = currentItem ();
+ if ( i >= 0 ) {
+ setSelected ( i, false );
+ }
+ QListBox::focusOutEvent ( e );
+}
+
QString KNoScrollListBox::getWhatsThisText(QPoint p)
{
QListBoxItem* item = itemAt ( p );
if ( ! item ) {
return i18n("Click in the cell\nto add an event!");
}
return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
}
void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
@@ -143,50 +165,51 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
if ( count () ) {
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
if(currentItem() == 0) {
setTopItem(0);
} else {
setTopItem(topItem()+1);
}
}
}
break;
case Key_I:
- QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
+ QTimer::singleShot( 1, 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();
break;
}
}
void KNoScrollListBox::oneDown()
{
- if ( count () ) {
+ if ( count () ) {
+ resetOnFocusIn = false;
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
if(currentItem() == 0) {
setTopItem(0);
} else {
setTopItem(topItem()+1);
}
}
}
}
void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
{