From 09bb58dcffb7089eea5e11654a9efb70898c11bd Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Fri, 1 Apr 2022 14:15:11 +0200 Subject: [PATCH] save --- src/librssguard/gui/reusable/baselineedit.cpp | 2 ++ src/librssguard/gui/reusable/baselineedit.h | 2 +- src/librssguard/gui/reusable/locationlineedit.h | 2 -- src/librssguard/gui/tabcontent.cpp | 2 ++ src/librssguard/gui/tabcontent.h | 1 + src/librssguard/gui/webbrowser.cpp | 12 ++++++++---- src/librssguard/gui/webbrowser.h | 5 ++++- src/librssguard/services/gmail/gmailserviceroot.cpp | 8 ++++---- src/librssguard/services/gmail/gmailserviceroot.h | 2 +- 9 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/librssguard/gui/reusable/baselineedit.cpp b/src/librssguard/gui/reusable/baselineedit.cpp index fb7bcc286..6cb5ab758 100644 --- a/src/librssguard/gui/reusable/baselineedit.cpp +++ b/src/librssguard/gui/reusable/baselineedit.cpp @@ -27,6 +27,8 @@ BaseLineEdit::BaseLineEdit(QWidget* parent) setClearButtonEnabled(true); } +BaseLineEdit::~BaseLineEdit() {} + void BaseLineEdit::setPasswordMode(bool is_password) { if (is_password) { setEchoMode(QLineEdit::EchoMode::Password); diff --git a/src/librssguard/gui/reusable/baselineedit.h b/src/librssguard/gui/reusable/baselineedit.h index a899b921b..ae4e69acf 100644 --- a/src/librssguard/gui/reusable/baselineedit.h +++ b/src/librssguard/gui/reusable/baselineedit.h @@ -10,7 +10,7 @@ class BaseLineEdit : public QLineEdit { public: explicit BaseLineEdit(QWidget* parent = nullptr); - virtual ~BaseLineEdit() = default; + virtual ~BaseLineEdit(); void setPasswordMode(bool is_password); diff --git a/src/librssguard/gui/reusable/locationlineedit.h b/src/librssguard/gui/reusable/locationlineedit.h index add4802e1..cddbe03d8 100644 --- a/src/librssguard/gui/reusable/locationlineedit.h +++ b/src/librssguard/gui/reusable/locationlineedit.h @@ -12,8 +12,6 @@ class LocationLineEdit : public BaseLineEdit { Q_OBJECT public: - - // Constructors and destructors. explicit LocationLineEdit(QWidget* parent = nullptr); virtual ~LocationLineEdit(); diff --git a/src/librssguard/gui/tabcontent.cpp b/src/librssguard/gui/tabcontent.cpp index 23d54ed7b..3de9e0180 100644 --- a/src/librssguard/gui/tabcontent.cpp +++ b/src/librssguard/gui/tabcontent.cpp @@ -3,3 +3,5 @@ #include "gui/tabcontent.h" TabContent::TabContent(QWidget* parent) : QWidget(parent), m_index(-1) {} + +TabContent::~TabContent() {} diff --git a/src/librssguard/gui/tabcontent.h b/src/librssguard/gui/tabcontent.h index b2e0a3caa..124696019 100644 --- a/src/librssguard/gui/tabcontent.h +++ b/src/librssguard/gui/tabcontent.h @@ -13,6 +13,7 @@ class TabContent : public QWidget { public: explicit TabContent(QWidget* parent = nullptr); + virtual ~TabContent(); // Gets/sets current index of this TabContent. // NOTE: This is the index under which this object lies diff --git a/src/librssguard/gui/webbrowser.cpp b/src/librssguard/gui/webbrowser.cpp index b89cdfb8e..667d53f40 100644 --- a/src/librssguard/gui/webbrowser.cpp +++ b/src/librssguard/gui/webbrowser.cpp @@ -92,6 +92,9 @@ void WebBrowser::setHtml(const QString& html, const QUrl& base_url) { } WebBrowser::~WebBrowser() { + m_toolBar->removeAction(m_txtLocationAction); + m_toolBar->removeAction(m_btnDiscoverFeedsAction); + // Delete members. Do not use scoped pointers here. delete m_layout; } @@ -276,12 +279,12 @@ void WebBrowser::initializeLayout() { m_actionReload->setIcon(qApp->icons()->fromTheme(QSL("reload"), QSL("view-refresh"))); m_actionStop->setIcon(qApp->icons()->fromTheme(QSL("process-stop"))); - QWidgetAction* act_discover = new QWidgetAction(this); + m_btnDiscoverFeedsAction = new QWidgetAction(this); m_actionOpenInSystemBrowser->setEnabled(false); m_actionReadabilePage->setEnabled(false); - act_discover->setDefaultWidget(m_btnDiscoverFeeds); + m_btnDiscoverFeedsAction->setDefaultWidget(m_btnDiscoverFeeds); // Add needed actions into toolbar. m_toolBar->addAction(m_actionBack); @@ -290,8 +293,9 @@ void WebBrowser::initializeLayout() { m_toolBar->addAction(m_actionStop); m_toolBar->addAction(m_actionOpenInSystemBrowser); m_toolBar->addAction(m_actionReadabilePage); - m_toolBar->addAction(act_discover); - m_toolBar->addWidget(m_txtLocation); + + m_toolBar->addAction(m_btnDiscoverFeedsAction); + m_txtLocationAction = m_toolBar->addWidget(m_txtLocation); m_loadingProgress = new QProgressBar(this); m_loadingProgress->setFixedHeight(10); diff --git a/src/librssguard/gui/webbrowser.h b/src/librssguard/gui/webbrowser.h index eaa9a054d..b83831b86 100644 --- a/src/librssguard/gui/webbrowser.h +++ b/src/librssguard/gui/webbrowser.h @@ -16,6 +16,7 @@ class QToolButton; class QVBoxLayout; class QHBoxLayout; class QProgressBar; +class QWidgetAction; class QMenu; class QLabel; class TabWidget; @@ -63,7 +64,7 @@ class WebBrowser : public TabContent { void onLoadingFinished(bool success); void onTitleChanged(const QString& new_title); void onIconChanged(const QIcon& icon); - void onLinkHovered(const QUrl &url); + void onLinkHovered(const QUrl& url); void newWindowRequested(WebViewer* viewer); void readabilePage(); @@ -85,7 +86,9 @@ class WebBrowser : public TabContent { WebViewer* m_webView; SearchTextWidget* m_searchWidget; LocationLineEdit* m_txtLocation; + QAction* m_txtLocationAction; DiscoverFeedsButton* m_btnDiscoverFeeds; + QWidgetAction* m_btnDiscoverFeedsAction; QProgressBar* m_loadingProgress; QAction* m_actionBack; QAction* m_actionForward; diff --git a/src/librssguard/services/gmail/gmailserviceroot.cpp b/src/librssguard/services/gmail/gmailserviceroot.cpp index ac30d08b2..147e42bdf 100644 --- a/src/librssguard/services/gmail/gmailserviceroot.cpp +++ b/src/librssguard/services/gmail/gmailserviceroot.cpp @@ -26,9 +26,9 @@ GmailServiceRoot::GmailServiceRoot(RootItem* parent) } GmailServiceRoot::~GmailServiceRoot() { - if (!m_emailPreview.isNull()) { - m_emailPreview->deleteLater(); - } + /*if (!m_emailPreview.isNull()) { + m_emailPreview->deleteLater(); + }*/ } void GmailServiceRoot::updateTitle() { @@ -106,7 +106,7 @@ bool GmailServiceRoot::wantsBaggedIdsOfExistingMessages() const { CustomMessagePreviewer* GmailServiceRoot::customMessagePreviewer() { if (m_emailPreview.isNull()) { - m_emailPreview = new EmailPreviewer(); + m_emailPreview.reset(new EmailPreviewer()); } return m_emailPreview.data(); diff --git a/src/librssguard/services/gmail/gmailserviceroot.h b/src/librssguard/services/gmail/gmailserviceroot.h index 7d48d1dde..5a53232ed 100644 --- a/src/librssguard/services/gmail/gmailserviceroot.h +++ b/src/librssguard/services/gmail/gmailserviceroot.h @@ -50,7 +50,7 @@ class GmailServiceRoot : public ServiceRoot, public CacheForServiceRoot { void updateTitle(); private: - QPointer m_emailPreview; + QScopedPointer m_emailPreview; GmailNetworkFactory* m_network; QAction* m_actionReply; Message m_replyToMessage;