author | hgs |
Fri, 15 Oct 2010 17:30:59 -0400 | |
changeset 16 | 3c88a81ff781 |
parent 14 | 6aeb7a756187 |
permissions | -rw-r--r-- |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
3 | 4 |
* |
5 |
* This program is free software: you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU Lesser General Public License as published by |
|
7 |
* the Free Software Foundation, version 2.1 of the License. |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
3 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU Lesser General Public License for more details. |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
3 | 14 |
* You should have received a copy of the GNU Lesser General Public License |
15 |
* along with this program. If not, |
|
16 |
* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
* |
3 | 18 |
* Description: |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
* |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
*/ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include "UrlSearchSnippet.h" |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include "Utilities.h" |
16 | 24 |
#include "UiUtil.h" |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include "ChromeRenderer.h" |
3 | 26 |
#include "ChromeLayout.h" |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include "ChromeWidget.h" |
3 | 28 |
#include "PageSnippet.h" |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include "ViewController.h" |
3 | 30 |
#include "ViewStack.h" |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include "WebChromeSnippet.h" |
3 | 32 |
#include "LoadController.h" |
33 |
#include "webpagecontroller.h" |
|
34 |
#include "GWebContentView.h" |
|
35 |
#include "WindowFlowView.h" |
|
16 | 36 |
#ifdef BROWSER_LAYOUT_TENONE |
37 |
#include "secureuicontroller.h" |
|
38 |
#endif |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
|
12 | 40 |
|
3 | 41 |
#include <QWebHistoryItem> |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
namespace GVA { |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
|
16 | 45 |
#define GO_BUTTON_ICON ":/urlsearch/go_btn.png" |
46 |
#define STOP_BUTTON_ICON ":/urlsearch/stop_btn.png" |
|
47 |
#define SPECIFIC_BUTTON_ICON ":/urlsearch/com.svg" |
|
9 | 48 |
#define SPECIFIC_BUTTON_STRING ".com" |
3 | 49 |
#define BETWEEN_ENTRY_AND_BUTTON_SPACE 4 |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
|
16 | 51 |
#ifdef BROWSER_LAYOUT_TENONE |
52 |
#define URL_TITLE_IND_BUTTON_ICON ":/urlsearch/url_title_ind_btn.png" |
|
53 |
#define URL_TITLE_IND_SECURE_BUTTON_ICON ":/urlsearch/url_title_ind_btn_secure.png" |
|
54 |
#endif |
|
55 |
||
12 | 56 |
static const QString KBookmarkHistoryViewName = "BookmarkHistoryView"; |
57 |
static const QString KBookmarkTreeViewName = "BookmarkTreeView"; |
|
58 |
static const QString KWindowViewName = "WindowView"; |
|
59 |
static const QString KSettingsViewName = "SettingsView"; |
|
60 |
||
61 |
//#define VBORDER_GRADIENT_START "#292929" |
|
62 |
//#define VBORDER_GRADIENT_STOP "#535354" |
|
63 |
//#define VBORDER_GRADIENT_END "#020202" |
|
64 |
||
3 | 65 |
GUrlSearchItem::GUrlSearchItem(ChromeSnippet * snippet, ChromeWidget * chrome, QGraphicsItem * parent) |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
: NativeChromeItem(snippet, parent) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
, m_chrome(chrome) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
, m_viewPortWidth(0.0) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
, m_viewPortHeight(0.0) |
3 | 70 |
, m_pendingClearCalls(0) |
71 |
, m_backFromNewWinTrans(false) |
|
72 |
, m_justFocusIn(false) |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
// Extract style information from element CSS. |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
75 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
// For border-related properties, we constrain all values (top, left, etc.) |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
// to be the same. These can be set using the css shorthand (e.g. padding:10px), |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
// but the computed css style will be for the four primitive values (padding-top, |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
// padding-left) etc, which will all be equal. Hence we just use one of the |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
// computed primitive values (top) to represent the common value. |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
|
12 | 82 |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
83 |
QWebElement we = m_snippet->element(); |
12 | 84 |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
85 |
QString cssPadding = we.styleProperty("padding-top", QWebElement::ComputedStyle); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
86 |
m_padding = cssPadding.remove("px").toInt(); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
QString cssBorder = we.styleProperty("border-top-width", QWebElement::ComputedStyle); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
m_border = cssBorder.remove("px").toInt(); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
|
3 | 91 |
// Create the view port widget |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
m_viewPort = new QGraphicsWidget(this); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
m_viewPort->setFlags(QGraphicsItem::ItemClipsChildrenToShape); |
12 | 94 |
|
16 | 95 |
createEditor(); |
96 |
createIcons(); |
|
97 |
||
3 | 98 |
// Update state as soon as chrome completes loading. |
99 |
safe_connect(m_chrome, SIGNAL(chromeComplete()), |
|
100 |
this, SLOT(onChromeComplete())); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
|
12 | 102 |
#ifndef BROWSER_LAYOUT_TENONE |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
// Monitor resize events. |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
safe_connect(m_chrome->renderer(), SIGNAL(chromeResized()), |
12 | 105 |
this, SLOT(resize())); |
106 |
#endif |
|
3 | 107 |
|
108 |
/* safe_connect(ViewStack::getSingleton(), SIGNAL(currentViewChanged()), |
|
109 |
this, SLOT(viewChanged()));*/ |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
110 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
111 |
|
3 | 112 |
GUrlSearchItem::~GUrlSearchItem() |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
113 |
{ |
12 | 114 |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
|
3 | 117 |
|
118 |
void GUrlSearchItem::resizeEvent(QGraphicsSceneResizeEvent * event) |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
{ |
3 | 120 |
QSizeF size = event->newSize(); |
121 |
||
122 |
m_viewPortWidth = size.width() - m_padding * 2; |
|
123 |
m_viewPortHeight = size.height() - m_padding * 2; |
|
124 |
||
125 |
m_viewPort->setGeometry( |
|
126 |
m_padding, |
|
127 |
m_padding, |
|
128 |
m_viewPortWidth, |
|
129 |
m_viewPortHeight); |
|
16 | 130 |
|
131 |
changeLayout(m_urlSearchBtn->isVisible()); |
|
132 |
} |
|
3 | 133 |
|
16 | 134 |
//TODO: Shouldn't have to explicitly set the viewport sizes here |
135 |
void GUrlSearchItem::changeLayout(const bool isSearch) |
|
136 |
{ |
|
137 |
||
138 |
#ifdef BROWSER_LAYOUT_TENONE |
|
139 |
qreal searchBtnWidth = (isSearch) ? m_buttonIconWidth : 0; |
|
140 |
qreal titleIndBtnWidth = (m_urlTitleIndBtn->isVisible() || m_urlTitleIndSecureBtn->isVisible()) ? m_buttonIconWidth : 0; |
|
141 |
||
142 |
m_urlTitleIndBtn->setGeometry(0, |
|
143 |
(m_viewPortHeight - m_buttonIconHeight)/2, |
|
144 |
titleIndBtnWidth, |
|
145 |
m_buttonIconHeight); |
|
146 |
||
147 |
m_urlTitleIndSecureBtn->setGeometry(0, |
|
148 |
(m_viewPortHeight - m_buttonIconHeight)/2, |
|
149 |
titleIndBtnWidth, |
|
150 |
m_buttonIconHeight); |
|
151 |
||
152 |
// NOTE: removed padding for the x coordinate since too much separation was introduced |
|
153 |
m_urlSearchBtn->setGeometry( |
|
154 |
m_viewPortWidth - searchBtnWidth, |
|
155 |
(m_viewPortHeight - m_buttonIconHeight)/2, |
|
156 |
searchBtnWidth, |
|
157 |
m_buttonIconHeight); |
|
158 |
||
159 |
m_urlSearchEditor->setRightTextMargin(m_buttonIconWidth); |
|
160 |
m_urlSearchEditor->setGeometry(titleIndBtnWidth, |
|
161 |
0, |
|
162 |
m_viewPortWidth - titleIndBtnWidth, |
|
163 |
m_viewPortHeight); |
|
164 |
||
165 |
#else |
|
166 |
qreal searchBtnWidth = m_buttonIconWidth; |
|
3 | 167 |
|
168 |
m_urlSearchBtn->setGeometry( |
|
16 | 169 |
m_viewPortWidth - searchBtnWidth - m_padding/2, |
170 |
(m_viewPortHeight - m_buttonIconHeight)/2, |
|
171 |
searchBtnWidth, |
|
172 |
m_buttonIconHeight); |
|
173 |
||
3 | 174 |
m_urlSearchEditor->setGeometry(0, |
175 |
0, |
|
176 |
m_viewPortWidth, |
|
177 |
m_viewPortHeight); |
|
16 | 178 |
|
179 |
#endif |
|
180 |
||
181 |
} |
|
182 |
||
183 |
void GUrlSearchItem::onContextEvent(bool isContentSelected) |
|
184 |
{ |
|
185 |
// dismiss suggest snippet |
|
186 |
PageSnippet * suggestSnippet = qobject_cast<PageSnippet*>(m_chrome->getSnippet("SuggestsChromeId")); |
|
187 |
if (suggestSnippet) { |
|
188 |
QString cmd = "searchSuggests.hideSuggests();"; |
|
189 |
suggestSnippet->evaluateJavaScript(cmd); |
|
190 |
} |
|
191 |
emit contextEvent(isContentSelected); |
|
192 |
} |
|
193 |
||
194 |
#ifdef BROWSER_LAYOUT_TENONE |
|
195 |
void GUrlSearchItem::layoutToEditMode(const bool editMode) |
|
196 |
{ |
|
197 |
m_urlSearchBtn->setVisible(editMode); |
|
198 |
m_urlSearchEditor->changeEditorMode(editMode); |
|
199 |
changeLayout(editMode); |
|
200 |
} |
|
201 |
#endif |
|
202 |
||
203 |
void GUrlSearchItem::urlSearchActivatedByEnterKey() |
|
204 |
{ |
|
205 |
m_urlSearchEditor->removeFocus(); |
|
206 |
urlSearchActivated(); |
|
3 | 207 |
} |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
|
3 | 209 |
void GUrlSearchItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) |
210 |
{ |
|
211 |
Q_UNUSED(option); |
|
212 |
Q_UNUSED(widget); |
|
213 |
||
214 |
painter->save(); |
|
215 |
painter->setRenderHint(QPainter::Antialiasing); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
|
3 | 217 |
if (m_padding > 0 || m_border > 0) { |
218 |
QPainterPath border; |
|
219 |
border.addRect(boundingRect()); |
|
220 |
border.addRoundedRect( |
|
221 |
m_padding, |
|
222 |
m_padding, |
|
223 |
m_viewPortWidth, |
|
224 |
m_viewPortHeight, |
|
225 |
4, |
|
226 |
4); |
|
227 |
||
228 |
if (m_padding > 0) { |
|
229 |
painter->fillPath(border, m_borderColor); |
|
230 |
} |
|
231 |
||
232 |
if (m_border > 0) { |
|
233 |
QPen pen; |
|
234 |
pen.setWidth(m_border); |
|
235 |
pen.setBrush(m_borderColor); |
|
236 |
painter->setPen(pen); |
|
237 |
painter->drawPath(border); |
|
238 |
} |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
240 |
|
3 | 241 |
painter->restore(); |
16 | 242 |
#ifndef BROWSER_LAYOUT_TENONE |
3 | 243 |
NativeChromeItem::paint(painter, option, widget); |
16 | 244 |
#endif |
12 | 245 |
|
246 |
} |
|
247 |
||
248 |
#ifdef BROWSER_LAYOUT_TENONE |
|
249 |
void GUrlSearchItem::changeToUrl(QPointF& pos) |
|
250 |
{ |
|
251 |
ViewController * viewController = m_chrome->viewController(); |
|
16 | 252 |
ControllableViewBase* curView = viewController->currentView(); |
12 | 253 |
|
16 | 254 |
if( curView && curView->type() == "webView" ) { |
12 | 255 |
emit changeEditMode(true); |
16 | 256 |
layoutToEditMode(true); |
12 | 257 |
m_urlSearchEditor->grabFocus(); |
258 |
tapped(pos); |
|
259 |
m_urlSearchEditor->openVKB(); |
|
16 | 260 |
} |
12 | 261 |
} |
262 |
||
263 |
void GUrlSearchItem::changeToTitle() |
|
264 |
{ |
|
265 |
emit changeEditMode(false); |
|
16 | 266 |
layoutToEditMode(false); |
12 | 267 |
} |
268 |
||
269 |
#endif |
|
270 |
||
271 |
void GUrlSearchItem::onContentMouseEvent(QEvent::Type type ) |
|
272 |
{ |
|
273 |
||
274 |
//qDebug() << "UrlSearchItem::onContentMouseEvent" << type; |
|
275 |
// We are dismissing the VKB on mouse release so that if the mouse press was on a link |
|
276 |
// we will not close VKB that might cause a shift in geometry which can potentially prevent |
|
277 |
// the link from being selected |
|
278 |
if ((WebPageController::getSingleton()->editMode()) && (type == QEvent::GraphicsSceneMouseRelease)) { |
|
279 |
// Edit canceled, so update LoadController state |
|
280 |
changeLoadState(false); |
|
281 |
||
282 |
m_urlSearchEditor->closeVKB(); |
|
283 |
||
284 |
#ifdef BROWSER_LAYOUT_TENONE |
|
285 |
if (! WebPageController::getSingleton()->isPageLoading()) |
|
286 |
changeToTitle(); |
|
287 |
// Set the text to the url of page |
|
288 |
setUrlText(urlToBeDisplayed()); |
|
289 |
#endif |
|
290 |
} |
|
291 |
||
3 | 292 |
} |
293 |
||
294 |
void GUrlSearchItem::onChromeComplete() |
|
295 |
{ |
|
12 | 296 |
WebPageController * pageController = WebPageController::getSingleton(); |
297 |
||
298 |
safe_connect(pageController, SIGNAL(pageUrlChanged(const QString)), |
|
299 |
this, SLOT(setUrlText(const QString &))) |
|
300 |
||
301 |
safe_connect(pageController, SIGNAL(pageLoadStarted()), |
|
302 |
this, SLOT(setStarted())); |
|
303 |
||
304 |
safe_connect(pageController, SIGNAL(pageLoadProgress(const int)), |
|
305 |
this, SLOT(setProgress(int))); |
|
306 |
||
307 |
safe_connect(pageController, SIGNAL(pageLoadFinished(bool)), |
|
308 |
this, SLOT(setFinished(bool))); |
|
309 |
||
310 |
safe_connect(pageController, SIGNAL(pageCreated(WRT::WrtBrowserContainer*)), |
|
311 |
this, SLOT(setPageCreated())); |
|
312 |
||
313 |
safe_connect(pageController, SIGNAL(pageChanged(WRT::WrtBrowserContainer*, WRT::WrtBrowserContainer*)), |
|
314 |
this, SLOT(setPageChanged())); |
|
315 |
||
316 |
safe_connect(pageController, SIGNAL(pageLoadFailed()), |
|
317 |
this, SLOT(setPageFailed())); |
|
318 |
#ifdef BROWSER_LAYOUT_TENONE |
|
16 | 319 |
safe_connect(pageController, SIGNAL(titleChanged(const QString&)), this, SLOT(onTitleChange(const QString&))); |
320 |
||
321 |
// Check for secure URL state change to change between the url and lock indicator icons in the url title indicator button |
|
322 |
safe_connect(pageController, SIGNAL(showSecureIcon(bool)), |
|
323 |
this, SLOT(showSecureIcon(bool))); |
|
12 | 324 |
#endif |
16 | 325 |
|
12 | 326 |
// Monitor view changes. |
327 |
||
328 |
ViewController * viewController = m_chrome->viewController(); |
|
16 | 329 |
|
330 |
safe_connect(viewController, SIGNAL(currentViewChanged(ControllableViewBase *)), |
|
331 |
this, SLOT(viewChanged(ControllableViewBase *))); |
|
12 | 332 |
|
333 |
GWebContentView* webView = static_cast<GWebContentView*> (m_chrome->getView("WebView")); |
|
334 |
safe_connect(webView, SIGNAL(contentViewMouseEvent(QEvent::Type )), this, SLOT(onContentMouseEvent(QEvent::Type ))); |
|
335 |
||
336 |
||
3 | 337 |
setStarted(); |
16 | 338 |
#ifndef Q_WS_MAEMO_5 |
3 | 339 |
WRT::WindowFlowView* windowView = static_cast<WRT::WindowFlowView *>(m_chrome->viewController()->view("WindowView")); |
340 |
safe_connect(windowView, SIGNAL(newWindowTransitionComplete()), this, SLOT(onNewWindowTransitionComplete())); |
|
16 | 341 |
#endif |
3 | 342 |
PageSnippet * suggestSnippet = qobject_cast<PageSnippet*>(m_chrome->getSnippet("SuggestsChromeId")); |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
|
3 | 344 |
// instantiate items needed to display suggest page snippet |
345 |
if (suggestSnippet) { |
|
346 |
suggestSnippet->instantiate(); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
|
3 | 350 |
void GUrlSearchItem::setStarted() |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
351 |
{ |
3 | 352 |
WebPageController * pageController = WebPageController::getSingleton(); |
353 |
ViewController * viewController = m_chrome->viewController(); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
354 |
|
12 | 355 |
#ifdef BROWSER_LAYOUT_TENONE |
16 | 356 |
showSecureIcon(false); |
12 | 357 |
emit changeEditMode(false); |
16 | 358 |
layoutToEditMode(true); |
12 | 359 |
#endif |
360 |
||
361 |
QString url = pageController->currentRequestedUrl(); |
|
362 |
if(!url.contains(KBOOKMARKURLFILESLASH)){ |
|
363 |
if(url.contains(KBOOKMARKURLFILE)) |
|
364 |
url.replace(QString(KBOOKMARKURLFILE), QString(KBOOKMARKURLFILESLASH)); |
|
365 |
} |
|
366 |
setUrlText(url); |
|
3 | 367 |
ControllableViewBase* curView = viewController->currentView(); |
368 |
if (curView && curView->type() == "webView") { |
|
369 |
GWebContentView * gView = qobject_cast<GWebContentView*> (curView); |
|
370 |
bool isSuperPage = gView ? gView->currentPageIsSuperPage() : false; |
|
371 |
if(!isSuperPage) |
|
12 | 372 |
m_chrome->layout()->slideView(100); |
3 | 373 |
} |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
374 |
// Strictly speaking we should set progress to 0. |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
375 |
// But set it higher to give immediate visual feedback |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
376 |
// that something is happening. |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
377 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
378 |
int progress = 0; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
379 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
380 |
if (pageController->isPageLoading()) { |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
381 |
progress = 5; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
382 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
383 |
|
3 | 384 |
m_urlSearchEditor->setProgress(progress); |
385 |
updateUrlSearchBtn(); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
386 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
387 |
|
3 | 388 |
void GUrlSearchItem::setProgress(int percent) |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
389 |
{ |
16 | 390 |
ViewController * viewController = m_chrome->viewController(); |
391 |
ControllableViewBase* curView = viewController->currentView(); |
|
392 |
if ( curView && curView->type() == "webView" && m_urlSearchEditor ) |
|
393 |
m_urlSearchEditor->setProgress(percent); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
394 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
395 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
396 |
// Wait a half-second before actually clearing the progress bar. |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
397 |
// |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
398 |
// We have to be careful of the following two use cases: |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
399 |
// |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
400 |
// 1. Another page starts loading between the call to setFinished() |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
401 |
// and the scheduled call to clearProgress(). |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
402 |
// |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
// We don't want to clear the progress bar if another page is |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
// loading. WebPageController::isPageLoading() can tell us |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
// if that is the case. |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
406 |
// |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
407 |
// 2. Another page finishes loading between the call to setFinished() |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
408 |
// and the scheduled call to clearProgress(). The sequence here is: |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
409 |
// |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
410 |
// setFinished(ok) // for URL #1 |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
411 |
// setFinished(ok) // for URL #2 |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
412 |
// clearProgress() // for URL #1 |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
413 |
// clearProgress() // for URL #2 |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
414 |
// |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
415 |
// We don't want to clear the progress bar in the first call to |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
416 |
// clearProgress() because we want the progress bar to retain its |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
417 |
// appearance for the full timeout period. We manage this by |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
// tracking the number of pending calls to clearProgress() and |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
419 |
// only clearing the progress bar when that number becomes 0. |
3 | 420 |
void GUrlSearchItem::setFinished(bool ok) |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
421 |
{ |
3 | 422 |
WebPageController * pageController = WebPageController::getSingleton(); |
12 | 423 |
ViewController * viewController = m_chrome->viewController(); |
16 | 424 |
ControllableViewBase* curView = viewController->currentView(); |
12 | 425 |
//qDebug() << "GUrlSearchItem::setFinished" << pageController->loadState(); |
426 |
||
427 |
if (pageController->loadState() != WRT::LoadController::GotoModeEditing) { |
|
428 |
m_urlSearchEditor->removeFocus(); |
|
429 |
||
430 |
if ( ok && curView && curView->type() == "webView" ){ |
|
431 |
setUrlText(formattedUrl()); |
|
432 |
#ifdef BROWSER_LAYOUT_TENONE |
|
433 |
m_urlSearchEditor->setTitle(currentTitle()); |
|
434 |
#endif |
|
435 |
} |
|
436 |
if (curView && curView->type() == "webView" && pageController->contentsYPos() > 0) |
|
437 |
m_chrome->layout()->slideView(-100); |
|
438 |
} |
|
439 |
||
3 | 440 |
// If the load was finished normally and not due to user stopping it, |
441 |
// simulate progress completion |
|
12 | 442 |
if ( !pageController->loadCanceled() && curView && curView->type() == "webView" ) |
3 | 443 |
m_urlSearchEditor->setProgress(100); |
444 |
||
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
445 |
++m_pendingClearCalls; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
446 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
447 |
QTimer::singleShot(500, this, SLOT(clearProgress())); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
448 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
449 |
|
12 | 450 |
void GUrlSearchItem::setPageFailed() |
451 |
{ |
|
452 |
WebPageController * pageController = WebPageController::getSingleton(); |
|
16 | 453 |
LoadController * loadController = pageController->currentPage()->loadController(); |
12 | 454 |
if( loadController->loadCanceled() && !loadController->pointOfNoReturn() ) |
455 |
{ |
|
16 | 456 |
setUrlText(loadController->urlText()); |
12 | 457 |
} |
458 |
else |
|
459 |
{ |
|
16 | 460 |
setUrlText(formattedUrl()); |
461 |
} |
|
462 |
#ifdef BROWSER_LAYOUT_TENONE |
|
463 |
m_urlSearchEditor->setTitle(currentTitle()); |
|
464 |
#endif |
|
12 | 465 |
} |
16 | 466 |
|
3 | 467 |
void GUrlSearchItem::setPageCreated() |
468 |
{ |
|
469 |
// remove slideview(100) since the new transition for the code-driven window |
|
470 |
//m_chrome->layout()->slideView(100); |
|
16 | 471 |
#ifdef Q_WS_MAEMO_5 |
472 |
setProgress(0); // no progress bar in new window shall be left from previous windows |
|
473 |
#endif |
|
3 | 474 |
} |
475 |
||
476 |
void GUrlSearchItem::setPageChanged() |
|
477 |
{ |
|
12 | 478 |
setUrlText(formattedUrl()); |
3 | 479 |
updateUrlSearchBtn(); |
12 | 480 |
WebPageController * pageController = WebPageController::getSingleton(); |
481 |
#ifdef BROWSER_LAYOUT_TENONE |
|
482 |
||
483 |
ViewController * viewController = m_chrome->viewController(); |
|
484 |
ControllableViewBase* curView = viewController->currentView(); |
|
3 | 485 |
|
12 | 486 |
QString title; |
487 |
if (curView && curView->type() == KWindowViewName ) { |
|
488 |
title = getWindowsViewTitle(); |
|
489 |
} |
|
490 |
else { |
|
16 | 491 |
title = currentTitle(); |
12 | 492 |
} |
493 |
||
494 |
m_urlSearchEditor->setTitle(title); |
|
495 |
#endif |
|
496 |
||
497 |
||
3 | 498 |
int progress = pageController->loadProgressValue(); |
499 |
if (progress == 100) |
|
500 |
m_urlSearchEditor->removeFocus(); |
|
501 |
} |
|
502 |
||
503 |
void GUrlSearchItem::clearProgress() |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
504 |
{ |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
505 |
--m_pendingClearCalls; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
506 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
507 |
if (m_pendingClearCalls > 0) { |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
508 |
return; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
509 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
510 |
|
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
511 |
WebPageController * pageController = WebPageController::getSingleton(); |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
512 |
if (pageController->isPageLoading()) { |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
513 |
return; |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
514 |
} |
12 | 515 |
|
3 | 516 |
m_urlSearchEditor->setProgress(0); |
517 |
updateUrlSearchBtn(); |
|
12 | 518 |
|
519 |
#ifdef BROWSER_LAYOUT_TENONE |
|
520 |
if ( !pageController->editMode() ) { |
|
521 |
changeToTitle(); |
|
522 |
} |
|
523 |
#endif |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
524 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
525 |
|
16 | 526 |
|
527 |
void GUrlSearchItem::viewChanged(ControllableViewBase *newView) |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
528 |
{ |
3 | 529 |
ViewController * viewController = m_chrome->viewController(); |
16 | 530 |
WebPageController * pageController = WebPageController::getSingleton(); |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
531 |
|
3 | 532 |
ControllableViewBase* curView = viewController->currentView(); |
533 |
GWebContentView * gView = qobject_cast<GWebContentView*> (curView); |
|
534 |
bool isSuperPage = gView ? gView->currentPageIsSuperPage() : false; |
|
535 |
||
16 | 536 |
#ifdef BROWSER_LAYOUT_TENONE |
537 |
QColor bgColor; |
|
538 |
QColor textColor; |
|
539 |
QColor titleColor; |
|
540 |
#endif |
|
541 |
||
3 | 542 |
// view changes to web content view |
543 |
if (curView && curView->type() == "webView" && !isSuperPage) { |
|
12 | 544 |
|
545 |
#ifdef BROWSER_LAYOUT_TENONE |
|
546 |
||
16 | 547 |
bgColor = Qt::transparent; |
548 |
textColor = Qt::black; |
|
549 |
titleColor = Qt::white; |
|
550 |
||
551 |
// when going to a web page view, set the correct icon for the url title indicator button state |
|
552 |
if (pageController->secureState() == 0){ |
|
553 |
showSecureIcon(false); |
|
554 |
} else { |
|
555 |
showSecureIcon(true); |
|
556 |
} |
|
557 |
||
12 | 558 |
if (pageController->isPageLoading()) { |
16 | 559 |
|
12 | 560 |
m_urlSearchEditor->changeEditorMode(true); |
561 |
m_urlSearchBtn->show(); |
|
562 |
#endif |
|
563 |
int progress = pageController->loadProgressValue(); |
|
564 |
if (progress >= 100) |
|
565 |
progress = 0; |
|
566 |
m_urlSearchEditor->setProgress(progress); |
|
567 |
updateUrlSearchBtn(); |
|
3 | 568 |
|
12 | 569 |
// place focus in urlsearch bar when returning from adding a new window in windows view |
570 |
if (pageController->loadText() == "") { |
|
571 |
if (m_backFromNewWinTrans ) { |
|
572 |
m_backFromNewWinTrans = false; |
|
573 |
setUrlText(pageController->currentRequestedUrl()); |
|
574 |
} |
|
575 |
else { |
|
576 |
m_urlSearchEditor->grabFocus(); |
|
577 |
} |
|
3 | 578 |
} |
12 | 579 |
#ifdef BROWSER_LAYOUT_TENONE |
580 |
} |
|
581 |
else { |
|
582 |
m_urlSearchEditor->setTitle(currentTitle()); |
|
3 | 583 |
} |
12 | 584 |
#endif |
3 | 585 |
if (!isSuperPage && (pageController->contentsYPos() <= 0 || pageController->isPageLoading())){ |
12 | 586 |
m_chrome->layout()->slideView(100); |
3 | 587 |
} else { |
12 | 588 |
m_chrome->layout()->slideView(-100); |
3 | 589 |
} |
590 |
m_backFromNewWinTrans = false; |
|
591 |
} else { |
|
12 | 592 |
|
16 | 593 |
#ifdef BROWSER_LAYOUT_TENONE |
594 |
bgColor = Qt::transparent; |
|
595 |
textColor = Qt::black; |
|
596 |
titleColor = Qt::white; |
|
597 |
||
598 |
// when going to a view other than a web page, set the non-secure icon for the url title indicator button |
|
599 |
hideIndicatorButton(); |
|
600 |
#endif |
|
601 |
||
12 | 602 |
pageController->urlTextChanged(m_urlSearchEditor->text()); |
603 |
// Remove progress bar |
|
604 |
// incorrect values are not seen before we can update when we come back |
|
605 |
m_urlSearchEditor->setProgress(0); |
|
606 |
||
607 |
#ifdef BROWSER_LAYOUT_TENONE |
|
608 |
QString key = curView->objectName(); |
|
609 |
if (key == KWindowViewName) { |
|
610 |
key = getWindowsViewTitle(); |
|
611 |
} |
|
612 |
else if (key == KSettingsViewName) { |
|
613 |
key = qtTrId("txt_browser_settings_settings"); |
|
614 |
} |
|
615 |
else if (key == KBookmarkHistoryViewName) { |
|
616 |
key = qtTrId("txt_browser_history_history"); |
|
617 |
} |
|
618 |
else if (key == KBookmarkTreeViewName) { |
|
619 |
key = qtTrId("txt_browser_bookmarks_bookmarks"); |
|
620 |
} |
|
621 |
changeToTitle(); |
|
622 |
m_urlSearchEditor->setTitle(key); |
|
623 |
#else |
|
624 |
m_chrome->layout()->slideView(-100); |
|
625 |
#endif |
|
3 | 626 |
} |
16 | 627 |
|
628 |
#ifdef BROWSER_LAYOUT_TENONE |
|
629 |
m_urlSearchEditor->setBackgroundColor(bgColor); |
|
630 |
m_urlSearchEditor->setTextColor(textColor); |
|
631 |
// reset the layout for secure icon |
|
632 |
changeLayout(m_urlSearchBtn->isVisible()); |
|
633 |
#endif |
|
3 | 634 |
} |
635 |
||
12 | 636 |
#ifdef BROWSER_LAYOUT_TENONE |
637 |
void GUrlSearchItem::onTitleChange(const QString& text) |
|
638 |
{ |
|
16 | 639 |
ViewController * viewController = m_chrome->viewController(); |
640 |
ControllableViewBase* curView = viewController->currentView(); |
|
641 |
if ( curView && curView->type() == "webView" ){ |
|
642 |
m_urlSearchEditor->setTitle(text); |
|
643 |
} |
|
12 | 644 |
} |
645 |
||
646 |
QString GUrlSearchItem::getWindowsViewTitle() { |
|
647 |
QString title = currentTitle(); |
|
648 |
if (title.isEmpty()) { |
|
649 |
title = qtTrId("txt_browser_windows_windows"); |
|
650 |
title += ": "; |
|
651 |
title += qtTrId("txt_browser_windows_new_window"); |
|
652 |
} |
|
653 |
else { |
|
654 |
title.prepend(": "); |
|
655 |
title.prepend(qtTrId("txt_browser_windows_windows")); |
|
656 |
||
657 |
} |
|
658 |
return title; |
|
659 |
} |
|
660 |
||
16 | 661 |
void GUrlSearchItem::showSecureIcon(bool show) |
3 | 662 |
{ |
16 | 663 |
m_urlTitleIndBtn->setVisible(!show); |
664 |
m_urlTitleIndSecureBtn->setVisible(show); |
|
3 | 665 |
} |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
666 |
|
16 | 667 |
void GUrlSearchItem::hideIndicatorButton() |
668 |
{ |
|
669 |
m_urlTitleIndBtn->hide(); |
|
670 |
m_urlTitleIndSecureBtn->hide(); |
|
671 |
} |
|
672 |
||
673 |
#endif |
|
674 |
||
3 | 675 |
void GUrlSearchItem::urlSearchActivated() |
676 |
{ |
|
677 |
WebPageController * pageController = WebPageController::getSingleton(); |
|
16 | 678 |
switch (pageController->loadState()) { |
679 |
case WRT::LoadController::GotoModeLoading: |
|
680 |
pageController->currentStop(); |
|
681 |
++m_pendingClearCalls; |
|
682 |
QTimer::singleShot(500, this, SLOT(clearProgress())); |
|
683 |
#ifdef BROWSER_LAYOUT_TENONE |
|
684 |
layoutToEditMode(false); |
|
685 |
#endif |
|
686 |
break; |
|
687 |
case WRT::LoadController::GotoModeEditing: |
|
688 |
loadToMainWindow(); |
|
689 |
break; |
|
690 |
case WRT::LoadController::GotoModeReloadable: |
|
691 |
if (pageController->currentDocUrl() == m_urlSearchEditor->text()) |
|
692 |
pageController->currentReload(); |
|
693 |
else |
|
694 |
loadToMainWindow(); |
|
695 |
break; |
|
696 |
default: |
|
697 |
qDebug() << "GUrlSearchItem::urlSearchActivated() Incorrect state"; |
|
698 |
break; |
|
699 |
} |
|
700 |
updateUrlSearchBtn(); |
|
3 | 701 |
} |
702 |
||
16 | 703 |
#ifdef BROWSER_LAYOUT_TENONE |
704 |
void GUrlSearchItem::urlTitleIndBtnActivated() |
|
705 |
{ |
|
706 |
// When the url title indicator button is pressed, focus into the url text area |
|
707 |
QPointF pos(0, 0); |
|
708 |
changeToUrl(pos); |
|
709 |
} |
|
710 |
#endif |
|
711 |
||
3 | 712 |
void GUrlSearchItem::updateUrlSearchBtn() |
713 |
{ |
|
16 | 714 |
|
3 | 715 |
WebPageController * pageController = WebPageController::getSingleton(); |
716 |
switch (pageController->loadState()) { |
|
717 |
case WRT::LoadController::GotoModeLoading: |
|
718 |
m_urlSearchBtn->addIcon(STOP_BUTTON_ICON); |
|
719 |
break; |
|
12 | 720 |
case WRT::LoadController::GotoModeEditinLoading: |
3 | 721 |
case WRT::LoadController::GotoModeEditing: |
722 |
m_urlSearchBtn->addIcon(GO_BUTTON_ICON); |
|
723 |
break; |
|
724 |
case WRT::LoadController::GotoModeReloadable: |
|
12 | 725 |
m_urlSearchBtn->addIcon(GO_BUTTON_ICON); |
3 | 726 |
break; |
727 |
default: |
|
12 | 728 |
qDebug() << "GUrlSearchItem::updateUrlSearchBtn Incorrect state"; |
3 | 729 |
break; |
730 |
} |
|
731 |
m_urlSearchBtn->update(); |
|
732 |
||
733 |
// notify suggest object of changes in load state |
|
734 |
PageSnippet * suggestSnippet = qobject_cast<PageSnippet*>(m_chrome->getSnippet("SuggestsChromeId")); |
|
735 |
if (suggestSnippet) { |
|
736 |
QString cmd = "searchSuggests.updateLoadState();"; |
|
737 |
suggestSnippet->evaluateJavaScript(cmd); |
|
738 |
} |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
739 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
740 |
|
16 | 741 |
void GUrlSearchItem::createEditor() |
742 |
{ |
|
743 |
QColor textColor; |
|
744 |
QColor backgroundColor; |
|
745 |
QColor progressColor; |
|
746 |
||
747 |
QWebElement we = m_snippet->element(); |
|
748 |
NativeChromeItem::CSSToQColor( |
|
749 |
we.styleProperty("border-bottom-color", QWebElement::ComputedStyle), |
|
750 |
progressColor); |
|
751 |
||
752 |
#ifdef BROWSER_LAYOUT_TENONE |
|
753 |
QFont titleFont; |
|
754 |
QColor titleColor; |
|
755 |
textColor = QColor(Qt::black); |
|
756 |
titleColor = QColor(Qt::white); |
|
757 |
m_borderColor = QColor(Qt::transparent); |
|
758 |
backgroundColor = QColor(Qt::transparent); |
|
759 |
||
760 |
titleFont = QFont(QApplication::font()); |
|
761 |
titleFont.setPointSize(9); |
|
762 |
titleFont.setWeight(QFont::Bold); |
|
763 |
#endif |
|
764 |
#ifndef BROWSER_LAYOUT_TENONE |
|
765 |
NativeChromeItem::CSSToQColor( |
|
766 |
we.styleProperty("color", QWebElement::ComputedStyle), |
|
767 |
textColor); |
|
768 |
||
769 |
NativeChromeItem::CSSToQColor( |
|
770 |
we.styleProperty("background-color", QWebElement::ComputedStyle), |
|
771 |
backgroundColor); |
|
772 |
||
773 |
NativeChromeItem::CSSToQColor( |
|
774 |
we.styleProperty("border-top-color", QWebElement::ComputedStyle), |
|
775 |
m_borderColor); |
|
776 |
#endif |
|
777 |
||
778 |
// Create the url search editor |
|
779 |
m_urlSearchEditor = new GProgressEditor(m_snippet, m_chrome, m_viewPort); |
|
780 |
m_urlSearchEditor->setObjectName("UrlEditor"); |
|
781 |
m_urlSearchEditor->setTextColor(textColor); |
|
782 |
#ifdef BROWSER_LAYOUT_TENONE |
|
783 |
m_urlSearchEditor->setTitleFont(titleFont); |
|
784 |
m_urlSearchEditor->setTitleColor(titleColor); |
|
785 |
#endif |
|
786 |
m_urlSearchEditor->setBackgroundColor(backgroundColor); |
|
787 |
m_urlSearchEditor->setProgressColor(progressColor); |
|
788 |
m_urlSearchEditor->setBorderColor(m_borderColor); |
|
789 |
m_urlSearchEditor->setPadding(0.1); // draw the Rounded Rect |
|
790 |
m_urlSearchEditor->setInputMethodHints(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); |
|
791 |
m_urlSearchEditor->setSpecificButton(SPECIFIC_BUTTON_STRING, SPECIFIC_BUTTON_ICON); |
|
792 |
safe_connect(m_urlSearchEditor, SIGNAL(contentsChange(int, int, int)), |
|
793 |
this, SLOT(updateLoadStateAndSuggest(int, int, int))); |
|
794 |
safe_connect(m_urlSearchEditor, SIGNAL(activated()),this, SLOT(urlSearchActivatedByEnterKey())); |
|
795 |
safe_connect(m_urlSearchEditor, SIGNAL(focusChanged(bool)),this, SLOT(focusChanged(bool))); |
|
796 |
#ifndef BROWSER_LAYOUT_TENONE |
|
797 |
safe_connect(m_urlSearchEditor, SIGNAL(tapped(QPointF&)),this, SLOT(tapped(QPointF&))); |
|
798 |
#endif |
|
799 |
safe_connect(m_urlSearchEditor, SIGNAL(contextEvent(bool)), this, SIGNAL(contextEvent(bool))); |
|
800 |
#ifdef BROWSER_LAYOUT_TENONE |
|
801 |
safe_connect(m_urlSearchEditor, SIGNAL(titleMouseEvent(QPointF&)),this, SLOT(changeToUrl(QPointF&))); |
|
802 |
#endif |
|
803 |
} |
|
804 |
||
805 |
void GUrlSearchItem::createIcons() |
|
806 |
{ |
|
807 |
// Create the url search button |
|
808 |
m_urlSearchBtn = new ActionButton(m_snippet, "UrlSearchButton", m_viewPort); |
|
809 |
QAction* urlSearchBtnAction = new QAction(this); |
|
810 |
m_urlSearchBtn->setAction(urlSearchBtnAction); // FIXME: should use diff QActions |
|
811 |
m_urlSearchBtn->setActiveOnPress(false); |
|
812 |
safe_connect(urlSearchBtnAction, SIGNAL(triggered()), this, SLOT(urlSearchActivated())); |
|
813 |
||
814 |
#ifdef BROWSER_LAYOUT_TENONE |
|
815 |
// Create the url title indicator button (NOTE: QAction created but not hooked up) |
|
816 |
m_urlTitleIndBtn = new ActionButton(m_snippet, "UrlSearchIndButton", m_viewPort); |
|
817 |
QAction* urlTitleIndBtnAction = new QAction(this); |
|
818 |
m_urlTitleIndBtn->setAction(urlTitleIndBtnAction); |
|
819 |
m_urlTitleIndBtn->addIcon(URL_TITLE_IND_BUTTON_ICON); |
|
820 |
m_urlTitleIndBtn->setActiveOnPress(false); |
|
821 |
safe_connect(urlTitleIndBtnAction, SIGNAL(triggered()), this, SLOT(urlTitleIndBtnActivated())); |
|
822 |
||
823 |
m_urlTitleIndSecureBtn = new ActionButton(m_snippet, "UrlSearchSecureButton", m_viewPort); |
|
824 |
QAction* urlTitleIndSecureBtnAction = new QAction(this); |
|
825 |
m_urlTitleIndSecureBtn->setAction(urlTitleIndSecureBtnAction); |
|
826 |
m_urlTitleIndSecureBtn->addIcon(URL_TITLE_IND_SECURE_BUTTON_ICON); |
|
827 |
m_urlTitleIndSecureBtn->setActiveOnPress(false); |
|
828 |
safe_connect(urlTitleIndSecureBtnAction, SIGNAL(triggered()), this, SLOT(urlTitleIndBtnActivated())); |
|
829 |
||
830 |
#endif |
|
831 |
||
832 |
QIcon btnIcon(GO_BUTTON_ICON); |
|
833 |
QSize actualSize = btnIcon.availableSizes()[0]; |
|
834 |
m_buttonIconWidth = actualSize.width(); |
|
835 |
m_buttonIconHeight = actualSize.height(); |
|
836 |
||
837 |
#ifndef BROWSER_LAYOUT_TENONE |
|
838 |
m_urlSearchEditor->setRightTextMargin(m_buttonIconWidth + BETWEEN_ENTRY_AND_BUTTON_SPACE); |
|
839 |
||
840 |
#endif |
|
841 |
||
842 |
} |
|
843 |
||
3 | 844 |
void GUrlSearchItem::loadToMainWindow() |
845 |
{ |
|
846 |
QString url = m_urlSearchEditor->text(); |
|
12 | 847 |
if(!url.contains(KBOOKMARKURLFILESLASH)){ |
848 |
if(url.contains(KBOOKMARKURLFILE)) |
|
849 |
url.replace(QString(KBOOKMARKURLFILE), QString(KBOOKMARKURLFILESLASH)); |
|
850 |
} |
|
3 | 851 |
WebPageController * pageController = WebPageController::getSingleton(); |
852 |
QString gotourl = pageController->guessUrlFromString(url); |
|
12 | 853 |
setUrlText(gotourl); |
3 | 854 |
pageController->currentLoad(gotourl); |
855 |
pageController->urlTextChanged(gotourl); |
|
12 | 856 |
#ifdef BROWSER_LAYOUT_TENONE |
857 |
m_urlSearchEditor->closeVKB(); |
|
858 |
#endif |
|
3 | 859 |
} |
860 |
||
12 | 861 |
void GUrlSearchItem::updateLoadStateAndSuggest(int /*position*/, int charsRemoved, int charsAdded) |
3 | 862 |
{ |
863 |
WebPageController * pageController = WebPageController::getSingleton(); |
|
16 | 864 |
if (url().contains('\n')) |
865 |
{ |
|
866 |
urlSearchActivatedByEnterKey(); |
|
867 |
return; |
|
868 |
} |
|
869 |
||
12 | 870 |
// will get contentsChanged() signal on programmatic changes and sometimes |
871 |
// position changes but we are only interested in user input |
|
872 |
if ((charsRemoved || charsAdded) && pageController->editMode()) { |
|
873 |
PageSnippet * suggestSnippet = qobject_cast<PageSnippet*>(m_chrome->getSnippet("SuggestsChromeId")); |
|
874 |
if (suggestSnippet) { |
|
875 |
QString cmd = "searchSuggests.updateUserInput();"; |
|
876 |
suggestSnippet->evaluateJavaScript(cmd); |
|
877 |
} |
|
878 |
} |
|
16 | 879 |
|
12 | 880 |
} |
881 |
||
882 |
||
883 |
void GUrlSearchItem::changeLoadState(bool editing) { |
|
884 |
||
885 |
WebPageController * pageController = WebPageController::getSingleton(); |
|
886 |
if (pageController->editMode() != editing) { |
|
887 |
pageController->setEditMode(editing); |
|
3 | 888 |
updateUrlSearchBtn(); |
889 |
} |
|
890 |
} |
|
891 |
void GUrlSearchItem::tapped(QPointF& pos) |
|
892 |
{ |
|
12 | 893 |
changeLoadState(true); |
3 | 894 |
bool hitText = m_urlSearchEditor->tappedOnText(pos.x()); |
895 |
if (!m_justFocusIn && !hitText) |
|
896 |
m_urlSearchEditor->unselect(); |
|
897 |
||
898 |
if (m_justFocusIn) { |
|
899 |
m_justFocusIn = false; |
|
12 | 900 |
|
3 | 901 |
if (hitText && !m_urlSearchEditor->hasSelection()) |
902 |
m_urlSearchEditor->selectAll(); |
|
903 |
} |
|
904 |
} |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
905 |
|
3 | 906 |
void GUrlSearchItem::focusChanged(bool focusIn) |
907 |
{ |
|
12 | 908 |
// Suggestion snippet needs to know about this event. |
909 |
PageSnippet * suggestSnippet = qobject_cast<PageSnippet*>(m_chrome->getSnippet("SuggestsChromeId")); |
|
910 |
if (suggestSnippet) { |
|
911 |
QString cmd("searchSuggests.urlSearchFocusChanged("); |
|
912 |
cmd += focusIn ? "true);" : "false);"; |
|
913 |
suggestSnippet->evaluateJavaScript(cmd); |
|
914 |
} |
|
915 |
||
916 |
if (focusIn) { |
|
3 | 917 |
m_justFocusIn = true; |
12 | 918 |
} |
3 | 919 |
else { |
920 |
m_justFocusIn = false; |
|
921 |
} |
|
922 |
} |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
923 |
|
3 | 924 |
void GUrlSearchItem::resize() |
925 |
{ |
|
926 |
QWebElement we = m_snippet->element(); |
|
927 |
QRectF g = we.geometry(); |
|
928 |
qreal newWidth = g.width(); |
|
929 |
qreal newHeight = g.height(); |
|
930 |
QGraphicsWidget::resize(newWidth, newHeight); |
|
931 |
} |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
932 |
|
3 | 933 |
void GUrlSearchItem::onNewWindowTransitionComplete() |
934 |
{ |
|
935 |
m_backFromNewWinTrans = true; |
|
936 |
} |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
937 |
|
3 | 938 |
QString GUrlSearchItem::formattedUrl() const |
939 |
{ |
|
940 |
WebPageController * pageController = WebPageController::getSingleton(); |
|
941 |
QString url = pageController->loadText(); |
|
12 | 942 |
|
3 | 943 |
// for first load of the windows restored from last session |
944 |
if (url.isEmpty()&& pageController->currentDocUrl().isEmpty()) { |
|
945 |
QWebHistoryItem item = pageController->currentPage()->history()->currentItem(); |
|
946 |
url = item.url().toString(); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
947 |
} |
12 | 948 |
|
3 | 949 |
return url.replace(" ","+"); |
950 |
} |
|
951 |
||
16 | 952 |
|
12 | 953 |
void GUrlSearchItem::setUrlText(const QString & str) |
954 |
{ |
|
955 |
ViewController * viewController = m_chrome->viewController(); |
|
956 |
ControllableViewBase* curView = viewController->currentView(); |
|
16 | 957 |
if ( curView && curView->type() == "webView" ) { |
958 |
QUrl url(str); |
|
959 |
m_urlSearchEditor->setText(WRT::UiUtil::encodeQueryItems(url, true).toString()); |
|
960 |
} |
|
12 | 961 |
} |
962 |
||
963 |
QString GUrlSearchItem::urlToBeDisplayed() |
|
964 |
{ |
|
965 |
||
966 |
WebPageController * pageController = WebPageController::getSingleton(); |
|
967 |
QString url = pageController->currentDocUrl(); |
|
968 |
if (url.isEmpty() ) { |
|
969 |
url = pageController->currentRequestedUrl(); |
|
970 |
} |
|
971 |
//qDebug() << "GUrlSearchItem::urlToBeDisplayed" << url; |
|
972 |
return url; |
|
973 |
} |
|
974 |
||
975 |
QString GUrlSearchItem::currentTitle() |
|
976 |
{ |
|
977 |
||
978 |
WebPageController * pageController = WebPageController::getSingleton(); |
|
979 |
QString title = pageController->currentDocTitle(); |
|
980 |
if (title.isEmpty() ){ |
|
981 |
title = pageController->currentPartialUrl(); |
|
16 | 982 |
if (title.isEmpty() ) { |
983 |
// New Window, so set title as such |
|
984 |
title = qtTrId("txt_browser_windows_new_window"); |
|
985 |
} |
|
12 | 986 |
} |
987 |
return title; |
|
988 |
} |
|
989 |
||
16 | 990 |
|
12 | 991 |
// GUrlSearchSnippet class |
992 |
||
993 |
||
3 | 994 |
GUrlSearchSnippet::GUrlSearchSnippet(const QString & elementId, ChromeWidget * chrome, |
995 |
QGraphicsWidget * widget, const QWebElement & element) |
|
996 |
: ChromeSnippet(elementId, chrome, widget, element) |
|
997 |
{ |
|
998 |
} |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
999 |
|
3 | 1000 |
GUrlSearchSnippet * GUrlSearchSnippet::instance(const QString& elementId, ChromeWidget * chrome, const QWebElement & element) |
1001 |
{ |
|
1002 |
GUrlSearchSnippet* that = new GUrlSearchSnippet(elementId, chrome, 0, element); |
|
16 | 1003 |
GUrlSearchItem* urlSearchItem = new GUrlSearchItem(that, chrome); |
1004 |
safe_connect(urlSearchItem, SIGNAL(contextEvent(bool)), that, SLOT(sendContextMenuEvent(bool))); |
|
1005 |
that->setChromeWidget(urlSearchItem); |
|
3 | 1006 |
return that; |
1007 |
} |
|
1008 |
||
16 | 1009 |
void GUrlSearchSnippet::sendContextMenuEvent(bool isContentSelected) |
3 | 1010 |
{ |
16 | 1011 |
emit contextEvent(isContentSelected, elementId()); |
3 | 1012 |
} |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1013 |
|
16 | 1014 |
GUrlSearchItem* GUrlSearchSnippet::urlSearchItem() |
3 | 1015 |
{ |
16 | 1016 |
return qobject_cast<GUrlSearchItem *>(widget()); |
1017 |
} |
|
1018 |
||
1019 |
GUrlSearchItem const * GUrlSearchSnippet::constUrlSearchItem() const |
|
1020 |
{ |
|
1021 |
return qobject_cast<GUrlSearchItem const *>(constWidget()); |
|
3 | 1022 |
} |
1023 |
||
1024 |
QString GUrlSearchSnippet::url() const |
|
1025 |
{ |
|
1026 |
return constUrlSearchItem()->url(); |
|
1027 |
} |
|
1028 |
||
1029 |
void GUrlSearchSnippet::setUrl(const QString &url) |
|
1030 |
{ |
|
1031 |
urlSearchItem()->setUrl(url); |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1032 |
} |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1033 |
|
16 | 1034 |
void GUrlSearchSnippet::cut() |
1035 |
{ |
|
1036 |
urlSearchItem()->cut(); |
|
1037 |
} |
|
1038 |
||
1039 |
void GUrlSearchSnippet::copy() |
|
1040 |
{ |
|
1041 |
urlSearchItem()->copy(); |
|
1042 |
} |
|
1043 |
||
1044 |
void GUrlSearchSnippet::paste() |
|
1045 |
{ |
|
1046 |
urlSearchItem()->paste(); |
|
1047 |
} |
|
1048 |
||
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1049 |
} // namespace GVA |