|
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: Search application main class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "Search.h" |
|
19 #include "hsruntime.h" |
|
20 #include "hsruntimefactory.h" |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // Search::Search |
|
24 // --------------------------------------------------------------------------- |
|
25 // |
|
26 Search::Search(QObject* aParent) : |
|
27 QObject(aParent), mRuntime(NULL) |
|
28 { |
|
29 SEARCH_FUNC_ENTRY("SEARCH::Search::Search"); |
|
30 |
|
31 HsRuntimeFactory factory("searchresources/plugins/runtimeproviders", |
|
32 "searchresources/plugins/runtimeproviders"); |
|
33 |
|
34 HsRuntimeToken token; |
|
35 token.mLibrary = "searchruntimeprovider.dll"; |
|
36 token.mUri = "search.nokia.com/runtime/defaultruntime"; |
|
37 |
|
38 mRuntime = factory.createRuntime(token); |
|
39 if (mRuntime) |
|
40 { |
|
41 mRuntime->setParent(this); |
|
42 connect(mRuntime, SIGNAL(started()), SLOT(handleRuntimeStarted())); |
|
43 connect(mRuntime, SIGNAL(stopped()), SLOT(handleRuntimeStopped())); |
|
44 connect(mRuntime, SIGNAL(faulted()), SLOT(handleRuntimeFaulted())); |
|
45 } |
|
46 |
|
47 SEARCH_FUNC_EXIT("SEARCH::Search::Search"); |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // Search::~Search() |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 Search::~Search() |
|
55 { |
|
56 if (mRuntime) |
|
57 { |
|
58 disconnect(mRuntime, SIGNAL(started()), this, |
|
59 SLOT(handleRuntimeStarted())); |
|
60 disconnect(mRuntime, SIGNAL(stopped()), this, |
|
61 SLOT(handleRuntimeStopped())); |
|
62 disconnect(mRuntime, SIGNAL(faulted()), this, |
|
63 SLOT(handleRuntimeFaulted())); |
|
64 |
|
65 delete mRuntime; |
|
66 } |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // Search::start() |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void Search::start() |
|
74 { |
|
75 SEARCH_FUNC_ENTRY("SEARCH::Search::start"); |
|
76 |
|
77 if (mRuntime) |
|
78 { |
|
79 mRuntime->start(); |
|
80 } |
|
81 else |
|
82 { |
|
83 emit exit(); |
|
84 } |
|
85 |
|
86 SEARCH_FUNC_EXIT("SEARCH::Search::start"); |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // Search::stop() |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 void Search::stop() |
|
94 { |
|
95 SEARCH_FUNC_ENTRY("SEARCH::Search::stop"); |
|
96 |
|
97 mRuntime->stop(); |
|
98 |
|
99 SEARCH_FUNC_EXIT("SEARCH::Search::stop"); |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // Search::handleRuntimeStarted() |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 void Search::handleRuntimeStarted() |
|
107 { |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // Search::handleRuntimeStopped() |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 void Search::handleRuntimeStopped() |
|
115 { |
|
116 emit exit(); |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // Search::handleRuntimeFaulted() |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 void Search::handleRuntimeFaulted() |
|
124 { |
|
125 emit exit(); |
|
126 } |