* BUG: Dialog.SaveFile() now uses the Dialog.Path property the same way as 
  the gb.form.dialog component.

[GB.QT4]
* BUG: Dialog.SaveFile() now uses the Dialog.Path property the same way as 
  the gb.form.dialog component.


git-svn-id: svn://localhost/gambas/trunk@5893 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2013-10-13 18:51:58 +00:00
parent 690b7f56ba
commit 3503f80e66
2 changed files with 16 additions and 2 deletions

View file

@ -505,7 +505,7 @@ bool gDialog::saveFile()
if (DIALOG_path)
{
if (g_file_test(DIALOG_path, G_FILE_TEST_IS_DIR))
if (DIALOG_path[strlen(DIALOG_path) - 1] == '/' && g_file_test(DIALOG_path, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder((GtkFileChooser*)msg, DIALOG_path);
else
gtk_file_chooser_select_filename((GtkFileChooser*)msg, DIALOG_path);

View file

@ -188,7 +188,21 @@ static QStringList my_getOpenFileNames()
static QString my_getSaveFileName()
{
QFileDialog dialog(qApp->activeWindow(), dialog_title, dialog_path, get_filter());
QString dir, file;
dir = dialog_path;
if (!dialog_path.endsWith('/'))
{
int pos = dialog_path.lastIndexOf('/');
if (pos >= 0)
{
dir = dialog_path.left(pos);
file = dialog_path.mid(pos + 1);
}
}
QFileDialog dialog(qApp->activeWindow(), dialog_title, dir, get_filter());
dialog.selectFile(file);
dialog.setAcceptMode(QFileDialog::AcceptSave);
dialog.setMode(QFileDialog::AnyFile);