Пример #1
0
void MainWindow::editBookmark()
{
    // search the model for the closest bookmark
    BookmarkItem * bookmarkItem = 0;
    QModelIndex bookmarkIndex = currentTreeItem;
    do
    {

        bookmarkItem = 0; // qobject_cast<BookmarkItem *>(static_cast<TreeItem *>(bookmarkIndex.internalPointer()));

        if (bookmarkItem)
            break; // we found one!

        // up one level
        bookmarkIndex = bookmarkIndex.parent();
    } while (bookmarkIndex.isValid());

    // we found no bookmark!
    if (!bookmarkItem)
        return;

    EditBookmarkDialog dlg(this);
    dlg.setDir(bookmarkItem->name());
    dlg.setAlias(bookmarkItem->alias());

    if (dlg.exec())
        model.updateBookmark(bookmarkIndex, dlg.dir(), dlg.alias());
}