diff options
| author | Kirill Volinsky <mataes2007@gmail.com> | 2013-02-26 04:31:03 +0000 | 
|---|---|---|
| committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-02-26 04:31:03 +0000 | 
| commit | f1c4053e3315afa3181b460cbeade77523827f3e (patch) | |
| tree | ca46f96794480bcb30f07388237cb39a12d2c3dc /plugins/FTPFileYM/src | |
| parent | e2722e2ccb5459c59d4b801db9de2b92c673621a (diff) | |
options saving fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@3772 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FTPFileYM/src')
| -rw-r--r-- | plugins/FTPFileYM/src/manager.cpp | 3 | ||||
| -rw-r--r-- | plugins/FTPFileYM/src/options.cpp | 24 | ||||
| -rw-r--r-- | plugins/FTPFileYM/src/options.h | 1 | ||||
| -rw-r--r-- | plugins/FTPFileYM/src/serverlist.cpp | 7 | 
4 files changed, 15 insertions, 20 deletions
diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index abf1ec3f0a..3befc801ce 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -49,7 +49,8 @@ Manager::~Manager()  void Manager::init()
  {
 -	if (opt.enabled != 0) 
 +	ServerList::FTP *ftp = ftpList.getSelected();
 +	if (ftp->bEnabled) 
  	{
  		this->hwnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DLG_MANAGER), NULL, Manager::ManagerDlgProc);
  		this->hwndFileTree = GetDlgItem(this->hwnd, IDC_FILELIST);
 diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp index 2e59b970bf..680d54fc82 100644 --- a/plugins/FTPFileYM/src/options.cpp +++ b/plugins/FTPFileYM/src/options.cpp @@ -33,7 +33,6 @@ void Options::deinit()  void Options::loadOptions()
  {
 -	enabled = db_get_b(0, MODULE, "Enabled", 0);
  	selected = db_get_b(0, MODULE, "Selected", 0);
  	defaultFTP = db_get_b(0, MODULE, "Default", 0);
  	bAutosend = db_get_b(0, MODULE, "Autosend", 0) ? true : false;
 @@ -103,12 +102,13 @@ INT_PTR CALLBACK Options::DlgProcOptsAccounts(HWND hwndDlg, UINT msg, WPARAM wPa  			SetDlgItemTextA(hwndDlg, IDC_CHMOD, ftp->szChmod);
  			SetDlgItemInt (hwndDlg, IDC_PORT, ftp->iPort, FALSE);
  			CheckDlgButton(hwndDlg, IDC_PASSIVE, ftp->bPassive);
 -		}
 -		if (ftpList.getSelected()->bEnabled) 
 -			CheckDlgButton(hwndDlg, IDC_ENABLED, 1);	
 -		else {
 -			CheckDlgButton(hwndDlg, IDC_ENABLED, 0);
 -			enableItems(hwndDlg, false);
 +			CheckDlgButton(hwndDlg, IDC_ENABLED, ftp->bEnabled);
 +			if (ftp->bEnabled)
 +				CheckDlgButton(hwndDlg, IDC_ENABLED, 1);	
 +			else {
 +				CheckDlgButton(hwndDlg, IDC_ENABLED, 0);
 +				enableItems(hwndDlg, false);
 +			}
  		}
  		return TRUE;
 @@ -134,7 +134,7 @@ INT_PTR CALLBACK Options::DlgProcOptsAccounts(HWND hwndDlg, UINT msg, WPARAM wPa  				SetDlgItemInt (hwndDlg, IDC_PORT, ftp->iPort, FALSE);
  				CheckDlgButton(hwndDlg, IDC_PASSIVE, ftp->bPassive);
 -				if (ftpList.getSelected()->bEnabled) {
 +				if (ftp->bEnabled) {
  					CheckDlgButton(hwndDlg, IDC_ENABLED, 1);	
  					enableItems(hwndDlg, true);
  				} 
 @@ -161,11 +161,6 @@ INT_PTR CALLBACK Options::DlgProcOptsAccounts(HWND hwndDlg, UINT msg, WPARAM wPa  	case WM_NOTIFY:
  		if (((LPNMHDR)lParam)->code == PSN_APPLY) {
 -			if (IsDlgButtonChecked(hwndDlg, IDC_ENABLED))
 -				opt.enabled |= (1 << opt.selected);
 -			else
 -				opt.enabled &= ~(1 << opt.selected);
 -
  			if (IsDlgButtonChecked(hwndDlg, IDC_DEFAULT))
  				opt.defaultFTP = opt.selected;
 @@ -180,7 +175,8 @@ INT_PTR CALLBACK Options::DlgProcOptsAccounts(HWND hwndDlg, UINT msg, WPARAM wPa  			ftp->ftpProto = (ServerList::FTP::EProtoType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PROTOLIST));
  			ftp->iPort = GetDlgItemInt(hwndDlg, IDC_PORT, 0, 0);
 -			ftp->bPassive = IsDlgButtonChecked(hwndDlg, IDC_PASSIVE) ? true : false;		
 +			ftp->bPassive = IsDlgButtonChecked(hwndDlg, IDC_PASSIVE) ? true : false;
 +			ftp->bEnabled = IsDlgButtonChecked(hwndDlg, IDC_ENABLED) ? true : false;
  			ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_FTPLIST), opt.selected);
  			ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_FTPLIST), opt.selected, ftp->stzName);
 diff --git a/plugins/FTPFileYM/src/options.h b/plugins/FTPFileYM/src/options.h index 5def96e1e5..3f76853061 100644 --- a/plugins/FTPFileYM/src/options.h +++ b/plugins/FTPFileYM/src/options.h @@ -37,7 +37,6 @@ public:  		TR_DAYS
  	};
 -	BYTE enabled;
  	BYTE selected;
  	BYTE defaultFTP;
  	bool bCloseDlg;
 diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index 4374a08834..79aea87d29 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -56,9 +56,9 @@ void ServerList::saveToDb() const  	DB::setAStringF(0, MODULE, "Chmod%d", opt.selected, ftp->szChmod);
  	DB::setWordF(0, MODULE, "FtpProto%d", opt.selected, ftp->ftpProto);
  	DB::setWordF(0, MODULE, "Port%d", opt.selected, ftp->iPort);
 -	DB::setByteF(0, MODULE, "Passive%d", opt.selected, ftp->bPassive);	
 +	DB::setByteF(0, MODULE, "Passive%d", opt.selected, ftp->bPassive);
 +	DB::setByteF(0, MODULE, "Enabled%d", opt.selected, ftp->bEnabled);
  	db_set_b(0, MODULE, "Selected", opt.selected);
 -	db_set_b(0, MODULE, "Enabled", opt.enabled);
  	db_set_b(0, MODULE, "Default", opt.defaultFTP);
  }
 @@ -66,8 +66,6 @@ ServerList::FTP::FTP(int index)  {
  	char buff[256];
 -	this->bEnabled = ((opt.enabled >> index) & 1); 
 -
  	if (DB::getStringF(0, MODULE, "Name%d", index, this->stzName))
  		mir_sntprintf(this->stzName, SIZEOF(this->stzName), TranslateT("FTP Server %d"), index + 1);
 @@ -82,6 +80,7 @@ ServerList::FTP::FTP(int index)  	this->ftpProto = (FTP::EProtoType)DB::getWordF(0, MODULE, "FtpProto%d", index, FTP::FT_STANDARD);
  	this->iPort = DB::getWordF(0, MODULE, "Port%d", index, 21);
  	this->bPassive = DB::getByteF(0, MODULE, "Passive%d", index, 0) ? true : false;
 +	this->bEnabled = DB::getByteF(0, MODULE, "Enabled%d", index, 0) ? true : false;
  }
  ServerList::FTP *ServerList::getSelected() const
  | 
