summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-14 21:41:46 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-14 21:41:46 (GMT)
commit64ab2483009bd6d68bf8d1e9f9efadec7084b3e0 (patch)
tree5c03402524d266bdd5aeceba783b0e910b358cfe
parent8cfc00ad42d30a4999adb0234f0ca3ea4e630675 (diff)
Activate by default emoticon. Add action to disable it if necessary
-rw-r--r--CMakeLists.txt2
-rw-r--r--messageviewer/src/header/grantleeheaderformatter.cpp5
-rw-r--r--messageviewer/src/header/plainheaderstyle.cpp5
-rw-r--r--messageviewer/src/settings/messageviewer.kcfg.cmake5
-rw-r--r--messageviewer/src/ui/settings.ui8
-rw-r--r--messageviewer/src/viewer/viewer.cpp6
-rw-r--r--messageviewer/src/viewer/viewer.h1
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp17
-rw-r--r--messageviewer/src/viewer/viewer_p.h3
-rw-r--r--messageviewer/src/widgets/configurewidget.cpp2
10 files changed, 29 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd7a673..42d6498 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.75")
+set(PIM_VERSION "5.3.76")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
diff --git a/messageviewer/src/header/grantleeheaderformatter.cpp b/messageviewer/src/header/grantleeheaderformatter.cpp
index 97e5445..38ac59b 100644
--- a/messageviewer/src/header/grantleeheaderformatter.cpp
+++ b/messageviewer/src/header/grantleeheaderformatter.cpp
@@ -112,10 +112,7 @@ QString GrantleeHeaderFormatter::format(const QString &absolutePath, const Grant
headerObject.insert(QStringLiteral("subjectDir"), d->headerStyleUtil.subjectDirectionString(message));
headerObject.insert(QStringLiteral("subjecti18n"), i18n("Subject:"));
- KTextToHTML::Options flags = KTextToHTML::PreserveSpaces;
- if (MessageViewer::MessageViewerSettings::self()->showEmoticons()) {
- flags |= KTextToHTML::ReplaceSmileys;
- }
+ const KTextToHTML::Options flags = KTextToHTML::PreserveSpaces | KTextToHTML::ReplaceSmileys;
headerObject.insert(QStringLiteral("subject"), d->headerStyleUtil.subjectString(message, flags));
diff --git a/messageviewer/src/header/plainheaderstyle.cpp b/messageviewer/src/header/plainheaderstyle.cpp
index 52be16e..e0747af 100644
--- a/messageviewer/src/header/plainheaderstyle.cpp
+++ b/messageviewer/src/header/plainheaderstyle.cpp
@@ -109,10 +109,7 @@ QString PlainHeaderStyle::format(KMime::Message *message) const
//case HdrLong:
if (strategy->showHeader(QStringLiteral("subject"))) {
- KTextToHTML::Options flags = KTextToHTML::PreserveSpaces;
- if (MessageViewer::MessageViewerSettings::self()->showEmoticons()) {
- flags |= KTextToHTML::ReplaceSmileys;
- }
+ const KTextToHTML::Options flags = KTextToHTML::PreserveSpaces | KTextToHTML::ReplaceSmileys;
headerStr += QStringLiteral("<div dir=\"%1\"><b style=\"font-size:130%\">").arg(subjectDir) +
diff --git a/messageviewer/src/settings/messageviewer.kcfg.cmake b/messageviewer/src/settings/messageviewer.kcfg.cmake
index 1991fbc..2e22eaa 100644
--- a/messageviewer/src/settings/messageviewer.kcfg.cmake
+++ b/messageviewer/src/settings/messageviewer.kcfg.cmake
@@ -52,11 +52,6 @@ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/sta
<default>true</default>
<label>Show HTML Side Bar</label>
</entry>
- <entry name="ShowEmoticons" type="Bool">
- <default>true</default>
- <label>Replace smileys by emoticons</label>
- <whatsthis>Enable this if you want smileys like :-) appearing in the message text to be replaced by emoticons (small pictures).</whatsthis>
- </entry>
<entry name="ShowExpandQuotesMark" type="Bool">
<default>false</default>
<label>Show expand/collapse quote marks</label>
diff --git a/messageviewer/src/ui/settings.ui b/messageviewer/src/ui/settings.ui
index a0ccd27..9c107da 100644
--- a/messageviewer/src/ui/settings.ui
+++ b/messageviewer/src/ui/settings.ui
@@ -100,13 +100,6 @@
</widget>
</item>
<item>
- <widget class="QCheckBox" name="kcfg_ShowEmoticons">
- <property name="text">
- <string>Replace smileys &amp;by emoticons</string>
- </property>
- </widget>
- </item>
- <item>
<widget class="QCheckBox" name="kcfg_ShrinkQuotes">
<property name="text">
<string>Reduce font size for &amp;quoted text</string>
@@ -239,7 +232,6 @@
<tabstops>
<tabstop>kcfg_AccessKeyEnabled</tabstop>
<tabstop>kcfg_showColorBar</tabstop>
- <tabstop>kcfg_ShowEmoticons</tabstop>
<tabstop>kcfg_ShrinkQuotes</tabstop>
<tabstop>kcfg_ShowExpandQuotesMark</tabstop>
<tabstop>kcfg_CollapseQuoteLevelSpin</tabstop>
diff --git a/messageviewer/src/viewer/viewer.cpp b/messageviewer/src/viewer/viewer.cpp
index 74a325c..7bafb84 100644
--- a/messageviewer/src/viewer/viewer.cpp
+++ b/messageviewer/src/viewer/viewer.cpp
@@ -593,6 +593,12 @@ QAction *Viewer::resetMessageDisplayFormatAction() const
return d->mResetMessageDisplayFormat;
}
+QAction *Viewer::disableEmoticonAction() const
+{
+ Q_D(const Viewer);
+ return d->mDisableEmoticonAction;
+}
+
void Viewer::saveMainFrameScreenshotInFile(const QString &filename)
{
Q_D(Viewer);
diff --git a/messageviewer/src/viewer/viewer.h b/messageviewer/src/viewer/viewer.h
index 5d4b278..0098319 100644
--- a/messageviewer/src/viewer/viewer.h
+++ b/messageviewer/src/viewer/viewer.h
@@ -277,6 +277,7 @@ public:
QAction *saveAsAction() const;
QAction *saveMessageDisplayFormatAction() const;
QAction *resetMessageDisplayFormatAction() const;
+ QAction *disableEmoticonAction() const;
KActionMenu *shareServiceUrlMenu() const;
HeaderStylePlugin *headerStylePlugin() const;
void setPluginName(const QString &pluginName);
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index ceb828c..ebd41eb 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -206,6 +206,7 @@ ViewerPrivate::ViewerPrivate(Viewer *aParent, QWidget *mainWindow,
mDecrytMessageOverwrite(false),
mShowSignatureDetails(false),
mShowAttachmentQuicklist(true),
+ mForceEmoticons(true),
mRecursionCountForDisplayMessage(0),
mCurrentContent(0),
mMessagePartNode(0),
@@ -739,7 +740,7 @@ void ViewerPrivate::attachmentOpen(KMime::Content *node)
bool ViewerPrivate::showEmoticons() const
{
- return MessageViewer::MessageViewerSettings::self()->showEmoticons();
+ return mForceEmoticons;
}
MimeTreeParser::HtmlWriter *ViewerPrivate::htmlWriter() const
@@ -1268,6 +1269,7 @@ void ViewerPrivate::printPreviewMessage(const Akonadi::Item &message)
void ViewerPrivate::resetStateForNewMessage()
{
+ mForceEmoticons = true;
mClickedUrl.clear();
mImageUrl.clear();
enableMessageDisplay(); // just to make sure it's on
@@ -1726,6 +1728,11 @@ void ViewerPrivate::createActions()
mShareServiceUrlMenu = mShareServiceManager->menu();
ac->addAction(QStringLiteral("shareservice_menu"), mShareServiceUrlMenu);
connect(mShareServiceManager, &PimCommon::ShareServiceUrlManager::serviceUrlSelected, this, &ViewerPrivate::slotServiceUrlSelected);
+
+ mDisableEmoticonAction = new QAction(i18n("Disable Emoticon"), this);
+ ac->addAction(QStringLiteral("disable_emoticon"), mDisableEmoticonAction);
+ connect(mDisableEmoticonAction, &QAction::triggered, this, &ViewerPrivate::slotDisableEmoticon);
+ ac->setDefaultShortcut(mFindInMessageAction, KStandardShortcut::find().first());
}
void ViewerPrivate::showContextMenu(KMime::Content *content, const QPoint &pos)
@@ -3040,3 +3047,11 @@ void ViewerPrivate::setPrintElementBackground(bool printElementBackground)
{
mViewer->setPrintElementBackground(printElementBackground);
}
+
+void ViewerPrivate::slotDisableEmoticon()
+{
+ if (mForceEmoticons) {
+ mForceEmoticons = false;
+ update(MimeTreeParser::Force);
+ }
+}
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index 2201da9..db72e97 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -469,6 +469,7 @@ private Q_SLOTS:
void slotExportHtmlPageSuccess(const QString &filename);
void slotHandlePagePrinted(bool result);
void slotLoadStarted();
+ void slotDisableEmoticon();
public Q_SLOTS:
/** An URL has been activate with a click. */
void slotUrlOpen(const QUrl &url = QUrl());
@@ -633,6 +634,7 @@ public:
QAction *mFindInMessageAction;
QAction *mSaveMessageDisplayFormat;
QAction *mResetMessageDisplayFormat;
+ QAction *mDisableEmoticonAction;
KToggleAction *mHeaderOnlyAttachmentsAction;
KSelectAction *mSelectEncodingAction;
KToggleAction *mToggleFixFontAction;
@@ -654,6 +656,7 @@ public:
bool mDecrytMessageOverwrite;
bool mShowSignatureDetails;
bool mShowAttachmentQuicklist;
+ bool mForceEmoticons;
int mRecursionCountForDisplayMessage;
KMime::Content *mCurrentContent;
KMime::Content *mMessagePartNode;
diff --git a/messageviewer/src/widgets/configurewidget.cpp b/messageviewer/src/widgets/configurewidget.cpp
index 6381377..1c01ef0 100644
--- a/messageviewer/src/widgets/configurewidget.cpp
+++ b/messageviewer/src/widgets/configurewidget.cpp
@@ -63,8 +63,6 @@ ConfigureWidget::ConfigureWidget(QWidget *parent)
d->mSettingsUi->overrideCharacterEncoding->setWhatsThis(
MessageCore::MessageCoreSettings::self()->overrideCharacterEncodingItem()->whatsThis());
- d->mSettingsUi->kcfg_ShowEmoticons->setWhatsThis(
- MessageViewer::MessageViewerSettings::self()->showEmoticonsItem()->whatsThis());
d->mSettingsUi->kcfg_ShrinkQuotes->setWhatsThis(
MessageViewer::MessageViewerSettings::self()->shrinkQuotesItem()->whatsThis());
d->mSettingsUi->kcfg_ShowExpandQuotesMark->setWhatsThis(