From: Keith F. <ven...@us...> - 2002-03-27 08:16:12
|
Update of /cvsroot/planeshift/planeshift/src/client/gui In directory usw-pr-cvs1:/tmp/cvs-serv1169 Modified Files: psdconn.h psdconn.cpp Log Message: Added config file settings for server/user/passwd, which now default on connection window. Index: psdconn.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psdconn.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** psdconn.h 23 Mar 2002 23:37:12 -0000 1.6 --- psdconn.h 27 Mar 2002 08:16:05 -0000 1.7 *************** *** 85,88 **** --- 85,91 ---- protected: + void LoadDefaults(); + void SaveDefaults(); + psTextInput* server; Index: psdconn.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psdconn.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** psdconn.cpp 27 Mar 2002 05:54:32 -0000 1.24 --- psdconn.cpp 27 Mar 2002 08:16:05 -0000 1.25 *************** *** 29,32 **** --- 29,33 ---- #include <iutil/objreg.h> #include <iutil/evdefs.h> + #include <iutil/cfgmgr.h> // PS include *************** *** 133,136 **** --- 134,139 ---- AddComp(error); + LoadDefaults(); // populate strings from cfg file + return true; } *************** *** 146,149 **** --- 149,183 ---- //------------------------------------------------------------------- + void psdConnect::LoadDefaults() + { + iObjectRegistry *object_reg=GetDialogManager()->GetObjectRegistry(); + + iPSEngine *psengine = CS_QUERY_REGISTRY (object_reg, iPSEngine); + iConfigManager* cfg = psengine->GetConfig(); + psengine->DecRef(); + + server->SetText(cfg->GetStr("Planeshift.Connection.Server", "")); + login->SetText (cfg->GetStr("Planeshift.Connection.User", "")); + passwd->SetText(cfg->GetStr("Planeshift.Connection.Password", "")); + + } + + void psdConnect::SaveDefaults() + { + iObjectRegistry *object_reg=GetDialogManager()->GetObjectRegistry(); + + iPSEngine *psengine = CS_QUERY_REGISTRY (object_reg, iPSEngine); + iConfigManager* cfg = psengine->GetConfig(); + psengine->DecRef(); + + cfg->SetStr("Planeshift.Connection.Server", server->GetText() ); + cfg->SetStr("Planeshift.Connection.User", login->GetText() ); + cfg->SetStr("Planeshift.Connection.Password", passwd->GetText() ); + cfg->Save(); + } + + + //------------------------------------------------------------------- + void psdConnect::Connect(psDialog *dialog, int ,void *) { *************** *** 177,180 **** --- 211,216 ---- return; } + + me->SaveDefaults(); netmanager->Authenticate(me->login->GetText(),me->passwd->GetText()); |