|
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: Implementation of the SEARCH state provider |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "searchstateprovider.h" |
|
19 #include "searchprogressivestate.h" |
|
20 |
|
21 #include "searchinitstate.h" |
|
22 #include "searchsettingsstate.h" |
|
23 |
|
24 #include <qstate.h> |
|
25 #include <qdebug.h> |
|
26 |
|
27 // constants |
|
28 const char providerFileName[] = "searchstateprovider.dll"; |
|
29 const char initStateFileUri[] = "search.nokia.com/state/initstate"; |
|
30 // states |
|
31 const char wizardProgressiveStateUri[] = |
|
32 "search.nokia.com/state/wizardprogressivestate"; |
|
33 const char wizardSettingStateUri[] = |
|
34 "search.nokia.com/state/wizardsettingstate"; |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // searchStateProvider::searchStateProvider() |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 SearchStateProvider::SearchStateProvider() |
|
41 { |
|
42 mInitStateToken.mLibrary = providerFileName; |
|
43 mInitStateToken.mUri = initStateFileUri; |
|
44 |
|
45 mWizardMenuStateToken.mLibrary = providerFileName; |
|
46 mWizardMenuStateToken.mUri = wizardProgressiveStateUri; |
|
47 |
|
48 mWizardActivatedStateToken.mLibrary = providerFileName; |
|
49 mWizardActivatedStateToken.mUri = wizardSettingStateUri; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // SearchStateProvider::~SearchStateProvider() |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 SearchStateProvider::~SearchStateProvider() |
|
57 { |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // SearchStateProvider::states() |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 QList<HsStateToken> SearchStateProvider::states() |
|
65 { |
|
66 return QList<HsStateToken> () << mInitStateToken << mWizardMenuStateToken |
|
67 << mWizardActivatedStateToken; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // SearchStateProvider::createState(const StateToken& aToken) |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 QState* SearchStateProvider::createState(const HsStateToken& aToken) |
|
75 { |
|
76 |
|
77 if (aToken.mUri == mWizardMenuStateToken.mUri) |
|
78 { |
|
79 return new SearchProgressiveState(); |
|
80 } |
|
81 else if (aToken.mUri == mWizardActivatedStateToken.mUri) |
|
82 { |
|
83 return new SearchSettingsState(); |
|
84 } |
|
85 else if (aToken.mUri == mInitStateToken.mUri) |
|
86 { |
|
87 return new SearchInitState(); |
|
88 } |
|
89 |
|
90 qDebug() << "SEARCH: No state found for mUri: " << aToken.mUri; |
|
91 return NULL; |
|
92 |
|
93 } |
|
94 |
|
95 #ifdef COVERAGE_MEASUREMENT |
|
96 #pragma CTC SKIP |
|
97 #endif //COVERAGE_MEASUREMENT |
|
98 Q_EXPORT_PLUGIN2(SearchStateProvider, SearchStateProvider) |
|
99 #ifdef COVERAGE_MEASUREMENT |
|
100 #pragma CTC ENDSKIP |
|
101 #endif //COVERAGE_MEASUREMENT |
|
102 |