[Digikam-devel] [Bug 152424] Workflow organizing : use Color Label Tags over icon view items

Gilles Caulier caulier.gilles at gmail.com
Tue Feb 1 08:44:13 GMT 2011


https://bugs.kde.org/show_bug.cgi?id=152424





--- Comment #50 from Gilles Caulier <caulier gilles gmail com>  2011-02-01 09:44:12 ---
SVN commit 1218201 by cgilles:

use Coor Label tags cache from TagsCache class


 M  +5 -40     tagsactionmngr.cpp
 M  +1 -3      tagsactionmngr.h


--- branches/extragear/graphics/digikam/core/digikam/tags/tagsactionmngr.cpp
#1218200:1218201
@@ -67,7 +67,7 @@
    {
    }

-    QMap<int, int>            colorLabelsMap;              // <color Id, tag
label Id from Db>
+
    QMultiMap<int, KAction*>  tagsActionMap;
    QList<KActionCollection*> actionCollectionList;
 };
@@ -96,39 +96,6 @@
    }
 }

-void TagsActionMngr::registerColorLabelTagsToDb()
-{
-    d->colorLabelsMap.insert(NoneLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelNone()));
-
-    d->colorLabelsMap.insert(RedLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelRed()));
-
-    d->colorLabelsMap.insert(OrangeLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelOrange()));
-
-    d->colorLabelsMap.insert(YellowLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelYellow()));
-
-    d->colorLabelsMap.insert(GreenLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelGreen()));
-
-    d->colorLabelsMap.insert(BlueLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelBlue()));
-
-    d->colorLabelsMap.insert(MagentaLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelMagenta()));
-
-    d->colorLabelsMap.insert(GrayLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelGray()));
-
-    d->colorLabelsMap.insert(BlackLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelBlack()));
-
-    d->colorLabelsMap.insert(WhiteLabel,
-                            
TagsCache::instance()->getOrCreateInternalTag(InternalTagName::colorLabelWhite()));
-}
-
 void TagsActionMngr::registerActionCollections()
 {
    d->actionCollectionList.append(DigikamApp::instance()->actionCollection());
@@ -168,15 +135,13 @@

    // Create Color Label shortcuts.

-    registerColorLabelTagsToDb();
-
    QMap<int, int>::const_iterator it;

    foreach(KActionCollection* ac, d->actionCollectionList)
    {
-        for (it = d->colorLabelsMap.begin() ; it != d->colorLabelsMap.end();
++it)
+        for (int i = NoneLabel ; i > WhiteLabel ; ++i)
        {
-            createColorLabelActionShortcut(ac, it.key(), it.value());
+            createColorLabelActionShortcut(ac, i);
        }
    }
 }
@@ -198,7 +163,7 @@
    return false;
 }

-bool TagsActionMngr::createColorLabelActionShortcut(KActionCollection* ac, int
colorId, int tagId)
+bool TagsActionMngr::createColorLabelActionShortcut(KActionCollection* ac, int
colorId)
 {
    if (ac)
    {
@@ -208,7 +173,7 @@
        action->setShortcut(KShortcut(QString("ALT+%1").arg(colorId)));
        action->setShortcutConfigurable(false);
        action->forgetGlobalShortcut();
-        action->setData(tagId);
+       
action->setData((int)(TagsCache::instance()->getTagForColorLabel((ColorLabel)colorId)));
        connect(action, SIGNAL(triggered()), this,
SLOT(slotAssignColorLabelFromShortcut()));
        return true;
    }
--- branches/extragear/graphics/digikam/core/digikam/tags/tagsactionmngr.h
#1218200:1218201
@@ -100,10 +100,8 @@
    void createActions();

    bool createRatingActionShortcut(KActionCollection* ac, int rating);
-    bool createColorLabelActionShortcut(KActionCollection* ac, int colorId,
int tagId);
+    bool createColorLabelActionShortcut(KActionCollection* ac, int colorId);

-    void registerColorLabelTagsToDb();
-
 private:

    static TagsActionMngr* m_defaultManager;

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Digikam-devel mailing list