mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
BookmarksToolbar: Fix drag and drop
- Fix crash
- Fix bookmark final position
Cherry Picked from: 06ea9c6b9c
Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
20c231c79d
commit
d6b1b57cb7
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user