-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 @@ -515,10 +515,32 @@ void KListView::slotOnViewport() void KListView::slotSettingsChanged(int category) { //qDebug("KListView::slotSettingsChanged has to be verified"); -/*US + switch (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: d->dragDelay = KGlobalSettings::dndEventDelay(); d->bUseSingle = KGlobalSettings::singleClick(); @@ -537,7 +559,6 @@ void KListView::slotSettingsChanged(int category) viewport()->unsetCursor(); break; - case KApplication::SETTINGS_POPUPMENU: d->contextMenuKey = KGlobalSettings::contextMenuKey (); d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); @@ -557,16 +578,12 @@ void KListView::slotSettingsChanged(int category) this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); } break; + */ default: break; } -*/ - if( d->bUseSingle ) - connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), - this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); - } void KListView::slotAutoSelect() @@ -658,8 +675,9 @@ 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) ) ) { // Double click mode ? @@ -670,25 +688,16 @@ void KListView::emitExecute( QListViewItem *item, const QPoint &pos, int c ) } else { -#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(); //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 ); emit executed( item, pos, c ); } -#endif -#endif } } } @@ -742,7 +751,7 @@ void KListView::leaveEvent( QEvent *e ) 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(); d->alternateBackground = QColor(240, 240, 240); } @@ -752,6 +761,7 @@ qDebug("KListView::event make alternate color configurable"); void KListView::contentsMousePressEvent( QMouseEvent *e ) { + //qDebug("KListView::contentsMousePressEvent"); if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) { bool block = signalsBlocked(); @@ -815,7 +825,7 @@ void KListView::contentsMouseMoveEvent( QMouseEvent *e ) (isExecuteArea(vp) != d->cursorInExecuteArea) ) { d->cursorInExecuteArea = isExecuteArea(vp); -qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); + //qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet"); /*US if( d->cursorInExecuteArea ) //cursor moved in execute area viewport()->setCursor( KCursor::handCursor() ); @@ -876,6 +886,7 @@ void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) { + //qDebug("KListView::contentsMouseDoubleClickEvent"); // We don't want to call the parent method because it does setOpen, // whereas we don't do it in single click mode... (David) //QListView::contentsMouseDoubleClickEvent( e ); @@ -887,17 +898,27 @@ void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; 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); + } } } void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) { - if( (btn == LeftButton) && item ) - emitExecute(item, pos, c); + //qDebug("KListView::slotMouseButtonClicked"); + + if( (btn == LeftButton) && item ) { + //qDebug("KListView::slotMouseButtonClicked: emitExecute"); + + emitExecute(btn, item, pos, c); + } } void KListView::contentsDropEvent(QDropEvent* e) @@ -983,7 +1004,7 @@ void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) void KListView::contentsDragMoveEvent(QDragMoveEvent *event) { -qDebug("KListView::contentsDropEvent drag&drop not supported yet"); + qDebug("KListView::contentsDropEvent drag&drop not supported yet"); /*US if (acceptDrag(event)) { @@ -1888,7 +1909,7 @@ void KListView::emitContextMenu (KListView*, QListViewItem* i) void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) { - qDebug("KListView::emitContextMenu col"); + // qDebug("KListView::emitContextMenu col"); emit contextRequest( i, p, col ); emit contextMenu (this, i, p); } @@ -2182,6 +2203,15 @@ void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in QListViewItem::paintCell(p, _cg, column, width, alignment); } +//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* ) { /*BASE::virtual_hook( id, data );*/ } 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 @@ -372,6 +372,10 @@ public: */ bool ascendingSort(void) const; + //US we do not have a "global KDE" variable to setup singleClick functionality + void setSingleClick(bool s); + + signals: /** @@ -683,7 +687,8 @@ protected: * Emit signal @ref #executed. * @internal */ - 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); /** * Reimplemented for internal reasons. |