From 53fe3e46177d17b4941610de19f5cc6210700cb4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 21:44:56 +0300 Subject: db_* functions replaced with g_plugin calls --- plugins/PasteIt/src/Options.cpp | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'plugins/PasteIt/src') diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index fe6a819888..9f6602076f 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -630,7 +630,7 @@ unsigned int Options::GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int void Options::SetDefWeb(int web) { defWeb = web; - db_set_ws(0, MODULENAME, "defWeb", pasteToWebs[web]->GetName()); + g_plugin.setWString("defWeb", pasteToWebs[web]->GetName()); DefWebPageChanged(); } @@ -697,11 +697,11 @@ int Options::InitOptions(WPARAM wParam, LPARAM) void Options::Save() { - db_set_ws(0, MODULENAME, "defWeb", pasteToWebs[defWeb]->GetName()); - db_set_dw(0, MODULENAME, "codepage", codepage); - db_set_b(0, MODULENAME, "autoUTF", autoUTF ? 1 : 0); - db_set_b(0, MODULENAME, "confDlg", confDlg ? 1 : 0); - db_set_b(0, MODULENAME, "autoSend", autoSend ? 1 : 0); + g_plugin.setWString("defWeb", pasteToWebs[defWeb]->GetName()); + g_plugin.setDword("codepage", codepage); + g_plugin.setByte("autoUTF", autoUTF ? 1 : 0); + g_plugin.setByte("confDlg", confDlg ? 1 : 0); + g_plugin.setByte("autoSend", autoSend ? 1 : 0); for (int i = 0; i < PasteToWeb::pages; ++i) { char buf[256]; wchar_t* name = pasteToWebs[i]->GetName(); @@ -718,29 +718,29 @@ void Options::Save() forms += it->id + L'=' + it->name + L';'; } - db_set_ws(0, MODULENAME, buf, forms.c_str()); + g_plugin.setWString(buf, forms.c_str()); mir_strncpy(buf + j, "defFormatId", _countof(buf) - j); - db_set_ws(0, MODULENAME, buf, webOptions[i]->defFormatId.c_str()); + g_plugin.setWString(buf, webOptions[i]->defFormatId.c_str()); if (webOptions[i]->isSendFileName) { mir_strncpy(buf + j, "sendFileName", _countof(buf) - j); - db_set_b(0, MODULENAME, buf, webOptions[i]->sendFileName ? 1 : 0); + g_plugin.setByte(buf, webOptions[i]->sendFileName ? 1 : 0); } if (webOptions[i]->isPublicPaste) { mir_strncpy(buf + j, "publicPaste", _countof(buf) - j); - db_set_b(0, MODULENAME, buf, webOptions[i]->publicPaste ? 1 : 0); + g_plugin.setByte(buf, webOptions[i]->publicPaste ? 1 : 0); } if (webOptions[i]->isCombo1) { mir_strncpy(buf + j, "combo1", _countof(buf) - j); - db_set_ws(0, MODULENAME, buf, webOptions[i]->combo1.c_str()); + g_plugin.setWString(buf, webOptions[i]->combo1.c_str()); } if (webOptions[i]->isPastebin) { mir_strncpy(buf + j, "pastebinUserKey", _countof(buf) - j); - db_set_ws(0, MODULENAME, buf, webOptions[i]->pastebinUserKey.c_str()); + g_plugin.setWString(buf, webOptions[i]->pastebinUserKey.c_str()); } } } @@ -748,7 +748,7 @@ void Options::Save() void Options::Load() { DBVARIANT defWebV; - if (!db_get_ws(0, MODULENAME, "defWeb", &defWebV)) { + if (!g_plugin.getWString("defWeb", &defWebV)) { for (int i = 0; i < PasteToWeb::pages; ++i) { if (!mir_wstrcmp(pasteToWebs[i]->GetName(), defWebV.pwszVal)) { defWeb = i; @@ -757,10 +757,10 @@ void Options::Load() } db_free(&defWebV); } - codepage = db_get_dw(0, MODULENAME, "codepage", CP_ACP); - autoUTF = db_get_b(0, MODULENAME, "autoUTF", 1) ? true : false; - confDlg = db_get_b(0, MODULENAME, "confDlg", 1) ? true : false; - autoSend = db_get_b(0, MODULENAME, "autoSend", 0) ? true : false; + codepage = g_plugin.getDword("codepage", CP_ACP); + autoUTF = g_plugin.getByte("autoUTF", 1) ? true : false; + confDlg = g_plugin.getByte("confDlg", 1) ? true : false; + autoSend = g_plugin.getByte("autoSend", 0) ? true : false; for (int i = 0; i < PasteToWeb::pages; ++i) { char buf[256]; int j = 0; @@ -775,7 +775,7 @@ void Options::Load() mir_strncpy(buf + j, "formats", _countof(buf) - j); DBVARIANT forms; - if (!db_get_ws(0, MODULENAME, buf, &forms)) { + if (!g_plugin.getWString(buf, &forms)) { webOptions[i]->formats.clear(); int k = 0; wchar_t *id = forms.pwszVal; @@ -802,25 +802,25 @@ void Options::Load() mir_strncpy(buf + j, "defFormatId", _countof(buf) - j); DBVARIANT defForm; - if (!db_get_ws(0, MODULENAME, buf, &defForm)) { + if (!g_plugin.getWString(buf, &defForm)) { webOptions[i]->defFormatId = defForm.pwszVal; db_free(&defForm); } if (webOptions[i]->isSendFileName) { mir_strncpy(buf + j, "sendFileName", _countof(buf) - j); - webOptions[i]->sendFileName = db_get_b(0, MODULENAME, buf, 1) ? true : false; + webOptions[i]->sendFileName = g_plugin.getByte(buf, 1) ? true : false; } if (webOptions[i]->isPublicPaste) { mir_strncpy(buf + j, "publicPaste", _countof(buf) - j); - webOptions[i]->publicPaste = db_get_b(0, MODULENAME, buf, 0) ? true : false; + webOptions[i]->publicPaste = g_plugin.getByte(buf, 0) ? true : false; } if (webOptions[i]->isCombo1) { mir_strncpy(buf + j, "combo1", _countof(buf) - j); DBVARIANT combo1; - if (!db_get_ws(0, MODULENAME, buf, &combo1)) { + if (!g_plugin.getWString(buf, &combo1)) { webOptions[i]->combo1 = combo1.pwszVal; db_free(&combo1); } @@ -829,7 +829,7 @@ void Options::Load() if (webOptions[i]->isPastebin) { mir_strncpy(buf + j, "pastebinUserKey", _countof(buf) - j); DBVARIANT pastebinUserKey; - if (!db_get_ws(0, MODULENAME, buf, &pastebinUserKey)) { + if (!g_plugin.getWString(buf, &pastebinUserKey)) { webOptions[i]->pastebinUserKey = pastebinUserKey.pwszVal; db_free(&pastebinUserKey); } -- cgit v1.2.3