Re: Breaking changes in file layout

Martin Höller <martin-RZb/AGe+/[email protected]> Mon, 6 Apr 2020 15:41:56 +0200
Newsgroups gmane.comp.kde.kimdaba
Message-ID <20200406154156.4bcb056f@linux-du93>
Am 06. Apr. 2020 schrieb Tobias Leupold:

> What about this one:
> 
>     QString Whatever::dbIdentifier(const QString &indexXml) const
>     {
>         const QFileInfo fileInfo(indexXml);
>         const QByteArray bytes(fileInfo.canonicalPath().toUtf8());
>         return QStringLiteral("%1-%2").arg(
>             QString::number(qChecksum(bytes.data(), bytes.size(),
>                             Qt::ChecksumIso3309)),
>             fileInfo.dir().dirName());
>     }
> 
> Gives me e. g. "60243-Fotoalbum" for my "/home/tobias/Fotoalbum/index.xml".

That's what I was thinking about.

I don't know ISO-3309 but this would also be possible with MD5/SHA/etc.:
https://stackoverflow.com/questions/16383392/how-to-get-the-sha-1-md5-checksum-of-a-file-with-qt

BTW, this link also uses an ID and a title like suggested.

- martin

_______________________________________________
KPhotoAlbum mailing list
[email protected]
https://mail.kdab.com/mailman/listinfo/kphotoalbum
signature.asc (application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAl6LMaQACgkQYJf22JPx7tkTEwCgpd06Wj9OUHOvCbvwTHyZVn76
4xYAmQFlZ5qgjoFDdUhMfkPa0L5SNE/5
=RzC4
-----END PGP SIGNATURE-----