summaryrefslogtreecommitdiff
path: root/src/gui/shortcut
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/shortcut')
-rw-r--r--src/gui/shortcut/itemshortcut.cpp10
-rw-r--r--src/gui/shortcut/itemshortcut.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/shortcut/itemshortcut.cpp b/src/gui/shortcut/itemshortcut.cpp
index 7b9bab6e6..2f80f6759 100644
--- a/src/gui/shortcut/itemshortcut.cpp
+++ b/src/gui/shortcut/itemshortcut.cpp
@@ -277,3 +277,13 @@ void ItemShortcut::swap(const int index1, const int index2)
mItemData[index2] = tmpData;
save();
}
+
+size_t ItemShortcut::getFreeIndex() const
+{
+ for (size_t i = 0; i < SHORTCUT_ITEMS; i++)
+ {
+ if (mItems[i] < 0)
+ return i;
+ }
+ return -1;
+}
diff --git a/src/gui/shortcut/itemshortcut.h b/src/gui/shortcut/itemshortcut.h
index b7ea160a7..15324d30c 100644
--- a/src/gui/shortcut/itemshortcut.h
+++ b/src/gui/shortcut/itemshortcut.h
@@ -168,6 +168,8 @@ class ItemShortcut final
void clear();
+ size_t getFreeIndex() const A_WARN_UNUSED;
+
private:
int mItems[SHORTCUT_ITEMS]; /**< The items. */
ItemColor mItemColors[SHORTCUT_ITEMS]; /**< The item colors. */