Commit 2d833441 authored by Dawit Alemayehu's avatar Dawit Alemayehu
Browse files

When a user creates a new bookmark folder make that the current item.

BUG: 152158
REVIEW: 114479
FIXED-IN: 4.12.1
parent d5a7ff18
......@@ -343,18 +343,25 @@ void KBookmarkDialog::newFolderButton()
m_mgr->emitChanged( parentGroup );
m_folderTree->clear();
QTreeWidgetItem *root = new KBookmarkTreeItem(m_folderTree);
fillGroup( root, m_mgr->root() );
fillGroup(root, m_mgr->root(), group);
}
}
void KBookmarkDialog::fillGroup( QTreeWidgetItem * parentItem, const KBookmarkGroup &group)
{
for ( KBookmark bk = group.first() ; !bk.isNull() ; bk = group.next(bk) )
{
if ( bk.isGroup() )
{
QTreeWidgetItem* item = new KBookmarkTreeItem(parentItem, m_folderTree, bk.toGroup() );
fillGroup( item, bk.toGroup() );
fillGroup(parentItem, group, KBookmarkGroup());
}
void KBookmarkDialog::fillGroup(QTreeWidgetItem* parentItem, const KBookmarkGroup& group, const KBookmarkGroup& selectGroup)
{
for (KBookmark bk = group.first() ; !bk.isNull() ; bk = group.next(bk)) {
if (bk.isGroup()) {
const KBookmarkGroup bkGroup = bk.toGroup();
QTreeWidgetItem* item = new KBookmarkTreeItem(parentItem, m_folderTree, bkGroup);
if (selectGroup == bkGroup) {
m_folderTree->setCurrentItem(item);
}
fillGroup(item, bkGroup, selectGroup);
}
}
}
......
......@@ -131,6 +131,9 @@ protected:
protected Q_SLOTS:
void newFolderButton();
private:
void fillGroup(QTreeWidgetItem* parentItem, const KBookmarkGroup& group, const KBookmarkGroup& selectGroup);
};
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment