]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kcategorizedview.cpp
Extracted the servicemenu code from KonqPopupMenu into KonqMenuActions, and used...
[dolphin.git] / src / kcategorizedview.cpp
index 7fe80605552a23b7a4c9336326c7ec42bf55c516..ec5ba36b7bf13556ddfff60e6a622677188781f8 100644 (file)
@@ -980,8 +980,8 @@ void KCategorizedView::startDrag(Qt::DropActions supportedActions)
     //        pixmap of selected icons to the dragging cursor, but it sets a non
     //        ARGB window so it is no transparent. Use QAbstractItemView when
     //        this is fixed on Qt.
-    //QListView::startDrag(supportedActions);
-    QAbstractItemView::startDrag(supportedActions);
+    // QAbstractItemView::startDrag(supportedActions);
+    QListView::startDrag(supportedActions);
 
     d->isDragging = false;
     d->mouseButtonPressed = false;
@@ -1022,7 +1022,7 @@ void KCategorizedView::dragLeaveEvent(QDragLeaveEvent *event)
 }
 
 QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction,
-                                  Qt::KeyboardModifiers modifiers)
+                                         Qt::KeyboardModifiers modifiers)
 {
     if ((viewMode() != KCategorizedView::IconMode) ||
          !d->proxyModel ||
@@ -1133,6 +1133,16 @@ QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction,
         }
 
         case QAbstractItemView::MoveLeft:
+            if (layoutDirection() == Qt::RightToLeft)
+            {
+                d->forcedSelectionPosition = d->elementsInfo[current.row() + 1].relativeOffsetToCategory % elementsPerRow;
+
+                if (d->forcedSelectionPosition < 0)
+                    d->forcedSelectionPosition = (d->categoriesIndexes[theCategory].count() - 1) % elementsPerRow;
+
+                return d->proxyModel->index(current.row() + 1, 0);
+            }
+
             d->forcedSelectionPosition = d->elementsInfo[current.row() - 1].relativeOffsetToCategory % elementsPerRow;
 
             if (d->forcedSelectionPosition < 0)
@@ -1141,6 +1151,16 @@ QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction,
             return d->proxyModel->index(current.row() - 1, 0);
 
         case QAbstractItemView::MoveRight:
+            if (layoutDirection() == Qt::RightToLeft)
+            {
+                d->forcedSelectionPosition = d->elementsInfo[current.row() - 1].relativeOffsetToCategory % elementsPerRow;
+
+                if (d->forcedSelectionPosition < 0)
+                    d->forcedSelectionPosition = (d->categoriesIndexes[theCategory].count() - 1) % elementsPerRow;
+
+                return d->proxyModel->index(current.row() - 1, 0);
+            }
+
             d->forcedSelectionPosition = d->elementsInfo[current.row() + 1].relativeOffsetToCategory % elementsPerRow;
 
             if (d->forcedSelectionPosition < 0)