1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Create new bookmark items near the current one (over it)

Summary:
Currently in the bookmarks manager the user can create new items via the contextual menu, so a position is implicitly chosen, but the new items are always inserted at the first position in the list.

This change aims to add new items just before the current (selected) one. If the selected item is a folder the behavior is unchanged (the new item will be inserted at the first position in that folder).

Test Plan:
- Select a separator/url item
- Add a new item (separator/url/folder)
- The new item is inserted just before the previously selected one

Reviewers: #falkon, drosca

Reviewed By: #falkon, drosca

Subscribers: cullmann, falkon

Tags: #falkon

Differential Revision: https://phabricator.kde.org/D14930
This commit is contained in:
Giacomo Barazzetti 2018-12-12 22:21:19 +01:00 committed by Christoph Cullmann
parent 4ff7ccc737
commit 77e928569a

View File

@ -292,7 +292,11 @@ void BookmarksManager::addBookmark(BookmarkItem* item)
BookmarkItem* parent = parentForNewBookmark();
Q_ASSERT(parent);
m_bookmarks->insertBookmark(parent, 0, item);
int row = 0;
if (m_selectedBookmark->isUrl() || m_selectedBookmark->isSeparator()) {
row = m_bookmarks->model()->index(m_selectedBookmark).row();
}
m_bookmarks->insertBookmark(parent, row, item);
// Select newly added bookmark
ui->tree->selectBookmark(item);