[GME-commit] GMESRC/GME/Gme GMEApp.cpp,1.130,1.131 MgaOpenDlg.cpp,1.12,1.13 MgaOpenDlg.h,1.5,1.6

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Fri Jun 24 18:58:04 CDT 2005


Update of /project/gme-repository/GMESRC/GME/Gme
In directory escher:/tmp/cvs-serv4822

Modified Files:
	GMEApp.cpp MgaOpenDlg.cpp MgaOpenDlg.h 
Log Message:
Import XML failed silently if the rootfolder's name contained invalid characters like slash.
Reason: This name was used by the CFileDialog as default name.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: GMEApp.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEApp.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -C2 -d -r1.130 -r1.131
*** GMEApp.cpp	21 Jun 2005 19:47:54 -0000	1.130
--- GMEApp.cpp	24 Jun 2005 17:58:01 -0000	1.131
***************
*** 1596,1602 ****
  
  					CMgaOpenDlg opdlg(CMgaOpenDlg::ImportDialog);
! 					opdlg.filenamehint = basename;
  					dataconn = opdlg.AskConnectionString(false);
  					if (dataconn.IsEmpty()) {
  					   return;
  					}
--- 1596,1603 ----
  
  					CMgaOpenDlg opdlg(CMgaOpenDlg::ImportDialog);
! 					opdlg.SetFileNameHint( PutInCString(basename));//opdlg.filenamehint = basename;
  					dataconn = opdlg.AskConnectionString(false);
  					if (dataconn.IsEmpty()) {
+ 					   CGMEEventLogger::LogGMEEvent("CGMEApp::OnFileImportxml exited because empty connection string has been given");
  					   return;
  					}

Index: MgaOpenDlg.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/MgaOpenDlg.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MgaOpenDlg.h	14 Sep 2004 14:02:35 -0000	1.5
--- MgaOpenDlg.h	24 Jun 2005 17:58:01 -0000	1.6
***************
*** 27,31 ****
  	CMgaOpenDlg(DialogTypes dType = OpenDialog, CWnd* pParent = NULL);   // standard constructor
  
! 	CString filenamehint;
  
  	bool pressed_back;
--- 27,31 ----
  	CMgaOpenDlg(DialogTypes dType = OpenDialog, CWnd* pParent = NULL);   // standard constructor
  
! 	void SetFileNameHint( CString hint);
  
  	bool pressed_back;
***************
*** 51,55 ****
  // Implementation
  protected:
! 
  	BOOL flag_isopen;
  	bool flag_back;
--- 51,56 ----
  // Implementation
  protected:
! 	
! 	CString filenamehint;
  	BOOL flag_isopen;
  	bool flag_back;

Index: MgaOpenDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/MgaOpenDlg.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** MgaOpenDlg.cpp	14 Sep 2004 14:02:35 -0000	1.12
--- MgaOpenDlg.cpp	24 Jun 2005 17:58:01 -0000	1.13
***************
*** 329,330 ****
--- 329,351 ----
  	CDialog::OnOK();
  }
+ 
+ void CMgaOpenDlg::SetFileNameHint( CString hint)
+ {
+ 	// are there invalid characters in the suggested file name?
+ 	if( -1 != hint.FindOneOf( _T("\\/:*?\"<>|")))
+ 	{
+ 		TCHAR nc = _T('_');
+ 		int rpl = 0;
+ 		rpl += hint.Replace(_T('\\'), nc);
+ 		rpl += hint.Replace(_T('/'), nc);
+ 		rpl += hint.Replace(_T(':'), nc);
+ 		rpl += hint.Replace(_T('*'), nc);
+ 		rpl += hint.Replace(_T('?'), nc);
+ 		rpl += hint.Replace(_T('"'), nc);
+ 		rpl += hint.Replace(_T('<'), nc);
+ 		rpl += hint.Replace(_T('>'), nc);
+ 		rpl += hint.Replace(_T('|'), nc);
+ 		// rpl chars replaced in total
+ 	}
+ 	filenamehint = hint;
+ }
\ No newline at end of file



More information about the GME-commit mailing list