platform/shared/common/RhodesApp.cpp in rhodes-2.0.2 vs platform/shared/common/RhodesApp.cpp in rhodes-2.0.3
- old
+ new
@@ -463,13 +463,19 @@
}
void CRhodesApp::setAppBackUrl(const String& url)
{
if ( url.length() > 0 )
+ {
+ m_strAppBackUrlOrig = url;
m_strAppBackUrl = canonicalizeRhoUrl(url);
+ }
else
+ {
+ m_strAppBackUrlOrig = "";
m_strAppBackUrl = "";
+ }
}
String CRhodesApp::getAppTitle()
{
String strTitle = RHOCONF().getString("title_text");
@@ -500,11 +506,11 @@
{
m_strOptionsUrl = canonicalizeRhoUrl( RHOCONF().getString("options_path") );
return m_strOptionsUrl;
}
-const String& CRhodesApp::getCurrentUrl(int index)
+const String& CRhodesApp::getCurrentUrl(int /*index*/)
{
return m_currentUrls[m_currentTabIndex];
}
const String& CRhodesApp::getFirstStartUrl()
@@ -531,14 +537,14 @@
rho_webview_navigate(strUrl.c_str(), 0);
}
void CRhodesApp::navigateBack()
{
- rho::String strAppUrl = getAppBackUrl();
+ //rho::String strAppUrl = getAppBackUrl();
- if ( strAppUrl.length() > 0 )
- rho_webview_navigate(strAppUrl.c_str(), 0);
+ if ( m_strAppBackUrlOrig.length() > 0 )
+ loadUrl(m_strAppBackUrlOrig);
else if ( strcasecmp(getCurrentUrl().c_str(),getStartUrl().c_str()) != 0 )
rho_webview_navigate_back();
}
String CRhodesApp::canonicalizeRhoUrl(const String& strUrl)
@@ -698,21 +704,19 @@
}
void CRhodesApp::loadUrl(String url)
{
boolean callback = false;
- if (url.size() >= 9 && url.substr(0, 9) == "callback:")
+ if (String_startsWith(url, "callback:") )
{
callback = true;
url = url.substr(9);
}
- char *s = rho_http_normalizeurl(url.c_str());
- url = s;
- free(s);
+ url = canonicalizeRhoUrl(url);
if (callback)
{
common::CAutoPtr<net::INetRequest> pNetRequest = m_ptrFactory->createNetRequest();
- NetResponse(resp, pNetRequest->pullData( url, null ));
+ NetResponse(resp, pNetRequest->pushData( url, "rho_callback=1", null ));
(void)resp;
}
else
navigateToUrl(url);
}