void WebBrowser::removeBookmarkMessageButtonPressed(const Plasma::MessageButton button) { if (button == Plasma::ButtonNo){ return; } const QModelIndexList list = m_bookmarkModel->match(m_bookmarkModel->index(0,0), BookmarkItem::UrlRole, m_url.prettyUrl()); if (!list.isEmpty()) { const QModelIndex &index = list.first(); BookmarkItem *item = dynamic_cast<BookmarkItem *>(m_bookmarkModel->itemFromIndex(index)); if (item) { KBookmark bookmark = item->bookmark(); bookmark.parentGroup().deleteBookmark(bookmark); m_bookmarkManager->save(); } if (item && item->parent()) { item->parent()->removeRow(index.row()); } else { m_bookmarkModel->removeRow(index.row()); } } m_addBookmark->setAction(m_addBookmarkAction); }
void WebBrowser::removeBookmark(const QModelIndex &index) { BookmarkItem *item = dynamic_cast<BookmarkItem *>(m_bookmarkModel->itemFromIndex(index)); if (item) { KBookmark bookmark = item->bookmark(); const QString text(i18nc("@info", "Do you really want to remove the bookmark to %1?", bookmark.url().host())); showMessage(KIcon("dialog-warning"), text, Plasma::ButtonYes | Plasma::ButtonNo); return; } if (item && item->parent()) { item->parent()->removeRow(index.row()); } else { m_bookmarkModel->removeRow(index.row()); } }