-rw-r--r-- | microkde/kdeui/klistview.cpp | 7 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 2856f2d..6477d11 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp @@ -1794,196 +1794,197 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) if (repaintItem1) ir = ir.unite( itemRect(repaintItem1) ); if (repaintItem2) ir = ir.unite( itemRect(repaintItem2) ); if ( !ir.isEmpty() ) { // rectangle to be repainted if ( ir.x() < 0 ) ir.moveBy( -ir.x(), 0 ); viewport()->repaint( ir, FALSE ); } /*if (repaintItem1) repaintItem1->repaint(); if (repaintItem2) repaintItem2->repaint();*/ update(); if (emitSelectionChanged) emit selectionChanged(); } void KListView::setSelectionModeExt (SelectionModeExt mode) { d->selectionMode = mode; switch (mode) { case Single: case Multi: case Extended: case NoSelection: setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); break; case FileManager: setSelectionMode (QListView::Extended); break; default: kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; break; } } KListView::SelectionModeExt KListView::selectionModeExt () const { return d->selectionMode; } int KListView::itemIndex( const QListViewItem *item ) const { if ( !item ) return -1; if ( item == firstChild() ) return 0; else { QListViewItemIterator it(firstChild()); uint j = 0; for (; it.current() && it.current() != item; ++it, ++j ); if( !it.current() ) return -1; return j; } } QListViewItem* KListView::itemAtIndex(int index) { if (index<0) return 0; int j(0); for (QListViewItemIterator it=firstChild(); it.current(); it++) { if (j==index) return it.current(); j++; }; return 0; } void KListView::emitContextMenu (KListView*, QListViewItem* i) { QPoint p; qDebug("KListView::emitContextMenu "); if (i) p = viewport()->mapToGlobal(itemRect(i).center()); else p = mapToGlobal(rect().center()); emit contextMenu (this, i, p); } -void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int) +void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) { - qDebug("KListView::emitContextMenu "); - emit contextMenu (this, i, p); + qDebug("KListView::emitContextMenu col"); + emit contextRequest( i, p, col ); + emit contextMenu (this, i, p); } void KListView::setAcceptDrops (bool val) { QListView::setAcceptDrops (val); viewport()->setAcceptDrops (val); } int KListView::dropVisualizerWidth () const { return d->mDropVisualizerWidth; } void KListView::viewportPaintEvent(QPaintEvent *e) { QListView::viewportPaintEvent(e); if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) { QPainter painter(viewport()); // This is where we actually draw the drop-visualizer painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); } if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) { QPainter painter(viewport()); qDebug("KListView::viewportPaintEvent has to be verified"); // This is where we actually draw the drop-highlighter //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), //US QStyle::Style_FocusAtBorder); //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); } } void KListView::setFullWidth() { setFullWidth(true); } void KListView::setFullWidth(bool fullWidth) { d->fullWidth = fullWidth; //US header()->setStretchEnabled(fullWidth, columns()-1); } bool KListView::fullWidth() const { return d->fullWidth; } int KListView::addColumn(const QString& label, int width) { int result = QListView::addColumn(label, width); if (d->fullWidth) { //US header()->setStretchEnabled(false, columns()-2); //US header()->setStretchEnabled(true, columns()-1); } return result; } int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) { int result = QListView::addColumn(iconset, label, width); if (d->fullWidth) { //US header()->setStretchEnabled(false, columns()-2); //US header()->setStretchEnabled(true, columns()-1); } return result; } void KListView::removeColumn(int index) { QListView::removeColumn(index); //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); } void KListView::viewportResizeEvent(QResizeEvent* e) { QListView::viewportResizeEvent(e); } const QColor &KListView::alternateBackground() const { return d->alternateBackground; } void KListView::setAlternateBackground(const QColor &c) { d->alternateBackground = c; diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index f7d9f85..8d933f6 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h @@ -320,192 +320,193 @@ public: * @see #addColumn() */ virtual void removeColumn(int index); /** * sets the alternate background background color. * This only has an effect if the items are KListViewItems * * @param c the color to use for every other item. Set to an invalid * colour to disable alternate colours. * * @see #alternateBackground() **/ void setAlternateBackground(const QColor &c); /** * @return the alternate background color * * @see #setAlternateBackground() */ const QColor &alternateBackground() const; /** * Saves the list view's layout (column widtsh, column order, sort column) * to a KConfig group * * @param config the @ref KConfig object to write to * @param group the config group to use */ void saveLayout(KConfig *config, const QString &group) const; /** * Reads the list view's layout from a KConfig group as stored with * @ref #saveLayout * * @param config the @ref KConfig object to read from * @param group the config group to use */ void restoreLayout(KConfig *config, const QString &group); /** * Reimplemented to remember the current sort column and order. * @param column is the column to be sorted, or -1 to sort in order of * insertion * @param whether to sort ascending (or descending) */ virtual void setSorting(int column, bool ascending = true); /** * @return the currently sorted column, or -1 if none is sorted */ int columnSorted(void) const; /** * @return whether the current sort is ascending (or descending) */ bool ascendingSort(void) const; signals: /** * This signal is emitted whenever the user executes an listview item. * That means depending on the KDE wide Single Click/Double Click * setting the user clicked or double clicked on that item. * @param item is the pointer to the executed listview item. * * Note that you may not delete any @ref QListViewItem objects in slots * connected to this signal. */ void executed( QListViewItem *item ); /** * This signal is emitted whenever the user executes an listview item. * That means depending on the KDE wide Single Click/Double Click * setting the user clicked or double clicked on that item. * @param item is the pointer to the executed listview item. * @param pos is the position where the user has clicked * @param c is the column into which the user clicked. * * Note that you may not delete any @ref QListViewItem objects in slots * connected to this signal. */ void executed( QListViewItem *item, const QPoint &pos, int c ); /** * This signal gets emitted whenever the user double clicks into the * listview. * @param item is the pointer to the clicked listview item. * @param pos is the position where the user has clicked, and * @param c is the column into which the user clicked. * * Note that you may not delete any @ref QListViewItem objects in slots * connected to this signal. * * This signal is more or less here for the sake of completeness. * You should normally not need to use this. In most cases its better * to use @ref #executed() instead. */ void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); + void contextRequest( QListViewItem *item, const QPoint &pos, int c ); /** * This signal gets emitted whenever something acceptable is * dropped onto the listview. * * @param e is the drop event itself (it has already been accepted) * @param after is the item after which the drop occured (or 0L, if * the drop was above all items) * * @see #acceptDrop() */ void dropped (QDropEvent * e, QListViewItem *after); /** * This signal gets emitted whenever something acceptable is * dropped onto the listview. * * This is an overloaded version of the above (provided to simplify * processing drops outside of the class). * * @param list is the listview * @param e is the drop event itself (it has already been accepted) * @param after is the item after which the drop occured (or 0L, if * the drop was above all items */ void dropped (KListView* list, QDropEvent* e, QListViewItem* after); /** * This signal gets emitted whenever something acceptable is * dropped onto the listview. * * This function also provides a parent, in the event that your listview * is a tree * @param list is the listview * @param e is the drop event itself (it has already been accepted) * @param parent the item that is to be the parent of the new item * @param after is the item after which the drop occured (or 0L, if * the drop was above all items */ void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); /** * This signal gets emitted whenever something acceptable is * dropped onto the listview. * * This function also provides a parent, in the event that your listview * is a tree * @param e is the drop event itself (it has already been accepted) * @param parent the item that is to be the parent of the new item * @param after is the item after which the drop occured (or 0L, if * the drop was above all items */ void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); /** * This signal is emitted when ever the user moves an item in the list via * DnD. * If more than one item is moved at the same time, this signal is only emitted * once. */ void moved(); /** * Connect to this signal if you want to do some preprocessing before * a move is made, for example, to disable sorting * * This is sent only once per each groups of moves. That is, for each * drop that is a move this will be emitted once, before KListView calls * @see moveItem() */ void aboutToMove(); /** * This signal is emitted when ever the user moves an item in the list via * DnD. * If more than one item is moved at the same time, @p afterFirst and * @p afterNow will reflect what was true before the move. * This differs from @ref moved(), so be careful. All the items will have been * moved before @ref moved() is emitted, which is not true in this method. // FIXME * @param item the item that was moved * @param afterFirst the item that parameter item was in before the move, in the list * @param afterNow the item it's currently after. */ void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); /** * This signal is emitted after all the items have been moved. It reports info for * each and every item moved, in order. The first element in @p items associates * with the first of afterFirst and afterNow. */ void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); /** * This signal gets emitted when an item is renamed via in-place renaming. * |