diff options
-rw-r--r-- | BUGS.md | 5 | ||||
-rw-r--r-- | lib/bookmarks/bookmarksform.ui | 30 | ||||
-rw-r--r-- | lib/bookmarks/bookmarksview.cpp | 5 | ||||
-rw-r--r-- | lib/bookmarks/bookmarksview.h | 1 | ||||
-rw-r--r-- | lib/bookmarks/bookmarkswidget.cpp | 4 | ||||
-rw-r--r-- | lib/web/webprofile.h | 8 | ||||
-rw-r--r-- | src/browser.cpp | 1 | ||||
-rw-r--r-- | src/browser.h | 5 | ||||
-rw-r--r-- | src/webengine/widgets/pagemenu.cpp | 5 |
9 files changed, 39 insertions, 25 deletions
@@ -44,6 +44,5 @@ Only affects Qt 5.11.0. Set __QTBUG_68224_WORKAROUND__. ## Wayland bugs ### mainwindow.maximized doesn't work -setWindowState(Qt::WindowMaximized) has no effect - -### window icon is not set +setWindowState(Qt::WindowMaximized) has no effect on KDE/Wayland: +https://community.kde.org/Plasma/Wayland_Showstoppers 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 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); diff --git a/src/browser.cpp b/src/browser.cpp index 7c7dca3..4c6549c 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -145,7 +145,6 @@ void Browser::setup(const QString &defaultProfile) connect(m_bookmarks.get(), &BookmarksWidget::openUrl, this, [this](const QUrl &url) { m_windows.last()->createTab(url); }); - connect(WebProfile::defaultProfile(), &WebProfile::addBookmarkRequested, m_bookmarks.get(), &BookmarksWidget::addBookmark); // downloads m_downloads = std::make_shared<DownloadsWidget>(QString::fromStdString(m_config->value<std::string>("downloads.path").value())); diff --git a/src/browser.h b/src/browser.h index e6b94e4..8148e99 100644 --- a/src/browser.h +++ b/src/browser.h @@ -36,6 +36,11 @@ public: void setConfiguration(std::shared_ptr<Configuration> &config); void setup(const QString &defaultProfile); + std::shared_ptr<BookmarksWidget> bookmarks() + { + return m_bookmarks; + } + WebProfile *profile(const QString &name) const; const QStringList profiles() const { diff --git a/src/webengine/widgets/pagemenu.cpp b/src/webengine/widgets/pagemenu.cpp index 9cfeb71..21efd3d 100644 --- a/src/webengine/widgets/pagemenu.cpp +++ b/src/webengine/widgets/pagemenu.cpp @@ -19,6 +19,7 @@ #include <QVBoxLayout> #include <QWidgetAction> #include "browser.h" +#include <bookmarks/bookmarkswidget.h> PageMenu::PageMenu(WebView *parent) : QMenu(tr("Page"), parent) @@ -28,7 +29,9 @@ PageMenu::PageMenu(WebView *parent) auto *bookmarkAction = addAction(tr("Bookmark page")); connect(bookmarkAction, &QAction::triggered, parent, [parent]() { - parent->profile()->addBookmark(parent->title(), parent->url().toString()); + auto *browser = qobject_cast<Browser *>(qApp); + Q_CHECK_PTR(browser); + browser->bookmarks()->addBookmark(parent->title(), parent->url().toString()); }); auto *savePageAction = addAction(tr("Save Page")); |