Changeset View
Changeset View
Standalone View
Standalone View
resources/maildir/libmaildir/maildir.cpp
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Line(s) | 156 | if (!dest.rename(path, newName)) { | |||
---|---|---|---|---|---|
158 | return false; | 158 | return false; | ||
159 | } | 159 | } | ||
160 | const QDir subDirs(Maildir::subDirPathForFolderPath(path)); | 160 | const QDir subDirs(Maildir::subDirPathForFolderPath(path)); | ||
161 | if (subDirs.exists() && !dest.rename(subDirs.path(), subDirNameForFolderName(newName))) { | 161 | if (subDirs.exists() && !dest.rename(subDirs.path(), subDirNameForFolderName(newName))) { | ||
162 | qCDebug(LIBMAILDIR_LOG) << "Failed to rename subfolders"; | 162 | qCDebug(LIBMAILDIR_LOG) << "Failed to rename subfolders"; | ||
163 | return false; | 163 | return false; | ||
164 | } | 164 | } | ||
165 | 165 | | |||
166 | path = dest.path() + QDir::separator() + newName; | 166 | path = dest.path() + QLatin1Char('/') + newName; | ||
167 | return true; | 167 | return true; | ||
168 | } | 168 | } | ||
169 | 169 | | |||
170 | QString path; | 170 | QString path; | ||
171 | QString hostName; | 171 | QString hostName; | ||
172 | QString lastError; | 172 | QString lastError; | ||
173 | bool isRoot; | 173 | bool isRoot; | ||
174 | }; | 174 | }; | ||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Line(s) | 422 | { | |||
425 | } | 425 | } | ||
426 | return QString(); | 426 | return QString(); | ||
427 | } | 427 | } | ||
428 | 428 | | |||
429 | QString Maildir::subDirPath() const | 429 | QString Maildir::subDirPath() const | ||
430 | { | 430 | { | ||
431 | QDir dir(d->path); | 431 | QDir dir(d->path); | ||
432 | dir.cdUp(); | 432 | dir.cdUp(); | ||
433 | return dir.path() + QDir::separator() + d->subDirPath(); | 433 | return dir.path() + QLatin1Char('/') + d->subDirPath(); | ||
434 | } | 434 | } | ||
435 | 435 | | |||
436 | QStringList Maildir::subFolderList() const | 436 | QStringList Maildir::subFolderList() const | ||
437 | { | 437 | { | ||
438 | QDir dir(d->path); | 438 | QDir dir(d->path); | ||
439 | 439 | | |||
440 | // the root maildir has its subfolders directly beneath it | 440 | // the root maildir has its subfolders directly beneath it | ||
441 | if (!d->isRoot) { | 441 | if (!d->isRoot) { | ||
▲ Show 20 Lines • Show All 347 Lines • ▼ Show 20 Line(s) | 788 | { | |||
789 | const QString realKey(d->findRealKey(key)); | 789 | const QString realKey(d->findRealKey(key)); | ||
790 | if (realKey.isEmpty()) { | 790 | if (realKey.isEmpty()) { | ||
791 | qCWarning(LIBMAILDIR_LOG) << "Unable to find: " << key; | 791 | qCWarning(LIBMAILDIR_LOG) << "Unable to find: " << key; | ||
792 | d->lastError = i18n("Cannot locate mail file %1.", key); | 792 | d->lastError = i18n("Cannot locate mail file %1.", key); | ||
793 | return QString(); | 793 | return QString(); | ||
794 | } | 794 | } | ||
795 | QFile f(realKey); | 795 | QFile f(realKey); | ||
796 | // ### is this safe regarding the maildir locking scheme? | 796 | // ### is this safe regarding the maildir locking scheme? | ||
797 | const QString targetKey = destination.path() + QDir::separator() + QLatin1String("new") + QDir::separator() + key; | 797 | const QString targetKey = destination.path() + QStringLiteral("/new/") + key; | ||
798 | if (!f.rename(targetKey)) { | 798 | if (!f.rename(targetKey)) { | ||
799 | qCDebug(LIBMAILDIR_LOG) << "Failed to rename" << realKey << "to" << targetKey << "! Error: " << f.errorString(); | 799 | qCDebug(LIBMAILDIR_LOG) << "Failed to rename" << realKey << "to" << targetKey << "! Error: " << f.errorString(); | ||
800 | d->lastError = f.errorString(); | 800 | d->lastError = f.errorString(); | ||
801 | return QString(); | 801 | return QString(); | ||
802 | } | 802 | } | ||
803 | 803 | | |||
804 | KeyCache *keyCache = KeyCache::self(); | 804 | KeyCache *keyCache = KeyCache::self(); | ||
805 | 805 | | |||
Show All 36 Lines |