Inform when we can"t set dictionary

wilder-work
Montel Laurent 9 years ago
parent fd956794e1
commit df168920e5
  1. 9
      src/editor/kmcomposerwin.cpp
  2. 13
      src/editor/warningwidgets/incorrectidentityfolderwarning.cpp
  3. 2
      src/editor/warningwidgets/incorrectidentityfolderwarning.h

@ -71,6 +71,7 @@
#include "kmcomposerglobalaction.h"
#include "widgets/kactionmenutransport.h"
#include "pimcommon/kactionmenuchangecase.h"
#include "sonnet_version.h"
#include <Libkdepim/StatusbarProgressWidget>
#include <Libkdepim/ProgressStatusBarWidget>
@ -1606,7 +1607,13 @@ void KMComposerWin::setMessage(const KMime::Message::Ptr &newMsg, bool lastSignS
if (auto hdr = mMsg->headerByType("X-KMail-Dictionary")) {
const QString dictionary = hdr->asUnicodeString();
if (!dictionary.isEmpty()) {
mComposerBase->dictionary()->setCurrentByDictionary(dictionary);
if (SONNET_VERSION_MINOR >= 40) {
if (!mComposerBase->dictionary()->assignDictionnaryName(dictionary)) {
mIncorrectIdentityFolderWarning->dictionaryInvalid();
}
} else {
mComposerBase->dictionary()->setCurrentByDictionary(dictionary);
}
}
} else {
mComposerBase->dictionary()->setCurrentByDictionaryName(ident.dictionary());

@ -52,6 +52,12 @@ void IncorrectIdentityFolderWarning::identityInvalid()
updateText();
}
void IncorrectIdentityFolderWarning::dictionaryInvalid()
{
mDictionaryIsInvalid = true;
updateText();
}
void IncorrectIdentityFolderWarning::updateText()
{
QString text;
@ -70,6 +76,12 @@ void IncorrectIdentityFolderWarning::updateText()
}
text += i18n("Identity was not found. Please verify that you will use a correct identity.");
}
if (mDictionaryIsInvalid) {
if (!text.isEmpty()) {
text += QLatin1Char('\n');
}
text += i18n("Dictionary was not found. Please verify that you will use a correct dictionnary.");
}
setText(text);
animatedShow();
}
@ -79,4 +91,5 @@ void IncorrectIdentityFolderWarning::slotHideAnnimationFinished()
mMailTransportIsInvalid = false;
mFccIsInvalid = false;
mIdentityIsInvalid = false;
mDictionaryIsInvalid = false;
}

@ -32,6 +32,7 @@ public:
void mailTransportIsInvalid();
void fccIsInvalid();
void identityInvalid();
void dictionaryInvalid();
private:
void updateText();
@ -39,6 +40,7 @@ private:
bool mMailTransportIsInvalid = false;
bool mFccIsInvalid = false;
bool mIdentityIsInvalid = false;
bool mDictionaryIsInvalid = false;
};
#endif // INCORRECTIDENTITYFOLDERWARNING_H

Loading…
Cancel
Save