Commit 1ea3dd68 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Reduce duplicate code. Remove unused code, use default value

parent b80e1402
......@@ -649,28 +649,6 @@ void ViewerPrivate::prepareHandleAttachment(KMime::Content *node)
mCurrentContent = node;
}
QString ViewerPrivate::createAtmFileLink(const QString &atmFileName) const
{
QFileInfo atmFileInfo(atmFileName);
// tempfile name is /TMP/attachmentsRANDOM/atmFileInfo.fileName()"
const QString tmpPath = QDir::tempPath() + QLatin1String("/attachments");
QDir().mkpath(tmpPath);
QTemporaryDir *linkDir = new QTemporaryDir(tmpPath);
QString linkPath = linkDir->path() + QLatin1Char('/') + atmFileInfo.fileName();
QFile *linkFile = new QFile(linkPath);
linkFile->open(QIODevice::ReadWrite);
const QString linkName = linkFile->fileName();
delete linkFile;
delete linkDir;
if (::link(QFile::encodeName(atmFileName).constData(),
QFile::encodeName(linkName).constData()) == 0) {
return linkName; // success
}
return {};
}
KService::Ptr ViewerPrivate::getServiceOffer(KMime::Content *content)
{
const QString fileName = mNodeHelper->writeNodeToTempFile(content);
......@@ -1839,6 +1817,8 @@ KToggleAction *ViewerPrivate::actionForAttachmentStrategy(
actionName = QStringLiteral("view_attachments_hide");
} else if (as == AttachmentStrategy::headerOnly()) {
actionName = QStringLiteral("view_attachments_headeronly");
} else {
qCWarning(MESSAGEVIEWER_LOG) << "actionForAttachmentStrategy invalid attachment type";
}
if (actionName.isEmpty()) {
......
......@@ -38,6 +38,7 @@
#include <KSharedConfig>
#include <QPointer>
#include <QUrl>
#include <QVector>
#include <viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.h>
#include <QObject>
......@@ -237,7 +238,6 @@ public:
*/
void prepareHandleAttachment(KMime::Content *node);
Q_REQUIRED_RESULT QString createAtmFileLink(const QString &atmFileName) const;
Q_REQUIRED_RESULT KService::Ptr getServiceOffer(KMime::Content *content);
Q_REQUIRED_RESULT KMime::Content::List selectedContents() const;
void attachmentOpenWith(KMime::Content *node, const KService::Ptr &offer = KService::Ptr());
......@@ -626,7 +626,7 @@ public:
bool mMsgDisplay = true;
CSSHelper *mCSSHelper = nullptr;
bool mUseFixedFont;
bool mUseFixedFont = false;
bool mPrinting = false;
QWidget *mMainWindow = nullptr;
KActionCollection *mActionCollection = nullptr;
......@@ -691,7 +691,7 @@ public:
MessageViewer::ViewerPluginToolManager *mViewerPluginToolManager = nullptr;
WebEngineViewer::ZoomActionMenu *mZoomActionMenu = nullptr;
QPrinter *mCurrentPrinter = nullptr;
QList<QPointer<MessageViewer::MailSourceWebEngineViewer> > mListMailSourceViewer;
QVector<QPointer<MessageViewer::MailSourceWebEngineViewer> > mListMailSourceViewer;
WebEngineViewer::LocalDataBaseManager *mPhishingDatabase = nullptr;
MessageViewer::ShowNextMessageWidget *mShowNextMessageWidget = nullptr;
#ifdef USE_DKIM_CHECKER
......
......@@ -87,13 +87,6 @@ void PrintingSettings::doLoadFromGlobalSettings()
void PrintingSettings::doResetToDefaultsOther()
{
const bool bUseDefaults = MessageViewer::MessageViewerSettings::self()->useDefaults(true);
loadWidget(d->mPrintingUi->mPrintEmptySelectedText,
MessageViewer::MessageViewerSettings::self()->printSelectedTextItem());
loadWidget(d->mPrintingUi->respectExpandCollapseSettings,
MessageViewer::MessageViewerSettings::self()->respectExpandCollapseSettingsItem());
loadWidget(d->mPrintingUi->printBackgroundColorAndImages,
MessageViewer::MessageViewerSettings::self()->printBackgroundColorImagesItem());
loadWidget(d->mPrintingUi->alwaysShowEncryptionSignatureDetail,
MessageViewer::MessageViewerSettings::self()->alwaysShowEncryptionSignatureDetailsItem());
doLoadFromGlobalSettings();
MessageViewer::MessageViewerSettings::self()->useDefaults(bUseDefaults);
}
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