2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Added confirming only images and videos when edit album item.

- Added hiding of checkbox when edit album item.
This commit is contained in:
23rd
2019-03-29 15:06:40 +03:00
committed by John Preston
parent 25e3674819
commit 89e1291d86
4 changed files with 32 additions and 2 deletions

View File

@@ -122,6 +122,22 @@ bool fileIsImage(const QString &name, const QString &mime) {
return false;
}
bool fileIsValidForAlbum(const QString &name, const QString &mime) {
QString lowermime = mime.toLower(), namelower = name.toLower();
if (lowermime.startsWith(qstr("video/mp4"))
|| lowermime.startsWith(qstr("image/jpeg"))
|| lowermime.startsWith(qstr("image/jpg"))
|| lowermime.startsWith(qstr("image/png"))) {
return true;
} else if (namelower.endsWith(qstr(".mp4"))
|| namelower.endsWith(qstr(".jpg"))
|| namelower.endsWith(qstr(".jpeg"))
|| namelower.endsWith(qstr(".png"))) {
return true;
}
return false;
}
QString FileNameUnsafe(
const QString &title,
const QString &filter,