summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-28 00:07:51 (UTC)
committer ulf69 <ulf69>2004-10-28 00:07:51 (UTC)
commit0766b449ccdcc125c18c401d87cc51c277464728 (patch) (side-by-side diff)
tree5279c7c3f441f448ecb82f1400439e4a7498dde3
parent5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c (diff)
downloadkdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.zip
kdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.tar.gz
kdepimpi-0766b449ccdcc125c18c401d87cc51c277464728.tar.bz2
bugfix: KListView did not recognize singleclicks
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdeui/klistview.cpp86
-rw-r--r--microkde/kdeui/klistview.h7
2 files changed, 64 insertions, 29 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
@@ -514,12 +514,34 @@ 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();
@@ -536,9 +558,8 @@ void KListView::slotSettingsChanged(int category)
if( !d->bUseSingle || !d->bChangeCursorOverItem )
viewport()->unsetCursor();
break;
-
case KApplication::SETTINGS_POPUPMENU:
d->contextMenuKey = KGlobalSettings::contextMenuKey ();
d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress ();
@@ -556,17 +577,13 @@ void KListView::slotSettingsChanged(int category)
connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)),
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()
@@ -657,10 +674,11 @@ void KListView::slotHeaderChanged()
setColumnWidth( columns() - 1, viewport()->width() - w - 1 );
}
}
-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 ?
if ( !d->bUseSingle )
@@ -669,27 +687,18 @@ void KListView::emitExecute( QListViewItem *item, const QPoint &pos, int c )
emit executed( item, pos, 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
}
}
}
@@ -741,9 +750,9 @@ 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);
}
@@ -751,8 +760,9 @@ 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();
blockSignals( true );
@@ -814,9 +824,9 @@ void KListView::contentsMouseMoveEvent( QMouseEvent *e )
if( (item != d->pCurrentItem) ||
(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() );
else //cursor moved out of execute area
@@ -875,8 +885,9 @@ 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 );
@@ -886,19 +897,29 @@ 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)
{
@@ -1887,9 +1908,9 @@ 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);
}
@@ -2181,8 +2202,17 @@ 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 );*/ }
//US #include "klistview.moc"
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
@@ -371,8 +371,12 @@ public:
* @return whether the current sort is ascending (or descending)
*/
bool ascendingSort(void) const;
+ //US we do not have a "global KDE" variable to setup singleClick functionality
+ void setSingleClick(bool s);
+
+
signals:
/**
* This signal is emitted whenever the user executes an listview item.
@@ -682,9 +686,10 @@ 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.
* Further reimplementations should call this function or else