From: Olivier Goffart Date: Mon, 28 May 2018 15:14:57 +0000 (+0200) Subject: Share dialog: use the original name and not the virtual file name X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~581 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ced5dfb8ee38bfc4feac2f372eec242ab9a4a60d;p=nextcloud-desktop.git Share dialog: use the original name and not the virtual file name When sharing a virtual file, we should actually use the original file name not the virtual file name Issue: #6461 --- diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index cffb4e796..5ef8984ae 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -87,8 +87,7 @@ ShareDialog::ShareDialog(QPointer accountState, } // Set filename - QFileInfo lPath(_localPath); - QString fileName = lPath.fileName(); + QString fileName = QFileInfo(_sharePath).fileName(); _ui->label_name->setText(tr("%1").arg(fileName)); QFont f(_ui->label_name->font()); f.setPointSize(qRound(f.pointSize() * 1.4)); diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 04acddae8..a8d381c92 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -864,7 +864,10 @@ SocketApi::FileData SocketApi::FileData::get(const QString &localFile) data.folderRelativePath = data.localPath.mid(data.folder->cleanPath().length() + 1); data.accountRelativePath = QDir(data.folder->remotePath()).filePath(data.folderRelativePath); - + QString virtualFileExt = QStringLiteral(APPLICATION_DOTVIRTUALFILE_SUFFIX); + if (data.accountRelativePath.endsWith(virtualFileExt)) { + data.accountRelativePath.chop(virtualFileExt.size()); + } return data; } diff --git a/src/gui/socketapi.h b/src/gui/socketapi.h index cb5c357fd..c97a1ee7a 100644 --- a/src/gui/socketapi.h +++ b/src/gui/socketapi.h @@ -82,8 +82,11 @@ private: FileData parentFolder() const; Folder *folder; + // Absolute path of the file locally. (May be a virtual file) QString localPath; + // Relative path of the file locally, as in the DB. (May be a virtual file) QString folderRelativePath; + // Path of the file on the server (In case of virtual file, it points to the actual file) QString accountRelativePath; };