aboutsummaryrefslogtreecommitdiff
path: root/lib/bookmarks
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-06-15 22:58:20 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-06-15 22:58:20 +0200
commitc407c15457b24cfcd85c32cb62473489645858f7 (patch)
tree035535c86de7dd39e79fcb2284d5b9628b44ea9c /lib/bookmarks
parentSubWindow: delete views right away when closing tab (diff)
downloadsmolbote-c407c15457b24cfcd85c32cb62473489645858f7.tar.xz
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
Diffstat (limited to 'lib/bookmarks')
-rw-r--r--lib/bookmarks/bookmarksform.ui30
-rw-r--r--lib/bookmarks/bookmarksview.cpp5
-rw-r--r--lib/bookmarks/bookmarksview.h1
-rw-r--r--lib/bookmarks/bookmarkswidget.cpp4
4 files changed, 28 insertions, 12 deletions
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 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QToolButton" name="addFolder_toolButton">
- <property name="text">
- <string>...</string>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
- </widget>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
</item>
<item>
- <widget class="QToolButton" name="addBookmark_toolButton">
+ <widget class="QToolButton" name="addFolder_toolButton">
<property name="text">
- <string>...</string>
+ <string>Add Folder</string>
</property>
</widget>
</item>
<item>
- <widget class="QToolButton" name="addSeparator_toolButton">
+ <widget class="QToolButton" name="addBookmark_toolButton">
<property name="text">
- <string>...</string>
+ <string>Add Bookmark</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="deleteItem_toolButton">
<property name="text">
- <string>...</string>
+ <string>Delete Item</string>
</property>
</widget>
</item>
@@ -63,6 +69,12 @@
<property name="columnCount">
<number>2</number>
</property>
+ <attribute name="headerDefaultSectionSize">
+ <number>200</number>
+ </attribute>
+ <attribute name="headerMinimumSectionSize">
+ <number>100</number>
+ </attribute>
<column>
<property name="text">
<string notr="true">Title</string>
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<Type>();
-} \ 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