1. Rui
  2. vim-qt
  3. Issues
Issue #67 resolved

Save as dialog has no filename

Andrew Pickin
created an issue

It is impossible to supply a new file name via the "Save as" dialog.

Comments (3)

  1. Rui repo owner
    • changed status to open

    Cheers, thanks for the report

    I can confirm this issue, but only with the default Qt file dialog (i.e. if you're running KDE this wont happen). I get a popup error with a message "File not found".

    The error seems to be in gui_qt.cpp:gui_mch_browse() where we are calling QFileDialog::getOpenFileName() instead of ::getSaveFileName().

    The following patch should fix it:

    diff --git a/src/gui_qt.cpp b/src/gui_qt.cpp
    index 6ba4b4d..0332b36 100644
    --- a/src/gui_qt.cpp
    +++ b/src/gui_qt.cpp
    @@ -1442,7 +1442,12 @@ gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *ini
    -       QString file = QFileDialog::getOpenFileName(window, VimWrapper::convertFrom(title), dir);
    +       QString file;
    +       if ( saving ) {
    +               file = QFileDialog::getSaveFileName(window, VimWrapper::convertFrom(title), dir);
    +       } else {
    +               file = QFileDialog::getOpenFileName(window, VimWrapper::convertFrom(title), dir);
    +       }

    Later today I should be able to push a commit that fixes this.

  2. Log in to comment