1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

BookmarksToolbar: Fix drag and drop

- Fix crash
- Fix bookmark final position

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2024-08-03 22:25:33 +02:00
parent 6e7047f7ec
commit 06ea9c6b9c
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B

View File

@ -269,10 +269,15 @@ void BookmarksToolbar::dropEvent(QDropEvent* e)
if (mime->hasFormat(BookmarksButtonMimeData::mimeType())) {
const auto* bookmarkMime = static_cast<const BookmarksButtonMimeData*>(mime);
bookmark = bookmarkMime->item();
const int initialIndex = bookmark->parent()->children().indexOf(bookmark);
BookmarksToolbarButton* current = buttonAt(m_dropPos);
if (initialIndex < m_layout->indexOf(current)) {
row -= 1;
if (row < 0) {
row = parent->children().count() - 1;
}
else {
const int initialIndex = bookmark->parent()->children().indexOf(bookmark);
if ((row > 0) && (initialIndex < row)) {
row -= 1;
}
}
} else {
const QUrl url = mime->urls().at(0);