]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Fix moving a bookmark to a specific location in a different folder. https://redmine...
authorSoren Stoutner <soren@stoutner.com>
Wed, 10 Jan 2024 23:09:41 +0000 (16:09 -0700)
committerSoren Stoutner <soren@stoutner.com>
Wed, 10 Jan 2024 23:09:41 +0000 (16:09 -0700)
src/widgets/DraggableTreeView.cpp

index 6471b08b4bf0f6ffba130efce540e9215421017f..b6a28da6896e7ea4460469620b81add1847790cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2023 Soren Stoutner <soren@stoutner.com>.
+ * Copyright 2023-2024 Soren Stoutner <soren@stoutner.com>.
  *
  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
  *
@@ -62,7 +62,7 @@ void DraggableTreeView::dropEvent(QDropEvent *dropEvent)
     // Process the move according to the drop position.
     switch (dropPosition)
     {
-        case QAbstractItemView::OnItem:
+        case QAbstractItemView::OnItem:  // This will only ever be called for folders as `BookmarksDialog::populateSubfolders` creates bookmarks without `setDropEnabled`.
         {
             // Get the new parent folder ID.
             double newParentFolderId = dropModelIndex.siblingAtColumn(BookmarksDialog::FOLDER_ID_COLUMN).data().toDouble();
@@ -109,7 +109,7 @@ void DraggableTreeView::dropEvent(QDropEvent *dropEvent)
             int dropDisplayOrder = dropModelIndex.siblingAtColumn(BookmarksDialog::DISPLAY_ORDER_COLUMN).data().toInt();
 
             // Get the drop parent folder ID.
-            double dropParentFolderId = dropModelIndex.parent().siblingAtColumn(BookmarksDialog::FOLDER_ID_COLUMN).data().toInt();
+            double dropParentFolderId = dropModelIndex.parent().siblingAtColumn(BookmarksDialog::FOLDER_ID_COLUMN).data().toDouble();
 
             // Get a list of all the items in the target folder except those selected.
             QList<BookmarkStruct> *itemsInFolderExceptSelectedListPointer = BookmarksDatabase::getBookmarksInFolderExcept(dropParentFolderId, selectedDatabaseIdsListPointer);
@@ -157,7 +157,7 @@ void DraggableTreeView::dropEvent(QDropEvent *dropEvent)
             int dropDisplayOrder = dropModelIndex.siblingAtColumn(BookmarksDialog::DISPLAY_ORDER_COLUMN).data().toInt();
 
             // Get the drop parent folder ID.
-            double dropParentFolderId = dropModelIndex.parent().siblingAtColumn(BookmarksDialog::FOLDER_ID_COLUMN).data().toInt();
+            double dropParentFolderId = dropModelIndex.parent().siblingAtColumn(BookmarksDialog::FOLDER_ID_COLUMN).data().toDouble();
 
             // Get a list of all the items in the target folder except those selected.
             QList<BookmarkStruct> *itemsInFolderExceptSelectedListPointer = BookmarksDatabase::getBookmarksInFolderExcept(dropParentFolderId, selectedDatabaseIdsListPointer);