Commit 0b0379a1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Rename widget class

parent 4e541d3d
Pipeline #55794 passed with stage
in 42 minutes and 19 seconds
......@@ -150,8 +150,8 @@ set(libmessageviewer_widgets_SRCS
widgets/opensavedfilefolderwidget.cpp
widgets/mailsourceviewtextbrowserwidget.cpp
widgets/submittedformwarningwidget.cpp
widgets/mailtrackingwarningwidget.cpp
widgets/mailtrackingdetailsdialog.cpp
widgets/trackingwarningwidget.cpp
widgets/trackingdetailsdialog.cpp
widgets/shownextmessagewidget.cpp
widgets/developertooldialog.cpp
widgets/developertoolwidget.cpp
......
......@@ -127,7 +127,7 @@
#include <AkonadiCore/agentmanager.h>
#include <AkonadiCore/collectionfetchscope.h>
#include "widgets/mailtrackingwarningwidget.h"
#include "widgets/trackingwarningwidget.h"
#include <KJobWidgets/KJobWidgets>
#include <KPIMTextEdit/TextToSpeechWidget>
#include <QApplication>
......@@ -929,7 +929,7 @@ void ViewerPrivate::initHtmlWidget()
connect(mViewer, &MailWebEngineView::wheelZoomChanged, this, &ViewerPrivate::slotWheelZoomChanged);
connect(mViewer, &MailWebEngineView::messageMayBeAScam, this, &ViewerPrivate::slotMessageMayBeAScam);
connect(mViewer, &MailWebEngineView::formSubmittedForbidden, mSubmittedFormWarning, &SubmittedFormWarningWidget::showWarning);
connect(mViewer, &MailWebEngineView::mailTrackingFound, mMailTrackingWarning, &MailTrackingWarningWidget::addTracker);
connect(mViewer, &MailWebEngineView::mailTrackingFound, mMailTrackingWarning, &TrackingWarningWidget::addTracker);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::showDetails, mViewer, &MailWebEngineView::slotShowDetails);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::moveMessageToTrash, this, &ViewerPrivate::moveMessageToTrash);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::messageIsNotAScam, this, &ViewerPrivate::slotMessageIsNotAScam);
......@@ -1391,7 +1391,7 @@ void ViewerPrivate::createWidgets()
mSubmittedFormWarning->setObjectName(QStringLiteral("submittedformwarning"));
readerBoxVBoxLayout->addWidget(mSubmittedFormWarning);
mMailTrackingWarning = new MailTrackingWarningWidget(readerBox);
mMailTrackingWarning = new TrackingWarningWidget(readerBox);
mMailTrackingWarning->setObjectName(QStringLiteral("mailtrackingwarning"));
readerBoxVBoxLayout->addWidget(mMailTrackingWarning);
......
......@@ -90,7 +90,7 @@ class HeaderStyleMenuManager;
class ViewerPluginToolManager;
class SubmittedFormWarningWidget;
class MailSourceWebEngineViewer;
class MailTrackingWarningWidget;
class TrackingWarningWidget;
class ShowNextMessageWidget;
class DeveloperToolDialog;
class RemoteContentMenu;
......@@ -693,7 +693,7 @@ public:
MessageViewer::ScamDetectionWarningWidget *mScamDetectionWarning = nullptr;
MessageViewer::OpenSavedFileFolderWidget *mOpenSavedFileFolderWidget = nullptr;
MessageViewer::SubmittedFormWarningWidget *mSubmittedFormWarning = nullptr;
MessageViewer::MailTrackingWarningWidget *mMailTrackingWarning = nullptr;
MessageViewer::TrackingWarningWidget *mMailTrackingWarning = nullptr;
KPIMTextEdit::TextToSpeechWidget *mTextToSpeechWidget = nullptr;
Viewer::DisplayFormatMessage mDisplayFormatMessageOverwrite;
KPIMTextEdit::SlideContainer *mSliderContainer = nullptr;
......
......@@ -8,8 +8,8 @@ macro(add_messageviewer_widget_unittest _source)
)
endmacro ()
add_messageviewer_widget_unittest(mailtrackingwarningwidgettest.cpp)
add_messageviewer_widget_unittest(mailtrackingdetailsdialogtest.cpp)
add_messageviewer_widget_unittest(trackingwarningwidgettest.cpp)
add_messageviewer_widget_unittest(trackingdetailsdialogtest.cpp)
add_messageviewer_widget_unittest(shownextmessagewidgettest.cpp)
add_messageviewer_widget_unittest(developertooldialogtest.cpp)
add_messageviewer_widget_unittest(developertoolwidgettest.cpp)
......@@ -4,20 +4,20 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "mailtrackingdetailsdialogtest.h"
#include "widgets/mailtrackingdetailsdialog.h"
#include "trackingdetailsdialogtest.h"
#include "widgets/trackingdetailsdialog.h"
#include <QStandardPaths>
#include <QTest>
QTEST_MAIN(MailTrackingDetailsDialogTest)
QTEST_MAIN(TrackingDetailsDialogTest)
MailTrackingDetailsDialogTest::MailTrackingDetailsDialogTest(QObject *parent)
TrackingDetailsDialogTest::TrackingDetailsDialogTest(QObject *parent)
: QObject(parent)
{
QStandardPaths::setTestModeEnabled(true);
}
void MailTrackingDetailsDialogTest::shouldHaveDefaultValue()
void TrackingDetailsDialogTest::shouldHaveDefaultValue()
{
// TOOD
}
......@@ -8,13 +8,12 @@
#include <QObject>
class MailTrackingDetailsDialogTest : public QObject
class TrackingDetailsDialogTest : public QObject
{
Q_OBJECT
public:
explicit MailTrackingDetailsDialogTest(QObject *parent = nullptr);
~MailTrackingDetailsDialogTest() override = default;
explicit TrackingDetailsDialogTest(QObject *parent = nullptr);
~TrackingDetailsDialogTest() override = default;
private Q_SLOTS:
void shouldHaveDefaultValue();
};
......@@ -4,20 +4,20 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "mailtrackingwarningwidgettest.h"
#include "widgets/mailtrackingwarningwidget.h"
#include "trackingwarningwidgettest.h"
#include "widgets/trackingwarningwidget.h"
#include <QTest>
QTEST_MAIN(MailTrackingWarningWidgetTest)
QTEST_MAIN(TrackingWarningWidgetTest)
MailTrackingWarningWidgetTest::MailTrackingWarningWidgetTest(QObject *parent)
TrackingWarningWidgetTest::TrackingWarningWidgetTest(QObject *parent)
: QObject(parent)
{
}
void MailTrackingWarningWidgetTest::shouldHaveDefaultValues()
void TrackingWarningWidgetTest::shouldHaveDefaultValues()
{
MessageViewer::MailTrackingWarningWidget w;
MessageViewer::TrackingWarningWidget w;
QVERIFY(!w.isVisible());
QVERIFY(!w.isCloseButtonVisible());
QVERIFY(w.wordWrap());
......
......@@ -8,13 +8,12 @@
#include <QObject>
class MailTrackingWarningWidgetTest : public QObject
class TrackingWarningWidgetTest : public QObject
{
Q_OBJECT
public:
explicit MailTrackingWarningWidgetTest(QObject *parent = nullptr);
~MailTrackingWarningWidgetTest() override = default;
explicit TrackingWarningWidgetTest(QObject *parent = nullptr);
~TrackingWarningWidgetTest() override = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
......@@ -4,7 +4,7 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "mailtrackingdetailsdialog.h"
#include "trackingdetailsdialog.h"
#include <KConfigGroup>
#include <KLocalizedString>
#include <KPIMTextEdit/RichTextEditorWidget>
......@@ -18,7 +18,7 @@ namespace
{
static const char myMailTrackingDetailsDialogConfigGroupName[] = "MailTrackingDetailsDialog";
}
MailTrackingDetailsDialog::MailTrackingDetailsDialog(QWidget *parent)
TrackingDetailsDialog::TrackingDetailsDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Details"));
......@@ -30,8 +30,8 @@ MailTrackingDetailsDialog::MailTrackingDetailsDialog(QWidget *parent)
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
buttonBox->setObjectName(QStringLiteral("buttonbox"));
connect(buttonBox, &QDialogButtonBox::rejected, this, &MailTrackingDetailsDialog::reject);
connect(buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, this, &MailTrackingDetailsDialog::close);
connect(buttonBox, &QDialogButtonBox::rejected, this, &TrackingDetailsDialog::reject);
connect(buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, this, &TrackingDetailsDialog::close);
mDetails = new KPIMTextEdit::RichTextEditorWidget(this);
mDetails->setObjectName(QStringLiteral("detail"));
......@@ -41,12 +41,12 @@ MailTrackingDetailsDialog::MailTrackingDetailsDialog(QWidget *parent)
readConfig();
}
MailTrackingDetailsDialog::~MailTrackingDetailsDialog()
TrackingDetailsDialog::~TrackingDetailsDialog()
{
writeConfig();
}
void MailTrackingDetailsDialog::readConfig()
void TrackingDetailsDialog::readConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), myMailTrackingDetailsDialogConfigGroupName);
const QSize size = group.readEntry("Size", QSize(600, 400));
......@@ -55,14 +55,14 @@ void MailTrackingDetailsDialog::readConfig()
}
}
void MailTrackingDetailsDialog::writeConfig()
void TrackingDetailsDialog::writeConfig()
{
KConfigGroup group(KSharedConfig::openConfig(), myMailTrackingDetailsDialogConfigGroupName);
group.writeEntry("Size", size());
group.sync();
}
void MailTrackingDetailsDialog::setDetails(const QString &details)
void TrackingDetailsDialog::setDetails(const QString &details)
{
mDetails->setHtml(details);
}
......@@ -16,12 +16,12 @@ class RichTextEditorWidget;
namespace MessageViewer
{
class MESSAGEVIEWER_TESTS_EXPORT MailTrackingDetailsDialog : public QDialog
class MESSAGEVIEWER_TESTS_EXPORT TrackingDetailsDialog : public QDialog
{
Q_OBJECT
public:
explicit MailTrackingDetailsDialog(QWidget *parent = nullptr);
~MailTrackingDetailsDialog() override;
explicit TrackingDetailsDialog(QWidget *parent = nullptr);
~TrackingDetailsDialog() override;
void setDetails(const QString &details);
......@@ -32,4 +32,3 @@ private:
KPIMTextEdit::RichTextEditorWidget *mDetails = nullptr;
};
}
......@@ -4,12 +4,12 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "mailtrackingwarningwidget.h"
#include "mailtrackingdetailsdialog.h"
#include "trackingwarningwidget.h"
#include "trackingdetailsdialog.h"
#include <KLocalizedString>
using namespace MessageViewer;
MailTrackingWarningWidget::MailTrackingWarningWidget(QWidget *parent)
TrackingWarningWidget::TrackingWarningWidget(QWidget *parent)
: KMessageWidget(parent)
{
setVisible(false);
......@@ -18,25 +18,25 @@ MailTrackingWarningWidget::MailTrackingWarningWidget(QWidget *parent)
setWordWrap(true);
setText(i18n("Some Mail Tracker was found and was blocked.<a href=\"mailtrackingdetails\">(Details...)"));
connect(this, &MailTrackingWarningWidget::linkActivated, this, &MailTrackingWarningWidget::slotShowDetails);
connect(this, &TrackingWarningWidget::linkActivated, this, &TrackingWarningWidget::slotShowDetails);
}
MailTrackingWarningWidget::~MailTrackingWarningWidget()
TrackingWarningWidget::~TrackingWarningWidget()
{
}
void MailTrackingWarningWidget::slotShowDetails(const QString &content)
void TrackingWarningWidget::slotShowDetails(const QString &content)
{
if (content == QLatin1String("mailtrackingdetails")) {
if (!mMailTrackingDetailDialog) {
mMailTrackingDetailDialog = new MessageViewer::MailTrackingDetailsDialog;
mMailTrackingDetailDialog = new MessageViewer::TrackingDetailsDialog;
}
mMailTrackingDetailDialog->setDetails(generateDetails());
mMailTrackingDetailDialog->show();
}
}
QString MailTrackingWarningWidget::generateDetails() const
QString TrackingWarningWidget::generateDetails() const
{
QString details = QLatin1String("<b>") + i18n("Details:") + QLatin1String("</b><ul>");
......@@ -50,7 +50,7 @@ QString MailTrackingWarningWidget::generateDetails() const
return details;
}
void MailTrackingWarningWidget::addTracker(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &tracker)
void TrackingWarningWidget::addTracker(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &tracker)
{
blackListFound item = mBackLists.value(tracker.mCompanyName);
if (item.url.isEmpty()) {
......@@ -65,7 +65,7 @@ void MailTrackingWarningWidget::addTracker(const WebEngineViewer::BlockTrackingU
}
}
void MailTrackingWarningWidget::hideAndClear()
void TrackingWarningWidget::hideAndClear()
{
mBackLists.clear();
setVisible(false);
......
......@@ -17,13 +17,13 @@
namespace MessageViewer
{
class MailTrackingDetailsDialog;
class MESSAGEVIEWER_TESTS_EXPORT MailTrackingWarningWidget : public KMessageWidget
class TrackingDetailsDialog;
class MESSAGEVIEWER_TESTS_EXPORT TrackingWarningWidget : public KMessageWidget
{
Q_OBJECT
public:
explicit MailTrackingWarningWidget(QWidget *parent = nullptr);
~MailTrackingWarningWidget() override;
explicit TrackingWarningWidget(QWidget *parent = nullptr);
~TrackingWarningWidget() override;
void addTracker(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &);
void hideAndClear();
......@@ -36,7 +36,6 @@ private:
int number = 1;
};
QMap<QString, blackListFound> mBackLists;
QPointer<MailTrackingDetailsDialog> mMailTrackingDetailDialog;
QPointer<TrackingDetailsDialog> mMailTrackingDetailDialog;
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment