Added featurs for AppControl(VIEW) and fixed jira issues
authorDongseok Jang <dongseok.jang@samsung.com>
Mon, 1 Apr 2013 10:25:51 +0000 (19:25 +0900)
committerDongseok Jang <dongseok.jang@samsung.com>
Mon, 1 Apr 2013 10:25:51 +0000 (19:25 +0900)
Change-Id: Icc63865f66992bb0bad4babead4fd11de17e1273
Signed-off-by: Dongseok Jang <dongseok.jang@samsung.com>
src/CtContactDetailsForm.cpp
src/CtContactEditorForm.cpp
src/CtContactsApp.cpp
src/CtGroupListPanel.cpp
src/CtTypes.cpp

index 9760a5b..1595ca9 100644 (file)
@@ -404,7 +404,7 @@ ContactDetailsForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previous
 
                __pTableView->RefreshItem(__pItemList->GetCount() - 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
        }
-       else if (previousSceneId == IDSCN_CONTACT_EDITOR)
+       else if (previousSceneId == IDSCN_CONTACT_EDITOR && __appControlViewType.IsEmpty())
        {
                InitializeDetailItemList();
                __pTableView->UpdateTableView();
@@ -416,7 +416,7 @@ ContactDetailsForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previous
                        return;
                }
 
-               if (pContactsApp->GetOperationId() == CONTACT_OPERATION_ID_VIEW)
+               if (pContactsApp->GetOperationId() == OPERATION_ID_VIEW)
                {
                        result r = InitializeAppControl(pArgs);
 
@@ -521,6 +521,8 @@ ContactDetailsForm::InitializeAppControl(Tizen::Base::Collection::IList* pArgs)
                                footerItemAdd.Construct(IDA_FOOTER_ADD);
                                footerItemAdd.SetText(ResourceManager::GetString(L"IDS_COM_OPT_ADD_TO_CONTACTS"));
                                pFooter->AddItem(footerItemAdd);
+
+                               __pPresentationModel->RemoveContactChangeListener(*this);
                        }
                        else
                        {
index 99a5080..460cc4c 100644 (file)
@@ -98,7 +98,7 @@ static const int H_EMPTY_SPACE = 32;
 static const int H_EXPANDED_NAME_FIELDS = 672;
 static const int H_BUTTON = 74;
 static const int W_THUMBNAIL = 360;
-static const int W_TITLE_LABEL = 160;
+static const int W_TITLE_LABEL = 170;
 static const int X_MORE_INFORMATION_BUTTON = 60;
 static const int Y_MORE_INFORMATION_BUTTON = 30;
 static const int Y_DEFAULT_NUMBER_BUTTON = 19;
@@ -150,6 +150,7 @@ static const wchar_t* INPUT_TYPE_EMAIL = L"email";
 static const wchar_t* INPUT_TYPE_URL = L"url";
 static const wchar_t* VIEW_TYPE = L"viewType";
 static const wchar_t* VIEW_TYPE_VALUE_CONTACT = L"contact";
+static const wchar_t* VIEW_TYPE_CONTACT_ID = L"contactId";
 
 ContactEditorForm::ContactEditorForm(void)
 : __isExpandable(false)
@@ -498,11 +499,6 @@ ContactEditorForm::OnActionPerformed(const Tizen::Ui::Control& source, int actio
 
                        Rectangle clientBounds = GetClientAreaBounds();
                        __pTableView->SetSize(clientBounds.width, clientBounds.height);
-
-                       if (__pCurrentFocusedItem != null)
-                       {
-                               SetFocus();
-                       }
                }
                break;
        case IDA_BUTTON_MORE_INFO:
@@ -2772,9 +2768,26 @@ ContactEditorForm::OnTextValueChanged(const Tizen::Ui::Control& source)
 
        pDeleteButton->SetShowState(true);
 
-       pEditField->HideKeypad();
-       __pTableView->UpdateTableView();
-       pEditField->ShowKeypad();
+       int index;
+       int groupIndex;
+       int itemCount;
+
+       Integer::Decode(pEditField->GetName(), index);
+       groupIndex = (index & TABLE_VIEW_GROUP_INDEX_MASK) >> TABLE_VIEW_GROUP_INDEX_SHIFT;
+       itemCount = __pTableView->GetItemCountAt(groupIndex);
+       if (groupIndex == TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX)
+       {
+               if (itemCount == 1)
+               {
+                       __isDefaultPhoneNumberButtonEnabled = true;
+                       __pTableView->RefreshItem(groupIndex, __pTableView->GetItemCountAt(groupIndex), TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
+               }
+               else
+               {
+                       itemCount--;
+               }
+       }
+       __pTableView->RefreshItem(groupIndex, itemCount, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
 }
 
 void
@@ -3354,7 +3367,7 @@ ContactEditorForm::OnContactsChanged(void)
                        pViewType->Append(DELIMITER);
                        pViewType->Append(VIEW_TYPE_VALUE_CONTACT);
 
-                       pValueType->Append(RETURN_TYPE_ITEM_ID);
+                       pValueType->Append(VIEW_TYPE_CONTACT_ID);
                        pValueType->Append(DELIMITER);
                        pValueType->Append(Integer::ToString(__pPresentationModel->GetContactId()));
 
index 0d00f52..604110f 100644 (file)
@@ -19,6 +19,7 @@
  * @brief      This is the implementation file for the ContactsApp class.
  */
 
+#include <FIo.h>
 #include "CtContactsApp.h"
 #include "CtContactListPresentationModel.h"
 #include "CtGroupContactListPresentationModel.h"
@@ -32,6 +33,7 @@ using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
+using namespace Tizen::Io;
 using namespace Tizen::System;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
@@ -47,6 +49,9 @@ static const wchar_t* VIEW_TYPE = L"viewType";
 static const wchar_t* CONTACT_ID = L"contactId";
 static const wchar_t* PATH = L"path";
 static const wchar_t* VALUE_VIEW_TYPE_CONTACT = L"contact";
+static const wchar_t* VALUE_VIEW_TYPE_VCF = L"vcf";
+static const wchar_t* VIEW_MIME_TYPE_VCF = L"text/x-vcard";
+static const wchar_t* VIEW_URI_VCF_PREFIX = L"file:///";
 
 ContactsApp::ContactsApp(void)
  : __initialSceneId(IDSCN_CONTACT_LIST)
@@ -438,7 +443,7 @@ ContactsApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::Str
                }
 
                const String* pItemType = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_KEY_ITEM_TYPE)));
-               if (pItemType == null || pItemType->Equals(ITEM_TYPE_CONTACT, true) == false)
+               if (pItemType == null || pItemType->Equals(ITEM_TYPE_PERSON, true) == false)
                {
                        AppLogDebug("To launch AppControl by the view operation, the item type should be input.");
                        AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, APP_CTRL_RESULT_FAILED, null);
@@ -470,47 +475,59 @@ ContactsApp::OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::Str
                __initialSceneId = IDSCN_CONTACT_DETAILS;
                __operationId = OPERATION_ID_VIEW;
        }
-       else if (operationId.Equals(OPERATION_ID_CONFIGURE, true))
-       {
-               __initialSceneId = IDSCN_SETTINGS;
-               __operationId = OPERATION_ID_CONFIGURE;
-       }
        else if (operationId.Equals(OPERATION_ID_VIEW, true))
        {
-               if (pExtraData == null)
+               if (pMimeType == null || pMimeType->Equals(VIEW_MIME_TYPE_VCF, true) == false)
                {
-                       AppLogDebug("To launch AppControl by the VIEW operation, the (key,value) pairs should be input.");
+                       AppLogDebug("To launch AppControl by the view operation, the mime type should be input.");
+                       AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, APP_CTRL_RESULT_FAILED, null);
                        Terminate();
 
                        return;
                }
 
-               String* pViewType = new (std::nothrow) String(VIEW_TYPE);
-               pViewType->Append(DELIMITER);
-               pViewType->Append(*static_cast<const String*>(pExtraData->GetValue(String(VIEW_TYPE))));
-               pArgs->Add(pViewType);
+               if (pUriData == null)
+               {
+                       AppLogDebug("To launch AppControl by the view operation, the uri data should be input.");
+                       AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, APP_CTRL_RESULT_FAILED, null);
+                       Terminate();
+
+                       return;
+               }
 
-               String* key = null;
-               const String* value = null;
+               String vcfPrefix(VIEW_URI_VCF_PREFIX);
+               String path;
 
-               value = static_cast<const String*>(pExtraData->GetValue(String(PATH)));
-               if (value)
+               if (pUriData->StartsWith(vcfPrefix, 0) == false)
                {
-                       key = new (std::nothrow) String(PATH);
-                       key->Append(DELIMITER);
-                       key->Append(*value);
-                       pArgs->Add(key);
+                       AppLogDebug("To launch AppControl by the view operation, the uri data should be input.");
+                       AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, APP_CTRL_RESULT_FAILED, null);
+                       Terminate();
+
+                       return;
                }
 
-               value = static_cast<const String*>(pExtraData->GetValue(String(CONTACT_ID)));
-               if (value)
+               pUriData->SubString(vcfPrefix.GetLength() - 1, pUriData->GetLength() - vcfPrefix.GetLength() + 1, path);
+
+               if (File::IsFileExist(path) == false)
                {
-                       key = new (std::nothrow) String(CONTACT_ID);
-                       key->Append(DELIMITER);
-                       key->Append(*value);
-                       pArgs->Add(key);
+                       AppLogDebug("The vcf file is not existed.");
+                       AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, APP_CTRL_RESULT_FAILED, null);
+                       Terminate();
+
+                       return;
                }
 
+               String* pViewType = new (std::nothrow) String(VIEW_TYPE);
+               pViewType->Append(DELIMITER);
+               pViewType->Append(VALUE_VIEW_TYPE_VCF);
+               pArgs->Add(pViewType);
+
+               String* pKey = new (std::nothrow) String(PATH);
+               pKey->Append(DELIMITER);
+               pKey->Append(path);
+               pArgs->Add(pKey);
+
                __initialSceneId = IDSCN_CONTACT_DETAILS;
                __operationId = OPERATION_ID_VIEW;
        }
index 8e00e5f..917c0de 100644 (file)
@@ -40,7 +40,7 @@ using namespace Tizen::Social;
 
 static const int IDA_FOOTER_MORE = 0;
 static const int IDA_FOOTER_CREATE = 1;
-static const int IDA_MORE_DELETE = 2;
+static const int IDA_MORE_EDIT = 2;
 static const int IDA_HEADER_CONTACTS = 10;
 static const int IDA_HEADER_GROUPS = 11;
 static const int IDA_HEADER_FAVORITES = 12;
@@ -138,7 +138,7 @@ GroupListPanel::OnInitializing(void)
 
        __pContextMenuMore = new (std::nothrow) ContextMenu();
        __pContextMenuMore->Construct(Point(X_MORE, clientBounds.y + clientBounds.height), CONTEXT_MENU_STYLE_LIST);
-       __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_SK_DELETE"), IDA_MORE_DELETE);
+       __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_COM_SK_EDIT"), IDA_MORE_EDIT);
        __pContextMenuMore->AddActionEventListener(*this);
 
        return E_SUCCESS;
@@ -221,7 +221,7 @@ GroupListPanel::OnActionPerformed(const Tizen::Ui::Control& source, int actionId
                        __pContextMenuMore->Show();
                }
                break;
-       case IDA_MORE_DELETE:
+       case IDA_MORE_EDIT:
                {
                        pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_LIST_EDITOR));
                }
index e046b7e..dd6b31b 100644 (file)
@@ -93,7 +93,7 @@ const wchar_t* ITEM_TYPE_CONTACT = L"contact";
 
 const wchar_t* PROVIDER_ID_CAMERA = L"tizen.camera";
 const wchar_t* PROVIDER_ID_GALLERY = L"tizen.gallery";
-const wchar_t* PROVIDER_ID_PHONE = L"tizen.phone";
+const wchar_t* PROVIDER_ID_PHONE = L"tizen.call";
 const wchar_t* PROVIDER_ID_MESSAGE = L"tizen.messages";
 const wchar_t* PROVIDER_ID_EMAIL = L"tizen.email";
 const wchar_t* PROVIDER_ID_FILEMANAGER = L"tizen.filemanager";