9
|
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: bingplugin.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "t_bingplugin.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 |
// bingplugin::bingplugin()
|
|
32 |
// ---------------------------------------------------------------------------
|
|
33 |
//
|
|
34 |
bingplugin::bingplugin()
|
|
35 |
{
|
|
36 |
// Set up plugin settings
|
|
37 |
}
|
|
38 |
|
|
39 |
// ---------------------------------------------------------------------------
|
|
40 |
// bingplugin::~bingplugin()
|
|
41 |
// ---------------------------------------------------------------------------
|
|
42 |
//
|
|
43 |
bingplugin::~bingplugin()
|
|
44 |
{
|
|
45 |
}
|
|
46 |
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
// bingplugin::initialize()
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
void bingplugin::initializePlugin()
|
|
52 |
{
|
|
53 |
emit pluginInitialized(true);
|
|
54 |
}
|
|
55 |
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
// bingplugin::activate()
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
void bingplugin::activatePlugin()
|
|
61 |
{
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
// bingplugin::activate(const QString &)
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
void bingplugin::activatePlugin(const QString &searchQuery)
|
|
69 |
{
|
|
70 |
#ifdef __WINSCW__
|
|
71 |
HbDialog* popup = new HbDialog();
|
|
72 |
popup->setDismissPolicy(HbDialog::NoDismiss);
|
|
73 |
popup->setTimeout(HbDialog::NoTimeout);
|
|
74 |
QString str;
|
|
75 |
str.append("bing Search ");
|
|
76 |
str.append(searchQuery);
|
|
77 |
HbLabel *label = new HbLabel(str);
|
|
78 |
popup->setHeadingWidget(label);
|
|
79 |
HbAction * action = new HbAction(hbTrId("Back"), popup);
|
|
80 |
connect(action, SIGNAL(triggered()), this, SLOT(BackEvent()));
|
13
|
81 |
popup->addAction(action);
|
9
|
82 |
popup->show();
|
|
83 |
#else
|
|
84 |
QString url("http://www.bing.com/search?q=");
|
|
85 |
url.append(searchQuery);
|
|
86 |
url.append("&form=QBLH&qs=n&sk=");
|
|
87 |
QDesktopServices::openUrl(url);
|
|
88 |
#endif
|
|
89 |
}
|
|
90 |
void bingplugin::BackEvent()
|
|
91 |
{
|
|
92 |
emit handleBackEvent();
|
|
93 |
}
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// bingplugin::deactivate()
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
void bingplugin::deactivatePlugin()
|
|
99 |
{
|
|
100 |
// Destroy everything but the initial view and data that takes a long time
|
|
101 |
// to reacquire when the plugin is deactivated
|
|
102 |
}
|
|
103 |
|
|
104 |
// ---------------------------------------------------------------------------
|
|
105 |
// bingplugin::shutdown()
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
//
|
|
108 |
void bingplugin::shutdownPlugin()
|
|
109 |
{
|
|
110 |
// Destroy all views
|
|
111 |
emit shutdownCompleted(true);
|
|
112 |
}
|
|
113 |
|