Commit 7dab10df authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix dnd on subject lineedit. When it's an url we don't want to

copy url we want to attach it
parent 7c51f6dc
Pipeline #145008 failed with stage
in 3 minutes and 44 seconds
......@@ -335,6 +335,9 @@ KMComposerWin::KMComposerWin(const KMime::Message::Ptr &aMsg,
mEdtSubject = new SubjectLineEditWithAutoCorrection(mHeadersArea, QStringLiteral("kmail2rc"));
mEdtSubject->installEventFilter(this);
mEdtSubject->setAutocorrection(KMKernel::self()->composerAutoCorrection());
connect(mEdtSubject, &SubjectLineEditWithAutoCorrection::handleMimeData, this, [this](const QMimeData *mimeData) {
insertFromMimeData(mimeData, false);
});
mLblIdentity = new QLabel(i18n("&Identity:"), mHeadersArea);
mDictionaryLabel = new QLabel(i18n("&Dictionary:"), mHeadersArea);
mLblFcc = new QLabel(i18n("&Sent-Mail folder:"), mHeadersArea);
......
......@@ -6,6 +6,8 @@
#include "subjectlineeditwithautocorrection.h"
#include <KLocalizedString>
#include <QDropEvent>
#include <QMimeData>
SubjectLineEditWithAutoCorrection::SubjectLineEditWithAutoCorrection(QWidget *parent, const QString &configFile)
: PimCommon::LineEditWithAutoCorrection(parent, configFile)
......@@ -17,3 +19,14 @@ SubjectLineEditWithAutoCorrection::SubjectLineEditWithAutoCorrection(QWidget *pa
SubjectLineEditWithAutoCorrection::~SubjectLineEditWithAutoCorrection()
{
}
void SubjectLineEditWithAutoCorrection::dropEvent(QDropEvent *event)
{
const QMimeData *mimeData = event->mimeData();
if (mimeData->hasUrls()) {
Q_EMIT handleMimeData(mimeData);
event->accept();
return;
}
PimCommon::LineEditWithAutoCorrection::dropEvent(event);
}
......@@ -14,4 +14,10 @@ class KMAILTESTS_TESTS_EXPORT SubjectLineEditWithAutoCorrection : public PimComm
public:
explicit SubjectLineEditWithAutoCorrection(QWidget *parent, const QString &configFile);
~SubjectLineEditWithAutoCorrection() override;
protected:
void dropEvent(QDropEvent *event) override;
Q_SIGNALS:
void handleMimeData(const QMimeData *mimeData);
};
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