From d24b0372ad949517488d19c8989eb75e58c3595c Mon Sep 17 00:00:00 2001 From: donho Date: Wed, 24 Oct 2007 18:41:33 +0000 Subject: [PATCH] [NEW_FEATURE] Session file load/save dialogs recognize the user defined session file extension. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@62 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 8994fe07..29c4f46f 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -7296,9 +7296,16 @@ bool Notepad_plus::fileLoadSession(const char *fn) if (fn == NULL) { FileDialog fDlg(_hSelf, _hInst); - fDlg.setExtFilter("All types", ".*", NULL); - fDlg.setExtFilter("Session file", ".session", NULL); + const char *ext = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str(); + string sessionExt = ""; + if (*ext != '\0') + { + if (*ext != '.') + sessionExt += "."; + sessionExt += ext; + fDlg.setExtFilter("Session file", sessionExt.c_str(), NULL); + } sessionFileName = fDlg.doOpenSingleFileDlg(); } else @@ -7331,6 +7338,7 @@ const char * Notepad_plus::fileSaveSession(size_t nbFile, char ** fileNames, con Session currentSession; if ((nbFile) && (!fileNames)) { + for (size_t i = 0 ; i < nbFile ; i++) { if (PathFileExists(fileNames[i])) @@ -7351,9 +7359,17 @@ const char * Notepad_plus::fileSaveSession(size_t nbFile, char ** fileNames) const char *sessionFileName = NULL; FileDialog fDlg(_hSelf, _hInst); + const char *ext = NppParameters::getInstance()->getNppGUI()._definedSessionExt.c_str(); fDlg.setExtFilter("All types", ".*", NULL); - fDlg.setExtFilter("Session file", ".session", NULL); + string sessionExt = ""; + if (*ext != '\0') + { + if (*ext != '.') + sessionExt += "."; + sessionExt += ext; + fDlg.setExtFilter("Session file", sessionExt.c_str(), NULL); + } sessionFileName = fDlg.doSaveDlg(); return fileSaveSession(nbFile, fileNames, sessionFileName);