|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Entry point for shortcut widget |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QStateMachine> |
|
19 |
|
20 #include "hsshortcutservice.h" |
|
21 #include "hsshortcutservice_p.h" |
|
22 #include "hscontentservice.h" |
|
23 #include "hsmenueventfactory.h" |
|
24 #include "hspage.h" |
|
25 #include "hsdomainmodeldatastructures.h" |
|
26 |
|
27 #include "canotifier.h" |
|
28 #include "canotifierfilter.h" |
|
29 #include "caservice.h" |
|
30 |
|
31 |
|
32 HsShortcutService *HsShortcutService::mInstance(0); |
|
33 |
|
34 HsShortcutServicePrivate::HsShortcutServicePrivate( |
|
35 QStateMachine* aStateMachine, |
|
36 QObject *parent) |
|
37 : QObject(parent), |
|
38 mStateMachine(aStateMachine) |
|
39 { |
|
40 } |
|
41 // --------------------------------------------------------------------------- |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 HsShortcutServicePrivate::~HsShortcutServicePrivate() |
|
45 { |
|
46 |
|
47 } |
|
48 |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 void HsShortcutServicePrivate::executeCollectionAction(int shortcutId, |
|
54 const QString& collectionType) |
|
55 { |
|
56 QEvent* menuEvent = HsMenuEventFactory::createOpenCollectionEvent( |
|
57 shortcutId, collectionType); |
|
58 mStateMachine->postEvent(menuEvent); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 bool HsShortcutServicePrivate::isItemShortcutWidget(int aItemId) |
|
65 { |
|
66 Q_UNUSED(aItemId); |
|
67 return false; |
|
68 } |
|
69 |
|
70 HsShortcutService *HsShortcutService::instance(QStateMachine* machine) |
|
71 { |
|
72 if(!mInstance && machine) { |
|
73 mInstance = new HsShortcutService(machine); |
|
74 } |
|
75 return mInstance; |
|
76 } |
|
77 |
|
78 |
|
79 |
|
80 /*! |
|
81 Contructor |
|
82 |
|
83 \a aManifestFileWithPath e.g c:/foo/bar/shortcutwidget.manifest |
|
84 \a aContentService Pointer to content service. |
|
85 \a aContentStore Pointer to content store. |
|
86 \a aMcsService Pointer to mcs service. |
|
87 \a aStateMachine Pointer to state machine to post events. |
|
88 \a parent Parent object. |
|
89 */ |
|
90 HsShortcutService::HsShortcutService( |
|
91 QStateMachine* aStateMachine, |
|
92 QObject *parent) |
|
93 : QObject(parent) |
|
94 { |
|
95 mD.reset(new HsShortcutServicePrivate(aStateMachine)); |
|
96 } |
|
97 |
|
98 /*! |
|
99 Destructor |
|
100 */ |
|
101 HsShortcutService::~HsShortcutService() |
|
102 { |
|
103 |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void HsShortcutService::executeCollectionAction(int shortcutId, |
|
110 const QString &collectionType) |
|
111 { |
|
112 mD->executeCollectionAction(shortcutId, collectionType); |
|
113 } |
|
114 |
|
115 bool HsShortcutService::isItemShortcutWidget(int aItemId) |
|
116 { |
|
117 return mD->isItemShortcutWidget(aItemId); |
|
118 } |