From 7141dc072b0187a7c9d8e751a4cf23798107f63f Mon Sep 17 00:00:00 2001 From: chitta ranjan Date: Fri, 10 May 2013 12:33:08 +0900 Subject: [PATCH] 1.Set as Contact fix 2.File size limit set to 255 Change-Id: I5f4e9fcb8b6afeab4c76c9767f32ad7b0f32002a Signed-off-by: chitta ranjan --- inc/IvTypes.h | 1 + src/IvImageCropForm.cpp | 47 +++++++++++++++---------------------------- src/IvImageNameEditorForm.cpp | 18 ++++++++--------- src/IvImageViewerForm.cpp | 13 ++++++++++++ src/IvTypes.cpp | 1 + 5 files changed, 39 insertions(+), 41 deletions(-) diff --git a/inc/IvTypes.h b/inc/IvTypes.h index c961b0c..84e2572 100644 --- a/inc/IvTypes.h +++ b/inc/IvTypes.h @@ -142,6 +142,7 @@ extern const wchar_t* FOLDER_PATH_DOWNLOADS; extern const wchar_t* TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER; extern const wchar_t* TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER; extern const wchar_t* TEMP_FILE_PATH_WEB_FILE; +extern const wchar_t* TEMP_FILE_PATH_CONTACT_IMAGE; extern const wchar_t* WEB_URL_HTTP; diff --git a/src/IvImageCropForm.cpp b/src/IvImageCropForm.cpp index 72e2e0b..7fb4c90 100644 --- a/src/IvImageCropForm.cpp +++ b/src/IvImageCropForm.cpp @@ -376,43 +376,28 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) } else if (__statusValue == SET_AT_TYPE_CALLER_IMAGE) { - int count = 1; - int index = 0; String destFilePath; if (__sourceFilePath.IsEmpty() == false) { - __sourceFilePath.Reverse(); - __sourceFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index); - __sourceFilePath.Reverse(); - __sourceFilePath.Insert(FILE_NAME_SEPARATOR, __sourceFilePath.GetLength() - index - 1); - destFilePath.Append(__sourceFilePath); - destFilePath.Insert(count, destFilePath.GetLength() - index - 1); - while (File::IsFileExist(destFilePath) == true) - { - count++; - destFilePath.Clear(); - destFilePath.Append(__sourceFilePath); - destFilePath.Insert(count, destFilePath.GetLength() - index - 1); - } - } - r = pCropBuffer->EncodeToFile(destFilePath, IMG_FORMAT_JPG, true, 100); - ContentManager::ScanFile(destFilePath); - Contact* pContact = null; - AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance(); - Addressbook* pAddressbook = null; - - pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID); - if (pAddressbook != null) - { - pContact = pAddressbook->GetContactN(__contentId); - if (pContact != null) + destFilePath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_CONTACT_IMAGE; + r = pCropBuffer->EncodeToFile(destFilePath, IMG_FORMAT_JPG, true, 100); + Contact* pContact = null; + AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance(); + Addressbook* pAddressbook = null; + + pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID); + if (pAddressbook != null) { - pContact->SetThumbnail(destFilePath); - pAddressbook->UpdateContact(*pContact); - delete pContact; + pContact = pAddressbook->GetContactN(__contentId); + if (pContact != null) + { + pContact->SetThumbnail(destFilePath); + pAddressbook->UpdateContact(*pContact); + delete pContact; + } + delete pAddressbook; } - delete pAddressbook; } } delete pCropBuffer; diff --git a/src/IvImageNameEditorForm.cpp b/src/IvImageNameEditorForm.cpp index df07571..94725cd 100644 --- a/src/IvImageNameEditorForm.cpp +++ b/src/IvImageNameEditorForm.cpp @@ -227,12 +227,12 @@ ImageNameEditorForm::OnTextValueChanged (const Control &source) String byteCountForInput; int byteCount = 0; int inputLength = 0; - int tempLength = 220; + int tempLength = 255; int textToCheck = 0; MessageBox messageBox; Utf8Encoding utf8; - - + String fileExtension = File::GetFileExtension(__pPresentationModel->GetFilePathAt(__currentIndex)); + tempLength = tempLength - 1 - fileExtension.GetLength(); FooterItemStatus currentStatus = FOOTER_ITEM_STATUS_NORMAL; result r = E_SUCCESS; @@ -242,7 +242,7 @@ ImageNameEditorForm::OnTextValueChanged (const Control &source) byteCountForInput = __pNameEditField->GetText(); r = utf8.GetByteCount(byteCountForInput, byteCount); AppLogDebug("result is %s",GetErrorMessage(r)); - AppLogDebug("Bye count is %d",byteCount); + AppLogDebug("Byte count is %d",byteCount); } if (__pNameEditField != null) @@ -268,11 +268,9 @@ ImageNameEditorForm::OnTextValueChanged (const Control &source) GetFooter()->SetItemEnabled(0,true); GetFooter()->Invalidate(true); } - } } - if (currentText.StartsWith(".", 0)) { String invalidCharacterString; @@ -305,7 +303,7 @@ ImageNameEditorForm::OnTextValueChanged (const Control &source) { String msg = ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS"); CreateMessage(msg); - currentInput.Replace("/",""); + currentInput.Replace("/", ""); __pNameEditField->SetText(currentInput); } @@ -322,7 +320,7 @@ ImageNameEditorForm::OnTextValueChanged (const Control &source) CreateMessage(msg); currentText = __pNameEditField->GetText(); - for (currentCharacter=0;checkByteCount < tempLength;currentCharacter++) + for (currentCharacter=0; checkByteCount < tempLength; currentCharacter++) { currentInputCharacter.Clear(); currentInputCharacter = currentText[currentCharacter]; @@ -336,8 +334,8 @@ ImageNameEditorForm::OnTextValueChanged (const Control &source) lengthOfFinalString++; } - r = __pNameEditField->GetText().SubString(0,lengthOfFinalString,currentInput); - AppLogDebug("current input is %S",currentInput.GetPointer()); + r = __pNameEditField->GetText().SubString(0, lengthOfFinalString, currentInput); + AppLogDebug("current input is %S", currentInput.GetPointer()); r = __pNameEditField->SetText(currentInput); __pNameEditField->ShowKeypad(); return; diff --git a/src/IvImageViewerForm.cpp b/src/IvImageViewerForm.cpp index f8fc986..ccef395 100644 --- a/src/IvImageViewerForm.cpp +++ b/src/IvImageViewerForm.cpp @@ -1803,6 +1803,19 @@ ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId, Invalidate(true); } + if (previousSceneId == IDSCN_IMAGE_CROP && pArgs != null) + { + String filePath; + filePath = *(static_cast(pArgs->GetAt(0))); + delete pArgs; + int count = __pPresentationModel->GetFileCount(); + __pPresentationModel->AddImageCache(filePath); + __pGallery->UpdateGallery(); + __pGallery->SetCurrentItemIndex(count); + __pPresentationModel->RequestImage(filePath); + ShowPanelDetail(false); + } + if (__pGallery->GetCurrentItemIndex() < 0) { SetFooterItemState(false); diff --git a/src/IvTypes.cpp b/src/IvTypes.cpp index 2748789..0b6f41d 100644 --- a/src/IvTypes.cpp +++ b/src/IvTypes.cpp @@ -85,6 +85,7 @@ const wchar_t* FOLDER_PATH_DOWNLOADS = L"Downloads/"; const wchar_t* TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER = L"home.jpg"; const wchar_t* TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER = L"lock.jpg"; const wchar_t* TEMP_FILE_PATH_WEB_FILE = L"data/test_out.jpg"; +const wchar_t* TEMP_FILE_PATH_CONTACT_IMAGE = L"data/contact.jpg"; const wchar_t* WEB_URL_HTTP = L"http://"; -- 2.7.4