mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -05:00
Fix saving a loaded file as another existing file.
This commit is contained in:
parent
27151d5e25
commit
91f0d049db
2 changed files with 7 additions and 2 deletions
|
@ -783,6 +783,7 @@ void MediaView::onSaveAs() {
|
|||
psShowOverAll(this);
|
||||
if (!file.isEmpty() && file != location.name()) {
|
||||
if (_doc->data().isEmpty()) {
|
||||
QFile(file).remove();
|
||||
QFile(location.name()).copy(file);
|
||||
} else {
|
||||
QFile f(file);
|
||||
|
@ -900,8 +901,11 @@ void MediaView::onDownload() {
|
|||
if (location.accessEnable()) {
|
||||
if (!QDir().exists(path)) QDir().mkpath(path);
|
||||
toName = filedialogNextFilename(_doc->name, location.name(), path);
|
||||
if (toName != location.name() && !QFile(location.name()).copy(toName)) {
|
||||
toName = QString();
|
||||
if (!toName.isEmpty() && toName != location.name()) {
|
||||
QFile(toName).remove();
|
||||
if (!QFile(location.name()).copy(toName)) {
|
||||
toName = QString();
|
||||
}
|
||||
}
|
||||
location.accessDisable();
|
||||
} else {
|
||||
|
|
|
@ -1889,6 +1889,7 @@ void DocumentData::save(const QString &toFile, ActionOnLoad action, const FullMs
|
|||
} else if (l.accessEnable()) {
|
||||
auto alreadyName = l.name();
|
||||
if (alreadyName != toFile) {
|
||||
QFile(toFile).remove();
|
||||
QFile(alreadyName).copy(toFile);
|
||||
}
|
||||
l.accessDisable();
|
||||
|
|
Loading…
Add table
Reference in a new issue