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/mir_app | |
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/mir_app')
-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/openurl.cpp | 82 | ||||
-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 |
8 files changed, 9 insertions, 96 deletions
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/openurl.cpp b/src/mir_app/src/openurl.cpp deleted file mode 100644 index 1ad7b508ad..0000000000 --- a/src/mir_app/src/openurl.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (ñ) 2012-15 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-12 Miranda IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-#include <ctype.h>
-
-struct TOpenUrlInfo
-{
- TOpenUrlInfo(TCHAR *_url, int _bNew) :
- szUrl(_url),
- newWindow(_bNew)
- {}
-
- ptrT szUrl;
- int newWindow;
-};
-
-static void OpenURLThread(void *arg)
-{
- TOpenUrlInfo *hUrlInfo = (TOpenUrlInfo*)arg;
-
- // wack a protocol on it
- CMString tszUrl;
- if ((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1] == ':') || hUrlInfo->szUrl[0] == '\\')
- tszUrl.Format(_T("file:///%s"), hUrlInfo->szUrl);
- else {
- int i;
- for (i = 0; _istalpha(hUrlInfo->szUrl[i]); i++);
- if (hUrlInfo->szUrl[i] == ':')
- tszUrl = hUrlInfo->szUrl;
- else if (!_tcsnicmp(hUrlInfo->szUrl, _T("ftp."), 4))
- tszUrl.Format(_T("ftp://%s"), hUrlInfo->szUrl);
- else
- tszUrl.Format(_T("http://%s"), hUrlInfo->szUrl);
- }
-
- // check user defined browser for opening urls
- ptrT tszBrowser(db_get_tsa(NULL, "Miranda", "OpenUrlBrowser"));
- if (tszBrowser)
- ShellExecute(NULL, _T("open"), tszBrowser, tszUrl, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
- else
- ShellExecute(NULL, _T("open"), tszUrl, NULL, NULL, (hUrlInfo->newWindow) ? SW_NORMAL : SW_SHOWDEFAULT);
-
- delete hUrlInfo;
-}
-
-static INT_PTR OpenURL(WPARAM wParam, LPARAM lParam)
-{
- 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;
-}
-
-int InitOpenUrl(void)
-{
- CreateServiceFunction(MS_UTILS_OPENURL, OpenURL);
- return 0;
-}
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;
|