2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +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

@@ -4378,7 +4378,10 @@ DragState HistoryWidget::getDragState(const QMimeData *d) {
QString file(i->toLocalFile());
if (file.startsWith(qsl("/.file/id="))) file = psConvertFileUrl(file);
quint64 s = QFileInfo(file).size();
QFileInfo info(file);
if (info.isDir()) return DragStateNone;
quint64 s = info.size();
if (s >= MaxUploadDocumentSize) {
return DragStateNone;
}
@@ -4527,10 +4530,10 @@ void HistoryWidget::onFilesDrop(const QMimeData *data) {
return;
}
if (files.size() == 1) {
if (files.size() == 1 && !QFileInfo(files.at(0)).isDir()) {
uploadFile(files.at(0), PrepareAuto);
}
// uploadFiles(files, PrepareAuto); // multiple confirm with "compressed" checkbox
// uploadFiles(files, PrepareAuto); // multiple confirm with "compressed" checkbox
}
void HistoryWidget::onKbToggle(bool manual) {
@@ -4816,7 +4819,7 @@ void HistoryWidget::uploadFile(const QString &file, PrepareMediaType type, FileL
void HistoryWidget::uploadFiles(const QStringList &files, PrepareMediaType type) {
if (!_history || files.isEmpty()) return;
if (files.size() == 1) return uploadFile(files.at(0), type);
if (files.size() == 1 && !QFileInfo(files.at(0)).isDir()) return uploadFile(files.at(0), type);
App::wnd()->activateWindow();