author | ulf69 <ulf69> | 2004-10-28 00:07:51 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-28 00:07:51 (UTC) |
commit | 0766b449ccdcc125c18c401d87cc51c277464728 (patch) (side-by-side diff) | |
tree | 5279c7c3f441f448ecb82f1400439e4a7498dde3 /microkde | |
parent | 5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c (diff) | |
download | kdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.zip kdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.tar.gz kdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.tar.bz2 |
bugfix: KListView did not recognize singleclicks
-rw-r--r-- | microkde/kdeui/klistview.cpp | 88 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 7 |
2 files changed, 65 insertions, 30 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 3c809b4..32483bb 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp @@ -517,3 +517,3 @@ void KListView::slotSettingsChanged(int category) //qDebug("KListView::slotSettingsChanged has to be verified"); -/*US + @@ -521,2 +521,24 @@ void KListView::slotSettingsChanged(int category) { + //US I create my private category (=1) to set the settings + case 1: + d->dragDelay = 2; + //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); + qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); + + disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), + this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); + + if( d->bUseSingle ) + connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), + this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); + + //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); + //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); + + if( !d->bUseSingle || !d->bChangeCursorOverItem ) + viewport()->unsetCursor(); + + break; + + /*US case KApplication::SETTINGS_MOUSE: @@ -539,3 +561,2 @@ void KListView::slotSettingsChanged(int category) break; - case KApplication::SETTINGS_POPUPMENU: @@ -559,2 +580,3 @@ void KListView::slotSettingsChanged(int category) break; + */ @@ -563,8 +585,3 @@ void KListView::slotSettingsChanged(int category) } -*/ - if( d->bUseSingle ) - connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), - this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); - } @@ -660,4 +677,5 @@ void KListView::slotHeaderChanged() -void KListView::emitExecute( QListViewItem *item, const QPoint &pos, int c ) +void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c) { + // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { @@ -672,12 +690,3 @@ void KListView::emitExecute( QListViewItem *item, const QPoint &pos, int c ) { -#if 0 -#ifndef Q_WS_QWS - // FIXME(E): Implement for Qt Embedded - Window root; - Window child; - int root_x, root_y, win_x, win_y; - uint keybstate; - XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, - &root_x, &root_y, &win_x, &win_y, &keybstate ); - + //US special implementation for embedded systems d->autoSelect.stop(); @@ -685,3 +694,5 @@ void KListView::emitExecute( QListViewItem *item, const QPoint &pos, int c ) //Dont emit executed if in SC mode and Shift or Ctrl are pressed - if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { + if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) { + // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { + emit executed( item ); @@ -689,4 +700,2 @@ void KListView::emitExecute( QListViewItem *item, const QPoint &pos, int c ) } -#endif -#endif } @@ -744,3 +753,3 @@ bool KListView::event( QEvent *e ) if (e->type() == QEvent::ApplicationPaletteChange) { -qDebug("KListView::event make alternate color configurable"); + //qDebug("KListView::event make alternate color configurable"); //US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); @@ -754,2 +763,3 @@ void KListView::contentsMousePressEvent( QMouseEvent *e ) { + //qDebug("KListView::contentsMousePressEvent"); if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) @@ -817,3 +827,3 @@ void KListView::contentsMouseMoveEvent( QMouseEvent *e ) d->cursorInExecuteArea = isExecuteArea(vp); -qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); + //qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); /*US @@ -878,2 +888,3 @@ void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) { + //qDebug("KListView::contentsMouseDoubleClickEvent"); // We don't want to call the parent method because it does setOpen, @@ -889,6 +900,11 @@ void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) if( item ) { + //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); + emit doubleClicked( item, e->globalPos(), col ); - if( (e->button() == LeftButton) && !d->bUseSingle ) - emitExecute( item, e->globalPos(), col ); + if( (e->button() == LeftButton) && !d->bUseSingle ) { + //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); + + emitExecute( e->button(), item, e->globalPos(), col); + } } @@ -898,4 +914,9 @@ void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoi { - if( (btn == LeftButton) && item ) - emitExecute(item, pos, c); + //qDebug("KListView::slotMouseButtonClicked"); + + if( (btn == LeftButton) && item ) { + //qDebug("KListView::slotMouseButtonClicked: emitExecute"); + + emitExecute(btn, item, pos, c); + } } @@ -985,3 +1006,3 @@ void KListView::contentsDragMoveEvent(QDragMoveEvent *event) { -qDebug("KListView::contentsDropEvent drag&drop not supported yet"); + qDebug("KListView::contentsDropEvent drag&drop not supported yet"); /*US @@ -1890,3 +1911,3 @@ void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) { - qDebug("KListView::emitContextMenu col"); + // qDebug("KListView::emitContextMenu col"); emit contextRequest( i, p, col ); @@ -2184,2 +2205,11 @@ void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in +//US we do not have a "global KDE" variable to setup singleClick functionality +void KListView::setSingleClick(bool s) +{ + d->bUseSingle = s; + slotSettingsChanged(1); + // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); +} + + void KListView::virtual_hook( int, void* ) diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index 8d933f6..d559ce7 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h @@ -374,2 +374,6 @@ public: + //US we do not have a "global KDE" variable to setup singleClick functionality + void setSingleClick(bool s); + + signals: @@ -685,3 +689,4 @@ protected: */ - void emitExecute( QListViewItem *item, const QPoint &pos, int c ); + //US I added buttonstate to pass the current keyboard status + void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c); |