[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [digikam] core: polish manual sorting
From:       Maik Qualmann <null () kde ! org>
Date:       2018-07-31 20:44:19
Message-ID: E1fkbVD-0004Rb-ID () code ! kde ! org
[Download RAW message or body]

Git commit 31db5599d319361a0ae39ac0ef4f0e32c7a48fbc by Maik Qualmann.
Committed on 31/07/2018 at 20:43.
Pushed by mqualmann into branch 'master'.

polish manual sorting

M  +2    -2    core/app/dragdrop/imagedragdrop.cpp
M  +1    -1    core/app/items/digikamimageview.cpp
M  +1    -1    core/libs/database/coredb/coredb.cpp
M  +1    -1    core/libs/database/coredb/coredb.h
M  +1    -1    core/libs/database/item/imageinfo.cpp
M  +1    -1    core/libs/database/item/imageinfo.h
M  +5    -0    core/libs/database/item/imageinfocache.cpp
M  +1    -1    core/libs/database/item/imageinfodata.h

https://commits.kde.org/digikam/31db5599d319361a0ae39ac0ef4f0e32c7a48fbc

diff --git a/core/app/dragdrop/imagedragdrop.cpp b/core/app/dragdrop/imagedragdrop.cpp
index 6be10ced70..c802bb8cb2 100644
--- a/core/app/dragdrop/imagedragdrop.cpp
+++ b/core/app/dragdrop/imagedragdrop.cpp
@@ -195,14 +195,14 @@ static DropAction groupAction(const QDropEvent* const, QWidget* const view)
 
     QMenu popMenu(view);
     QAction* sortAction        = 0;
-    QAction* const groupAction = addGroupAction(&popMenu);
 
     if (sort == ImageSortSettings::SortByManualOrder)
     {
-        popMenu.addSeparator();
         sortAction             = addSortAction(&popMenu);
+        popMenu.addSeparator();
     }
 
+    QAction* const groupAction = addGroupAction(&popMenu);
     popMenu.addSeparator();
     addCancelAction(&popMenu);
 
diff --git a/core/app/items/digikamimageview.cpp b/core/app/items/digikamimageview.cpp
index 57e6f1347a..5384bb5956 100644
--- a/core/app/items/digikamimageview.cpp
+++ b/core/app/items/digikamimageview.cpp
@@ -222,7 +222,7 @@ void DigikamImageView::dragDropSort(const ImageInfo& pick, const QList<ImageInfo
     }
 
     ImageInfoList infoList = allImageInfos(false);
-    int counter            = pick.manualOrder();
+    qlonglong counter      = pick.manualOrder();
     bool order             = (ApplicationSettings::instance()->
                                 getImageSorting() == Qt::AscendingOrder);
     bool found             = false;
diff --git a/core/libs/database/coredb/coredb.cpp b/core/libs/database/coredb/coredb.cpp
index decb87ecc7..5f73498a66 100644
--- a/core/libs/database/coredb/coredb.cpp
+++ b/core/libs/database/coredb/coredb.cpp
@@ -3771,7 +3771,7 @@ void CoreDB::setItemAlbum(qlonglong imageID, qlonglong album)
     d->db->recordChangeset(CollectionImageChangeset(imageID, album, CollectionImageChangeset::Added));
 }
 
-void CoreDB::setItemManualOrder(qlonglong imageID, int value)
+void CoreDB::setItemManualOrder(qlonglong imageID, qlonglong value)
 {
     QVariantList boundValues;
     boundValues << value << imageID;
diff --git a/core/libs/database/coredb/coredb.h b/core/libs/database/coredb/coredb.h
index 76826f3d89..1c57b49f96 100644
--- a/core/libs/database/coredb/coredb.h
+++ b/core/libs/database/coredb/coredb.h
@@ -760,7 +760,7 @@ public:
     /**
      * Updates the manualOrder field for the item.
      */
-    void setItemManualOrder(qlonglong imageID, int value);
+    void setItemManualOrder(qlonglong imageID, qlonglong value);
 
     /**
      * Rename the item.
diff --git a/core/libs/database/item/imageinfo.cpp b/core/libs/database/item/imageinfo.cpp
index e99dfb318f..05cdd9bde8 100644
--- a/core/libs/database/item/imageinfo.cpp
+++ b/core/libs/database/item/imageinfo.cpp
@@ -1674,7 +1674,7 @@ void ImageInfo::setRating(int value)
     m_data->ratingCached = true;
 }
 
-void ImageInfo::setManualOrder(int value)
+void ImageInfo::setManualOrder(qlonglong value)
 {
     if (!m_data)
     {
diff --git a/core/libs/database/item/imageinfo.h b/core/libs/database/item/imageinfo.h
index 94b346db77..2b01e31901 100644
--- a/core/libs/database/item/imageinfo.h
+++ b/core/libs/database/item/imageinfo.h
@@ -470,7 +470,7 @@ public:
     /**
      * Set the manul sorting order for the item
      */
-    void setManualOrder(int value);
+    void setManualOrder(qlonglong value);
 
     /**
      * Set the orientation for the item
diff --git a/core/libs/database/item/imageinfocache.cpp b/core/libs/database/item/imageinfocache.cpp
index 0aebba6eeb..b41d754cbc 100644
--- a/core/libs/database/item/imageinfocache.cpp
+++ b/core/libs/database/item/imageinfocache.cpp
@@ -298,6 +298,11 @@ void ImageInfoCache::slotImageChanged(const ImageChangeset& changeset)
                 (*it)->fileSizeCached = false;
             }
 
+            if (changes & DatabaseFields::ManualOrder)
+            {
+                (*it)->manualOrderCached = false;
+            }
+
             if ((changes & DatabaseFields::Width) || (changes & DatabaseFields::Height))
             {
                 (*it)->imageSizeCached = false;
diff --git a/core/libs/database/item/imageinfodata.h b/core/libs/database/item/imageinfodata.h
index 42f1ef9089..c06d6b50fd 100644
--- a/core/libs/database/item/imageinfodata.h
+++ b/core/libs/database/item/imageinfodata.h
@@ -136,12 +136,12 @@ public:
     bool                   pickLabelCached        : 1;
     bool                   colorLabelCached       : 1;
     bool                   ratingCached           : 1;
-    bool                   manualOrderCached      : 1;
     bool                   categoryCached         : 1;
     bool                   formatCached           : 1;
     bool                   creationDateCached     : 1;
     bool                   modificationDateCached : 1;
     bool                   fileSizeCached         : 1;
+    bool                   manualOrderCached      : 1;
     bool                   uniqueHashCached       : 1;
     bool                   imageSizeCached        : 1;
     bool                   tagIdsCached           : 1;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic