equal
deleted
inserted
replaced
17 |
17 |
18 #include <QStateMachine> |
18 #include <QStateMachine> |
19 #include "hsshortcutservice.h" |
19 #include "hsshortcutservice.h" |
20 #include "hsshortcutservice_p.h" |
20 #include "hsshortcutservice_p.h" |
21 #include "hsdatabase.h" |
21 #include "hsdatabase.h" |
22 #include "hswidgetdata.h" |
22 #include "hsdomainmodeldatastructures.h" |
23 #include "hsmenueventfactory.h" |
23 #include "hsmenueventfactory.h" |
24 |
24 |
25 namespace |
25 namespace |
26 { |
26 { |
27 const char SHORTCUT_ID[] = "mcsId"; |
27 const char gShortcutId[] = "mcsId"; |
28 const char SHORTCUT_WIDGET_URI[] = "hsshortcutwidgetplugin"; |
28 const char gShortcutWidgetUri[] = "hsshortcutwidgetplugin"; |
29 } |
29 } |
30 |
30 |
31 HsShortcutServicePrivate::HsShortcutServicePrivate(QStateMachine *stateMachine, QObject *parent) |
31 HsShortcutServicePrivate::HsShortcutServicePrivate(QStateMachine *stateMachine, QObject *parent) |
32 : QObject(parent), |
32 : QObject(parent), |
33 mStateMachine(stateMachine) |
33 mStateMachine(stateMachine) |
50 bool HsShortcutServicePrivate::isItemShortcutWidget(int itemId) |
50 bool HsShortcutServicePrivate::isItemShortcutWidget(int itemId) |
51 { |
51 { |
52 HsDatabase *db = HsDatabase::instance(); |
52 HsDatabase *db = HsDatabase::instance(); |
53 Q_ASSERT(db); |
53 Q_ASSERT(db); |
54 |
54 |
55 QList<int> ids; |
55 QList<HsWidgetData> widgetDatas; |
56 if (db->widgetIds(SHORTCUT_WIDGET_URI, ids)) { |
56 if (db->widgets(gShortcutWidgetUri, widgetDatas)) { |
57 for (int i = 0; i < ids.count(); ++i) { |
57 for (int i = 0; i < widgetDatas.count(); ++i) { |
58 QString id; |
58 QVariant id; |
59 if (db->widgetPreferenceForKey(ids.at(i), SHORTCUT_ID, id) |
59 if (db->widgetPreference(widgetDatas.at(i).id, gShortcutId, id) && |
60 && id.toInt() == itemId) { |
60 id.toInt() == itemId) { |
61 return true; |
61 return true; |
62 } |
62 } |
63 } |
63 } |
64 } |
64 } |
65 return false; |
65 return false; |