2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

folders not allowed to be dropped / pasted

This commit is contained in:
John Preston
2015-11-02 17:36:26 -05:00
parent 83a542713a
commit 3f8d7944c1
3 changed files with 17 additions and 5 deletions

View File

@@ -216,6 +216,10 @@ void FileLoadTask::process() {
if (!_filepath.isEmpty()) {
QFileInfo info(_filepath);
if (info.isDir()) {
_result->filesize = -1;
return;
}
filesize = info.size();
filemime = mimeTypeForFile(info).name();
filename = info.fileName();
@@ -399,6 +403,11 @@ void FileLoadTask::finish() {
App::wnd()->replaceLayer(new InformBox(lang(lng_send_image_empty)));
return;
}
if (_result->filesize == -1) { // dir
App::main()->onSendFileCancel(_result);
App::wnd()->replaceLayer(new InformBox(lng_send_folder(lt_name, QFileInfo(_filepath).fileName())));
return;
}
if (_result->filesize > MaxUploadDocumentSize) {
App::main()->onSendFileCancel(_result);
App::wnd()->replaceLayer(new InformBox(lang(lng_send_image_too_large)));