diff options
Diffstat (limited to 'accounts/maildir/maildirsettings.cpp')
-rw-r--r-- | accounts/maildir/maildirsettings.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/accounts/maildir/maildirsettings.cpp b/accounts/maildir/maildirsettings.cpp index 18abaebb..c8b892d7 100644 --- a/accounts/maildir/maildirsettings.cpp +++ b/accounts/maildir/maildirsettings.cpp | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <QDebug> | 24 | #include <QDebug> |
25 | #include <QUuid> | 25 | #include <QUuid> |
26 | #include <QDir> | 26 | #include <QDir> |
27 | #include <QUrl> | ||
27 | 28 | ||
28 | MaildirSettings::MaildirSettings(QObject *parent) | 29 | MaildirSettings::MaildirSettings(QObject *parent) |
29 | : QObject(parent) | 30 | : QObject(parent) |
@@ -65,17 +66,18 @@ QByteArray MaildirSettings::accountIdentifier() const | |||
65 | return mAccountIdentifier; | 66 | return mAccountIdentifier; |
66 | } | 67 | } |
67 | 68 | ||
68 | void MaildirSettings::setPath(const QString &path) | 69 | void MaildirSettings::setPath(const QUrl &path) |
69 | { | 70 | { |
70 | if (mPath != path) { | 71 | auto normalizedPath = path.path(); |
71 | mPath = path; | 72 | if (mPath != normalizedPath) { |
73 | mPath = normalizedPath; | ||
72 | emit pathChanged(); | 74 | emit pathChanged(); |
73 | } | 75 | } |
74 | } | 76 | } |
75 | 77 | ||
76 | QString MaildirSettings::path() const | 78 | QUrl MaildirSettings::path() const |
77 | { | 79 | { |
78 | return mPath; | 80 | return QUrl(mPath); |
79 | } | 81 | } |
80 | 82 | ||
81 | QValidator *MaildirSettings::pathValidator() const | 83 | QValidator *MaildirSettings::pathValidator() const |
@@ -83,7 +85,7 @@ QValidator *MaildirSettings::pathValidator() const | |||
83 | class PathValidator : public QValidator { | 85 | class PathValidator : public QValidator { |
84 | State validate(QString &input, int &pos) const { | 86 | State validate(QString &input, int &pos) const { |
85 | Q_UNUSED(pos); | 87 | Q_UNUSED(pos); |
86 | if (QDir(input).exists()) { | 88 | if (!input.isEmpty() && QDir(input).exists()) { |
87 | return Acceptable; | 89 | return Acceptable; |
88 | } else { | 90 | } else { |
89 | return Intermediate; | 91 | return Intermediate; |