| 107 |
{ //If an item is selected and the current selection is valid, |
{ //If an item is selected and the current selection is valid, |
| 108 |
//we can save the data and close the dialog |
//we can save the data and close the dialog |
| 109 |
//And don't forget to ask for the password first! |
//And don't forget to ask for the password first! |
| 110 |
|
site2=*(t_Site *)m_cTree.GetItemData(item); |
| 111 |
BOOL bUseGSS=FALSE; |
BOOL bUseGSS=FALSE; |
| 112 |
if (COptions::GetOptionVal(OPTION_USEGSS) && m_bPassDontSave) |
if (COptions::GetOptionVal(OPTION_USEGSS) && m_bPassDontSave) |
| 113 |
{ |
{ |
| 130 |
GssServers=GssServers.Mid(i+1); |
GssServers=GssServers.Mid(i+1); |
| 131 |
} |
} |
| 132 |
} |
} |
| 133 |
|
CString pass=m_Pass; |
| 134 |
if (!bUseGSS) |
if (!bUseGSS) |
| 135 |
{ |
{ |
| 136 |
if (m_bPassDontSave) |
if (m_bPassDontSave) |
| 138 |
CEnterSomething dlg(IDS_INPUTDIALOGTITLE_INPUTPASSWORD,IDS_INPUTDIALOGTEXT_INPUTPASSWORD,'*'); |
CEnterSomething dlg(IDS_INPUTDIALOGTITLE_INPUTPASSWORD,IDS_INPUTDIALOGTEXT_INPUTPASSWORD,'*'); |
| 139 |
if (dlg.DoModal()!=IDOK) |
if (dlg.DoModal()!=IDOK) |
| 140 |
return; |
return; |
| 141 |
m_Pass=dlg.m_String; //Update dialog data. Don't worry, won't be saved |
pass=dlg.m_String; //Update dialog data. Don't worry, won't be saved |
| 142 |
UpdateData(FALSE); |
UpdateData(FALSE); |
| 143 |
} |
} |
| 144 |
} |
} |
| 145 |
SaveData(); |
SaveData(); |
| 146 |
OnClose(); |
OnClose(); |
| 147 |
DisplaySite(&site2); |
DisplaySite(&site2); |
| 148 |
|
m_Pass=pass; |
| 149 |
|
UpdateData(FALSE); |
| 150 |
CDialog::OnOK(); |
CDialog::OnOK(); |
| 151 |
} |
} |
| 152 |
} |
} |
| 179 |
|
|
| 180 |
void CSiteManager::SetKey(CString subkey,CString keyname,CString value) |
void CSiteManager::SetKey(CString subkey,CString keyname,CString value) |
| 181 |
{ |
{ |
| 182 |
|
subkey.TrimLeft("\\"); |
| 183 |
char *tmp=new char[value.GetLength()+1]; |
char *tmp=new char[value.GetLength()+1]; |
| 184 |
LPCSTR str=value; |
LPCSTR str=value; |
| 185 |
strcpy(tmp,str); |
strcpy(tmp,str); |
| 530 |
//Save the sites, old items will be overwritten. |
//Save the sites, old items will be overwritten. |
| 531 |
while(item) |
while(item) |
| 532 |
{ |
{ |
| 533 |
|
t_Site *site=0; |
| 534 |
if (m_cTree.ItemHasChildren(item)) |
if (m_cTree.ItemHasChildren(item)) |
| 535 |
{ |
{ |
| 536 |
item=m_cTree.GetChildItem(item); |
item=m_cTree.GetChildItem(item); |
| 537 |
path+="\\"+m_cTree.GetItemText(item); |
path+="\\"+m_cTree.GetItemText(item); |
| 538 |
continue; |
continue; |
| 539 |
} |
} |
| 540 |
t_Site *site=(t_Site *)m_cTree.GetItemData(item); |
site=(t_Site *)m_cTree.GetItemData(item); |
| 541 |
if (site) |
if (site) |
| 542 |
{ |
{ |
| 543 |
SetKey(path,"Default Site",(item==m_DefaultSite)?"1":"0"); |
SetKey(path,"Default Site",(item==m_DefaultSite)?"1":"0"); |
| 1312 |
if (m_cTree.GetItemText(item)==pTVDispInfo->item.pszText) |
if (m_cTree.GetItemText(item)==pTVDispInfo->item.pszText) |
| 1313 |
{ |
{ |
| 1314 |
AfxMessageBox(IDS_ERRORMSG_SITEMANAGERNAMEINUSE,MB_OK|MB_ICONEXCLAMATION); |
AfxMessageBox(IDS_ERRORMSG_SITEMANAGERNAMEINUSE,MB_OK|MB_ICONEXCLAMATION); |
| 1315 |
|
m_cTree.SetFocus(); |
| 1316 |
|
m_cTree.EditLabel(pTVDispInfo->item.hItem); |
| 1317 |
*pResult=0; |
*pResult=0; |
| 1318 |
return; |
return; |
| 1319 |
} |
} |
| 1325 |
if (m_cTree.GetItemText(item)==pTVDispInfo->item.pszText) |
if (m_cTree.GetItemText(item)==pTVDispInfo->item.pszText) |
| 1326 |
{ |
{ |
| 1327 |
AfxMessageBox(IDS_ERRORMSG_SITEMANAGERNAMEINUSE,MB_OK|MB_ICONEXCLAMATION); |
AfxMessageBox(IDS_ERRORMSG_SITEMANAGERNAMEINUSE,MB_OK|MB_ICONEXCLAMATION); |
| 1328 |
|
m_cTree.SetFocus(); |
| 1329 |
|
m_cTree.EditLabel(pTVDispInfo->item.hItem); |
| 1330 |
*pResult=0; |
*pResult=0; |
| 1331 |
return; |
return; |
| 1332 |
} |
} |