summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-01-08 07:57:06 +0100
committerLaurent Montel <[email protected]>2018-01-08 07:57:06 +0100
commita1de50cd0a87e62a3c1fdfbcfc1e1e35ae14dfed (patch)
tree81c7f0284de982a9128517ad4b48dc4b07fe775e
parent4234292e2548c5c3b9a8e20b64797e2c56008db9 (diff)
Reduce duplicate code
-rw-r--r--src/editor/warningwidgets/incorrectidentityfolderwarning.cpp19
-rw-r--r--src/editor/warningwidgets/incorrectidentityfolderwarning.h1
2 files changed, 11 insertions, 9 deletions
diff --git a/src/editor/warningwidgets/incorrectidentityfolderwarning.cpp b/src/editor/warningwidgets/incorrectidentityfolderwarning.cpp
index ec85136..63d0795 100644
--- a/src/editor/warningwidgets/incorrectidentityfolderwarning.cpp
+++ b/src/editor/warningwidgets/incorrectidentityfolderwarning.cpp
@@ -58,6 +58,13 @@ void IncorrectIdentityFolderWarning::dictionaryInvalid()
updateText();
}
+void IncorrectIdentityFolderWarning::addNewLine(QString &str)
+{
+ if (!str.isEmpty()) {
+ str += QLatin1Char('\n');
+ }
+}
+
void IncorrectIdentityFolderWarning::updateText()
{
QString text;
@@ -65,21 +72,15 @@ void IncorrectIdentityFolderWarning::updateText()
text = i18n("Transport was not found. Please verify that you will use a correct mail transport.");
}
if (mFccIsInvalid) {
- if (!text.isEmpty()) {
- text += QLatin1Char('\n');
- }
+ addNewLine(text);
text += i18n("Sent Folder is not defined. Please verify it before to send it.");
}
if (mIdentityIsInvalid) {
- if (!text.isEmpty()) {
- text += QLatin1Char('\n');
- }
+ addNewLine(text);
text += i18n("Identity was not found. Please verify that you will use a correct identity.");
}
if (mDictionaryIsInvalid) {
- if (!text.isEmpty()) {
- text += QLatin1Char('\n');
- }
+ addNewLine(text);
text += i18n("Dictionary was not found. Please verify that you will use a correct dictionary.");
}
setText(text);
diff --git a/src/editor/warningwidgets/incorrectidentityfolderwarning.h b/src/editor/warningwidgets/incorrectidentityfolderwarning.h
index aa17846..f90bcfd 100644
--- a/src/editor/warningwidgets/incorrectidentityfolderwarning.h
+++ b/src/editor/warningwidgets/incorrectidentityfolderwarning.h
@@ -35,6 +35,7 @@ public:
void dictionaryInvalid();
private:
+ void addNewLine(QString &str);
void updateText();
void slotHideAnnimationFinished();
bool mMailTransportIsInvalid = false;