Changeset View
Changeset View
Standalone View
Standalone View
src/filefetchjob.cpp
Show All 15 Lines | |||||
16 | * License along with this library; if not, write to the Free Software | 16 | * License along with this library; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | * | 18 | * | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "filefetchjob.h" | 21 | #include "filefetchjob.h" | ||
22 | #include "filemetadatautil_p.h" | 22 | #include "filemetadatautil_p.h" | ||
23 | 23 | | |||
24 | #include <QFileInfo> | ||||
24 | #include <QTimer> | 25 | #include <QTimer> | ||
25 | #include <Baloo/File> | 26 | #include <Baloo/File> | ||
26 | 27 | | |||
27 | #include <KFileMetaData/UserMetaData> | 28 | #include <KFileMetaData/UserMetaData> | ||
28 | 29 | | |||
29 | using namespace Baloo; | 30 | using namespace Baloo; | ||
30 | 31 | | |||
31 | FileFetchJob::FileFetchJob(const QStringList& urls, bool canEditAll, QObject* parent) | 32 | FileFetchJob::FileFetchJob(const QStringList& urls, bool canEditAll, QObject* parent) | ||
Show All 20 Lines | 46 | for (const QString& filePath : m_urls) { | |||
52 | if (umd.isSupported()) { | 53 | if (umd.isSupported()) { | ||
53 | // FIXME - check writable | 54 | // FIXME - check writable | ||
54 | 55 | | |||
55 | QVariantMap attributes = Baloo::Private::convertUserMetaData(umd); | 56 | QVariantMap attributes = Baloo::Private::convertUserMetaData(umd); | ||
56 | prop.unite(attributes); | 57 | prop.unite(attributes); | ||
57 | } else { | 58 | } else { | ||
58 | m_canEditAll = false; | 59 | m_canEditAll = false; | ||
59 | } | 60 | } | ||
61 | if (m_canEditAll) { | ||||
62 | m_canEditAll = QFileInfo(filePath).isWritable(); | ||||
63 | } | ||||
60 | 64 | | |||
61 | m_data << prop; | 65 | m_data << prop; | ||
62 | } | 66 | } | ||
63 | 67 | | |||
64 | emitResult(); | 68 | emitResult(); | ||
65 | } | 69 | } | ||
66 | 70 | | |||
67 | QList<QVariantMap> Baloo::FileFetchJob::data() const | 71 | QList<QVariantMap> Baloo::FileFetchJob::data() const | ||
68 | { | 72 | { | ||
69 | return m_data; | 73 | return m_data; | ||
70 | } | 74 | } | ||
71 | 75 | | |||
72 | bool FileFetchJob::canEditAll() const | 76 | bool FileFetchJob::canEditAll() const | ||
73 | { | 77 | { | ||
74 | return m_canEditAll; | 78 | return m_canEditAll; | ||
75 | } | 79 | } |