From: Vinay Sachdeva Date: Wed, 12 Jun 2013 23:27:26 +0000 (+0530) Subject: Fixed Nabi Issues and Hardware Key Implementation X-Git-Tag: submit/tizen_2.2/20130714.134441~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e9c61ca3c685e50f4876314607bcd6945795e65;p=apps%2Fosp%2FInternet.git Fixed Nabi Issues and Hardware Key Implementation Change-Id: I6cb21f706d51bce61052de398d79d3c8ef91eac1 Signed-off-by: Vinay Sachdeva --- diff --git a/inc/IntAddBookmarkForm.h b/inc/IntAddBookmarkForm.h index a7d7bfc..2d7b627 100644 --- a/inc/IntAddBookmarkForm.h +++ b/inc/IntAddBookmarkForm.h @@ -32,6 +32,7 @@ class AddBookmarkForm : public Tizen::Ui::Controls::Form , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFormBackEventListener , public Tizen::Ui::IKeypadEventListener , public Tizen::Ui::Controls::IListViewItemEventListener , public Tizen::Ui::Controls::IListViewItemProvider @@ -85,6 +86,9 @@ class AddBookmarkForm //IActionEventListener virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + //IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + //IKeypadEventListener virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction); virtual void OnKeypadClosed(Tizen::Ui::Control& source); diff --git a/inc/IntCreateBookmarkFolderForm.h b/inc/IntCreateBookmarkFolderForm.h index d8b19cd..9f15aab 100644 --- a/inc/IntCreateBookmarkFolderForm.h +++ b/inc/IntCreateBookmarkFolderForm.h @@ -32,6 +32,7 @@ class CreateBookmarkFolderForm : public Tizen::Ui::Controls::Form , public Tizen::Ui::IActionEventListener + , public Tizen::Ui::Controls::IFormBackEventListener , public Tizen::Ui::IKeypadEventListener , public Tizen::Ui::Scenes::ISceneEventListener , public Tizen::Ui::ITextEventListener @@ -68,6 +69,9 @@ public: // IActionEventListener virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + //IFormBackEventListener + virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + //IKeypadListener virtual void OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction); virtual void OnKeypadClosed(Tizen::Ui::Control& source); diff --git a/inc/IntInternetApp.h b/inc/IntInternetApp.h index bf2cb14..b52c35c 100644 --- a/inc/IntInternetApp.h +++ b/inc/IntInternetApp.h @@ -54,6 +54,7 @@ public: virtual ~InternetApp(void); public: + bool IsHwBackKeyExists(void); bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry); @@ -83,6 +84,7 @@ public: private: MultipleWindowPresentationModel* __pMultiWindowManager; WindowInfo* __pNewWindowInfo;//the new window object to be created either by the normal launch of application or as an appcontrol launch + bool __isHwBackButtonExists; }; #endif // _INT_INTERNET_APP_H_ diff --git a/inc/IntMainForm.h b/inc/IntMainForm.h index 10b9711..626d2ec 100644 --- a/inc/IntMainForm.h +++ b/inc/IntMainForm.h @@ -48,6 +48,7 @@ enum AddressBarMode class MainForm : public Tizen::Ui::Controls::Form + , public Tizen::Ui::Controls::IFormMenuEventListener , public Tizen::Ui::Controls::IListViewItemEventListener , public Tizen::Ui::Controls::IListViewItemProvider , public Tizen::Ui::IActionEventListener @@ -98,6 +99,9 @@ public: void LoadUrl(Tizen::Base::String& url); + //IFormMenuEventListener + virtual void OnFormMenuRequested (Tizen::Ui::Controls::Form &source); + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); @@ -284,6 +288,7 @@ private: result InitAddressbar(void); result InitFooter(void); result InitContextMenu(Tizen::Graphics::Point& p); + result InitOptionMenu(void); result InitFindWordPanel(void); result InitImageContextMenu(Tizen::Graphics::Point p); result InitImageLinkContextMenu(Tizen::Graphics::Point p); @@ -355,6 +360,8 @@ private: Tizen::Web::Controls::HitElementResult* __pHitElementResult; Tizen::Ui::Controls::ContextMenu* __pImageMenu; Tizen::Ui::Controls::ContextMenu* __pMenu; + + Tizen::Ui::Controls::OptionMenu* __pOptionMenu; Tizen::Ui::Controls::Button* __pMoreButton; Tizen::Ui::Controls::Button* __pMultiWindowButton; // Tizen::Ui::Controls::Button* __pNewWindowButton; @@ -387,6 +394,7 @@ private: Tizen::Ui::Controls::Button* __pReaderBtn; Tizen::Graphics::Point __longPressPoint; int __fontSize; + bool __isHwKeySupported; }; #endif //_INT_MAIN_FORM_H_ diff --git a/res/screen-size-normal/IDL_FORM_HW_KEY.xml b/res/screen-size-normal/IDL_FORM_HW_KEY.xml new file mode 100644 index 0000000..9c23632 --- /dev/null +++ b/res/screen-size-normal/IDL_FORM_HW_KEY.xml @@ -0,0 +1,84 @@ + + + + + + 720 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/IntAddBookmarkForm.cpp b/src/IntAddBookmarkForm.cpp index 5998543..f341684 100644 --- a/src/IntAddBookmarkForm.cpp +++ b/src/IntAddBookmarkForm.cpp @@ -105,6 +105,7 @@ AddBookmarkForm::OnInitializing(void) pHeader = GetHeader(); + SetFormBackEventListener(this); if (pHeader != null) { pHeader->AddActionEventListener(*this); @@ -434,6 +435,30 @@ AddBookmarkForm::OnActionPerformed(const Control& source, int actionId) } void +AddBookmarkForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + + if (pSceneManager == null) + { + return ; + } + + if (__pEditFieldTitle != NULL) + { + __pEditFieldTitle->Clear(); + } + + if (__pEditFieldUrl != NULL) + { + __pEditFieldUrl->Clear(); + } + + pSceneManager->GoBackward(BackwardSceneTransition()); + + +} +void AddBookmarkForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) { return; diff --git a/src/IntBookmarkListForm.cpp b/src/IntBookmarkListForm.cpp index 704a632..741aa3e 100644 --- a/src/IntBookmarkListForm.cpp +++ b/src/IntBookmarkListForm.cpp @@ -1033,10 +1033,10 @@ BookmarkListForm::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, if(__pSearchBar) { - __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight())); + r = __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight())); __pSearchBar->SetText(L""); } - AppLog("OnSearchBarModeChanged SetContentAreaSize heihgt %d",__pSearchListView->GetHeight()); + AppLog("OnSearchBarModeChanged SetContentAreaSize heihgt %d, %d",__pSearchListView->GetHeight() , GetClientAreaBounds().height - __pSearchBar->GetHeight()); __pListview->UpdateList(); __pSearchListView->UpdateList(); } diff --git a/src/IntCreateBookmarkFolderForm.cpp b/src/IntCreateBookmarkFolderForm.cpp index bd5dc10..1a1e9d8 100644 --- a/src/IntCreateBookmarkFolderForm.cpp +++ b/src/IntCreateBookmarkFolderForm.cpp @@ -74,6 +74,7 @@ CreateBookmarkFolderForm::OnInitializing(void) SceneManager* pSceneManager = SceneManager::GetInstance(); AppAssert(pSceneManager); pSceneManager->AddSceneEventListener(IDSCN_CREATE_BOOKMARK_FOLDER, *this); + SetFormBackEventListener(this); __pFolderTitle = static_cast< EditField* >(GetControl(L"IDC_EDITFIELD_FOLDER_TITLE")); @@ -377,6 +378,27 @@ CreateBookmarkFolderForm::OnActionPerformed(const Control& source, int actionId) } void +CreateBookmarkFolderForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source) +{ + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return; + } + result r; + if (__pFolderTitle != NULL) + { + __pFolderTitle->Clear(); + __pFolderTitle->HideKeypad(); + } + + r = pSceneManager->GoBackward(BackwardSceneTransition()); + AppLogDebug("SCENE_ADD_BOOKMARK error = %s",GetErrorMessage(r)); + + +} + +void CreateBookmarkFolderForm::OnKeypadActionPerformed(Control& source, KeypadAction keypadAction) { diff --git a/src/IntEditHistoryListForm.cpp b/src/IntEditHistoryListForm.cpp index 095da6c..514eb6a 100644 --- a/src/IntEditHistoryListForm.cpp +++ b/src/IntEditHistoryListForm.cpp @@ -740,7 +740,7 @@ EditHistoryListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previou __pListView->UpdateList(); } __pSelectAllCheck->SetSelected(false); - + __selectedCount = 0; GetFooter()->SetItemEnabled(0, false); Invalidate(true); } diff --git a/src/IntHistoryListForm.cpp b/src/IntHistoryListForm.cpp index 578126a..5fe41f4 100644 --- a/src/IntHistoryListForm.cpp +++ b/src/IntHistoryListForm.cpp @@ -112,13 +112,20 @@ HistoryListForm::OnInitializing(void) Bitmap *pIconBitmap = null; AppResource* pAppResource = UiApp::GetInstance()->GetAppResource(); const Color brown = Color(32, 32, 32, 0xFF); - +// bool isHwBackButtonExist = false; +// Tizen::System::SystemInfo::GetValue(L"http:://tizen.org/feature/input.back.key",isHwBackButtonExist); +// +// SetFormStyle(FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER); // Setup back event listener SetFormBackEventListener(this); GetHeader()->AddActionEventListener(*this); GetFooter()->AddActionEventListener(*this); +// if(isHwBackButtonExist) +// { +// GetFooter()->SetBackButtonEnabled(false); +// } AddOrientationEventListener(*this); SettingInfo::AddSettingEventListener(*this); diff --git a/src/IntHistoryPresentationModel.cpp b/src/IntHistoryPresentationModel.cpp index 893f9ba..6c592c6 100644 --- a/src/IntHistoryPresentationModel.cpp +++ b/src/IntHistoryPresentationModel.cpp @@ -743,6 +743,7 @@ HistoryPresentationModel::GetHistoryCountWithTimeRange(Tizen::Base::DateTime& st for (int counter = 0 ; counter < count; counter++) { History *pHistory = dynamic_cast(__pDataList->GetAt(counter)); + AppLog("vinayhistorytimecomparison %d, %d",pHistory->GetVisitedTime().CompareTo(startTime),pHistory->GetVisitedTime().CompareTo(endTime)); if(pHistory != null && pHistory->GetVisitedTime().CompareTo(startTime) > 0 && pHistory->GetVisitedTime().CompareTo(endTime) < 0) { historyCount++; diff --git a/src/IntInternetApp.cpp b/src/IntInternetApp.cpp index 2ba1b68..72f8294 100644 --- a/src/IntInternetApp.cpp +++ b/src/IntInternetApp.cpp @@ -43,7 +43,7 @@ using namespace Tizen::Ui::Scenes; InternetApp::InternetApp(void) : __pMultiWindowManager(NULL),__pNewWindowInfo(null) { - + __isHwBackButtonExists = false; } InternetApp::~InternetApp(void) @@ -55,6 +55,12 @@ InternetApp::~InternetApp(void) } } +bool +InternetApp::IsHwBackKeyExists(void) +{ + return __isHwBackButtonExists; +} + UiApp* InternetApp::CreateInstance(void) { @@ -92,6 +98,7 @@ InternetApp::OnAppInitializing(AppRegistry& appRegistry) result r = pAppMgr->SetAppControlProviderEventListener(this); AppLogDebug("SetAppControlProviderEventListener result %s",GetErrorMessage(r)); } + Tizen::System::SystemInfo::GetValue(L"http://tizen.org/feature/input.keys.back",__isHwBackButtonExists); return true; } diff --git a/src/IntMainForm.cpp b/src/IntMainForm.cpp index deb1d46..7187e92 100644 --- a/src/IntMainForm.cpp +++ b/src/IntMainForm.cpp @@ -30,6 +30,7 @@ #include "IntBookmarkPresentationModel.h" #include "IntCommonLib.h" #include "IntFaviconManager.h" +#include "IntInternetApp.h" #include "IntMainForm.h" #include "IntNotificationPanel.h" #include "IntSceneRegister.h" @@ -154,6 +155,7 @@ MainForm::MainForm(void) __pWebViewer = null; __pImageMenu = null; __pMenu = null; + __pOptionMenu = null; __pFindWordControl = null; __pFindWordPanelLeftToRight = null; __pFindWordPanelRightToLeft = null; @@ -211,6 +213,7 @@ MainForm::MainForm(void) __pReaderBtn = null; __isWebKeypadOpened = false; __fontSize = 44; + __isHwKeySupported = false; } MainForm::~MainForm(void) @@ -261,7 +264,22 @@ MainForm::~MainForm(void) bool MainForm::Initialize(void) { - Construct(L"IDL_FORM"); + InternetApp* pInternet = static_cast (Application::GetInstance()); + + + if(pInternet) + { + __isHwKeySupported = pInternet->IsHwBackKeyExists(); + } + if(__isHwKeySupported) + { + Construct(L"IDL_FORM_HW_KEY"); + } + else + { + Construct(L"IDL_FORM"); + } +// SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER); return true; } @@ -283,6 +301,7 @@ MainForm::OnInitializing(void) SettingPresentationModel::GetInstance()->AddSettingsEventListener(*this); SceneManager::GetInstance()->AddSceneEventListener(IDSCN_MAIN_VIEW, *this); AddOrientationEventListener(*this); + AppLogDebug(" MainForm::OnInitializing ended"); if (__pMostVisitedSites == null) { @@ -330,7 +349,7 @@ MainForm::OnInitializing(void) { delete pBitmapPressed; } - + SetFormMenuEventListener(this); return E_SUCCESS; } @@ -596,11 +615,18 @@ MainForm::InitFooter(void) return E_FAILURE; } - __pMoreButton = static_cast(GetControl(L"IDC_MORE_BUTTON",true)); + if(__isHwKeySupported == false) + { + __pMoreButton = static_cast(GetControl(L"IDC_MORE_BUTTON",true)); - if ( __pMoreButton == NULL ) + if ( __pMoreButton == NULL ) + { + return E_FAILURE; + } + } + else { - return E_FAILURE; + SetFormBackEventListener(this); } if (__pMultiWindowButton != null) @@ -762,7 +788,6 @@ MainForm::InitFooter(void) return E_SUCCESS; } - result MainForm::InitContextMenu(Point& p) { @@ -814,6 +839,56 @@ MainForm::InitContextMenu(Point& p) return r; } +result +MainForm::InitOptionMenu() +{ + result r = E_SUCCESS; + bool isPrivateBrowsing = false; + Bitmap* pBitmap = null; + + if (__pOptionMenu != null) + { + __pOptionMenu->Invalidate(true); + return r; + } + + __pOptionMenu = new(std::nothrow) OptionMenu(); + r = __pOptionMenu->Construct(); + TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r)); + + isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn(); + + + if (isPrivateBrowsing == true) + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_ON); + } + else + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_BUTTON_OFF); + } + + r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_BOOKMARK"), IDA_BOOKMARKBTN_CLICKED); + + if ( pBitmap != NULL) + { + __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"), IDA_PRIVATEON_CLICKED,*pBitmap); + delete pBitmap; + } + r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_BR_TAB_HISTORY"), IDA_HISTORY_CLICKED); + r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_BRIGHTNESS"), IDA_BRIGHTNESS_BTN_CLICKED); + r = __pOptionMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_SETTINGS_CLICKED); + + + __pOptionMenu->SetMaxVisibleItemsCount(6); + __pOptionMenu->SetShowState(false); + __pOptionMenu->AddActionEventListener(*this); + SetControlAlwaysOnTop(*__pOptionMenu, true); + + CATCH: + return r; +} + result MainForm::InitImageContextMenu(Tizen::Graphics::Point p) { result r = E_SUCCESS; @@ -1438,8 +1513,16 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) { __pWebViewer->GoForward(); } - __pMenu->SetShowState(false); - __pMenu->Invalidate(false); + if(__isHwKeySupported == true) + { + __pOptionMenu->SetShowState(false); + __pOptionMenu->Invalidate(false); + } + else + { + __pMenu->SetShowState(false); + __pMenu->Invalidate(false); + } break; case IDA_FINDONPAGE_CLICKED: @@ -1448,8 +1531,16 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) __currentSearchStr.Clear(); InitFindWordPanel(); - __pMenu->SetShowState(false); - __pMenu->Invalidate(false); + if(__isHwKeySupported == true) + { + __pOptionMenu->SetShowState(false); + __pOptionMenu->Invalidate(false); + } + else + { + __pMenu->SetShowState(false); + __pMenu->Invalidate(false); + } ShowFindWordPanel(true); @@ -1514,13 +1605,20 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) __pAddressbar->UpdateFaviconBitmap(true); } } - - - itemIndex = __pMenu->GetItemIndexFromActionId(IDA_PRIVATEON_CLICKED); - r = __pMenu->SetItemAt(itemIndex,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); - AppLog("Result:: %s for index = %d", GetErrorMessage(r),itemIndex); - __pMenu->Invalidate(true); - + if(__isHwKeySupported == true) + { + itemIndex = __pOptionMenu->GetItemIndexFromActionId(IDA_PRIVATEON_CLICKED); + r = __pOptionMenu->SetItemAt(itemIndex,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); + AppLog("Result:: %s for index = %d", GetErrorMessage(r),itemIndex); + __pOptionMenu->Invalidate(true); + } + else + { + itemIndex = __pMenu->GetItemIndexFromActionId(IDA_PRIVATEON_CLICKED); + r = __pMenu->SetItemAt(itemIndex,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); + AppLog("Result:: %s for index = %d", GetErrorMessage(r),itemIndex); + __pMenu->Invalidate(true); + } if ( pBitmap != NULL ) { delete pBitmap; @@ -1538,8 +1636,16 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) pArgList->Add(*__pWindowInfo); SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SETTINGS), pArgList); } - __pMenu->SetShowState(false); - __pMenu->Invalidate(false); + if(__isHwKeySupported) + { + __pOptionMenu->SetShowState(false); + __pOptionMenu->Invalidate(false); + } + else + { + __pMenu->SetShowState(false); + __pMenu->Invalidate(false); + } if (pArgList != null) { delete pArgList; @@ -1607,13 +1713,31 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP); } } - if (pBitmap != null) + if(__isHwKeySupported == true) { - r = __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap); - delete pBitmap; + if (pBitmap != null) + { + r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap); + delete pBitmap; + } + } + else + { + if (pBitmap != null) + { + r = __pMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap); + delete pBitmap; + } + } + if(__isHwKeySupported == true) + { + __pOptionMenu->Invalidate(true); + } + else + { + __pMenu->Invalidate(true); } } - __pMenu->Invalidate(true); } break; @@ -2173,10 +2297,21 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) __currentSearchStr.Append(__currentSelectedStr); InitFindWordPanel(); __pFindWordEditField->SetText(__currentSearchStr); - if(__pMenu != null) + if(__isHwKeySupported) { - __pMenu->SetShowState(false); - __pMenu->Invalidate(false); + if(__pOptionMenu != null) + { + __pOptionMenu->SetShowState(false); + __pOptionMenu->Invalidate(false); + } + } + else + { + if(__pMenu != null) + { + __pMenu->SetShowState(false); + __pMenu->Invalidate(false); + } } __adressPanelPosition.y = 0; @@ -2379,13 +2514,117 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) void MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source) { - - UiApp* pApp = UiApp::GetInstance(); - if (pApp == null) + result r = E_FAILURE; + if (__pWebViewer && __pWebViewer->CanGoBack()) { - return; + __pWebViewer->GoBack(); + } + else if(__pWindowInfo->isJavascriptInitiated == false) + { + UiApp* pApp = null; + pApp = UiApp::GetInstance(); + if (pApp != null) + { + r = pApp->Terminate(); + if (IsFailed(r)) + { + AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r)); + return; + } + } + } + else + { + UiApp* pApp = null; + WindowInfo* pWindowInfo = null; + int totalCount = 0; + SceneManager* pSceneManager = SceneManager::GetInstance(); + if (pSceneManager == null) + { + return; + } + ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList(); + if (pAllWindowList == NULL) + { + pApp = UiApp::GetInstance(); + if (pApp != null) + { + r = pApp->Terminate(); + if (IsFailed(r)) + { + AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r)); + return; + } + } + } + if (pAllWindowList != null) + { + totalCount = pAllWindowList->GetCount(); + } + for (int count = 0; count < totalCount; count++) + { + pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count)); + if (pWindowInfo == null) + { + pApp = UiApp::GetInstance(); + if (pApp != null) + { + r = pApp->Terminate(); + if (IsFailed(r)) + { + AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r)); + return; + } + } + } + else + { + if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true) + { + r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID); + if (IsFailed(r)) + { + AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r)); + return; + } + r = pAllWindowList->RemoveAt(count, true); + __pWindowInfo = null; + if (IsFailed(r)) + { + AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r)); + return; + } + if(count > 0) + { + pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count - 1)); + } + else + { + pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1)); + } + if (pWindowInfo == null) + { + pApp = UiApp::GetInstance(); + if (pApp != null) + { + r = pApp->Terminate(); + return; + } + } + else + { + r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE)); + if (IsFailed(r)) + { + AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r)); + return; + } + } + break; + } + } + } } - pApp->Terminate(); } void @@ -2520,15 +2759,30 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, } } - if (__pMenu != null && __pMenu->GetItemCount() == 3) + if(__isHwKeySupported == true) { - __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); + if (__pOptionMenu != null && __pOptionMenu->GetItemCount() == 3) + { + __pOptionMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); + } + else if (__pOptionMenu != null ) + { + __pOptionMenu->SetItemAt(3,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); + } + } - else if (__pMenu != null ) + else { - __pMenu->SetItemAt(3,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); - } + if (__pMenu != null && __pMenu->GetItemCount() == 3) + { + __pMenu->SetItemAt(0,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); + } + else if (__pMenu != null ) + { + __pMenu->SetItemAt(3,CommonUtil::GetString(L"IDS_BR_BODY_PRIVACY_AND_SECURITY_ABB"),IDA_PRIVATEON_CLICKED,*pBitmap); + } + } if (pBitmap != null) { delete pBitmap; @@ -2602,11 +2856,24 @@ MainForm::OnLoadingStarted(void) { return; } + // this is added in case if menu is opened and user load the page - if(__pMenu != null && __pMenu->GetShowState() == true) + if(__isHwKeySupported == true) { - __pMenu->SetShowState(false); - __pMenu->Invalidate(true); + if(__pOptionMenu != null && __pOptionMenu->GetShowState() == true) + { + __pOptionMenu->SetShowState(false); + __pOptionMenu->Invalidate(true); + } + + } + else + { + if(__pMenu != null && __pMenu->GetShowState() == true) + { + __pMenu->SetShowState(false); + __pMenu->Invalidate(true); + } } if(__pImageMenu != null && __pImageMenu->GetShowState() == true) { @@ -3755,7 +4022,8 @@ MainForm::StartWordSearch() __pFindWordPrev->SetEnabled(false); String *pCountStr = null; - __pWebViewer->SearchTextAllAsync(__currentSearchStr, false); + result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false); + AppLog("Search Result %s",GetErrorMessage(r)); /*__pWebViewer->EvaluateJavascriptN(L"document.body.textContent.match(/" + __currentSearchStr + "/gi).length;"); if (pCountStr != null) { @@ -4189,8 +4457,8 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori __pWebViewer->ReleaseBlock(); }*/ - if(__pFindWordControl != null) - ShowFindWordPanel(__pFindWordControl->GetShowState(), false); +// if(__pFindWordControl != null) +// ShowFindWordPanel(__pFindWordControl->GetShowState(), false); if ( __pFooterLabel != null) { Bitmap *pBitmap = CommonUtil::GetNinepatchedBitmapN(IDB_SEARCH_INPUT_FIELD_BG, __pFooterLabel->GetWidth(), __pFooterLabel->GetHeight()); @@ -4222,8 +4490,16 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori } } - if(__pMenu != null) - __pMenu->SetShowState(false); + if(__isHwKeySupported == true) + { + if(__pOptionMenu != null) + __pOptionMenu->SetShowState(false); + } + else + { + if(__pMenu != null) + __pMenu->SetShowState(false); + } if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) { widthContextItem = WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE; @@ -4514,7 +4790,7 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics if(__pFindWordControl) { AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState()); - ShowFindWordPanel(__pFindWordControl->GetShowState(), true); +// ShowFindWordPanel(__pFindWordControl->GetShowState(), true); } //__isLongPressedDone = false; if(__pAddressbar) @@ -4565,11 +4841,11 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics } } if( pList != NULL) - { pList->RemoveAll(true); delete pList; } +// RelayoutControls(false); return; } @@ -5171,9 +5447,109 @@ MainForm::AddressBarCancelledClicked(const Addressbar& addBar) __pMostVisitedListView->SetFocus(); else if(__pMultiWindowButton) __pMultiWindowButton->SetFocus(); - __pMoreButton->SetFocus(); + else if(__pMoreButton) + __pMoreButton->SetFocus(); __pAddressbar->SetShowState(false); RelayoutControls(false); } + +void +MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source) +{ + AppLog("MainForm::OnFormMenuRequested called"); + + + + + + + + + + + + + + + + InitOptionMenu(); + if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true) + { + int bookmarkCount=0; + bool exist = false; + String url=L""; + url=__pWindowInfo->pageUrl; + result r = E_SUCCESS; + Bitmap* pBitmap = null; + + r=BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(url,exist); + if (IsFailed(r)) + { + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED failed"); + return; + } + if ( exist == true) + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP); + } + else + { + pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP); + } + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 3"); + + if (__pOptionMenu->GetItemCount() == 9) + { + r = __pOptionMenu->SetItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap); + } + else + { + r = __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED,*pBitmap); + } + + if (IsFailed(r)) + { + AppLogException("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED Add to Bookmark failed with %s", GetErrorMessage(r)); + delete pBitmap; + return ; + } + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 4"); + if (__pOptionMenu->GetItemCount() != 9) + { + __pOptionMenu->InsertItemAt(1,CommonUtil::GetString(L"IDS_BR_OPT_ADDTOBOOKMARKS"), IDA_ADDTOBOOKMARK_CLICKED); + __pOptionMenu->InsertItemAt(2,CommonUtil::GetString(L"IDS_BR_BODY_PRINT"), IDA_PRINT_CLICKED); +// __pOptionMenu->InsertItemAt(2,L"Add to Home"/*CommonUtil::GetString(L"IDS_BR_OPT_SHARE")*/, IDA_ADD_TO_HOME_CLICKED); + __pOptionMenu->InsertItemAt(3,CommonUtil::GetString(L"IDS_BR_OPT_SHARE"), IDA_SHARE_CLICKED); + __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED); + __pOptionMenu->SetMaxVisibleItemsCount(6); + } + if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE) + { + AppLog(" Orientation landscape"); + __pOptionMenu->SetMaxVisibleItemsCount(5); + } + else + { + AppLog(" Orientation potrait"); + __pOptionMenu->SetMaxVisibleItemsCount(6); + } + + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED 5"); + delete pBitmap; + } + AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end"); + __pOptionMenu->SetShowState(true); + __pOptionMenu->Invalidate(true); + __pOptionMenu->Show(); + + + + + + + + + +} diff --git a/src/IntSettingForm.cpp b/src/IntSettingForm.cpp index b8d496d..7c611c5 100644 --- a/src/IntSettingForm.cpp +++ b/src/IntSettingForm.cpp @@ -28,6 +28,7 @@ #include "IntDefaultCustomItem.h" #include "IntDropDownCustomItem.h" #include "IntHistoryPresentationModel.h" +#include "IntInternetApp.h" #include "IntMultipleWindowPresentationModel.h" #include "IntNotificationPanel.h" #include "IntRadioCustomItem.h" @@ -257,7 +258,18 @@ SettingForm::OnInitializing(void) SceneManager* pSceneManager = NULL; __fontSize = CommonUtil::GetFontSize(); + InternetApp* pInternet = static_cast (Application::GetInstance()); + bool isHwKeySupported = false; + if(pInternet) + { + isHwKeySupported = pInternet->IsHwBackKeyExists(); + } + + if(isHwKeySupported) + { + SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR); + } __pList = static_cast< GroupedListView* >(GetControl(L"IDC_SETTING_LIST")); if ( __pList != NULL ) { @@ -272,8 +284,9 @@ SettingForm::OnInitializing(void) { AppLogDebug("setting back button"); pFooter->SetBackButtonEnabled(true); - SetFormBackEventListener(this); } + SetFormBackEventListener(this); + AppLog("SetFormBackEventListener result %s",GetErrorMessage(GetLastResult())); pSceneManager = SceneManager::GetInstance(); if (pSceneManager != null) { @@ -782,6 +795,7 @@ SettingForm::GetItemCount(int groupIndex) void SettingForm::OnFormBackRequested(Form& source) { + AppLog("SettingForm::OnFormBackRequested entered"); String* pSelectedScene = NULL; Object* value = NULL; MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &value);