summaryrefslogtreecommitdiff
path: root/src/itemshortcut.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-03 15:48:02 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-03 15:48:02 +0300
commit2eb15d389f85e300cb124b990ebbf2663acaa637 (patch)
tree1016d973c9ca54b262b828daf462f07505c7fd4c /src/itemshortcut.cpp
parent9e4161f7324331498630fb25e72ff6d08c2db76f (diff)
downloadmv-2eb15d389f85e300cb124b990ebbf2663acaa637.tar.gz
mv-2eb15d389f85e300cb124b990ebbf2663acaa637.tar.bz2
mv-2eb15d389f85e300cb124b990ebbf2663acaa637.tar.xz
mv-2eb15d389f85e300cb124b990ebbf2663acaa637.zip
add support for drag and drop from/to shortcuts window.
Diffstat (limited to 'src/itemshortcut.cpp')
-rw-r--r--src/itemshortcut.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 499b8e5b8..0ca90e9be 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -202,8 +202,6 @@ void ItemShortcut::setItemSelected(const Item *const item)
{
if (item)
{
-// logger->log("set selected id: %d", item->getId());
-// logger->log("set selected color: %d", item->getColor());
mItemSelected = item->getId();
mItemColorSelected = item->getColor();
}
@@ -220,3 +218,28 @@ void ItemShortcut::setItem(const int index)
mItemColors[index] = mItemColorSelected;
save();
}
+
+void ItemShortcut::setItem(const int index, const int item,
+ const unsigned char color)
+{
+ mItems[index] = item;
+ mItemColors[index] = color;
+ save();
+}
+
+void ItemShortcut::swap(const int index1, const int index2)
+{
+ if (index1 < 0 || index2 < 0 || (unsigned int)index1 >= SHORTCUT_ITEMS
+ || (unsigned int)index2 >= SHORTCUT_ITEMS)
+ {
+ return;
+ }
+
+ const int tmpItem = mItems[index1];
+ mItems[index1] = mItems[index2];
+ mItems[index2] = tmpItem;
+ const unsigned char tmpColor = mItemColors[index1];
+ mItemColors[index1] = mItemColors[index2];
+ mItemColors[index2] = tmpColor;
+ save();
+}