diff options
author | George Hazan <george.hazan@gmail.com> | 2012-12-05 10:33:01 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-12-05 10:33:01 +0000 |
commit | a24b86d275a37bde42ae74ec12c235e4fe6b0d60 (patch) | |
tree | dc195697c83eee24a29ce24806786faeba872b6d | |
parent | e5483a07e282dbc6be8ee498ff6ce676ee0ce2ed (diff) |
- removed useless array for icons handle;
- removed unused stubs for the database functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@2651 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/FTPFileYM/src/dbentry.cpp | 8 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/ftpfile.cpp | 15 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/job_generic.cpp | 2 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/job_upload.cpp | 2 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/mir_db.cpp | 71 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/mir_db.h | 16 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/options.cpp | 351 | ||||
-rw-r--r-- | plugins/FTPFileYM/src/serverlist.cpp | 6 |
8 files changed, 191 insertions, 280 deletions
diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp index bb43e120a8..4d23aa323b 100644 --- a/plugins/FTPFileYM/src/dbentry.cpp +++ b/plugins/FTPFileYM/src/dbentry.cpp @@ -41,7 +41,7 @@ DBEntry *DBEntry::getFirts() DBEntry *DBEntry::getNext(DBEntry *entry)
{
char szValue[256];
- int count = DB::getDword(0, MODULE_FILES, "NextFileID", 0);
+ int count = db_get_dw(0, MODULE_FILES, "NextFileID", 0);
for (; entryID < count; entryID++)
{
@@ -80,7 +80,7 @@ void DBEntry::cleanupDB() entry = getNext(entry);
}
- DB::setDword(0, MODULE_FILES, "NextFileID", count);
+ db_set_dw(0, MODULE_FILES, "NextFileID", count);
}
DBEntry *DBEntry::get(int fileID)
@@ -136,7 +136,7 @@ void DBEntry::add(GenericJob *job) return;
Lock *lock = new Lock(mutexDB);
- int id = DB::getDword(0, MODULE_FILES, "NextFileID", 0);
+ int id = db_get_dw(0, MODULE_FILES, "NextFileID", 0);
DB::setByteF(0, MODULE_FILES, "Ftp%d", id, job->iFtpNum);
DB::setAStringF(0, MODULE_FILES, "Filename%d", id, job->szSafeFileName);
@@ -147,7 +147,7 @@ void DBEntry::add(GenericJob *job) DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", id, deleteTS);
}
- DB::setDword(0, MODULE_FILES, "NextFileID", id + 1);
+ db_set_dw(0, MODULE_FILES, "NextFileID", id + 1);
job->fileID = id;
delete lock;
diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index d6f5dfe11b..2642fb49d5 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -85,8 +85,6 @@ static IconItem iconList[] = { "Delete from FTP", "delete", IDI_DELETE }
};
-static HANDLE hIconlibItem[ServerList::FTP_COUNT + SIZEOF(iconList)];
-
static void InitIcolib()
{
Icon_Register(hInst, MODULE, iconList, SIZEOF(iconList), MODULE);
@@ -98,12 +96,13 @@ void InitMenuItems() CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = hIconlibItem[ServerList::FTP_COUNT];
+ mi.icolibItem = iconList[ServerList::FTP_COUNT].hIcolib;
mi.position = 3000090001;
mi.ptszName = LPGENT("FTP File");
hMainMenu = Menu_AddMainMenuItem(&mi);
- if (opt.bUseSubmenu) hMenu = Menu_AddContactMenuItem(&mi);
+ if (opt.bUseSubmenu)
+ hMenu = Menu_AddContactMenuItem(&mi);
memset(&mi, 0, sizeof(mi));
mi.cbSize = sizeof(mi);
@@ -126,7 +125,7 @@ void InitMenuItems() mi.hParentMenu = hMenu;
}
- mi.icolibItem = hIconlibItem[i];
+ mi.icolibItem = iconList[i].hIcolib;
mi.popupPosition = i + 1000;
hSubMenu[i] = Menu_AddContactMenuItem(&mi);
@@ -168,7 +167,7 @@ void InitMenuItems() memset(&mi, 0, sizeof(mi));
mi.cbSize = sizeof(mi);
mi.flags = CMIF_ICONFROMICOLIB | CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR;
- mi.icolibItem = hIconlibItem[ServerList::FTP_COUNT];
+ mi.icolibItem = iconList[ServerList::FTP_COUNT].hIcolib;
mi.position = 3000090001;
mi.ptszName = LPGENT("FTP File manager");
mi.pszService = MS_FTPFILE_SHOWMANAGER;
@@ -200,7 +199,7 @@ void InitTabsrmmButton() btn.dwButtonID = 1;
btn.pszModuleName = MODULE;
btn.dwDefPos = 105;
- btn.hIcon = hIconlibItem[ServerList::FTP_COUNT];
+ btn.hIcon = iconList[ServerList::FTP_COUNT].hIcolib;
btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_ISLSIDEBUTTON | BBBF_CANBEHIDDEN;
btn.ptszTooltip = TranslateT("FTP File");
CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn);
@@ -214,7 +213,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
bool bIsContact = false;
- char *szProto = DB::getProto((HANDLE)wParam);
+ char *szProto = GetContactProto((HANDLE)wParam);
if (szProto) bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) ? true : false;
bool bHideRoot = opt.bHideInactive;
diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp index ea199ea4db..17d9257e41 100644 --- a/plugins/FTPFileYM/src/job_generic.cpp +++ b/plugins/FTPFileYM/src/job_generic.cpp @@ -238,7 +238,7 @@ void GenericJob::refreshTab(bool bTabChanged) {
if (this->hContact != NULL)
{
- SendDlgItemMessage(uDlg->hwnd, IDC_BTN_PROTO, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedProtoIcon(DB::getProto(this->hContact), ID_STATUS_ONLINE));
+ SendDlgItemMessage(uDlg->hwnd, IDC_BTN_PROTO, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadSkinnedProtoIcon( GetContactProto(this->hContact), ID_STATUS_ONLINE));
SetDlgItemText(uDlg->hwnd, IDC_UP_CONTACT, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)this->hContact, GCDNF_TCHAR));
}
else
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index bdc31fc61e..591a99448f 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -80,7 +80,7 @@ void UploadJob::autoSend() {
if (this->hContact != NULL)
{
- char *szProto = DB::getProto(this->hContact);
+ char *szProto = GetContactProto(this->hContact);
if (szProto)
{
DBEVENTINFO dbei = {0};
diff --git a/plugins/FTPFileYM/src/mir_db.cpp b/plugins/FTPFileYM/src/mir_db.cpp index 6c634da656..254734c8db 100644 --- a/plugins/FTPFileYM/src/mir_db.cpp +++ b/plugins/FTPFileYM/src/mir_db.cpp @@ -18,64 +18,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "common.h"
-int DB::setByte(HANDLE hContact, char *szModule, char *szSetting, int iValue)
-{
- return DBWriteContactSettingByte(hContact, szModule, szSetting, iValue);
-}
-
int DB::setByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return setByte(hContact, szModule, formSet, iValue);
-}
-
-int DB::setWord(HANDLE hContact, char *szModule, char *szSetting, int iValue)
-{
- return DBWriteContactSettingWord(hContact, szModule, szSetting, iValue);
+ return db_set_b(hContact, szModule, formSet, iValue);
}
int DB::setWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return setWord(hContact, szModule, formSet, iValue);
-}
-
-int DB::setDword(HANDLE hContact, char *szModule, char *szSetting, int iValue)
-{
- return DBWriteContactSettingDword(hContact, szModule, szSetting, iValue);
+ return db_set_w(hContact, szModule, formSet, iValue);
}
int DB::setDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return setDword(hContact, szModule, formSet, iValue);
-}
-
-int DB::setAString(HANDLE hContact, char *szModule, char *szSetting, char *szValue)
-{
- return DBWriteContactSettingString(hContact, szModule, szSetting, szValue);
+ return db_set_dw(hContact, szModule, formSet, iValue);
}
int DB::setAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *szValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return setAString(hContact, szModule, formSet, szValue);
-}
-
-int DB::setString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *stzValue)
-{
- return DBWriteContactSettingTString(hContact, szModule, szSetting, stzValue);
+ return db_set_s(hContact, szModule, formSet, szValue);
}
int DB::setStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *stzValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return setString(hContact, szModule, formSet, stzValue);
+ return db_set_ts(hContact, szModule, formSet, stzValue);
}
int DB::setCryptedString(HANDLE hContact, char *szModule, char *szSetting, char *szValue)
@@ -83,43 +58,28 @@ int DB::setCryptedString(HANDLE hContact, char *szModule, char *szSetting, char char buff[256];
strcpy(buff, szValue);
CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)sizeof(buff), (LPARAM)buff);
- return setAString(hContact, szModule, szSetting, buff);
-}
-
-int DB::getByte(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue)
-{
- return DBGetContactSettingByte(hContact, szModule, szSetting, iErrorValue);
+ return db_set_s(hContact, szModule, szSetting, buff);
}
int DB::getByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return getByte(hContact, szModule, formSet, iErrorValue);
-}
-
-int DB::getWord(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue)
-{
- return DBGetContactSettingWord(hContact, szModule, szSetting, iErrorValue);
+ return db_get_b(hContact, szModule, formSet, iErrorValue);
}
int DB::getWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return getWord(hContact, szModule, formSet, iErrorValue);
-}
-
-int DB::getDword(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue)
-{
- return DBGetContactSettingDword(hContact, szModule, szSetting, iErrorValue);
+ return db_get_w(hContact, szModule, formSet, iErrorValue);
}
int DB::getDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return getDword(hContact, szModule, formSet, iErrorValue);
+ return db_get_dw(hContact, szModule, formSet, iErrorValue);
}
int DB::getAString(HANDLE hContact, char *szModule, char *szSetting, char *buff)
@@ -178,20 +138,9 @@ int DB::getCryptedString(HANDLE hContact, char *szModule, char *szSetting, char return 1;
}
-int DB::deleteSetting(HANDLE hContact, char *szModule, char *szSetting)
-{
- return DBDeleteContactSetting(hContact, szModule, szSetting);
-}
-
int DB::deleteSettingF(HANDLE hContact, char *szModule, char *szSetting, int id)
{
char formSet[256];
mir_snprintf(formSet, sizeof(formSet), szSetting, id);
- return deleteSetting(hContact, szModule, formSet);
+ return db_unset(hContact, szModule, formSet);
}
-
-char *DB::getProto(HANDLE hContact)
-{
- char *szProto = GetContactProto(hContact);
- return ((INT_PTR)szProto != CALLSERVICE_NOTFOUND) ? szProto : NULL;
-}
\ No newline at end of file diff --git a/plugins/FTPFileYM/src/mir_db.h b/plugins/FTPFileYM/src/mir_db.h index df2004c86d..84f81b82bb 100644 --- a/plugins/FTPFileYM/src/mir_db.h +++ b/plugins/FTPFileYM/src/mir_db.h @@ -23,26 +23,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class DB
{
public:
- static int setByte(HANDLE hContact, char *szModule, char *szSetting, int iValue);
static int setByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue);
- static int setWord(HANDLE hContact, char *szModule, char *szSetting, int iValue);
static int setWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue);
- static int setDword(HANDLE hContact, char *szModule, char *szSetting, int iValue);
static int setDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue);
- static int setAString(HANDLE hContact, char *szModule, char *szSetting, char *szValue);
static int setAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *szValue);
- static int setString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *stzValue);
static int setStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *stzValue);
- static int getByte(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue);
static int getByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1);
- static int getWord(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue = -1);
static int getWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1);
- static int getDword(HANDLE hContact, char *szModule, char *szSetting, int iErrorValue = -1);
static int getDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1);
- static int getAString(HANDLE hContact, char *szModule, char *szSetting, char *buff);
+ // !!!!!!!!!!!!!!!!!!! dangerous as hell
+ static int getAString(HANDLE hContact, char *szModule, char *szSetting, char *buff);
static int getAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *buff);
static int getString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *buff);
static int getStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *buff);
@@ -50,8 +43,5 @@ public: static int setCryptedString(HANDLE hContact, char *szModule, char *szSetting, char *szValue);
static int getCryptedString(HANDLE hContact, char *szModule, char *szSetting, char *szValue);
- static int deleteSetting(HANDLE hContact, char *szModule, char *szSetting);
static int deleteSettingF(HANDLE hContact, char *szModule, char *szSetting, int id);
-
- static char *getProto(HANDLE hContact);
-};
\ No newline at end of file +};
diff --git a/plugins/FTPFileYM/src/options.cpp b/plugins/FTPFileYM/src/options.cpp index b1dfdb0c62..2e59b970bf 100644 --- a/plugins/FTPFileYM/src/options.cpp +++ b/plugins/FTPFileYM/src/options.cpp @@ -33,33 +33,33 @@ void Options::deinit() void Options::loadOptions()
{
- enabled = DB::getByte(0, MODULE, "Enabled", 0);
- selected = DB::getByte(0, MODULE, "Selected", 0);
- defaultFTP = DB::getByte(0, MODULE, "Default", 0);
- bAutosend = DB::getByte(0, MODULE, "Autosend", 0) ? true : false;
- bCloseDlg = DB::getByte(0, MODULE, "CloseDlg", 0) ? true : false;
- bCopyLink = DB::getByte(0, MODULE, "CopyLink", 1) ? true : false;
- bUseSubmenu = DB::getByte(0, MODULE, "UseSubmenu", 1) ? true : false;
- bHideInactive = DB::getByte(0, MODULE, "HideInactive", 1) ? true : false;
- bAutoDelete = DB::getByte(0, MODULE, "DeleteTimer", 0) ? true : false;
- iDeleteTime = DB::getDword(0, MODULE, "AutoDeleteTime", 60);
- timeRange = (ETimeRange)DB::getByte(0, MODULE, "TimeRange", TR_MINUTES);
- iCompressionLevel = DB::getByte(0, MODULE, "CompressionLevel", 6);
- bSetZipName = DB::getByte(0, MODULE, "SetZipName", 0) ? true : false;
+ 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;
+ bCloseDlg = db_get_b(0, MODULE, "CloseDlg", 0) ? true : false;
+ bCopyLink = db_get_b(0, MODULE, "CopyLink", 1) ? true : false;
+ bUseSubmenu = db_get_b(0, MODULE, "UseSubmenu", 1) ? true : false;
+ bHideInactive = db_get_b(0, MODULE, "HideInactive", 1) ? true : false;
+ bAutoDelete = db_get_b(0, MODULE, "DeleteTimer", 0) ? true : false;
+ iDeleteTime = db_get_dw(0, MODULE, "AutoDeleteTime", 60);
+ timeRange = (ETimeRange)db_get_b(0, MODULE, "TimeRange", TR_MINUTES);
+ iCompressionLevel = db_get_b(0, MODULE, "CompressionLevel", 6);
+ bSetZipName = db_get_b(0, MODULE, "SetZipName", 0) ? true : false;
}
void Options::saveOptions() const
{
- DB::setByte(0, MODULE, "Autosend", bAutosend ? 1 : 0);
- DB::setByte(0, MODULE, "CopyLink", bCopyLink ? 1 : 0);
- DB::setByte(0, MODULE, "UseSubmenu", bUseSubmenu ? 1 : 0);
- DB::setByte(0, MODULE, "HideInactive", bHideInactive ? 1 : 0);
- DB::setByte(0, MODULE, "CloseDlg", bCloseDlg ? 1 : 0);
- DB::setByte(0, MODULE, "DeleteTimer", bAutoDelete ? 1 : 0);
- DB::setDword(0, MODULE, "AutoDeleteTime", iDeleteTime);
- DB::setByte(0, MODULE, "TimeRange", (int)timeRange);
- DB::setByte(0, MODULE, "CompressionLevel", iCompressionLevel);
- DB::setByte(0, MODULE, "SetZipName", bSetZipName ? 1 : 0);
+ db_set_b(0, MODULE, "Autosend", bAutosend ? 1 : 0);
+ db_set_b(0, MODULE, "CopyLink", bCopyLink ? 1 : 0);
+ db_set_b(0, MODULE, "UseSubmenu", bUseSubmenu ? 1 : 0);
+ db_set_b(0, MODULE, "HideInactive", bHideInactive ? 1 : 0);
+ db_set_b(0, MODULE, "CloseDlg", bCloseDlg ? 1 : 0);
+ db_set_b(0, MODULE, "DeleteTimer", bAutoDelete ? 1 : 0);
+ db_set_dw(0, MODULE, "AutoDeleteTime", iDeleteTime);
+ db_set_b(0, MODULE, "TimeRange", (int)timeRange);
+ db_set_b(0, MODULE, "CompressionLevel", iCompressionLevel);
+ db_set_b(0, MODULE, "SetZipName", bSetZipName ? 1 : 0);
}
void Options::enableItems(HWND hwndDlg, bool state)
@@ -78,12 +78,10 @@ void Options::enableItems(HWND hwndDlg, bool state) INT_PTR CALLBACK Options::DlgProcOptsAccounts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
- case WM_INITDIALOG:
+ switch(msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- TranslateDialogDefault(hwndDlg);
-
for (int i = 0; i < ServerList::FTP_COUNT; i++)
ComboBox_AddString(GetDlgItem(hwndDlg, IDC_FTPLIST), ftpList[i]->stzName);
@@ -105,180 +103,158 @@ 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);
+ }
+ return TRUE;
- if (ftpList.getSelected()->bEnabled)
- {
- CheckDlgButton(hwndDlg, IDC_ENABLED, 1);
- }
- else
- {
- CheckDlgButton(hwndDlg, IDC_ENABLED, 0);
- enableItems(hwndDlg, false);
- }
+ case WM_COMMAND:
- return TRUE;
+ if (HIWORD(wParam) == BN_CLICKED) {
+ if (LOWORD(wParam) == IDC_ENABLED)
+ enableItems(hwndDlg, IsDlgButtonChecked(hwndDlg, IDC_ENABLED) == BST_CHECKED ? true : false);
}
- case WM_COMMAND:
- {
- if (HIWORD(wParam) == BN_CLICKED)
- {
- if (LOWORD(wParam) == IDC_ENABLED)
- enableItems(hwndDlg, IsDlgButtonChecked(hwndDlg, IDC_ENABLED) == BST_CHECKED ? true : false);
- }
- else if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- if (LOWORD(wParam) == IDC_FTPLIST)
- {
- opt.selected = (BYTE)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FTPLIST));
- CheckDlgButton(hwndDlg, IDC_DEFAULT, opt.selected == opt.defaultFTP);
-
- ServerList::FTP *ftp = ftpList.getSelected();
- SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_SETCURSEL, ftp->ftpProto, 0);
- SetDlgItemTextA(hwndDlg, IDC_SERVER, ftp->szServer);
- SetDlgItemTextA(hwndDlg, IDC_USER, ftp->szUser);
- SetDlgItemTextA(hwndDlg, IDC_PASSWORD, ftp->szPass);
- SetDlgItemTextA(hwndDlg, IDC_DIR, ftp->szDir);
- SetDlgItemTextA(hwndDlg, IDC_URL, ftp->szUrl);
- 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);
- enableItems(hwndDlg, true);
- }
- else
- {
- CheckDlgButton(hwndDlg, IDC_ENABLED, 0);
- enableItems(hwndDlg, false);
- }
+ else if (HIWORD(wParam) == CBN_SELCHANGE) {
+ if (LOWORD(wParam) == IDC_FTPLIST) {
+ opt.selected = (BYTE)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_FTPLIST));
+ CheckDlgButton(hwndDlg, IDC_DEFAULT, opt.selected == opt.defaultFTP);
+
+ ServerList::FTP *ftp = ftpList.getSelected();
+ SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_SETCURSEL, ftp->ftpProto, 0);
+ SetDlgItemTextA(hwndDlg, IDC_SERVER, ftp->szServer);
+ SetDlgItemTextA(hwndDlg, IDC_USER, ftp->szUser);
+ SetDlgItemTextA(hwndDlg, IDC_PASSWORD, ftp->szPass);
+ SetDlgItemTextA(hwndDlg, IDC_DIR, ftp->szDir);
+ SetDlgItemTextA(hwndDlg, IDC_URL, ftp->szUrl);
+ 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);
+ enableItems(hwndDlg, true);
+ }
+ else {
+ CheckDlgButton(hwndDlg, IDC_ENABLED, 0);
+ enableItems(hwndDlg, false);
}
- else if (LOWORD(wParam) == IDC_PROTOLIST)
- {
- int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PROTOLIST));
- switch (sel)
- {
- case ServerList::FTP::FT_STANDARD:
- case ServerList::FTP::FT_SSL_EXPLICIT: SetDlgItemInt(hwndDlg, IDC_PORT, 21, FALSE); break;
- case ServerList::FTP::FT_SSL_IMPLICIT: SetDlgItemInt(hwndDlg, IDC_PORT, 990, FALSE); break;
- case ServerList::FTP::FT_SSH: SetDlgItemInt(hwndDlg, IDC_PORT, 22, FALSE); break;
- }
+ }
+ else if (LOWORD(wParam) == IDC_PROTOLIST) {
+ int sel = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_PROTOLIST));
+ switch (sel) {
+ case ServerList::FTP::FT_STANDARD:
+ case ServerList::FTP::FT_SSL_EXPLICIT: SetDlgItemInt(hwndDlg, IDC_PORT, 21, FALSE); break;
+ case ServerList::FTP::FT_SSL_IMPLICIT: SetDlgItemInt(hwndDlg, IDC_PORT, 990, FALSE); break;
+ case ServerList::FTP::FT_SSH: SetDlgItemInt(hwndDlg, IDC_PORT, 22, FALSE); break;
}
}
-
- if (HIWORD(wParam)==BN_CLICKED || HIWORD(wParam)==EN_CHANGE || HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)==CBN_EDITCHANGE)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- return TRUE;
}
- 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;
- ServerList::FTP *ftp = ftpList.getSelected();
- GetDlgItemText(hwndDlg, IDC_FTPLIST, ftp->stzName, SIZEOF(ftp->stzName));
- GetDlgItemTextA(hwndDlg, IDC_SERVER, ftp->szServer, SIZEOF(ftp->szServer));
- GetDlgItemTextA(hwndDlg, IDC_USER, ftp->szUser, SIZEOF(ftp->szUser));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, ftp->szPass, SIZEOF(ftp->szPass));
- GetDlgItemTextA(hwndDlg, IDC_DIR, ftp->szDir, SIZEOF(ftp->szDir));
- GetDlgItemTextA(hwndDlg, IDC_URL, ftp->szUrl, SIZEOF(ftp->szUrl));
- GetDlgItemTextA(hwndDlg, IDC_CHMOD, ftp->szChmod, SIZEOF(ftp->szChmod));
-
- 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;
-
- ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_FTPLIST), opt.selected);
- ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_FTPLIST), opt.selected, ftp->stzName);
- ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_FTPLIST), opt.selected);
-
- ftpList.saveToDb();
- PrebuildMainMenu();
- }
- return TRUE;
+ if (HIWORD(wParam)==BN_CLICKED || HIWORD(wParam)==EN_CHANGE || HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)==CBN_EDITCHANGE)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ return TRUE;
+
+ 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;
+
+ ServerList::FTP *ftp = ftpList.getSelected();
+ GetDlgItemText(hwndDlg, IDC_FTPLIST, ftp->stzName, SIZEOF(ftp->stzName));
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, ftp->szServer, SIZEOF(ftp->szServer));
+ GetDlgItemTextA(hwndDlg, IDC_USER, ftp->szUser, SIZEOF(ftp->szUser));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, ftp->szPass, SIZEOF(ftp->szPass));
+ GetDlgItemTextA(hwndDlg, IDC_DIR, ftp->szDir, SIZEOF(ftp->szDir));
+ GetDlgItemTextA(hwndDlg, IDC_URL, ftp->szUrl, SIZEOF(ftp->szUrl));
+ GetDlgItemTextA(hwndDlg, IDC_CHMOD, ftp->szChmod, SIZEOF(ftp->szChmod));
+
+ 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;
+
+ ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_FTPLIST), opt.selected);
+ ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_FTPLIST), opt.selected, ftp->stzName);
+ ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_FTPLIST), opt.selected);
+
+ ftpList.saveToDb();
+ PrebuildMainMenu();
}
+ return TRUE;
}
-
+
return FALSE;
}
INT_PTR CALLBACK Options::DlgProcOptsAdvanced(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
-
- CheckDlgButton(hwndDlg, IDC_URL_AUTOSEND, opt.bAutosend ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_URL_COPYTOML, opt.bCopyLink ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_USESUBMENU, opt.bUseSubmenu ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_HIDEINACTIVE, opt.bHideInactive ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_CLOSEDLG, opt.bCloseDlg ? 1 : 0);
- CheckDlgButton(hwndDlg, IDC_AUTODELETE, opt.bAutoDelete ? 1 : 0);
-
- SendDlgItemMessage(hwndDlg, IDC_LEVEL_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(9, 0));
- SetDlgItemInt(hwndDlg, IDC_LEVEL, opt.iCompressionLevel, FALSE);
- CheckDlgButton(hwndDlg, IDC_SETZIPNAME, opt.bSetZipName ? 1 : 0);
-
- SendDlgItemMessage(hwndDlg, IDC_DELETETIME_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(UD_MAXVAL, 1));
- SetDlgItemInt(hwndDlg, IDC_DELETETIME, opt.iDeleteTime, FALSE);
-
- SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_ADDSTRING, 0, (LPARAM)TranslateT("minutes"));
- SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_ADDSTRING, 0, (LPARAM)TranslateT("hours"));
- SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_ADDSTRING, 0, (LPARAM)TranslateT("days"));
- SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_SETCURSEL, (int)opt.timeRange, 0);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_DELETETIME), opt.bAutoDelete);
- EnableWindow(GetDlgItem(hwndDlg, IDC_RANGE), opt.bAutoDelete);
-
- return TRUE;
+ switch(msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ CheckDlgButton(hwndDlg, IDC_URL_AUTOSEND, opt.bAutosend ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_URL_COPYTOML, opt.bCopyLink ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_USESUBMENU, opt.bUseSubmenu ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_HIDEINACTIVE, opt.bHideInactive ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_CLOSEDLG, opt.bCloseDlg ? 1 : 0);
+ CheckDlgButton(hwndDlg, IDC_AUTODELETE, opt.bAutoDelete ? 1 : 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_LEVEL_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(9, 0));
+ SetDlgItemInt(hwndDlg, IDC_LEVEL, opt.iCompressionLevel, FALSE);
+ CheckDlgButton(hwndDlg, IDC_SETZIPNAME, opt.bSetZipName ? 1 : 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_DELETETIME_SPIN, UDM_SETRANGE, 0, (LPARAM)MAKELONG(UD_MAXVAL, 1));
+ SetDlgItemInt(hwndDlg, IDC_DELETETIME, opt.iDeleteTime, FALSE);
+
+ SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_ADDSTRING, 0, (LPARAM)TranslateT("minutes"));
+ SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_ADDSTRING, 0, (LPARAM)TranslateT("hours"));
+ SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_ADDSTRING, 0, (LPARAM)TranslateT("days"));
+ SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_SETCURSEL, (int)opt.timeRange, 0);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETETIME), opt.bAutoDelete);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RANGE), opt.bAutoDelete);
+ return TRUE;
+
+ case WM_COMMAND:
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_AUTODELETE) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DELETETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTODELETE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RANGE), IsDlgButtonChecked(hwndDlg, IDC_AUTODELETE));
}
- case WM_COMMAND:
- {
- if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_AUTODELETE)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_DELETETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTODELETE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_RANGE), IsDlgButtonChecked(hwndDlg, IDC_AUTODELETE));
- }
- if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- return TRUE;
- }
- case WM_NOTIFY:
- {
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- opt.bAutosend = IsDlgButtonChecked(hwndDlg, IDC_URL_AUTOSEND) ? true : false;
- opt.bCopyLink = IsDlgButtonChecked(hwndDlg, IDC_URL_COPYTOML) ? true : false;
- opt.bUseSubmenu = IsDlgButtonChecked(hwndDlg, IDC_USESUBMENU) ? true : false;
- opt.bHideInactive = IsDlgButtonChecked(hwndDlg, IDC_HIDEINACTIVE) ? true : false;
- opt.bCloseDlg = IsDlgButtonChecked(hwndDlg, IDC_CLOSEDLG) ? true : false;
- opt.bAutoDelete = IsDlgButtonChecked(hwndDlg, IDC_AUTODELETE) ? true : false;
- opt.iCompressionLevel = GetDlgItemInt(hwndDlg, IDC_LEVEL, 0, FALSE);
- opt.bSetZipName = IsDlgButtonChecked(hwndDlg, IDC_SETZIPNAME) ? true : false;
- opt.iDeleteTime = GetDlgItemInt(hwndDlg, IDC_DELETETIME, 0, FALSE);
- opt.timeRange = (Options::ETimeRange)SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_GETCURSEL, 0, 0);
- opt.saveOptions();
-
- if (opt.bAutoDelete) deleteTimer.start();
- else deleteTimer.stop();
-
- PrebuildMainMenu();
- }
- return TRUE;
+ if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == EN_CHANGE)
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ return TRUE;
+
+ case WM_NOTIFY:
+ if(((LPNMHDR)lParam)->code == PSN_APPLY) {
+ opt.bAutosend = IsDlgButtonChecked(hwndDlg, IDC_URL_AUTOSEND) ? true : false;
+ opt.bCopyLink = IsDlgButtonChecked(hwndDlg, IDC_URL_COPYTOML) ? true : false;
+ opt.bUseSubmenu = IsDlgButtonChecked(hwndDlg, IDC_USESUBMENU) ? true : false;
+ opt.bHideInactive = IsDlgButtonChecked(hwndDlg, IDC_HIDEINACTIVE) ? true : false;
+ opt.bCloseDlg = IsDlgButtonChecked(hwndDlg, IDC_CLOSEDLG) ? true : false;
+ opt.bAutoDelete = IsDlgButtonChecked(hwndDlg, IDC_AUTODELETE) ? true : false;
+ opt.iCompressionLevel = GetDlgItemInt(hwndDlg, IDC_LEVEL, 0, FALSE);
+ opt.bSetZipName = IsDlgButtonChecked(hwndDlg, IDC_SETZIPNAME) ? true : false;
+ opt.iDeleteTime = GetDlgItemInt(hwndDlg, IDC_DELETETIME, 0, FALSE);
+ opt.timeRange = (Options::ETimeRange)SendDlgItemMessage(hwndDlg, IDC_RANGE, CB_GETCURSEL, 0, 0);
+ opt.saveOptions();
+
+ if (opt.bAutoDelete) deleteTimer.start();
+ else deleteTimer.stop();
+
+ PrebuildMainMenu();
}
+ return TRUE;
}
return FALSE;
@@ -286,9 +262,7 @@ INT_PTR CALLBACK Options::DlgProcOptsAdvanced(HWND hwndDlg, UINT msg, WPARAM wPa int Options::InitOptions(WPARAM wParam, LPARAM lParam)
{
- OPTIONSDIALOGPAGE odp = {0};
-
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = 100000000;
odp.hInstance = hInst;
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
@@ -304,6 +278,5 @@ int Options::InitOptions(WPARAM wParam, LPARAM lParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ADVANCED);
odp.pfnDlgProc = Options::DlgProcOptsAdvanced;
Options_AddPage(wParam, &odp);
-
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index 1d1c67b145..4374a08834 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -57,9 +57,9 @@ void ServerList::saveToDb() const 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::setByte(0, MODULE, "Selected", opt.selected);
- DB::setByte(0, MODULE, "Enabled", opt.enabled);
- DB::setByte(0, MODULE, "Default", opt.defaultFTP);
+ db_set_b(0, MODULE, "Selected", opt.selected);
+ db_set_b(0, MODULE, "Enabled", opt.enabled);
+ db_set_b(0, MODULE, "Default", opt.defaultFTP);
}
ServerList::FTP::FTP(int index)
|