summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-07-08 18:36:25 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-07-08 18:36:25 +0200
commit1f0595f0e4c46dce8483d387ceccc1ad12c14576 (patch)
tree2eb27773cc8b3743949f58f3b93f68af4dd76159
parentMerge commit 'avaddon/master' (diff)
downloadrekonq-1f0595f0e4c46dce8483d387ceccc1ad12c14576.tar.xz
Cleaning code && removing unuseful search bar
-rw-r--r--TODO25
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/mainwindow.cpp16
-rw-r--r--src/mainwindow.h28
-rw-r--r--src/searchbar.cpp131
-rw-r--r--src/searchbar.h68
6 files changed, 19 insertions, 250 deletions
diff --git a/TODO b/TODO
index 40ccda35..88cb8e92 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,8 @@
-- QWebFrame management
-- Fix crash on example sites..
+(4.6) - QWebFrame management
++ Fix crash on example sites..
- improve DOCUMENTATION
-- Type "FormSubmitted" ("WordPress Bug")
-- cookies
++ Type "FormSubmitted" ("WordPress Bug")
++ cookies
- unit tests
LONG TERM GOALS
@@ -14,11 +14,14 @@ LONG TERM GOALS
TO 0.2 release
-- unique url/search/history bar
-- WebkitKDE (ask about status)
-- cookie system refactor
-- bookmarks panel
-- MimeType Manager
-- BETTER KDE INTEGRATION (What else to be done??)
-- error pages
++- unique url/search/history bar
++ WebkitKDE (ask about status)
++ cookie system refactor
+x- bookmarks panel
+x- MimeType Manager
++- BETTER KDE INTEGRATION (What else to be done??)
++- error pages
+- CLEAN CLEAN CLEAN code
+- remove searchbar
+- \ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 809e54af..f3f7544a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,7 +22,6 @@ SET( rekonq_SRCS
modelmenu.cpp
urlbar.cpp
findbar.cpp
- searchbar.cpp
settings.cpp
webview.cpp
main.cpp
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 44ca861c..3cff7cff 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -92,7 +92,6 @@
MainWindow::MainWindow()
: KXmlGuiWindow()
, m_view(new MainView(this))
- , m_searchBar(new SearchBar(this))
, m_findBar(new FindBar(this))
, m_sidePanel(0)
{
@@ -119,8 +118,8 @@ MainWindow::MainWindow()
// then, setup our actions
setupActions();
- // setting up toolbars: this has to be done BEFORE setupGUI!!
- setupToolBars();
+ // setting up toolbars && location bar: this has to be done BEFORE setupGUI!!
+ setupBars();
// Bookmark Menu
KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu();
@@ -195,7 +194,7 @@ QSize MainWindow::sizeHint() const
}
-void MainWindow::setupToolBars()
+void MainWindow::setupBars()
{
KAction *a;
@@ -205,13 +204,6 @@ void MainWindow::setupToolBars()
a->setDefaultWidget(m_view->urlBarStack());
actionCollection()->addAction(QLatin1String("url_bar"), a);
- // search bar
- a = new KAction(i18n("Search Bar"), this);
- a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_K));
- a->setDefaultWidget(m_searchBar);
- connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
- actionCollection()->addAction(QLatin1String("search_bar"), a);
-
// bookmarks bar
KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction();
a = actionCollection()->addAction(QLatin1String("bookmarks_bar"), bookmarkBarAction);
@@ -360,7 +352,7 @@ void MainWindow::setupHistoryMenu()
// setting history menu position
menuBar()->insertMenu(actionCollection()->action("bookmarks"), historyMenu);
- // setting initial actions
+ // setting initial actions
QList<QAction*> historyActions;
historyActions.append(actionCollection()->action("history_back"));
historyActions.append(actionCollection()->action("history_forward"));
diff --git a/src/mainwindow.h b/src/mainwindow.h
index b276a544..c8ce7673 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -25,7 +25,6 @@
#define MAINWINDOW_H
// Local Includes
-#include "searchbar.h"
#include "bookmarks.h"
#include "mainview.h"
#include "webview.h"
@@ -39,8 +38,6 @@ class QWebFrame;
class KUrl;
class KAction;
-class KActionMenu;
-class KMenu;
class KPassivePopup;
class HistoryMenu;
@@ -49,23 +46,6 @@ class SidePanel;
class WebView;
-// namespace Rekonq
-// {
-// /**
-// * @short notifying message status
-// * Different message status
-// */
-//
-// enum Notify
-// {
-// Success, ///< url successfully (down)loaded
-// Error, ///< url failed to (down)load
-// Download, ///< downloading url
-// Info ///< information, (default)
-// };
-// }
-
-
/**
* This class serves as the main window for rekonq.
* It handles the menus, toolbars, and status bars.
@@ -87,7 +67,7 @@ public:
private:
void setupActions();
void setupHistoryMenu();
- void setupToolBars();
+ void setupBars();
void setupSidePanel();
SidePanel *sidePanel();
@@ -152,16 +132,10 @@ private slots:
private:
MainView *m_view;
- SearchBar *m_searchBar;
FindBar *m_findBar;
SidePanel *m_sidePanel;
- KMenu *m_windowMenu;
- KActionMenu *m_historyActionMenu;
-
KAction *m_stopReloadAction;
- KAction *m_stopAction;
- KAction *m_reloadAction;
KAction *m_historyBackAction;
KAction *m_historyForwardAction;
diff --git a/src/searchbar.cpp b/src/searchbar.cpp
deleted file mode 100644
index e8ffb178..00000000
--- a/src/searchbar.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it
-* and/or modify it under the terms of the GNU General
-* Public License as published by the Free Software Foundation;
-* either version 3, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "searchbar.h"
-#include "searchbar.moc"
-
-// Local Includes
-#include "application.h"
-#include "mainwindow.h"
-
-// KDE Includes
-#include <KUrl>
-#include <KCompletionBox>
-
-// Qt Includes
-#include <QtCore/QString>
-#include <QtGui/QSizePolicy>
-#include <QtNetwork/QNetworkAccessManager>
-#include <QtNetwork/QNetworkRequest>
-#include <QtNetwork/QNetworkReply>
-#include <QtXml/QXmlStreamReader>
-
-
-SearchBar::SearchBar(QWidget *parent)
- : LineEdit(parent)
- , m_networkAccessManager(new QNetworkAccessManager(this))
- , m_timer(new QTimer(this))
-{
- setFocusPolicy(Qt::WheelFocus);
- setMouseTracking(true);
- setAcceptDrops(true);
-
- setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
-
- setClearButtonShown(true);
-
- // better solution than using QPalette(s)..
- setClickMessage(i18n("Search..."));
-
- // setting QNetworkAccessManager..
- connect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleNetworkData(QNetworkReply*)));
-
- // setting QTimer..
- m_timer->setSingleShot(true);
- m_timer->setInterval(200);
- connect(m_timer, SIGNAL(timeout()), SLOT(autoSuggest()));
- connect(this, SIGNAL(textEdited(QString)), m_timer, SLOT(start()));
-
- // connect searchNow slot..
- connect(this, SIGNAL(returnPressed()) , this , SLOT(searchNow()));
-}
-
-
-SearchBar::~SearchBar()
-{
-}
-
-
-void SearchBar::searchNow()
-{
- m_timer->stop();
- QString searchText = text();
- completionBox()->hide();
-
- KUrl url(QLatin1String("http://www.google.com/search"));
- url.addQueryItem(QLatin1String("q"), searchText);
- url.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8"));
- url.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8"));
- url.addQueryItem(QLatin1String("client"), QLatin1String("rekonq"));
- emit search(url);
-}
-
-
-void SearchBar::focusInEvent(QFocusEvent *event)
-{
- selectAll();
- LineEdit::focusInEvent(event);
-}
-
-
-void SearchBar::autoSuggest()
-{
- QString str = text();
- QString url = QString("http://google.com/complete/search?output=toolbar&q=%1").arg(str);
- m_networkAccessManager->get(QNetworkRequest(QString(url)));
-}
-
-
-void SearchBar::handleNetworkData(QNetworkReply *networkReply)
-{
- QUrl url = networkReply->url();
- if (!networkReply->error())
- {
- QStringList choices;
-
- QString response(networkReply->readAll());
- QXmlStreamReader xml(response);
- while (!xml.atEnd())
- {
- xml.readNext();
- if (xml.tokenType() == QXmlStreamReader::StartElement)
- if (xml.name() == "suggestion")
- {
- QStringRef str = xml.attributes().value("data");
- choices << str.toString();
- }
- }
-
- setCompletedItems(choices, true);
- }
-
- networkReply->deleteLater();
-}
diff --git a/src/searchbar.h b/src/searchbar.h
deleted file mode 100644
index 621c2081..00000000
--- a/src/searchbar.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it
-* and/or modify it under the terms of the GNU General
-* Public License as published by the Free Software Foundation;
-* either version 3, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* ============================================================ */
-
-
-
-#ifndef SEARCHBAR_H
-#define SEARCHBAR_H
-
-// Local Includes
-#include "lineedit.h"
-
-// Forward Declarations
-class KUrl;
-class QFocusEvent;
-class QTimer;
-class QNetworkAccessManager;
-class QNetworkReply;
-
-/**
- * This class defines an internet search bar.
- *
- */
-class SearchBar : public LineEdit
-{
- Q_OBJECT
-
-public:
- SearchBar(QWidget *parent = 0);
- ~SearchBar();
-
-public slots:
- void autoSuggest();
- void handleNetworkData(QNetworkReply *networkReply);
-
- /**
- * Use this slot to perform one search in one search engine
- *
- */
- void searchNow();
-
-protected:
- void focusInEvent(QFocusEvent *);
-
-signals:
- void search(const KUrl &);
-
-private:
- QNetworkAccessManager *m_networkAccessManager;
- QTimer *m_timer;
-};
-
-#endif