|
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: googleplugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "t_googleplugin.h" |
|
19 |
|
20 #include <QDebug> |
|
21 #include <QGraphicsLayout> |
|
22 #include <QWidget> |
|
23 #include <QtWebKit/QGraphicsWebView> |
|
24 #include <QtGui/QApplication> |
|
25 #include <QGraphicsWidget> |
|
26 #include <hbdialog.h> |
|
27 #include <hbaction.h> |
|
28 #include <hblabel.h> |
|
29 #include <qdesktopservices.h> |
|
30 // --------------------------------------------------------------------------- |
|
31 // googleplugin::googleplugin() |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 googleplugin::googleplugin() |
|
35 { |
|
36 qDebug() << "googleplugin"; |
|
37 // Set up plugin settings |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // googleplugin::~googleplugin() |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 googleplugin::~googleplugin() |
|
45 { |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // googleplugin::initialize() |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void googleplugin::initializePlugin() |
|
53 { |
|
54 emit pluginInitialized(true); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // googleplugin::activate() |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 void googleplugin::activatePlugin() |
|
62 { |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // googleplugin::activate(const QString &) |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 void googleplugin::activatePlugin(const QString &searchQuery) |
|
70 { |
|
71 qDebug() << "search:activatePlugin" ; |
|
72 #ifdef __WINSCW__ |
|
73 qDebug() << "search:activatePlugin winscw" ; |
|
74 HbDialog* popup = new HbDialog(); |
|
75 popup->setDismissPolicy(HbDialog::NoDismiss); |
|
76 popup->setTimeout(HbDialog::NoTimeout); |
|
77 QString str; |
|
78 str.append(QString("google Search ")); |
|
79 str.append(searchQuery); |
|
80 HbLabel *label = new HbLabel(str); |
|
81 popup->setHeadingWidget(label); |
|
82 HbAction * action = new HbAction(hbTrId("Back"), popup); |
|
83 connect(action, SIGNAL(triggered()), this, SLOT(BackEvent())); |
|
84 popup->setPrimaryAction(action); |
|
85 popup->show(); |
|
86 #else |
|
87 qDebug() << "search:activatePlugin armvs" ; |
|
88 QString url("http://www.google.co.in/search?hl=en&source=hp&q="); |
|
89 url.append(searchQuery); |
|
90 url.append("&meta=&aq=f&aqi=g10&aql=&oq=&gs_rfai="); |
|
91 QDesktopServices::openUrl(url); |
|
92 #endif |
|
93 |
|
94 } |
|
95 void googleplugin::BackEvent() |
|
96 { |
|
97 emit handleBackEvent(); |
|
98 } |
|
99 // --------------------------------------------------------------------------- |
|
100 // googleplugin::deactivate() |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 void googleplugin::deactivatePlugin() |
|
104 { |
|
105 // Destroy everything but the initial view and data that takes a long time |
|
106 // to reacquire when the plugin is deactivated |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // googleplugin::shutdown() |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 void googleplugin::shutdownPlugin() |
|
114 { |
|
115 // Destroy all views |
|
116 emit shutdownCompleted(true); |
|
117 //return true; |
|
118 } |
|
119 |