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