Unverified Commit fe6ba226 authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Use better default path for outlook attachments

Kleopatra is commonly used together with outlook to
decrypt encrypted attachments. In that case the heuristic
base directory was a long path to a temporary outlook location.
Now we default to the documents location in that case.

GnuPG-Bug-Id: T5774
parent 87458c2a
Pipeline #132625 passed with stage
in 2 minutes and 41 seconds
......@@ -18,6 +18,7 @@
#include "kleopatra_debug.h"
#include <KLocalizedString>
#include <QStandardPaths>
#include <QString>
#include <QStorageInfo>
#include <QFileInfo>
......@@ -52,6 +53,17 @@ QString Kleo::heuristicBaseDirectory(const QStringList &fileNames)
}
qCDebug(KLEOPATRA_LOG) << "dirs" << dirs;
const QString candidate = longestCommonPrefix(dirs);
/* Special case handling for Outlook attachment temporary path.
* This is otherwise something like:
* c:\users\username\AppData\Local\Microsoft\Windows\INetCache\
* Content.Outlook\ADSDFG9\foo.txt
*
* This is very common when encrypted attachments are opened
* within outlook.
*/
if (candidate.contains(QStringLiteral("Content.Outlook"))) {
return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
}
const int idx = candidate.lastIndexOf(QLatin1Char('/'));
return candidate.left(idx);
}
......
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