summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2012-03-21 11:16:24 (GMT)
committerChristian Franke <nobody@nowhere.ws>2012-03-21 11:16:24 (GMT)
commit179da0310ec3df51b1e95492fca04ab273fa70ac (patch)
tree390773c34b09a01fef5828b7b7d7d53e0122b71e
parentc483d3e895de888a65488d6a15818c376074fcdc (diff)
allow for POST search from ToolbarSearch
-rw-r--r--src/browsermainwindow.cpp4
-rw-r--r--src/tabwidget.cpp18
-rw-r--r--src/tabwidget.h1
-rw-r--r--src/toolbarsearch.cpp3
-rw-r--r--src/toolbarsearch.h2
5 files changed, 23 insertions, 5 deletions
diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp
index ffcb8b8..a5c0ade 100644
--- a/src/browsermainwindow.cpp
+++ b/src/browsermainwindow.cpp
@@ -1049,8 +1049,8 @@ void BrowserMainWindow::setupToolBar()
m_toolbarSearch = new ToolbarSearch(m_navigationBar);
m_navigationSplitter->addWidget(m_toolbarSearch);
- connect(m_toolbarSearch, SIGNAL(search(const QUrl&, TabWidget::OpenUrlIn)),
- m_tabWidget, SLOT(loadUrl(const QUrl&, TabWidget::OpenUrlIn)));
+ connect(m_toolbarSearch, SIGNAL(search(const QString&, TabWidget::OpenUrlIn)),
+ m_tabWidget, SLOT(performSearch(const QString&, TabWidget::OpenUrlIn)));
m_navigationSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
m_tabWidget->locationBarStack()->setMinimumWidth(120);
m_navigationSplitter->setCollapsible(0, false);
diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp
index 7e5b0bf..beb7dfb 100644
--- a/src/tabwidget.cpp
+++ b/src/tabwidget.cpp
@@ -948,6 +948,24 @@ void TabWidget::loadUrl(const QUrl &url, OpenUrlIn tab, const QString &title)
}
/*
+ Somewhere in the browser interface a users wants to search for something.
+ */
+void TabWidget::performSearch(const QString &term, OpenUrlIn tab)
+{
+ if (tab == UserOrCurrent) {
+ tab = modifyWithUserBehavior(CurrentTab);
+ }
+
+ WebView *webView = getView(tab, currentWebView());
+ if (webView) {
+ OpenSearchEngine *engine = ToolbarSearch::openSearchManager()->currentEngine();
+ engine->setDelegate(webView);
+ engine->requestSearchResults(term);
+ engine->setDelegate(NULL);
+ }
+}
+
+/*
Return the view that matches the openIn behavior creating
a new view/window if necessary.
*/
diff --git a/src/tabwidget.h b/src/tabwidget.h
index 6ceff10..be6ff75 100644
--- a/src/tabwidget.h
+++ b/src/tabwidget.h
@@ -155,6 +155,7 @@ public slots:
void loadString(const QString &string, OpenUrlIn tab = CurrentTab);
void loadUrlFromUser(const QUrl &url, const QString &title = QString());
void loadUrl(const QUrl &url, TabWidget::OpenUrlIn tab = CurrentTab, const QString &title = QString());
+ void performSearch(const QString &term, TabWidget::OpenUrlIn tab = CurrentTab);
void createTab(const QByteArray &historyState, TabWidget::OpenUrlIn tab = CurrentTab);
void newTab();
void cloneTab(int index = -1);
diff --git a/src/toolbarsearch.cpp b/src/toolbarsearch.cpp
index 5f14206..3a6dd5c 100644
--- a/src/toolbarsearch.cpp
+++ b/src/toolbarsearch.cpp
@@ -267,11 +267,10 @@ void ToolbarSearch::searchNow()
m_autosaver->changeOccurred();
}
- QUrl searchUrl = engine->searchUrl(searchText);
TabWidget::OpenUrlIn tab = TabWidget::CurrentTab;
if (qApp->keyboardModifiers() == Qt::AltModifier)
tab = TabWidget::NewSelectedTab;
- emit search(searchUrl, tab);
+ emit search(searchText, tab);
}
void ToolbarSearch::newSuggestions(const QStringList &suggestions)
diff --git a/src/toolbarsearch.h b/src/toolbarsearch.h
index a09a18d..dbe1d53 100644
--- a/src/toolbarsearch.h
+++ b/src/toolbarsearch.h
@@ -80,7 +80,7 @@ class ToolbarSearch : public SearchLineEdit
Q_OBJECT
signals:
- void search(const QUrl &url, TabWidget::OpenUrlIn tab);
+ void search(const QString &term, TabWidget::OpenUrlIn tab);
public:
ToolbarSearch(QWidget *parent = 0);