summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/dropbox_dialogs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Dropbox/src/dropbox_dialogs.cpp')
-rw-r--r--plugins/Dropbox/src/dropbox_dialogs.cpp53
1 files changed, 23 insertions, 30 deletions
diff --git a/plugins/Dropbox/src/dropbox_dialogs.cpp b/plugins/Dropbox/src/dropbox_dialogs.cpp
index a57afbae5b..0639bad285 100644
--- a/plugins/Dropbox/src/dropbox_dialogs.cpp
+++ b/plugins/Dropbox/src/dropbox_dialogs.cpp
@@ -4,54 +4,48 @@ INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam
{
CDropbox *instance = (CDropbox*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
- {
TranslateDialogDefault(hwndDlg);
-
instance = (CDropbox*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
EnableWindow(GetDlgItem(hwndDlg, IDC_AUTHORIZE), FALSE);
+ {
+ LOGFONT lf;
+ HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_AUTH_STATUS, WM_GETFONT, 0, 0);
+ GetObject(hFont, sizeof(lf), &lf);
+ lf.lfWeight = FW_BOLD;
+ SendDlgItemMessage(hwndDlg, IDC_AUTH_STATUS, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
- LOGFONT lf;
- HFONT hFont = (HFONT)SendDlgItemMessage(hwndDlg, IDC_AUTH_STATUS, WM_GETFONT, 0, 0);
- GetObject(hFont, sizeof(lf), &lf);
- lf.lfWeight = FW_BOLD;
- SendDlgItemMessage(hwndDlg, IDC_AUTH_STATUS, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
-
- if (instance->HasAccessToken())
- SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you are already authorized"));
- else
- SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you are not authorized yet"));
+ if (instance->HasAccessToken())
+ SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you are already authorized"));
+ else
+ SetDlgItemText(hwndDlg, IDC_AUTH_STATUS, TranslateT("you are not authorized yet"));
- CheckDlgButton(hwndDlg, IDC_USE_SHORT_LINKS, db_get_b(NULL, MODULE, "UseSortLinks", 1) ? BST_CHECKED : BST_UNCHECKED);
- if (db_get_b(NULL, MODULE, "UrlAutoSend", 1))
- CheckDlgButton(hwndDlg, IDC_URL_AUTOSEND, BST_CHECKED);
- else if (db_get_b(NULL, MODULE, "UrlPasteToMessageInputArea", 1))
- CheckDlgButton(hwndDlg, IDC_URL_COPYTOMIA, BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_URL_COPYTOCB, db_get_b(NULL, MODULE, "UrlCopyToClipboard", 0) ? BST_CHECKED : BST_UNCHECKED);
- }
- return TRUE;
+ CheckDlgButton(hwndDlg, IDC_USE_SHORT_LINKS, db_get_b(NULL, MODULE, "UseSortLinks", 1) ? BST_CHECKED : BST_UNCHECKED);
+ if (db_get_b(NULL, MODULE, "UrlAutoSend", 1))
+ CheckDlgButton(hwndDlg, IDC_URL_AUTOSEND, BST_CHECKED);
+ else if (db_get_b(NULL, MODULE, "UrlPasteToMessageInputArea", 1))
+ CheckDlgButton(hwndDlg, IDC_URL_COPYTOMIA, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_URL_COPYTOCB, db_get_b(NULL, MODULE, "UrlCopyToClipboard", 0) ? BST_CHECKED : BST_UNCHECKED);
+ }
+ return TRUE;
case WM_COMMAND:
- switch (LOWORD(wParam))
- {
+ switch (LOWORD(wParam)) {
case IDC_GETAUTH:
CallService(MS_UTILS_OPENURL, 0, (LPARAM)DROPBOX_WWW_URL DROPBOX_API_VER "/oauth2/authorize?response_type=code&client_id=" DROPBOX_API_KEY);
SetFocus(GetDlgItem(hwndDlg, IDC_REQUEST_CODE));
break;
case IDC_REQUEST_CODE:
- {
if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0;
char requestToken[128];
GetDlgItemTextA(hwndDlg, IDC_REQUEST_CODE, requestToken, SIZEOF(requestToken));
EnableWindow(GetDlgItem(hwndDlg, IDC_AUTHORIZE), strlen(requestToken) != 0);
- }
- break;
+ break;
case IDC_AUTHORIZE:
mir_forkthreadowner(CDropbox::RequestAcceessTokenAsync, instance, hwndDlg, 0);
@@ -68,8 +62,7 @@ INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam
break;
case WM_NOTIFY:
- if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY)
- {
+ if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY) {
db_set_b(NULL, MODULE, "UseSortLinks", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_USE_SHORT_LINKS));
db_set_b(NULL, MODULE, "UrlAutoSend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_URL_AUTOSEND));
db_set_b(NULL, MODULE, "UrlPasteToMessageInputArea", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_URL_COPYTOMIA));
@@ -78,4 +71,4 @@ INT_PTR CALLBACK CDropbox::MainOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam
break;
}
return FALSE;
-} \ No newline at end of file
+}