This commit is contained in:
Martin Rotter 2022-04-01 14:15:11 +02:00
parent ba6c81ceb7
commit 09bb58dcff
9 changed files with 23 additions and 13 deletions

View File

@ -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);

View File

@ -10,7 +10,7 @@ class BaseLineEdit : public QLineEdit {
public:
explicit BaseLineEdit(QWidget* parent = nullptr);
virtual ~BaseLineEdit() = default;
virtual ~BaseLineEdit();
void setPasswordMode(bool is_password);

View File

@ -12,8 +12,6 @@ class LocationLineEdit : public BaseLineEdit {
Q_OBJECT
public:
// Constructors and destructors.
explicit LocationLineEdit(QWidget* parent = nullptr);
virtual ~LocationLineEdit();

View File

@ -3,3 +3,5 @@
#include "gui/tabcontent.h"
TabContent::TabContent(QWidget* parent) : QWidget(parent), m_index(-1) {}
TabContent::~TabContent() {}

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -50,7 +50,7 @@ class GmailServiceRoot : public ServiceRoot, public CacheForServiceRoot {
void updateTitle();
private:
QPointer<EmailPreviewer> m_emailPreview;
QScopedPointer<EmailPreviewer> m_emailPreview;
GmailNetworkFactory* m_network;
QAction* m_actionReply;
Message m_replyToMessage;