serverstart/src/serverstartdlg.cpp
//-------------------------------------------------------------------------------
// This private function will read all values from the edit controls and will 
// save this values in the *.prefs file.
//-------------------------------------------------------------------------------
This private function will read all values from the edit controls and will
save this values in the *.prefs file.
This private function will read all values from the edit controls and will save this values in the * . prefs file .
void CServerStartDlg::SavePrefs(CString & filename) {
CString adminStr;
CString sharedSrcStr;
CString privateSrcStr;
CString sharedModelStr;
CString privateModelStr;
CString prefsStr;
CString pdfStr;
CString homeStr;
    m_AdminEdit.GetWindowText(adminStr);
	m_SharedSrcEdit.GetWindowText(sharedSrcStr);
	m_PrivateSrcEdit.GetWindowText(privateSrcStr);
	m_SharedModelEdit.GetWindowText(sharedModelStr);
	m_PrivateModelEdit.GetWindowText(privateModelStr);
	m_PrefsEdit.GetWindowText(prefsStr);
   	m_PdfEdit.GetWindowText(pdfStr);
	m_HomeEdit.GetWindowText(homeStr);
       Settings *new_settings_instance = new Settings("psetPrefs");
       int res=new_settings_instance->open(filename);
       Settings::Item pdf_item("pdfFileUser");
       if( new_settings_instance->read(pdf_item) != -1 ) {
		   pdf_item.write(pdfStr);
		   new_settings_instance->write(pdf_item);
	   }
       Settings::Item home_item("projectHome");
       if( new_settings_instance->read(home_item) != -1 ) {
		   home_item.write(homeStr);
		   new_settings_instance->write(home_item);
	   }
       Settings::Item admin_item("ADMINDIR");
       if( new_settings_instance->read(admin_item) != -1 ) {
		   admin_item.write(adminStr);
		   new_settings_instance->write(admin_item);
	   }
       Settings::Item sharedsrc_item("sharedSrcRoot");
       if( new_settings_instance->read(sharedsrc_item) != -1 ) {
		   sharedsrc_item.write(sharedSrcStr);
		   new_settings_instance->write(sharedsrc_item);
	   }
       Settings::Item privatesrc_item("privateSrcRoot");
       if( new_settings_instance->read(privatesrc_item) != -1 ) {
		   privatesrc_item.write(privateSrcStr);
		   new_settings_instance->write(privatesrc_item);
	   }
       Settings::Item sharedmodel_item("sharedModelRoot");
       if( new_settings_instance->read(sharedmodel_item) != -1 ) {
		   sharedmodel_item.write(sharedModelStr);
		   new_settings_instance->write(sharedmodel_item);
	   }
       Settings::Item privatemodel_item("privateModelRoot");
       if( new_settings_instance->read(privatemodel_item) != -1 ) {
		   privatemodel_item.write(privateModelStr);
		   new_settings_instance->write(privatemodel_item);
	   }
	   new_settings_instance->close(1);
	   delete new_settings_instance;
}
void CServerStartDlg :: SavePrefs ( CString & filename ) { CString adminStr ; CString sharedSrcStr ; CString privateSrcStr ; CString sharedModelStr ; CString privateModelStr ; CString prefsStr ; CString pdfStr ; CString homeStr ; m_AdminEdit . GetWindowText ( adminStr ) ; m_SharedSrcEdit . GetWindowText ( sharedSrcStr ) ; m_PrivateSrcEdit . GetWindowText ( privateSrcStr ) ; m_SharedModelEdit . GetWindowText ( sharedModelStr ) ; m_PrivateModelEdit . GetWindowText ( privateModelStr ) ; m_PrefsEdit . GetWindowText ( prefsStr ) ; m_PdfEdit . GetWindowText ( pdfStr ) ; m_HomeEdit . GetWindowText ( homeStr ) ; Settings * new_settings_instance = new Settings ( " " ) ; int res = new_settings_instance -> open ( filename ) ; Settings :: Item pdf_item ( " " ) ; if ( new_settings_instance -> read ( pdf_item ) != -1 ) { pdf_item . write ( pdfStr ) ; new_settings_instance -> write ( pdf_item ) ; } Settings :: Item home_item ( " " ) ; if ( new_settings_instance -> read ( home_item ) != -1 ) { home_item . write ( homeStr ) ; new_settings_instance -> write ( home_item ) ; } Settings :: Item admin_item ( " " ) ; if ( new_settings_instance -> read ( admin_item ) != -1 ) { admin_item . write ( adminStr ) ; new_settings_instance -> write ( admin_item ) ; } Settings :: Item sharedsrc_item ( " " ) ; if ( new_settings_instance -> read ( sharedsrc_item ) != -1 ) { sharedsrc_item . write ( sharedSrcStr ) ; new_settings_instance -> write ( sharedsrc_item ) ; } Settings :: Item privatesrc_item ( " " ) ; if ( new_settings_instance -> read ( privatesrc_item ) != -1 ) { privatesrc_item . write ( privateSrcStr ) ; new_settings_instance -> write ( privatesrc_item ) ; } Settings :: Item sharedmodel_item ( " " ) ; if ( new_settings_instance -> read ( sharedmodel_item ) != -1 ) { sharedmodel_item . write ( sharedModelStr ) ; new_settings_instance -> write ( sharedmodel_item ) ; } Settings :: Item privatemodel_item ( " " ) ; if ( new_settings_instance -> read ( privatemodel_item ) != -1 ) { privatemodel_item . write ( privateModelStr ) ; new_settings_instance -> write ( privatemodel_item ) ; } new_settings_instance -> close ( 1 ) ; delete new_settings_instance ; }
This private function will read all values from the edit controls and will
save this values in the *.prefs file.
This private function will read all values from the edit controls and will save this values in the * . prefs file .
// Getting data from all edit controls