diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-21 19:09:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-21 19:09:56 +0000 |
commit | ba456be50d3b780e4accf075ba78d5badf282b05 (patch) | |
tree | a1e4a2df606b21f814306f7c0bfdef15d6de419b /src | |
parent | a08db3aa08808c6adec9891d429f262126faca80 (diff) |
MS_UTIL_OPENURL -> mir_core::Utils_OpenUrl
git-svn-id: http://svn.miranda-ng.org/main/trunk@14306 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdchat/src/window.cpp | 17 | ||||
-rw-r--r-- | src/core/stdhelp/src/help.cpp | 6 | ||||
-rw-r--r-- | src/core/stdurl/urldialogs.cpp | 4 | ||||
-rw-r--r-- | src/core/stduserinfo/src/stdinfo.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/enterstring.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/lpopts.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/pluginopts.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/proto_opts.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/skin2opts.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/sounds.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/utils.cpp | 3 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 2 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 2 | ||||
-rw-r--r-- | src/mir_core/src/openurl.cpp (renamed from src/mir_app/src/openurl.cpp) | 16 |
14 files changed, 33 insertions, 41 deletions
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 13dc4c0497..511c18c65b 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -2215,18 +2215,15 @@ LABEL_SHOWWINDOW: case ID_SEARCH_GOOGLE:
if (pszWord[0])
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR,
- (LPARAM)CMString(FORMAT, _T("http://www.google.com/search?q=%s"), pszWord).GetString());
+ Utils_OpenUrlT(CMString(FORMAT, _T("http://www.google.com/search?q=%s"), pszWord));
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
break;
case ID_SEARCH_WIKIPEDIA:
- if (pszWord[0]) {
- TCHAR szURL[1024];
- mir_sntprintf(szURL, _countof(szURL), _T("http://en.wikipedia.org/wiki/%s"), pszWord);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)szURL);
- }
+ if (pszWord[0])
+ Utils_OpenUrlT(CMString(FORMAT, _T("http://en.wikipedia.org/wiki/%s"), pszWord));
+
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
break;
@@ -2267,11 +2264,11 @@ LABEL_SHOWWINDOW: ClientToScreen(((NMHDR *) lParam)->hwndFrom, &pt);
switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) {
case ID_NEW:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW|OUF_TCHAR, (LPARAM) tr.lpstrText);
+ Utils_OpenUrlT(tr.lpstrText);
break;
case ID_CURR:
- CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM) tr.lpstrText);
+ Utils_OpenUrlT(tr.lpstrText);
break;
case ID_COPY:
@@ -2292,7 +2289,7 @@ LABEL_SHOWWINDOW: return TRUE;
}
- CallService(MS_UTILS_OPENURL, OUF_TCHAR|OUF_NEWWINDOW, (LPARAM) tr.lpstrText);
+ Utils_OpenUrlT(tr.lpstrText);
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
mir_free(tr.lpstrText);
break;
diff --git a/src/core/stdhelp/src/help.cpp b/src/core/stdhelp/src/help.cpp index af276a413d..a6a09e1220 100644 --- a/src/core/stdhelp/src/help.cpp +++ b/src/core/stdhelp/src/help.cpp @@ -41,19 +41,19 @@ static INT_PTR AboutCommand(WPARAM wParam, LPARAM) static INT_PTR IndexCommand(WPARAM, LPARAM)
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://wiki.miranda-ng.org"));
+ Utils_OpenUrl("http://wiki.miranda-ng.org");
return 0;
}
static INT_PTR WebsiteCommand(WPARAM, LPARAM)
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://miranda-ng.org"));
+ Utils_OpenUrl("http://miranda-ng.org");
return 0;
}
static INT_PTR BugCommand(WPARAM, LPARAM)
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW | OUF_TCHAR, (LPARAM)_T("http://trac.miranda-ng.org/newticket"));
+ Utils_OpenUrl("http://trac.miranda-ng.org/newticket");
return 0;
}
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index f654cae874..3fb66a7e25 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -168,10 +168,10 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemTextA(hwndDlg, IDC_URL, url, _countof(url));
switch(TrackPopupMenu(hSubMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL)) {
case IDM_OPENNEW:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url);
+ Utils_OpenUrl(url);
break;
case IDM_OPENEXISTING:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)url);
+ Utils_OpenUrl(url);
break;
case IDM_COPYLINK:
{
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp index 0ac9910f84..d51607ad5c 100644 --- a/src/core/stduserinfo/src/stdinfo.cpp +++ b/src/core/stduserinfo/src/stdinfo.cpp @@ -345,7 +345,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, _countof(szPage));
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szPage);
+ Utils_OpenUrl(szPage);
}
}
break;
@@ -483,7 +483,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_WEBPAGE))) {
char szPage[256];
GetDlgItemTextA(hwndDlg, IDC_WEBPAGE, szPage, _countof(szPage));
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szPage);
+ Utils_OpenUrl(szPage);
}
break;
}
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp index d1d42ab4cc..1019b695e3 100644 --- a/src/mir_app/src/enterstring.cpp +++ b/src/mir_app/src/enterstring.cpp @@ -198,11 +198,9 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa TEXTRANGE tr;
tr.chrg = param->chrg;
tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 2));
- SendMessage(param->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)& tr);
+ SendMessage(param->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
- char *tmp = mir_t2a(tr.lpstrText);
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)tmp);
- mir_free(tmp);
+ Utils_OpenUrlT(tr.lpstrText);
mir_free(tr.lpstrText);
}
return TRUE;
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index 735d4ab1bf..96f3f78553 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -126,12 +126,12 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char buf[512];
mir_strcpy(buf, "mailto:");
if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), &buf[7], _countof(buf) - 7))
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)buf);
+ Utils_OpenUrl(buf);
}
break;
case IDC_MORELANG:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://wiki.miranda-ng.org/index.php?title=Langpacks/en#Download");
+ Utils_OpenUrl("http://wiki.miranda-ng.org/index.php?title=Langpacks/en#Download");
break;
case IDC_LANGUAGES:
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 278050a96d..24ef35348b 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -522,7 +522,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (HIWORD(wParam) == STN_CLICKED) {
switch (LOWORD(wParam)) {
case IDC_GETMOREPLUGINS:
- CallService(MS_UTILS_OPENURL, 0, (LPARAM) "http://miranda-ng.org/downloads/");
+ Utils_OpenUrl("http://miranda-ng.org/downloads/");
break;
case IDC_PLUGINEMAIL:
@@ -531,7 +531,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar char *p = &buf[7];
mir_strcpy(buf, "mailto:");
if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), p, _countof(buf) - 7))
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)(LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p));
+ Utils_OpenUrl(LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p);
break;
}
}
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index ce4c986679..0c5ae404f3 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -913,7 +913,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM break;
case IDC_LNK_ADDONS:
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/");
+ Utils_OpenUrl("http://miranda-ng.org/");
break;
case IDOK:
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index 194a2a7696..882eade304 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -202,7 +202,7 @@ void UndoSubItemChanges(HWND htv, HTREEITEM hItem, int cmd) static void OpenIconsPage()
{
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/");
+ Utils_OpenUrl("http://miranda-ng.org/");
}
static int OpenPopupMenu(HWND hwndDlg)
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index 0fb366e812..6722e17c83 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -335,7 +335,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetDlgItemText(hwndDlg, IDC_LOCATION, strFull);
}
if (LOWORD(wParam) == IDC_GETMORE) {
- CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)"http://miranda-ng.org/addons/category/14");
+ Utils_OpenUrl("http://miranda-ng.org/addons/category/14");
break;
}
if (LOWORD(wParam) == IDC_LOCATION)
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp index 64b204da68..8efafe2673 100644 --- a/src/mir_app/src/utils.cpp +++ b/src/mir_app/src/utils.cpp @@ -28,9 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR ResizeDialog(WPARAM wParam, LPARAM lParam);
-int InitOpenUrl(void);
int InitPathUtils(void);
-void InitXmlApi(void);
int InitCrypt(void);
void UninitCrypt(void);
@@ -352,7 +350,6 @@ int LoadUtilsModule(void) CreateServiceFunction(MS_UTILS_ENTERSTRING, svcEnterString);
CreateServiceFunction(MS_SYSTEM_RESTART, RestartMiranda);
- InitOpenUrl();
InitPathUtils();
InitCrypt();
return 0;
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index d12bbf2897..fed657fd09 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -971,3 +971,5 @@ TimeZone_ToStringW @1128 TimeZone_UtcToLocal @1129
Utils_ResizeDialog @1130
Utils_GetRandom @1131
+Utils_OpenUrl @1132
+Utils_OpenUrlW @1133
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 3cd65aa139..af4a9a45d7 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -971,3 +971,5 @@ TimeZone_ToStringW @1128 TimeZone_UtcToLocal @1129
Utils_ResizeDialog @1130
Utils_GetRandom @1131
+Utils_OpenUrl @1132
+Utils_OpenUrlW @1133
diff --git a/src/mir_app/src/openurl.cpp b/src/mir_core/src/openurl.cpp index 1ad7b508ad..00b2813322 100644 --- a/src/mir_app/src/openurl.cpp +++ b/src/mir_core/src/openurl.cpp @@ -65,18 +65,14 @@ static void OpenURLThread(void *arg) delete hUrlInfo;
}
-static INT_PTR OpenURL(WPARAM wParam, LPARAM lParam)
+MIR_CORE_DLL(void) Utils_OpenUrl(const char *pszUrl, bool bOpenInNewWindow)
{
- if (lParam == 0)
- return 1;
-
- TOpenUrlInfo *hUrlInfo = new TOpenUrlInfo((wParam & OUF_UNICODE) ? mir_wstrdup((WCHAR*)lParam) : mir_a2t((char*)lParam), wParam & OUF_NEWWINDOW);
- forkthread(OpenURLThread, 0, hUrlInfo);
- return 0;
+ if (pszUrl)
+ forkthread(OpenURLThread, 0, new TOpenUrlInfo(mir_a2t(pszUrl), bOpenInNewWindow));
}
-int InitOpenUrl(void)
+MIR_CORE_DLL(void) Utils_OpenUrlW(const wchar_t *pszUrl, bool bOpenInNewWindow)
{
- CreateServiceFunction(MS_UTILS_OPENURL, OpenURL);
- return 0;
+ if (pszUrl)
+ forkthread(OpenURLThread, 0, new TOpenUrlInfo(mir_wstrdup(pszUrl), bOpenInNewWindow));
}
|