Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit a1de50cd authored by Laurent Montel's avatar Laurent Montel 😁

Reduce duplicate code

parent 4234292e
......@@ -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);
......
......@@ -35,6 +35,7 @@ public:
void dictionaryInvalid();
private:
void addNewLine(QString &str);
void updateText();
void slotHideAnnimationFinished();
bool mMailTransportIsInvalid = false;
......
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