Ignore:
Timestamp:
2005-11-07T16:42:49Z (19 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
f56c491
Parents:
99318ad
Message:

More work on config manager

File:
1 moved

Legend:

Unmodified
Added
Removed
  • win32/admin/PropConn.cpp

    r99318ad rabe53d3  
    22//
    33
    4 #define BITLBEE_CORE
    5 #include "bitlbeewin.h"
    64#include "PropConn.h"
    75
     
    5755void CPropConn::OnProxyEnabled()
    5856{
    59         // TODO: Add your control notification handler code here
    6057        m_proxyhost.EnableWindow(m_proxy_enabled.GetCheck());
    6158        m_proxytype.EnableWindow(m_proxy_enabled.GetCheck());
     
    7370void CPropConn::OnOK()
    7471{
     72        CString tmp;
     73        m_proxyhost.GetWindowText(tmp);
     74        WriteProfileString("proxy_host", tmp);
     75
     76        m_proxyport.GetWindowText(tmp);
     77        WriteProfileInt("proxy_port", atoi(tmp));
     78
    7579        if(!m_proxy_enabled.GetCheck()) {
    76                 proxytype = PROXY_NONE;
    77                 return;
     80                WriteProfileInt("proxy_type", 0);
     81        } else {
     82                WriteProfileInt("proxy_type", m_proxytype.GetCurSel()+1);
    7883        }
    7984
    80         CString tmp;
    81         m_proxyhost.GetWindowText(tmp);
    82         strcpy(proxyhost, tmp);
    83 
    84         m_proxyport.GetWindowText(tmp);
    85         proxyport = atoi(tmp);
    86 
    87         proxytype = m_proxytype.GetCurSel()+1;
    88 
    8985        if(!m_proxy_auth_enabled.GetCheck()) {
    90                 strcpy(proxyuser, "");
    91                 strcpy(proxypass, "");
    92                 return;
     86                WriteProfileString("proxy_user", "");
     87                WriteProfileString("proxy_password", "");
     88        } else {
     89                m_proxyuser.GetWindowText(tmp);
     90                WriteProfileString("proxy_user", tmp);
     91                m_proxypass.GetWindowText(tmp);
     92                WriteProfileString("proxy_password", tmp);
    9393        }
    94 
    95         m_proxyuser.GetWindowText(tmp);
    96         strcpy(proxyuser, tmp);
    97         m_proxypass.GetWindowText(tmp);
    98         strcpy(proxypass, tmp);
    9994       
    10095        CPropertyPage::OnOK();
     
    105100        char pp[20];
    106101        CPropertyPage::OnInitDialog();
     102        int proxytype;
    107103
    108         m_proxyhost.SetWindowText(proxyhost);
    109         m_proxyuser.SetWindowText(proxyuser);
    110         m_proxypass.SetWindowText(proxypass);
    111         g_snprintf(pp, 20, "%d", proxyport);
     104        m_proxyhost.SetWindowText(GetProfileString("proxy_host", ""));
     105        m_proxyuser.SetWindowText(GetProfileString("proxy_user", ""));
     106        m_proxypass.SetWindowText(GetProfileString("proxy_password", ""));
     107        sprintf(pp, "%d", GetProfileInt("proxy_port", 3128));
    112108        m_proxyport.SetWindowText(pp);
     109
     110        proxytype = GetProfileInt("proxy_type", 0);
    113111
    114112        m_proxytype.AddString("SOCKS 4");
     
    117115        m_proxytype.SetCurSel(proxytype-1);
    118116
    119         m_proxy_enabled.SetCheck(proxytype == PROXY_NONE?0:1);
    120         m_proxy_auth_enabled.SetCheck(strcmp(proxyuser, "")?1:0);
     117        m_proxy_enabled.SetCheck(proxytype == 0?0:1);
     118        m_proxy_auth_enabled.SetCheck(strcmp(GetProfileString("proxy_user", ""), "")?1:0);
    121119
    122120        OnProxyEnabled();
Note: See TracChangeset for help on using the changeset viewer.