1.Set as Contact fix 2.File size limit set to 255
authorchitta ranjan <chitta.rs@samsung.com>
Fri, 10 May 2013 03:33:08 +0000 (12:33 +0900)
committerchitta ranjan <chitta.rs@samsung.com>
Fri, 10 May 2013 03:37:45 +0000 (12:37 +0900)
Change-Id: I5f4e9fcb8b6afeab4c76c9767f32ad7b0f32002a
Signed-off-by: chitta ranjan <chitta.rs@samsung.com>
inc/IvTypes.h
src/IvImageCropForm.cpp
src/IvImageNameEditorForm.cpp
src/IvImageViewerForm.cpp
src/IvTypes.cpp

index c961b0c..84e2572 100644 (file)
@@ -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;
 
index 72e2e0b..7fb4c90 100644 (file)
@@ -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;
index df07571..94725cd 100644 (file)
@@ -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;
index f8fc986..ccef395 100644 (file)
@@ -1803,6 +1803,19 @@ ImageViewerForm::OnSceneActivatedN(const SceneId& previousSceneId,
                Invalidate(true);
        }
 
+       if (previousSceneId == IDSCN_IMAGE_CROP && pArgs != null)
+       {
+               String filePath;
+               filePath = *(static_cast<String*>(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);
index 2748789..0b6f41d 100644 (file)
@@ -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://";