Author: kitone
Date: Sun Apr 12 14:04:09 2015
New Revision: 904
URL: http://svn.gna.org/viewcvs/subtitleeditor?rev=904&view=rev
Log:
Fix bug #20672 : Automatically put the extension when saving a project file
Modified:
trunk/ChangeLog
trunk/plugins/actions/documentmanagement/documentmanagement.cc
trunk/src/gui/dialogfilechooser.cc
trunk/src/gui/dialogfilechooser.h
Modified: trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/ChangeLog?rev=904&r1=903&r2=904&view=diff
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Sun Apr 12 14:04:09 2015
@@ -1,3 +1,10 @@
+2015-04-12 kitone <[email protected]>
+
+ * plugins/actions/documentmanagement/documentmanagement.cc:
+ * src/gui/dialogfilechooser.cc:
+ * src/gui/dialogfilechooser.h:
+ Fix bug #20672 : Automatically put the extension when saving a project
file
+
2015-04-12 kitone <[email protected]>
* plugins/actions/documentmanagement/documentmanagement.cc:
Modified: trunk/plugins/actions/documentmanagement/documentmanagement.cc
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/plugins/actions/documentmanagement/documentmanagement.cc?rev=904&r1=903&r2=904&view=diff
==============================================================================
--- trunk/plugins/actions/documentmanagement/documentmanagement.cc
(original)
+++ trunk/plugins/actions/documentmanagement/documentmanagement.cc Sun Apr
12 14:04:09 2015
@@ -373,7 +373,9 @@
DialogSaveDocument::auto_ptr dialog =
DialogSaveDocument::create();
if(Glib::file_test(doc->getFilename(), Glib::FILE_TEST_EXISTS))
- dialog->set_filename(doc->getFilename());
+ {
+ dialog->set_current_folder_and_name(doc->getFilename());
+ }
else
if(SubtitleEditorWindow::get_instance()->get_player()->get_state() !=
Player::NONE)
{
dialog->set_filename_from_another_uri(
@@ -381,7 +383,9 @@
SubtitleFormatSystem::instance().get_extension_of_format(format));
}
else
+ {
dialog->set_current_name(doc->getName());
+ }
dialog->set_format(format);
dialog->set_encoding(doc->getCharset());
Modified: trunk/src/gui/dialogfilechooser.cc
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/src/gui/dialogfilechooser.cc?rev=904&r1=903&r2=904&view=diff
==============================================================================
--- trunk/src/gui/dialogfilechooser.cc (original)
+++ trunk/src/gui/dialogfilechooser.cc Sun Apr 12 14:04:09 2015
@@ -157,6 +157,14 @@
}
}
+/*
+ * Internally call set_current_folder and set_current_name with dirname and
basename
+ */
+void DialogFileChooser::set_current_folder_and_name(const Glib::ustring
&filename)
+{
+ set_current_folder( Glib::path_get_dirname(filename) );
+ set_current_name( Glib::path_get_basename(filename) );
+}
/*
@@ -345,12 +353,10 @@
*/
void DialogSaveDocument::on_combo_format_changed()
{
- Glib::ustring filename = get_filename();
- if(filename.empty())
+ Glib::ustring basename = get_current_name();
+
+ if(basename.empty())
return;
-
- // Only work with the name of the file
- Glib::ustring basename = Glib::path_get_basename(filename);
// Try to get the extension from the format
SubtitleFormatInfo sfinfo;
Modified: trunk/src/gui/dialogfilechooser.h
URL:
http://svn.gna.org/viewcvs/subtitleeditor/trunk/src/gui/dialogfilechooser.h?rev=904&r1=903&r2=904&view=diff
==============================================================================
--- trunk/src/gui/dialogfilechooser.h (original)
+++ trunk/src/gui/dialogfilechooser.h Sun Apr 12 14:04:09 2015
@@ -72,6 +72,11 @@
*/
void set_filename_from_another_uri(const Glib::ustring &another_uri,
const Glib::ustring &ext);
+ /*
+ * Internally call set_current_folder and set_current_name with dirname
and basename
+ */
+ void set_current_folder_and_name(const Glib::ustring &filename);
+
protected:
Glib::ustring m_name;
};
_______________________________________________
Subtitleeditor-commits mailing list
[email protected]
https://mail.gna.org/listinfo/subtitleeditor-commits