summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93c007e)
raw | patch | inline | side by side (parent: 93c007e)
| author | keescook <keescook@users.sourceforge.net> | |
| Sun, 1 Oct 2006 17:23:40 +0000 (17:23 +0000) | ||
| committer | keescook <keescook@users.sourceforge.net> | |
| Sun, 1 Oct 2006 17:23:40 +0000 (17:23 +0000) |
| src/file.cpp | patch | blob | history | |
| src/ui/dialog/filedialog.cpp | patch | blob | history | |
| src/ui/dialog/filedialog.h | patch | blob | history |
diff --git a/src/file.cpp b/src/file.cpp
index de8ab2b5dca10285da5f7dc6a333c7da185d8d36..f8ebc9809ff6fac4f07434c67a921952f9eec7fa 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
save_loc.append(formatBuf);
}
} else {
- save_loc = Glib::path_get_dirname(doc->uri);
+ save_loc = Glib::build_filename(Glib::path_get_dirname(doc->uri),
+ Glib::path_get_basename(doc->uri));
}
// convert save_loc from utf-8 to locale
(char const *) _("Select file to save to"),
default_extension
);
+ else
+ saveDialogInstance->change_path(save_loc);
saveDialogInstance->change_title(dialog_title);
bool success = saveDialogInstance->show();
if (success)
prefs_set_recent_file(SP_DOCUMENT_URI(doc), SP_DOCUMENT_NAME(doc));
- save_path = fileName;
+ save_path = Glib::path_get_dirname(fileName);
prefs_set_string_attribute("dialogs.save_as", "path", save_path.c_str());
return success;
index 3417ba06c929fd09d0369b2f1e317c084c43abf5..7381c660e4a820c709a847f11949e27627b72f71 100644 (file)
Glib::ustring getFilename();
void change_title(const Glib::ustring& title);
+ void change_path(const Glib::ustring& dir);
private:
// leaving a trailing backslash on the directory name leads to the infamous
// double-directory bug on win32
if (len != 0 && udir[len - 1] == '\\') udir.erase(len - 1);
- set_current_folder(udir.c_str());
+ myFilename = udir;
}
//###### Add the file types menu
bool
FileSaveDialogImpl::show()
{
- Glib::ustring s = Glib::filename_to_utf8 (get_current_folder());
- if (s.length() == 0)
- s = getcwd (NULL, 0);
- set_current_folder(Glib::filename_from_utf8(s)); //hack to force initial dir listing
+ change_path(myFilename);
set_modal (TRUE); //Window
sp_transientize((GtkWidget *)gobj()); //Make transient
gint b = run(); //Dialog
this->set_title(title);
}
+/**
+ * Change the default save path location.
+ */
+void
+FileSaveDialogImpl::change_path(const Glib::ustring& path)
+{
+ myFilename = path;
+ if (Glib::file_test(myFilename, Glib::FILE_TEST_IS_DIR)) {
+ //fprintf(stderr,"set_current_folder(%s)\n",myFilename.c_str());
+ set_current_folder(myFilename);
+ } else {
+ //fprintf(stderr,"set_filename(%s)\n",myFilename.c_str());
+ set_filename(myFilename);
+ Glib::ustring basename = Glib::path_get_basename(myFilename);
+ //fprintf(stderr,"set_current_name(%s)\n",basename.c_str());
+ set_current_name(basename);
+ }
+}
index daefc9387c9c9ac74dca442a5be9fb6f4c3ec410..508c72997cd2bc120e7cc8d53c6bcfddfc6c4727 100644 (file)
*/
virtual void change_title(const Glib::ustring& title) =0;
+ /**
+ * Change the default save path location.
+ */
+ virtual void change_path(const Glib::ustring& path) =0;
}; //FileSaveDialog