2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

0.6.2 version, context menus fixed, image documents view in overlay added

This commit is contained in:
John Preston
2014-10-07 21:57:57 +04:00
parent c3a5194a6c
commit aebe171f55
27 changed files with 648 additions and 326 deletions

View File

@@ -907,7 +907,21 @@ void MainWidget::documentLoadProgress(mtpFileLoader *loader) {
document->finish();
QString already = document->already();
if (!already.isEmpty() && document->openOnSave) {
psOpenFile(already, document->openOnSave < 0);
bool showInMediaView = false;
if (document->openOnSave > 0 && document->size < MediaViewImageSizeLimit) {
QMimeType mime = QMimeDatabase().mimeTypeForName(document->mime);
QString name = mime.name().toLower(), fname = already.toLower();;
if (name == qsl("image/jpeg") || name == qsl("image/png")) {
showInMediaView = true;
} else if (fname.endsWith(qsl(".jpeg")) || fname.endsWith(qsl(".jpg")) || fname.endsWith(qsl(".png"))) {
showInMediaView = name.isEmpty();
}
}
if (showInMediaView) {
App::wnd()->showDocument(document, App::histItemById(document->openOnSaveMsgId));
} else {
psOpenFile(already, document->openOnSave < 0);
}
}
}
}