}
+//static
+KeyMap::ItemType PrefShortcuts::itemType(QTreeWidgetItem & item)
+{
+ return static_cast<KeyMap::ItemType>(item.data(0, Qt::UserRole).toInt());
+}
+
+
void PrefShortcuts::setItemType(QTreeWidgetItem * item, KeyMap::ItemType tag)
{
item->setData(0, Qt::UserRole, QVariant(tag));
if (items.isEmpty())
return;
- KeyMap::ItemType tag =
- static_cast<KeyMap::ItemType>(items[0]->data(0, Qt::UserRole).toInt());
- if (tag == KeyMap::UserUnbind)
+ if (itemType(*items[0]) == KeyMap::UserUnbind)
removePB->setText(qt_("Res&tore"));
else
removePB->setText(qt_("Remo&ve"));
string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString());
string lfun = fromqstr(items[i]->text(0));
FuncRequest func = lyxaction.lookupFunc(lfun);
- KeyMap::ItemType tag =
- static_cast<KeyMap::ItemType>(items[i]->data(0, Qt::UserRole).toInt());
- switch (tag) {
+ switch (itemType(*items[i])) {
case KeyMap::System: {
// for system bind, we do not touch the item
// but add an user unbind item
string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString());
string lfun = fromqstr(items[i]->text(0));
FuncRequest func = lyxaction.lookupFunc(lfun);
- KeyMap::ItemType tag =
- static_cast<KeyMap::ItemType>(items[i]->data(0, Qt::UserRole).toInt());
- switch (tag) {
+ switch (itemType(*items[i])) {
case KeyMap::System:
// for system bind, we do not touch the item
// but add an user unbind item