summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-05-02 22:34:48 +0200
committerMontel Laurent <[email protected]>2016-05-02 22:34:48 +0200
commit8d4a4680a1951703aef2b096d071c1b2e718b5d2 (patch)
treee4a7203371ab1726ee49f1089138361b88d10ddd
parent635653636c0f5d8caa08fdb99a93ff3541a1479c (diff)
Minor optimization
-rw-r--r--kmail/src/editor/kmcomposereditorng.cpp10
-rw-r--r--kmail/src/editor/kmcomposerwin.cpp6
2 files changed, 12 insertions, 4 deletions
diff --git a/kmail/src/editor/kmcomposereditorng.cpp b/kmail/src/editor/kmcomposereditorng.cpp
index 5fe684f..f1bef9d 100644
--- a/kmail/src/editor/kmcomposereditorng.cpp
+++ b/kmail/src/editor/kmcomposereditorng.cpp
@@ -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;
}
diff --git a/kmail/src/editor/kmcomposerwin.cpp b/kmail/src/editor/kmcomposerwin.cpp
index 235f081..033d67f 100644
--- a/kmail/src/editor/kmcomposerwin.cpp
+++ b/kmail/src/editor/kmcomposerwin.cpp
@@ -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;