Fix of TizenRefApp-9046 [Gallery] Impossible to delete images 94/143094/1 submit/tizen/20170809.085249
authorIgor Nazarov <i.nazarov@samsung.com>
Tue, 8 Aug 2017 11:11:33 +0000 (14:11 +0300)
committerIgor Nazarov <i.nazarov@samsung.com>
Tue, 8 Aug 2017 11:11:33 +0000 (14:11 +0300)
- Fixed issue when images sent via USB not removed;
- Fixed GUi issue with display of extra images.

Change-Id: I951615415e032762c82ae539e9eee2f7db045d77

gallery/model/MediaItem.cpp
gallery/view/ImageGrid.cpp

index 6b7ba9108ddb85e0eb4932dee33a1ce417a18d9e..aec6b5d214acbf102cfdf603963591e16e483ab4 100644 (file)
@@ -379,12 +379,6 @@ namespace gallery {
                        LOG_RETURN(RES_NOT_SUPPORTED, "Operation not supported!");
                }
 
-               const bool exists = ecore_file_exists(m_filePath.c_str());
-
-               if (exists && !ecore_file_can_write(m_filePath.c_str())) {
-                       LOG_RETURN(RES_FAIL, "File can't be removed!");
-               }
-
                {
                        MutexLock lock(getMediaMutex());
 
@@ -397,7 +391,8 @@ namespace gallery {
                        m_isValid = false;
                }
 
-               if (exists && !ecore_file_remove(m_filePath.c_str())) {
+               if (ecore_file_exists(m_filePath.c_str()) &&
+                               !ecore_file_remove(m_filePath.c_str())) {
                        FLOG("ecore_file_remove() failed! Attempting to rescan....");
                        MutexLock lock(getMediaMutex());
                        const int ret = media_content_scan_file(m_filePath.c_str());
index ef28f5fcb5483fe8643a87dfcaddcc2d0a05f233..942ff973fca8df39ab4c3c5f7c378a9913f31383 100644 (file)
@@ -333,6 +333,10 @@ namespace gallery {
                                        if (const auto listener = m_imageGrid.m_listener.lock()) {
                                                listener->onItemRealized(itemIndex);
                                        }
+
+                                       makeWhite(m_btn);
+                               } else {
+                                       makeTransparent(m_btn);
                                }
                        }
 
@@ -534,29 +538,26 @@ namespace gallery {
 
                        void onClicked(Widget &widget, void *eventInfo)
                        {
-                               if (!isRealized()) {
-                                       LOG_RETURN_VOID(RES_ILLEGAL_STATE, "Item is not realized!");
+                               if (isRealized()) {
+                                       m_imageGrid.handleItemEvent(m_realizeIndex,
+                                                       ItemEvent::CLICK, -1, -1);
                                }
-                               m_imageGrid.handleItemEvent(m_realizeIndex,
-                                               ItemEvent::CLICK, -1, -1);
                        }
 
                        void onDoubleTap(const int x, const int y)
                        {
-                               if (!isRealized()) {
-                                       LOG_RETURN_VOID(RES_ILLEGAL_STATE, "Item is not realized!");
+                               if (isRealized()) {
+                                       m_imageGrid.handleItemEvent(m_realizeIndex,
+                                                       ItemEvent::DOUBLE_TAP, x, y);
                                }
-                               m_imageGrid.handleItemEvent(m_realizeIndex,
-                                               ItemEvent::DOUBLE_TAP, x, y);
                        }
 
                        void onTapAndHold(const int x, const int y)
                        {
-                               if (!isRealized()) {
-                                       LOG_RETURN_VOID(RES_ILLEGAL_STATE, "Item is not realized!");
+                               if (isRealized()) {
+                                       m_imageGrid.handleItemEvent(m_realizeIndex,
+                                                       ItemEvent::TAP_AND_HOLD, x, y);
                                }
-                               m_imageGrid.handleItemEvent(m_realizeIndex,
-                                               ItemEvent::TAP_AND_HOLD, x, y);
                        }
 
                        void onHighlighted(Widget &widget, void *eventInfo)