Menu

#2 Make file dialog default to previously opened file

open
None
5
2012-09-06
2006-01-26
No

To prevent forgetting the last read issue and assisting
in opening the next file in series, make the file open
dialog default to the last opened file.

Tested on Ubuntu 5.10 Breezy.

--- src/ComicalFrame.cpp 23 Jan 2006 00:17:14
-0000 1.9
+++ src/ComicalFrame.cpp 26 Jan 2006 12:22:08 -0000
@@ -262,8 +262,10 @@ void
ComicalFrame::OnAbout(wxCommandEven
void ComicalFrame::OnOpen(wxCommandEvent& event)
{
wxString cwd;
+ wxString currFile;
config->Read(wxT("CWD"), &cwd);
- wxString filename = wxFileSelector(wxT("Open a
Comic Book"), cwd, wxT(""), wxT(""), wxT("Comic Books
(.cbr,.cbz,.rar,.zip)|.cbr;.CBR;.cbz;.CBZ;.rar;.RAR;.zip;.ZIP"),wxOPEN
| wxCHANGE_DIR | wxFILE_MUST_EXIST, this);
+ config->Read(wxT("CurrFile"), &currFile);
+ wxString filename = wxFileSelector(wxT("Open a
Comic Book"), cwd, currFile, wxT(""), wxT("Comic Books
(.cbr,.cbz,.rar,.zip)|.cbr;.CBR;.cbz;.CBZ;.rar;.RAR;.zip;.ZIP"),
wxOPEN | wxCHANGE_DIR | wxFILE_MUST_EXIST, this);

    if (!filename.empty())
            OpenFile(filename);

@@ -300,6 +302,7 @@ void
ComicalFrame::OpenFile(wxString fil
startBook();
SetTitle(wxT("Comical - " +
filename));
config->Write(wxT("CWD"),
wxPathOnly(filename));
+ config->Write(wxT("CurrFile"),
wxFileNameFromPath(filename));
} catch (ArchiveException &ae) {
clearComicBook();
wxLogError(ae.Message);

Discussion

  • Dafydd Jones

    Dafydd Jones - 2006-01-26

    Patch to default to last opened file in file dialog

     
  • James Athey

    James Athey - 2006-02-06

    Logged In: YES
    user_id=923253

    I'll take a look at this.

     
  • Nobody/Anonymous

    Logged In: NO

    Don't think this is really necessary since once bookmarks
    are implemented this should be a non-issue. However, if this
    is still wanted, it may be better to just modify the CWD
    setting to append the file name on to the end of the working
    directory. Then you can just strip the name of the end.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.