openSUSE / kmozillahelper

KDE mozilla integration
MIT License
17 stars 9 forks source link

Save file dialog does not prefill filename when title have "xxx : xxx" #7

Closed nx-99 closed 7 years ago

nx-99 commented 7 years ago

For exsemple this page https://github.com/openSUSE/kmozillahelper

Vogtinator commented 7 years ago

Can you retest this with the current version and provide an example with screenshots? Thanks!

Vogtinator commented 7 years ago

Nevermind, I was able to reproduce it. It is sadly a bug in KIO so I can't fix it here (maybe add a workaround though) and I reported it here: https://bugs.kde.org/show_bug.cgi?id=376365

Vogtinator commented 7 years ago

I found a workaround, but unfortunately the workaround would break it entirely once the bug is fixed, so I won't apply it. In case you want to do it yourself:

diff --git a/main.cpp b/main.cpp
index 6256b51..7da1384 100644
--- a/main.cpp
+++ b/main.cpp
@@ -352,7 +352,11 @@ bool Helper::handleGetOpenOrSaveX(bool url, bool save)

     QFileDialog dialog(nullptr, title, defaultPath.path());

-    dialog.selectFile(defaultPath.fileName());
+    // Workaround for kde#376365
+    if(defaultPath.fileName().indexOf(":") != -1)
+        dialog.selectFile(QUrl::toPercentEncoding(defaultPath.fileName()));
+    else
+        dialog.selectFile(defaultPath.fileName());
     dialog.setNameFilters(filtersParsed);
     dialog.setOption(QFileDialog::DontConfirmOverwrite, false);
     dialog.setAcceptMode(save ? QFileDialog::AcceptSave : QFileDialog::AcceptOpen);
nx-99 commented 7 years ago

This Workaround work, but when change directory to save, file name disappears. Second, save only complete pag. not only HTML . Thank.

Vogtinator commented 7 years ago

I'm sorry, I don't understand what you mean.

Vogtinator commented 7 years ago

I made a fix for plasma-integration: https://phabricator.kde.org/D4579 and added it to the openSUSE package.

Vogtinator commented 7 years ago

Fix is now pushed upstream and will likely be part of Plasma 5.10, 5.9.2 and 5.8.6.