From c407c15457b24cfcd85c32cb62473489645858f7 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 15 Jun 2018 22:58:20 +0200 Subject: Bookmarks manager bugfixes WebProfile: remove addBookmark signal and member Bookmarks: remove unused '...' button Bookmarks: stop crashing if there's no selected item Bookmarks: activating an item will only open it if it's a bookmark Bookmarks: change header size split --- lib/bookmarks/bookmarksform.ui | 30 +++++++++++++++++++++--------- lib/bookmarks/bookmarksview.cpp | 5 ++++- lib/bookmarks/bookmarksview.h | 1 + lib/bookmarks/bookmarkswidget.cpp | 4 ++-- lib/web/webprofile.h | 8 -------- 5 files changed, 28 insertions(+), 20 deletions(-) (limited to 'lib') diff --git a/lib/bookmarks/bookmarksform.ui b/lib/bookmarks/bookmarksform.ui index db1a85e..491bdc3 100644 --- a/lib/bookmarks/bookmarksform.ui +++ b/lib/bookmarks/bookmarksform.ui @@ -17,30 +17,36 @@ - - - ... + + + Qt::Horizontal - + + + 40 + 20 + + + - + - ... + Add Folder - + - ... + Add Bookmark - ... + Delete Item @@ -63,6 +69,12 @@ 2 + + 200 + + + 100 + Title diff --git a/lib/bookmarks/bookmarksview.cpp b/lib/bookmarks/bookmarksview.cpp index e427c2f..a92a3a7 100644 --- a/lib/bookmarks/bookmarksview.cpp +++ b/lib/bookmarks/bookmarksview.cpp @@ -45,5 +45,8 @@ QTreeWidgetItem *BookmarksView::createFolder(QTreeWidgetItem *parentItem) BookmarksView::Type BookmarksView::itemType(QTreeWidgetItem *item) const { + if(item == nullptr) + return Invalid; + return item->data(0, Qt::UserRole).value(); -} \ No newline at end of file +} diff --git a/lib/bookmarks/bookmarksview.h b/lib/bookmarks/bookmarksview.h index 47b3f9c..f99fd2a 100644 --- a/lib/bookmarks/bookmarksview.h +++ b/lib/bookmarks/bookmarksview.h @@ -17,6 +17,7 @@ class BookmarksView : public QTreeWidget public: enum Type { + Invalid, Folder, Bookmark }; diff --git a/lib/bookmarks/bookmarkswidget.cpp b/lib/bookmarks/bookmarkswidget.cpp index f56c53b..a027518 100644 --- a/lib/bookmarks/bookmarkswidget.cpp +++ b/lib/bookmarks/bookmarkswidget.cpp @@ -17,7 +17,6 @@ BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent) { // make sure this dialog does not get deleted on close setAttribute(Qt::WA_DeleteOnClose, false); - setWindowTitle(tr("Bookmarks")); ui->setupUi(this); ui->bookmark_groupBox->setVisible(false); @@ -43,7 +42,8 @@ BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent) // open bookmark action connect(ui->treeWidget, &QTreeWidget::itemActivated, this, [this](QTreeWidgetItem *item, int column) { - emit openUrl(QUrl::fromUserInput(item->text(1))); + if(ui->treeWidget->itemType(item) == BookmarksView::Bookmark) + emit openUrl(QUrl::fromUserInput(item->text(1))); }); // add bookmark action diff --git a/lib/web/webprofile.h b/lib/web/webprofile.h index 7a747a3..f4d31e6 100644 --- a/lib/web/webprofile.h +++ b/lib/web/webprofile.h @@ -81,15 +81,7 @@ public: void setSpellCheckEnabled(bool enable); - void addBookmark(const QString &title, const QString &url) - { - if(!title.isEmpty() && !url.isEmpty()) - emit addBookmarkRequested(title, url); - } - signals: - void addBookmarkRequested(const QString &title, const QString &url); - void searchChanged(const QString &url); void homepageChanged(const QUrl &url); void newtabChanged(const QUrl &url); -- cgit v1.2.1