Changeset View
Changeset View
Standalone View
Standalone View
klipper/historyurlitem.cpp
Show All 18 Lines | |||||
19 | #include "historyurlitem.h" | 19 | #include "historyurlitem.h" | ||
20 | 20 | | |||
21 | #include <QMimeData> | 21 | #include <QMimeData> | ||
22 | #include <QCryptographicHash> | 22 | #include <QCryptographicHash> | ||
23 | 23 | | |||
24 | namespace { | 24 | namespace { | ||
25 | QByteArray compute_uuid(const QList<QUrl>& _urls, const KUrlMimeData::MetaDataMap &_metaData, bool _cut ) { | 25 | QByteArray compute_uuid(const QList<QUrl>& _urls, const KUrlMimeData::MetaDataMap &_metaData, bool _cut ) { | ||
26 | QCryptographicHash hash(QCryptographicHash::Sha1); | 26 | QCryptographicHash hash(QCryptographicHash::Sha1); | ||
27 | foreach(const QUrl& url, _urls) { | 27 | for (const QUrl& url : _urls) { | ||
28 | hash.addData(url.toEncoded()); | 28 | hash.addData(url.toEncoded()); | ||
29 | hash.addData("\0", 1); // Use binary zero as that is not a valid path character | 29 | hash.addData("\0", 1); // Use binary zero as that is not a valid path character | ||
30 | } | 30 | } | ||
31 | QByteArray buffer; | 31 | QByteArray buffer; | ||
32 | QDataStream out(&buffer, QIODevice::WriteOnly); | 32 | QDataStream out(&buffer, QIODevice::WriteOnly); | ||
33 | out << _metaData << "\0" << _cut; | 33 | out << _metaData << "\0" << _cut; | ||
34 | hash.addData(buffer); | 34 | hash.addData(buffer); | ||
35 | return hash.result(); | 35 | return hash.result(); | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |