Commit 9bb30370 authored by Stefan Brüns's avatar Stefan Brüns
Browse files

[FileMetaDataProvider] Actually check if the file can be modified

Summary:
Adding tags etc. requires the file to be writable, so disallow editing
for readonly files.

Depends on D20980

Test Plan:
1. Add a tag to some file
2. Remove write permissions
3. The tag is still shown, but can no longer be edited

Reviewers: #baloo, astippich, ngraham

Reviewed By: #baloo, ngraham

Tags: #baloo

Differential Revision: https://phabricator.kde.org/D20981
parent 6f8d9d1c
......@@ -21,6 +21,7 @@
#include "filefetchjob.h"
#include "filemetadatautil_p.h"
#include <QFileInfo>
#include <QTimer>
#include <Baloo/File>
......@@ -57,6 +58,9 @@ void FileFetchJob::doStart()
} else {
m_canEditAll = false;
}
if (m_canEditAll) {
m_canEditAll = QFileInfo(filePath).isWritable();
}
m_data << prop;
}
......
......@@ -65,8 +65,7 @@ void IndexedDataRetriever::slotIndexedFile(int exitCode, QProcess::ExitStatus ex
KFileMetaData::UserMetaData umd(m_url);
if (umd.isSupported()) {
// FIXME - check writable
m_canEdit = true;
m_canEdit = QFileInfo(m_url).isWritable();
QVariantMap attributes = Baloo::Private::convertUserMetaData(umd);
m_data.unite(attributes);
......
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