-rw-r--r-- | microkde/kdeui/klistview.cpp | 5 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 154cd02..31e2053 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -360,102 +360,103 @@ void KListViewLineEdit::terminate() | |||
360 | } | 360 | } |
361 | 361 | ||
362 | void KListViewLineEdit::terminate(bool commit) | 362 | void KListViewLineEdit::terminate(bool commit) |
363 | { | 363 | { |
364 | if ( item ) | 364 | if ( item ) |
365 | { | 365 | { |
366 | //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; | 366 | //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; |
367 | if (commit) | 367 | if (commit) |
368 | item->setText(col, text()); | 368 | item->setText(col, text()); |
369 | int c=col; | 369 | int c=col; |
370 | QListViewItem *i=item; | 370 | QListViewItem *i=item; |
371 | col=0; | 371 | col=0; |
372 | item=0; | 372 | item=0; |
373 | hide(); // will call focusOutEvent, that's why we set item=0 before | 373 | hide(); // will call focusOutEvent, that's why we set item=0 before |
374 | emit done(i,c); | 374 | emit done(i,c); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | void KListViewLineEdit::focusOutEvent(QFocusEvent *ev) | 378 | void KListViewLineEdit::focusOutEvent(QFocusEvent *ev) |
379 | { | 379 | { |
380 | QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev); | 380 | QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev); |
381 | // Don't let a RMB close the editor | 381 | // Don't let a RMB close the editor |
382 | if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow) | 382 | if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow) |
383 | terminate(true); | 383 | terminate(true); |
384 | } | 384 | } |
385 | 385 | ||
386 | void KListViewLineEdit::paintEvent( QPaintEvent *e ) | 386 | void KListViewLineEdit::paintEvent( QPaintEvent *e ) |
387 | { | 387 | { |
388 | KLineEdit::paintEvent( e ); | 388 | KLineEdit::paintEvent( e ); |
389 | 389 | ||
390 | if ( !frame() ) { | 390 | if ( !frame() ) { |
391 | QPainter p( this ); | 391 | QPainter p( this ); |
392 | p.setClipRegion( e->region() ); | 392 | p.setClipRegion( e->region() ); |
393 | p.drawRect( rect() ); | 393 | p.drawRect( rect() ); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | // selection changed -> terminate. As our "item" can be already deleted, | 397 | // selection changed -> terminate. As our "item" can be already deleted, |
398 | // we can't call terminate(false), because that would emit done() with | 398 | // we can't call terminate(false), because that would emit done() with |
399 | // a dangling pointer to "item". | 399 | // a dangling pointer to "item". |
400 | void KListViewLineEdit::slotSelectionChanged() | 400 | void KListViewLineEdit::slotSelectionChanged() |
401 | { | 401 | { |
402 | item = 0; | 402 | item = 0; |
403 | col = 0; | 403 | col = 0; |
404 | hide(); | 404 | hide(); |
405 | } | 405 | } |
406 | */ | 406 | */ |
407 | 407 | ||
408 | KListView::KListView( QWidget *parent, const char *name ) | 408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) |
409 | : QListView( parent, name ), | 409 | : QListView( parent, name ), |
410 | d (new KListViewPrivate (this)) | 410 | d (new KListViewPrivate (this)) |
411 | { | 411 | { |
412 | #ifndef DESKTOP_VERSION | 412 | #ifndef DESKTOP_VERSION |
413 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 413 | if ( emulateRightMouse ) |
414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | ||
414 | #endif | 415 | #endif |
415 | //US setDragAutoScroll(true); | 416 | //US setDragAutoScroll(true); |
416 | 417 | ||
417 | connect( this, SIGNAL( onViewport() ), | 418 | connect( this, SIGNAL( onViewport() ), |
418 | this, SLOT( slotOnViewport() ) ); | 419 | this, SLOT( slotOnViewport() ) ); |
419 | connect( this, SIGNAL( onItem( QListViewItem * ) ), | 420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), |
420 | this, SLOT( slotOnItem( QListViewItem * ) ) ); | 421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); |
421 | 422 | ||
422 | connect (this, SIGNAL(contentsMoving(int,int)), | 423 | connect (this, SIGNAL(contentsMoving(int,int)), |
423 | this, SLOT(cleanDropVisualizer())); | 424 | this, SLOT(cleanDropVisualizer())); |
424 | connect (this, SIGNAL(contentsMoving(int,int)), | 425 | connect (this, SIGNAL(contentsMoving(int,int)), |
425 | this, SLOT(cleanItemHighlighter())); | 426 | this, SLOT(cleanItemHighlighter())); |
426 | 427 | ||
427 | /*US | 428 | /*US |
428 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); | 429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); |
429 | 430 | ||
430 | if (kapp) | 431 | if (kapp) |
431 | { | 432 | { |
432 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); | 433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); |
433 | kapp->addKipcEventMask( KIPC::SettingsChanged ); | 434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); |
434 | } | 435 | } |
435 | */ | 436 | */ |
436 | slotSettingsChanged(1); //US do this to initialize the connections | 437 | slotSettingsChanged(1); //US do this to initialize the connections |
437 | 438 | ||
438 | 439 | ||
439 | connect(&d->autoSelect, SIGNAL( timeout() ), | 440 | connect(&d->autoSelect, SIGNAL( timeout() ), |
440 | this, SLOT( slotAutoSelect() ) ); | 441 | this, SLOT( slotAutoSelect() ) ); |
441 | connect(&d->dragExpand, SIGNAL( timeout() ), | 442 | connect(&d->dragExpand, SIGNAL( timeout() ), |
442 | this, SLOT( slotDragExpand() ) ); | 443 | this, SLOT( slotDragExpand() ) ); |
443 | 444 | ||
444 | // context menu handling | 445 | // context menu handling |
445 | if (d->showContextMenusOnPress) | 446 | if (d->showContextMenusOnPress) |
446 | { | 447 | { |
447 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |
448 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
449 | } | 450 | } |
450 | else | 451 | else |
451 | { | 452 | { |
452 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), |
453 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
454 | } | 455 | } |
455 | 456 | ||
456 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), | 457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), |
457 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); | 458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); |
458 | 459 | ||
459 | 460 | ||
460 | //qDebug("KListView::KListView make alternate color configurable"); | 461 | //qDebug("KListView::KListView make alternate color configurable"); |
461 | //US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); | 462 | //US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); |
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index d559ce7..0058416 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h | |||
@@ -78,97 +78,97 @@ public: | |||
78 | * Possible selection modes. | 78 | * Possible selection modes. |
79 | * | 79 | * |
80 | * The first four correspond directly to QListView::SelectionMode, while | 80 | * The first four correspond directly to QListView::SelectionMode, while |
81 | * the FileManager selection mode is defined as follows: | 81 | * the FileManager selection mode is defined as follows: |
82 | * @li home: move to the first | 82 | * @li home: move to the first |
83 | * @li end: move to the last | 83 | * @li end: move to the last |
84 | * @li PgUp/PgDn: move one page up/down | 84 | * @li PgUp/PgDn: move one page up/down |
85 | * @li up/down: move one item up/down | 85 | * @li up/down: move one item up/down |
86 | * @li insert: toggle selection of current and move to the next | 86 | * @li insert: toggle selection of current and move to the next |
87 | * @li space: toggle selection of the current | 87 | * @li space: toggle selection of the current |
88 | * @li CTRL+up: move to the previous item and toggle selection of this one | 88 | * @li CTRL+up: move to the previous item and toggle selection of this one |
89 | * @li CTRL+down: toggle selection of the current item and move to the next | 89 | * @li CTRL+down: toggle selection of the current item and move to the next |
90 | * @li CTRL+end: toggle selection from (including) the current | 90 | * @li CTRL+end: toggle selection from (including) the current |
91 | * item to (including) the last item | 91 | * item to (including) the last item |
92 | * @li CTRL+home: toggle selection from (including) the current | 92 | * @li CTRL+home: toggle selection from (including) the current |
93 | * item to the (including) the first item | 93 | * item to the (including) the first item |
94 | * @li CTRL+PgDn: toggle selection from (including) the current | 94 | * @li CTRL+PgDn: toggle selection from (including) the current |
95 | * item to (excluding) the item one page down | 95 | * item to (excluding) the item one page down |
96 | * @li CTRL+PgUp: toggle selection from (excluding) the current | 96 | * @li CTRL+PgUp: toggle selection from (excluding) the current |
97 | * item to (including) the item one page up | 97 | * item to (including) the item one page up |
98 | * | 98 | * |
99 | * The combinations work the same with SHIFT instead of CTRL, except | 99 | * The combinations work the same with SHIFT instead of CTRL, except |
100 | * that if you start selecting something using SHIFT everything selected | 100 | * that if you start selecting something using SHIFT everything selected |
101 | * before will be deselected first. | 101 | * before will be deselected first. |
102 | * | 102 | * |
103 | * Additionally the current item is always selected automatically when | 103 | * Additionally the current item is always selected automatically when |
104 | * navigating using the keyboard, except other items were selected explicitely. | 104 | * navigating using the keyboard, except other items were selected explicitely. |
105 | * | 105 | * |
106 | * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected | 106 | * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected |
107 | */ | 107 | */ |
108 | enum SelectionModeExt { | 108 | enum SelectionModeExt { |
109 | Single = QListView::Single, | 109 | Single = QListView::Single, |
110 | Multi = QListView::Multi, | 110 | Multi = QListView::Multi, |
111 | Extended = QListView::Extended, | 111 | Extended = QListView::Extended, |
112 | NoSelection = QListView::NoSelection, | 112 | NoSelection = QListView::NoSelection, |
113 | FileManager | 113 | FileManager |
114 | }; | 114 | }; |
115 | void repaintContents( bool erase = true ) | 115 | void repaintContents( bool erase = true ) |
116 | { | 116 | { |
117 | QScrollView::repaintContents( contentsX(), contentsY(), | 117 | QScrollView::repaintContents( contentsX(), contentsY(), |
118 | visibleWidth(), visibleHeight(), erase ); | 118 | visibleWidth(), visibleHeight(), erase ); |
119 | }; | 119 | }; |
120 | /** | 120 | /** |
121 | * Constructor. | 121 | * Constructor. |
122 | * | 122 | * |
123 | * The parameters @p parent and @p name are handled by | 123 | * The parameters @p parent and @p name are handled by |
124 | * @ref QListView, as usual. | 124 | * @ref QListView, as usual. |
125 | */ | 125 | */ |
126 | KListView (QWidget *parent = 0, const char *name = 0); | 126 | KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Destructor. | 129 | * Destructor. |
130 | */ | 130 | */ |
131 | virtual ~KListView(); | 131 | virtual ~KListView(); |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * Reimplemented for internal reasons. | 134 | * Reimplemented for internal reasons. |
135 | * Further reimplementations should call this function or else | 135 | * Further reimplementations should call this function or else |
136 | * some features may not work correctly. | 136 | * some features may not work correctly. |
137 | * | 137 | * |
138 | * The API is unaffected. | 138 | * The API is unaffected. |
139 | */ | 139 | */ |
140 | virtual void setAcceptDrops (bool); | 140 | virtual void setAcceptDrops (bool); |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * This function determines whether the given coordinates are within the | 143 | * This function determines whether the given coordinates are within the |
144 | * execute area. The execute area is the part of a @ref QListViewItem where mouse | 144 | * execute area. The execute area is the part of a @ref QListViewItem where mouse |
145 | * clicks or double clicks respectively generate a @ref #executed() signal. | 145 | * clicks or double clicks respectively generate a @ref #executed() signal. |
146 | * Depending on @ref QListView::allColumnsShowFocus() this is either the | 146 | * Depending on @ref QListView::allColumnsShowFocus() this is either the |
147 | * whole item or only the first column. | 147 | * whole item or only the first column. |
148 | * @return true if point is inside execute area of an item, false in all | 148 | * @return true if point is inside execute area of an item, false in all |
149 | * other cases including the case that it is over the viewport. | 149 | * other cases including the case that it is over the viewport. |
150 | */ | 150 | */ |
151 | virtual bool isExecuteArea( const QPoint& point ); | 151 | virtual bool isExecuteArea( const QPoint& point ); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Same thing, but from an x coordinate only. This only checks if x is in | 154 | * Same thing, but from an x coordinate only. This only checks if x is in |
155 | * the first column (if all columns don't show focus), without testing if | 155 | * the first column (if all columns don't show focus), without testing if |
156 | * the y coordinate is over an item or not. | 156 | * the y coordinate is over an item or not. |
157 | */ | 157 | */ |
158 | bool isExecuteArea( int x ); | 158 | bool isExecuteArea( int x ); |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * @return a list containing the currently selected items. | 161 | * @return a list containing the currently selected items. |
162 | */ | 162 | */ |
163 | QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) | 163 | QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) |
164 | 164 | ||
165 | /** | 165 | /** |
166 | * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. | 166 | * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. |
167 | */ | 167 | */ |
168 | void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); | 168 | void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | * @return the last item (not child!) of this listview. | 171 | * @return the last item (not child!) of this listview. |
172 | * | 172 | * |
173 | * @see lastChild() | 173 | * @see lastChild() |
174 | */ | 174 | */ |