Commit 8d4a4680 authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent 63565363
......@@ -32,6 +32,12 @@
#include <KPIMTextEdit/RichTextComposerEmailQuoteHighlighter>
#include <sonnet/dictionarycombobox.h>
namespace {
inline QString textSnippetMimeType() {
return QStringLiteral("text/x-kmail-textsnippet");
}
}
KMComposerEditorNg::KMComposerEditorNg(KMComposerWin *win, QWidget *parent)
: MessageComposer::RichTextComposerNg(parent),
mComposerWin(win)
......@@ -65,7 +71,7 @@ bool KMComposerEditorNg::canInsertFromMimeData(const QMimeData *source) const
if (source->hasImage() && source->hasFormat(QStringLiteral("image/png"))) {
return true;
}
if (source->hasFormat(QStringLiteral("text/x-kmail-textsnippet"))) {
if (source->hasFormat(textSnippetMimeType())) {
return true;
}
if (source->hasUrls()) {
......@@ -77,7 +83,7 @@ bool KMComposerEditorNg::canInsertFromMimeData(const QMimeData *source) const
void KMComposerEditorNg::insertFromMimeData(const QMimeData *source)
{
if (source->hasFormat(QStringLiteral("text/x-kmail-textsnippet"))) {
if (source->hasFormat(textSnippetMimeType())) {
Q_EMIT insertSnippet();
return;
}
......
......@@ -2031,8 +2031,9 @@ bool KMComposerWin::insertFromMimeData(const QMimeData *source, bool forceAttach
}
} else {
QMenu p;
const QAction *addAsTextAction = p.addAction(i18np("Add URL into Message", "Add URLs into Message", urlList.size()));
const QAction *addAsAttachmentAction = p.addAction(i18np("Add File as &Attachment", "Add Files as &Attachment", urlList.size()));
const int sizeUrl(urlList.size());
const QAction *addAsTextAction = p.addAction(i18np("Add URL into Message", "Add URLs into Message", sizeUrl));
const QAction *addAsAttachmentAction = p.addAction(i18np("Add File as &Attachment", "Add Files as &Attachment", sizeUrl));
const QAction *selectedAction = p.exec(QCursor::pos());
if (selectedAction == addAsTextAction) {
......@@ -2054,6 +2055,7 @@ bool KMComposerWin::insertFromMimeData(const QMimeData *source, bool forceAttach
connect(itemFetchJob, &Akonadi::ItemFetchJob::result, this, &KMComposerWin::slotFetchJob);
}
if (!collections.isEmpty()) {
qCDebug(KMAIL_LOG) << "Collection dnd not supported";
//TODO
}
return true;
......
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