[DEV] add opening URL for Linux, IOs & MacOs

This commit is contained in:
Edouard DUPIN 2014-05-11 13:09:36 +02:00
parent cb5582c54a
commit 96719f3dcc
10 changed files with 46 additions and 6 deletions

2
external/agg vendored

@ -1 +1 @@
Subproject commit 8bf2d17b61989d8fbe01cbd1228147ab52e19d23
Subproject commit 31442b4615e43ebda829622b4da4961c32e01f26

2
external/airtaudio vendored

@ -1 +1 @@
Subproject commit bcf636ce0dd91091340b2cd81c8247e181867f22
Subproject commit 490e993c6fa05036f06abe1e39f9e04b5c5e03cb

2
external/enet vendored

@ -1 +1 @@
Subproject commit 77dd712c56d11f1a6e1b98180f2f717dec52ab96
Subproject commit 488658aecf730231e265d7d6b6887d00b74f9dec

2
external/esvg vendored

@ -1 +1 @@
Subproject commit 95215e438d27f4ee715a1bf33fa491d89cb98f15
Subproject commit 467a412ccdfeee3e64ec57c82ba36fda275483b9

View File

@ -273,7 +273,7 @@ namespace ewol {
* @brief Open an URL on an eternal brother.
* @param[in] _url URL to open.
*/
virtual void openURL(const std::string& _url) {};
virtual void openURL(const std::string& _url) { };
/**
* @brief force the screen orientation (availlable on portable elements ...
* @param[in] _orientation Selected orientation.

View File

@ -122,6 +122,9 @@ public:
bool _isDown) {
OS_SetKeyboardMove(_special, _move, _isDown);
}
void openURL(const std::string& _url) {
mm_openURL(_url.c_str());
}
};

View File

@ -15,6 +15,7 @@ extern "C" {
int mm_main(int argc, const char *argv[]);
void mm_exit(void);
void mm_openURL(const char *_url);
#ifdef __cplusplus
}

View File

@ -23,3 +23,7 @@ void mm_exit(void) {
[[NSThread mainThread] cancel];
}
void mm_openURL(const char *_url) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:_url]];
}

View File

@ -107,11 +107,15 @@ class MacOSInterface : public ewol::Context {
OS_SetKeyboard(_keyboardMode, _unichar, !_isDown, _isAReapeateKey);
}
}
void MAC_SetKeyboardMove(ewol::key::Special& _special,
void MAC_SetKeyboardMove(ewol::key::Special& _special,
enum ewol::key::keyboard _move,
bool _isDown) {
OS_SetKeyboardMove(_special, _move, _isDown);
}
void openURL(const std::string& _url) {
std::string req = "open " + _url;
system(req.c_str());
}
};

View File

@ -1246,6 +1246,34 @@ class X11Interface : public ewol::Context {
XSetWMIconName(m_display, m_WindowHandle, &tp);
X11_INFO("X11: set Title (END)");
}
void openURL(const std::string& _url) {
// TODO : call user to select his browser
// TODO : try to find the prefered browser ...
std::vector<std::string> listBrowser;
listBrowser.push_back("chrome");
listBrowser.push_back("chromium-browser");
listBrowser.push_back("firefox");
listBrowser.push_back("opera");
listBrowser.push_back("konqueror");
listBrowser.push_back("epiphany");
for (auto browser : listBrowser) {
// heck if the browser is installed
std::string req = "which ";
req += browser;
if (system(req.c_str()) != 0) {
continue;
}
// call it to open the page ...
req = browser;
req += " ";
req += _url;
req += " &"; // disociate from this process ...
system(req.c_str());
return;
}
}
/****************************************************************************************/
void clipBoardGet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
switch (_clipboardID) {