attempting to display to user which file was saved

This commit is contained in:
Chris Cochrun 2024-04-17 10:08:32 -05:00
parent 479c22087f
commit 3b96885afd
2 changed files with 12 additions and 3 deletions

View file

@ -289,9 +289,10 @@ Kirigami.ApplicationWindow {
target: ServiceItemModel target: ServiceItemModel
function onSavedToFile(saved, file) { function onSavedToFile(saved, file) {
if (saved) { if (saved) {
Utils.dbg(file); let path = file.toString();
console.log(file); path = path.replace(/^(file:\/{2})/,"");
showPassiveNotification("Saved to ", + Qt.resolvedUrl(file)); let cleanPath = decodeURIComponent(path);
showPassiveNotification("Saved to ", + cleanPath);
} }
} }
} }

View file

@ -56,6 +56,7 @@ mod utilities {
unsafe extern "C++" { unsafe extern "C++" {
include!("cxx-qt-lib/qstring.h"); include!("cxx-qt-lib/qstring.h");
type QString = cxx_qt_lib::QString; type QString = cxx_qt_lib::QString;
type QUrl = cxx_qt_lib::QUrl;
} }
unsafe extern "RustQt" { unsafe extern "RustQt" {
@ -71,6 +72,9 @@ mod utilities {
#[qinvokable] #[qinvokable]
fn inf(self: &Utils, message: QString); fn inf(self: &Utils, message: QString);
#[qinvokable]
fn url_to_string(self: &Utils, url: QUrl) -> QString;
} }
} }
@ -99,6 +103,10 @@ impl utilities::Utils {
pub fn inf(self: &Self, message: QString) { pub fn inf(self: &Self, message: QString) {
info!(msg = ?message); info!(msg = ?message);
} }
pub fn url_to_string(self: &Self, url: QUrl) -> QString {
url.path()
}
} }
pub fn setup() { pub fn setup() {