mirror of https://github.com/OpenVPN/openvpn-gui
URL profile import: allow specifying owner window of message box
This will be used later when parent window needs to be disabled when message box is displayed. Signed-off-by: Lev Stipakov <lev@openvpn.net>pull/446/head
parent
78ee9b981d
commit
d6a622a023
2
access.c
2
access.c
|
@ -260,7 +260,7 @@ AuthorizeConfig(const connection_t *c)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* semaphore locked -- relase before return */
|
/* semaphore locked -- relase before return */
|
||||||
res = ShowLocalizedMsgEx(MB_YESNO|MB_ICONWARNING, TEXT(PACKAGE_NAME),
|
res = ShowLocalizedMsgEx(MB_YESNO|MB_ICONWARNING, NULL, TEXT(PACKAGE_NAME),
|
||||||
IDS_ERR_CONFIG_TRY_AUTHORIZE, c->config_name,
|
IDS_ERR_CONFIG_TRY_AUTHORIZE, c->config_name,
|
||||||
o.ovpn_admin_group);
|
o.ovpn_admin_group);
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
|
|
|
@ -215,19 +215,19 @@ LoadLocalizedStringBuf(PTSTR buffer, int bufferSize, const UINT stringId, ...)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
__ShowLocalizedMsgEx(const UINT type, LPCTSTR caption, const UINT stringId, va_list args)
|
__ShowLocalizedMsgEx(const UINT type, HANDLE parent, LPCTSTR caption, const UINT stringId, va_list args)
|
||||||
{
|
{
|
||||||
return MessageBoxEx(NULL, __LoadLocalizedString(stringId, args), caption,
|
return MessageBoxEx(parent, __LoadLocalizedString(stringId, args), caption,
|
||||||
type | MB_SETFOREGROUND, GetGUILanguage());
|
type | MB_SETFOREGROUND, GetGUILanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ShowLocalizedMsgEx(const UINT type, LPCTSTR caption, const UINT stringId, ...)
|
ShowLocalizedMsgEx(const UINT type, HANDLE parent, LPCTSTR caption, const UINT stringId, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, stringId);
|
va_start(args, stringId);
|
||||||
int result = __ShowLocalizedMsgEx(type, caption, stringId, args);
|
int result = __ShowLocalizedMsgEx(type, parent, caption, stringId, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ ShowLocalizedMsg(const UINT stringId, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, stringId);
|
va_start(args, stringId);
|
||||||
__ShowLocalizedMsgEx(MB_OK, _T(PACKAGE_NAME), stringId, args);
|
__ShowLocalizedMsgEx(MB_OK, NULL, _T(PACKAGE_NAME), stringId, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ int LocalizedTime(const time_t, LPTSTR, size_t);
|
||||||
PTSTR LoadLocalizedString(const UINT, ...);
|
PTSTR LoadLocalizedString(const UINT, ...);
|
||||||
int LoadLocalizedStringBuf(PTSTR, const int, const UINT, ...);
|
int LoadLocalizedStringBuf(PTSTR, const int, const UINT, ...);
|
||||||
void ShowLocalizedMsg(const UINT, ...);
|
void ShowLocalizedMsg(const UINT, ...);
|
||||||
int ShowLocalizedMsgEx(const UINT, LPCTSTR, const UINT, ...);
|
int ShowLocalizedMsgEx(const UINT, HANDLE, LPCTSTR, const UINT, ...);
|
||||||
HICON LoadLocalizedIconEx(const UINT, int cx, int cy);
|
HICON LoadLocalizedIconEx(const UINT, int cx, int cy);
|
||||||
HICON LoadLocalizedIcon(const UINT);
|
HICON LoadLocalizedIcon(const UINT);
|
||||||
HICON LoadLocalizedSmallIcon(const UINT);
|
HICON LoadLocalizedSmallIcon(const UINT);
|
||||||
|
|
4
main.c
4
main.c
|
@ -739,7 +739,7 @@ CloseApplication(HWND hwnd)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (o.service_state == service_connected
|
if (o.service_state == service_connected
|
||||||
&& ShowLocalizedMsgEx(MB_YESNO, _T("Exit OpenVPN"), IDS_NFO_SERVICE_ACTIVE_EXIT) == IDNO)
|
&& ShowLocalizedMsgEx(MB_YESNO, NULL, _T("Exit OpenVPN"), IDS_NFO_SERVICE_ACTIVE_EXIT) == IDNO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < o.num_configs; i++)
|
for (i = 0; i < o.num_configs; i++)
|
||||||
|
@ -748,7 +748,7 @@ CloseApplication(HWND hwnd)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Ask for confirmation if still connected */
|
/* Ask for confirmation if still connected */
|
||||||
if (ShowLocalizedMsgEx(MB_YESNO, _T("Exit OpenVPN"), IDS_NFO_ACTIVE_CONN_EXIT) == IDNO)
|
if (ShowLocalizedMsgEx(MB_YESNO, NULL, _T("Exit OpenVPN"), IDS_NFO_ACTIVE_CONN_EXIT) == IDNO)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
misc.c
2
misc.c
|
@ -671,7 +671,7 @@ ImportConfigFile(const TCHAR* source)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A file with same name exists. Ask the user whether to replace or not. */
|
/* A file with same name exists. Ask the user whether to replace or not. */
|
||||||
if (ShowLocalizedMsgEx(MB_YESNO, _T(PACKAGE_NAME), IDS_NFO_IMPORT_OVERWRITE, fileName) == IDNO)
|
if (ShowLocalizedMsgEx(MB_YESNO, NULL, _T(PACKAGE_NAME), IDS_NFO_IMPORT_OVERWRITE, fileName) == IDNO)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* try again with overwrite allowed */
|
/* try again with overwrite allowed */
|
||||||
|
|
|
@ -2454,7 +2454,7 @@ out:
|
||||||
void
|
void
|
||||||
ResetSavePasswords(connection_t *c)
|
ResetSavePasswords(connection_t *c)
|
||||||
{
|
{
|
||||||
if (ShowLocalizedMsgEx(MB_OKCANCEL, TEXT(PACKAGE_NAME), IDS_NFO_DELETE_PASS, c->config_name) == IDCANCEL)
|
if (ShowLocalizedMsgEx(MB_OKCANCEL, NULL, TEXT(PACKAGE_NAME), IDS_NFO_DELETE_PASS, c->config_name) == IDCANCEL)
|
||||||
return;
|
return;
|
||||||
DeleteSavedPasswords(c->config_name);
|
DeleteSavedPasswords(c->config_name);
|
||||||
c->flags &= ~(FLAG_SAVE_KEY_PASS | FLAG_SAVE_AUTH_PASS);
|
c->flags &= ~(FLAG_SAVE_KEY_PASS | FLAG_SAVE_AUTH_PASS);
|
||||||
|
|
|
@ -374,7 +374,7 @@ ChangePassphraseDialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, UNUSED LPARAM
|
||||||
/* Confirm if the new password is empty. */
|
/* Confirm if the new password is empty. */
|
||||||
if (NewPasswordLengh(hwndDlg) == 0)
|
if (NewPasswordLengh(hwndDlg) == 0)
|
||||||
{
|
{
|
||||||
if (ShowLocalizedMsgEx(MB_YESNO, _T(PACKAGE_NAME), IDS_NFO_EMPTY_PWD) == IDNO)
|
if (ShowLocalizedMsgEx(MB_YESNO, NULL, _T(PACKAGE_NAME), IDS_NFO_EMPTY_PWD) == IDNO)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Else check minimum length of password */
|
/* Else check minimum length of password */
|
||||||
|
|
2
tray.c
2
tray.c
|
@ -363,7 +363,7 @@ OnNotifyTray(LPARAM lParam)
|
||||||
MyStartService();
|
MyStartService();
|
||||||
}
|
}
|
||||||
else if (o.service_state == service_connected
|
else if (o.service_state == service_connected
|
||||||
&& ShowLocalizedMsgEx(MB_YESNO, _T(PACKAGE_NAME), IDS_MENU_ASK_STOP_SERVICE) == IDYES) {
|
&& ShowLocalizedMsgEx(MB_YESNO, NULL, _T(PACKAGE_NAME), IDS_MENU_ASK_STOP_SERVICE) == IDYES) {
|
||||||
MyStopService();
|
MyStopService();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue