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
This commit is contained in:
Olivier Goffart 2018-05-28 17:14:57 +02:00 committed by Kevin Ottens
parent a6c19572a2
commit ced5dfb8ee
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
3 changed files with 8 additions and 3 deletions

View file

@ -87,8 +87,7 @@ ShareDialog::ShareDialog(QPointer<AccountState> 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));

View file

@ -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;
}

View file

@ -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;
};