summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoonchan Choi <yc81.choi@samsung.com>2013-07-30 23:06:34 +0900
committerYoonchan Choi <yc81.choi@samsung.com>2013-07-30 23:39:37 +0900
commitdf6f6ea4407d22f4692e53426b60c481485cde6e (patch)
tree5e29525328b5438a5fa4fe13c9fafe623c1342a3
parent9d86ca65291a60afed7e30272252372a81980262 (diff)
downloadAccountApp-df6f6ea4407d22f4692e53426b60c481485cde6e.tar.gz
AccountApp-df6f6ea4407d22f4692e53426b60c481485cde6e.tar.bz2
AccountApp-df6f6ea4407d22f4692e53426b60c481485cde6e.zip
Fix the N_SE-46963
Change-Id: I7be9d32d0bb2ac84276ce1ab351631df4b6e12d5 Signed-off-by: Yoonchan Choi <yc81.choi@samsung.com>
-rw-r--r--project/inc/ConfigureAccountForm.h15
-rw-r--r--project/src/AddAccountForm.cpp16
-rw-r--r--project/src/ConfigureAccountForm.cpp124
3 files changed, 117 insertions, 38 deletions
diff --git a/project/inc/ConfigureAccountForm.h b/project/inc/ConfigureAccountForm.h
index 8803bc3..13d46b7 100644
--- a/project/inc/ConfigureAccountForm.h
+++ b/project/inc/ConfigureAccountForm.h
@@ -27,6 +27,7 @@ class ConfigureAccountForm
, public Tizen::Ui::Controls::IFormBackEventListener
, public Tizen::Ui::IActionEventListener
, public Tizen::Ui::Scenes::ISceneEventListener
+ , public Tizen::Ui::Controls::IFrameEventListener
{
public:
ConfigureAccountForm(void);
@@ -42,14 +43,28 @@ public:
virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
+ // Tizen::Ui::Scenes::ISceneEventListener
virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
const Tizen::Ui::Scenes::SceneId& nextSceneId);
+ // Tizen::Ui::Controls::IFrameEventListener
+ virtual void OnFrameActivated(const Tizen::Ui::Controls::Frame &source);
+ virtual void OnFrameDeactivated(const Tizen::Ui::Controls::Frame &source);
+ virtual void OnFrameMinimized (const Tizen::Ui::Controls::Frame &source);
+ virtual void OnFrameRestored (const Tizen::Ui::Controls::Frame &source);
+ virtual void OnFrameTerminating(const Tizen::Ui::Controls::Frame &source);
+
+private:
+ void ShowMessagePopup(result r, Tizen::Base::String errorMessage);
+ void TerminateApp(void);
+
private:
RequestId __reqId;
Tizen::Social::AccountId __accountId;
+ bool __isFrameActivated;
+ result __resultForPopup;
};
#endif
diff --git a/project/src/AddAccountForm.cpp b/project/src/AddAccountForm.cpp
index 3235303..96dd7e7 100644
--- a/project/src/AddAccountForm.cpp
+++ b/project/src/AddAccountForm.cpp
@@ -96,14 +96,19 @@ AddAccountForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId
result r = pAccountManager->AddAccount(account);
if (IsFailed(r))
{
+ MessageBox messageBox;
+
if (r == E_USER_NOT_CONSENTED)
{
- MessageBox messageBox;
messageBox.Construct(L"Error", L"The account privacy should be enabled.", MSGBOX_STYLE_OK);
-
- int modalResult;
- messageBox.ShowAndWait(modalResult);
}
+ else
+ {
+ messageBox.Construct(L"Error", L"Failed to add the account.", MSGBOX_STYLE_OK);
+ }
+
+ int modalResult;
+ messageBox.ShowAndWait(modalResult);
AppControlProviderManager::GetInstance()->SendAppControlResult(__reqId, APP_CTRL_RESULT_FAILED, null);
}
@@ -140,8 +145,6 @@ void
AddAccountForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
{
- AppLog("OnSceneActivatedN");
-
if (pArgs != null)
{
Integer* pReqId = static_cast<Integer*> (pArgs->GetAt(0));
@@ -156,5 +159,4 @@ void
AddAccountForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
const Tizen::Ui::Scenes::SceneId& nextSceneId)
{
- AppLog("OnSceneDeactivated");
}
diff --git a/project/src/ConfigureAccountForm.cpp b/project/src/ConfigureAccountForm.cpp
index 9dd54a4..2f508de 100644
--- a/project/src/ConfigureAccountForm.cpp
+++ b/project/src/ConfigureAccountForm.cpp
@@ -38,6 +38,8 @@ static const int IDA_CHECKBUTTON2_SELECTED = 303;
ConfigureAccountForm::ConfigureAccountForm(void)
: __reqId(INVALID_REQUEST_ID)
, __accountId(INVALID_ACCOUNT_ID)
+ , __isFrameActivated(false)
+ , __resultForPopup(E_SUCCESS)
{
}
@@ -78,6 +80,11 @@ ConfigureAccountForm::OnInitializing(void)
pCheckbutton2->AddActionEventListener(*this);
}
+ Frame *pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame();
+ AppAssert(pFrame);
+
+ pFrame->AddFrameEventListener(*this);
+
return E_SUCCESS;
}
@@ -94,13 +101,26 @@ ConfigureAccountForm::UpdateAccount(Tizen::Base::String key, Tizen::Base::String
AppAssert(pAccountAccessor);
Account account = pAccountAccessor->GetAccount(__accountId);
+ result r = GetLastResult();
+ if (IsFailed(r))
+ {
+ ShowMessagePopup(r, L"Failed to get the account.");
+ TerminateApp();
+
+ return;
+ }
+
account.SetExtendedData(key, value);
AccountManager* pAccountManager = AccountManager::GetInstance();
AppAssert(pAccountManager);
- result r = pAccountManager->UpdateAccount(account);
- TryReturnVoid(!IsFailed(r), "[%s] Failed to update the account.", GetErrorMessage(r));
+ r = pAccountManager->UpdateAccount(account);
+ if (IsFailed(r))
+ {
+ ShowMessagePopup(r, L"Failed to update the account.");
+ TerminateApp();
+ }
}
void
@@ -147,14 +167,7 @@ ConfigureAccountForm::OnActionPerformed(const Tizen::Ui::Control& source, int ac
result r = pAccountManager->RemoveAccount(__accountId);
if (IsFailed(r))
{
- if (r == E_USER_NOT_CONSENTED)
- {
- MessageBox messageBox;
- messageBox.Construct(L"Error", L"The account privacy should be enabled.", MSGBOX_STYLE_OK);
-
- int modalResult;
- messageBox.ShowAndWait(modalResult);
- }
+ ShowMessagePopup(r, L"Failed to remove the account.");
AppControlProviderManager::GetInstance()->SendAppControlResult(__reqId, APP_CTRL_RESULT_FAILED, null);
}
@@ -164,10 +177,7 @@ ConfigureAccountForm::OnActionPerformed(const Tizen::Ui::Control& source, int ac
}
// Terminate the application
- UiApp* pApp = UiApp::GetInstance();
- AppAssert(pApp);
-
- pApp->Terminate();
+ TerminateApp();
break;
}
@@ -200,34 +210,25 @@ ConfigureAccountForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previo
result r = GetLastResult();
if (r != E_SUCCESS)
{
- MessageBox messageBox;
-
- if (r == E_USER_NOT_CONSENTED)
+ if (__isFrameActivated)
{
- messageBox.Construct(L"Error", L"The account privacy should be enabled.", MSGBOX_STYLE_OK);
+ ShowMessagePopup(r, L"Failed to get the account.");
+ TerminateApp();
}
else
{
- messageBox.Construct(L"Error", L"Failed to get the account.", MSGBOX_STYLE_OK);
+ __resultForPopup = r;
}
- int modalResult;
- messageBox.ShowAndWait(modalResult);
-
- // Terminate the application
- UiApp* pApp = UiApp::GetInstance();
- AppAssert(pApp);
-
- pApp->Terminate();
return;
}
- IMap* pExtendData = account.GetExtendedDataN();
+ IMap* pExtendedData = account.GetExtendedDataN();
CheckButton *pCheckbutton1 = static_cast<CheckButton*> (GetControl(IDC_CHECKBUTTON1));
if (pCheckbutton1)
{
- const String* pValue = static_cast<const String*> (pExtendData->GetValue(String(L"ContactSync")));
+ const String* pValue = static_cast<const String*> (pExtendedData->GetValue(String(L"ContactSync")));
if (pValue->Equals(String(L"enable")))
{
pCheckbutton1->SetSelected(true);
@@ -241,7 +242,7 @@ ConfigureAccountForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previo
CheckButton *pCheckbutton2 = static_cast<CheckButton*> (GetControl(IDC_CHECKBUTTON2));
if (pCheckbutton2)
{
- const String* pValue = static_cast<const String*> (pExtendData->GetValue(String(L"CalendarSync")));
+ const String* pValue = static_cast<const String*> (pExtendedData->GetValue(String(L"CalendarSync")));
if (pValue->Equals(String(L"enable")))
{
pCheckbutton2->SetSelected(true);
@@ -260,5 +261,66 @@ void
ConfigureAccountForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
const Tizen::Ui::Scenes::SceneId& nextSceneId)
{
- AppLog("OnSceneDeactivated");
+}
+
+void
+ConfigureAccountForm::OnFrameActivated(const Tizen::Ui::Controls::Frame &source)
+{
+ if (__resultForPopup != E_SUCCESS)
+ {
+ ShowMessagePopup(__resultForPopup, L"Failed to get the account.");
+ TerminateApp();
+ }
+
+ __isFrameActivated = true;
+}
+
+void
+ConfigureAccountForm::OnFrameDeactivated(const Tizen::Ui::Controls::Frame &source)
+{
+
+ __isFrameActivated = false;
+}
+
+void
+ConfigureAccountForm::OnFrameMinimized (const Tizen::Ui::Controls::Frame &source)
+{
+}
+
+void
+ConfigureAccountForm::OnFrameRestored (const Tizen::Ui::Controls::Frame &source)
+{
+}
+
+void
+ConfigureAccountForm::OnFrameTerminating (const Tizen::Ui::Controls::Frame &source)
+{
+}
+
+void
+ConfigureAccountForm::ShowMessagePopup(result r, String errorMessage)
+{
+ MessageBox messageBox;
+
+ if (r == E_USER_NOT_CONSENTED)
+ {
+ messageBox.Construct(L"Error", L"The account privacy should be enabled.", MSGBOX_STYLE_OK);
+ }
+ else
+ {
+ messageBox.Construct(L"Error", errorMessage, MSGBOX_STYLE_OK);
+ }
+
+ int modalResult;
+ messageBox.ShowAndWait(modalResult);
+}
+
+void
+ConfigureAccountForm::TerminateApp(void)
+{
+ // Terminate the application
+ UiApp* pApp = UiApp::GetInstance();
+ AppAssert(pApp);
+
+ pApp->Terminate();
}