mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 09:35:23 -04:00
Symbian: Implement Process_StartOpen
This commit is contained in:
parent
0624680953
commit
4739372547
@ -71,6 +71,22 @@ class CWindow;
|
||||
|
||||
CWindow* window;
|
||||
|
||||
static bool ConvertToUnicode(const char* str, size_t length, TDes& destBuf) {
|
||||
if (str) {
|
||||
wchar_t* dest = reinterpret_cast <wchar_t*> (const_cast <TUint16*> (destBuf.Ptr()));
|
||||
TInt len = mbstowcs(dest, str, length);
|
||||
if (len > 0) {
|
||||
destBuf.SetLength(len);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool ConvertToUnicode(const cc_string* str, TDes& destBuf) {
|
||||
return ConvertToUnicode(str->buffer, (size_t)str->length, destBuf);
|
||||
}
|
||||
|
||||
class CWindow : public CBase
|
||||
{
|
||||
public:
|
||||
@ -82,7 +98,7 @@ public:
|
||||
void ProcessEvents(float delta);
|
||||
void RequestClose();
|
||||
void InitEvents();
|
||||
cc_result OpenBrowser(const cc_string* url);
|
||||
cc_result OpenBrowserL(const cc_string* url);
|
||||
~CWindow();
|
||||
|
||||
TWsEvent iWsEvent;
|
||||
@ -464,6 +480,7 @@ void CWindow::HandleWsEvent(const TWsEvent& aWsEvent) {
|
||||
}
|
||||
// shutdown request from task manager
|
||||
case KAknShutOrHideApp: {
|
||||
WindowInfo.Exists = false;
|
||||
RequestClose();
|
||||
break;
|
||||
}
|
||||
@ -471,6 +488,7 @@ void CWindow::HandleWsEvent(const TWsEvent& aWsEvent) {
|
||||
case EEventUser: {
|
||||
TApaSystemEvent apaSystemEvent = *(TApaSystemEvent*) aWsEvent.EventData();
|
||||
if (apaSystemEvent == EApaSystemEventShutdown) {
|
||||
WindowInfo.Exists = false;
|
||||
RequestClose();
|
||||
}
|
||||
break;
|
||||
@ -590,28 +608,31 @@ void CWindow::InitEvents() {
|
||||
iWsSession.EventReady(&iWsEventStatus);
|
||||
}
|
||||
|
||||
cc_result CWindow::OpenBrowser(const cc_string* url) {
|
||||
#if 0
|
||||
TUid browserUid = {0x1020724d};
|
||||
cc_result CWindow::OpenBrowserL(const cc_string* url) {
|
||||
#if defined CC_BUILD_SYMBIAN_3 || defined CC_BUILD_SYMBIAN_S60V5
|
||||
TUid browserUid = {0x10008D39};
|
||||
#else
|
||||
TUid browserUid = {0x1020724D};
|
||||
#endif
|
||||
TApaTaskList tasklist(window->iWsSession);
|
||||
TApaTask task = tasklist.FindApp(browserUid);
|
||||
TPtrC des;
|
||||
// TODO convert url to utf16
|
||||
|
||||
if (task.Exists()) {
|
||||
task.BringToForeground();
|
||||
|
||||
|
||||
task.SendMessage(TUid::Uid(0), TPtrC8((TUint8 *)url->buffer, (TInt)url->length));
|
||||
} else {
|
||||
RApaLsSession ls;
|
||||
if (!ls.Connect()) {
|
||||
TThreadId tid;
|
||||
ls.StartDocument(des, browserUid, tid);
|
||||
ls.Close();
|
||||
if (!ls.Handle()) {
|
||||
User::LeaveIfError(ls.Connect());
|
||||
}
|
||||
|
||||
TThreadId tid;
|
||||
TBuf<FILENAME_SIZE> buf;
|
||||
ConvertToUnicode(url, buf);
|
||||
ls.StartDocument(buf, browserUid, tid);
|
||||
ls.Close();
|
||||
}
|
||||
#endif
|
||||
return ERR_NOT_SUPPORTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Window_PreInit(void) {
|
||||
@ -779,7 +800,7 @@ void GLContext_Create(void) {
|
||||
|
||||
cc_result Process_StartOpen(const cc_string* args) {
|
||||
TInt err = 0;
|
||||
TRAP(err, err = window->OpenBrowser(args));
|
||||
TRAP(err, err = window->OpenBrowserL(args));
|
||||
return (cc_result) err;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user