diff options
author | Thierry Crozat | 2016-09-09 23:51:40 +0100 |
---|---|---|
committer | Thierry Crozat | 2016-09-10 01:12:42 +0100 |
commit | 1f2a50bcd354e3aae80ce4f99e50f618a7b83e3c (patch) | |
tree | 872c1e77f3264360936c029e20a9ebc6bea6d1da /backends/networking | |
parent | dff88b105885e0ed3766f5e86c0d7f606348634a (diff) | |
download | scummvm-rg350-1f2a50bcd354e3aae80ce4f99e50f618a7b83e3c.tar.gz scummvm-rg350-1f2a50bcd354e3aae80ce4f99e50f618a7b83e3c.tar.bz2 scummvm-rg350-1f2a50bcd354e3aae80ce4f99e50f618a7b83e3c.zip |
CLOUD: Move openUrl to OSystem
Diffstat (limited to 'backends/networking')
-rw-r--r-- | backends/networking/browser/openurl-android.cpp | 35 | ||||
-rw-r--r-- | backends/networking/browser/openurl-default.cpp | 36 | ||||
-rw-r--r-- | backends/networking/browser/openurl-osx.cpp | 49 | ||||
-rw-r--r-- | backends/networking/browser/openurl-posix.cpp | 77 | ||||
-rw-r--r-- | backends/networking/browser/openurl-windows.cpp | 42 | ||||
-rw-r--r-- | backends/networking/browser/openurl.h | 41 |
6 files changed, 0 insertions, 280 deletions
diff --git a/backends/networking/browser/openurl-android.cpp b/backends/networking/browser/openurl-android.cpp deleted file mode 100644 index 64e683238b..0000000000 --- a/backends/networking/browser/openurl-android.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "backends/networking/browser/openurl.h" -#include "backends/platform/android/jni.h" - -namespace Networking { -namespace Browser { - -bool openUrl(const Common::String &url) { - return JNI::openUrl(url.c_str()); -} - -} // End of namespace Browser -} // End of namespace Networking - diff --git a/backends/networking/browser/openurl-default.cpp b/backends/networking/browser/openurl-default.cpp deleted file mode 100644 index c430953196..0000000000 --- a/backends/networking/browser/openurl-default.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "backends/networking/browser/openurl.h" -#include "common/textconsole.h" - -namespace Networking { -namespace Browser { - -bool openUrl(const Common::String &url) { - warning("Networking::Browser::openUrl(): not implemented"); - return false; -} - -} // End of namespace Browser -} // End of namespace Networking - diff --git a/backends/networking/browser/openurl-osx.cpp b/backends/networking/browser/openurl-osx.cpp deleted file mode 100644 index 8d786d7fd2..0000000000 --- a/backends/networking/browser/openurl-osx.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#define FORBIDDEN_SYMBOL_ALLOW_ALL - -#include "backends/networking/browser/openurl.h" -#include <CoreFoundation/CFBundle.h> -#include <ApplicationServices/ApplicationServices.h> - -namespace Networking { -namespace Browser { - -using namespace std; - -bool openUrl(const Common::String &url) { - CFURLRef urlRef = CFURLCreateWithBytes ( - NULL, - (UInt8*)url.c_str(), - url.size(), - kCFStringEncodingASCII, - NULL - ); - int result = LSOpenCFURLRef(urlRef, 0); - CFRelease(urlRef); - return result == 0; -} - -} // End of namespace Browser -} // End of namespace Networking - diff --git a/backends/networking/browser/openurl-posix.cpp b/backends/networking/browser/openurl-posix.cpp deleted file mode 100644 index 429a379fcf..0000000000 --- a/backends/networking/browser/openurl-posix.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#define FORBIDDEN_SYMBOL_ALLOW_ALL - -#include "backends/networking/browser/openurl.h" -#include "common/textconsole.h" -#include <stdlib.h> - -namespace Networking { -namespace Browser { - -namespace { -bool launch(const Common::String client, const Common::String &url) { - // FIXME: system's input must be heavily escaped - // well, when url's specified by user - // it's OK now (urls are hardcoded somewhere in GUI) - Common::String cmd = client + " " + url; - return (system(cmd.c_str()) != -1); -} -} - -bool openUrl(const Common::String &url) { - // inspired by Qt's "qdesktopservices_x11.cpp" - - // try "standards" - if (launch("xdg-open", url)) - return true; - if (launch(getenv("DEFAULT_BROWSER"), url)) - return true; - if (launch(getenv("BROWSER"), url)) - return true; - - // try desktop environment specific tools - if (launch("gnome-open", url)) // gnome - return true; - if (launch("kfmclient openURL", url)) // kde - return true; - if (launch("exo-open", url)) // xfce - return true; - - // try browser names - if (launch("firefox", url)) - return true; - if (launch("mozilla", url)) - return true; - if (launch("netscape", url)) - return true; - if (launch("opera", url)) - return true; - - warning("Networking::Browser::openUrl() (POSIX) failed to open URL"); - return false; -} - -} // End of namespace Browser -} // End of namespace Networking - diff --git a/backends/networking/browser/openurl-windows.cpp b/backends/networking/browser/openurl-windows.cpp deleted file mode 100644 index b78c9fa7ed..0000000000 --- a/backends/networking/browser/openurl-windows.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "backends/networking/browser/openurl.h" -#include "common/textconsole.h" -#include <windows.h> -#include <shellapi.h> - -namespace Networking { -namespace Browser { - -bool openUrl(const Common::String &url) { - const uint64 result = (uint64)ShellExecute(0, 0, /*(wchar_t*)nativeFilePath.utf16()*/url.c_str(), 0, 0, SW_SHOWNORMAL); - // ShellExecute returns a value greater than 32 if successful - if (result <= 32) { - warning("ShellExecute failed: error = %u", result); - return false; - } - return true; -} - -} // End of namespace Browser -} // End of namespace Networking diff --git a/backends/networking/browser/openurl.h b/backends/networking/browser/openurl.h deleted file mode 100644 index 15b4bf385b..0000000000 --- a/backends/networking/browser/openurl.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef NETWORKING_BROWSER_OPENURL_H -#define NETWORKING_BROWSER_OPENURL_H - -#include "common/str.h" - -namespace Networking { -namespace Browser { - -/** - * Opens URL in default browser (if available on the target system). - * - * Returns true on success. - */ -bool openUrl(const Common::String &url); - -} // End of namespace Browser -} // End of namespace Networking - -#endif /*NETWORKING_BROWSER_OPENURL_H*/ |