summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/browsermainwindow.cpp19
-rw-r--r--src/browsermainwindow.h6
-rw-r--r--src/searchbar.cpp62
-rw-r--r--src/searchbar.h (renamed from src/toolbarsearch.h)47
-rw-r--r--src/toolbarsearch.cpp139
-rw-r--r--src/urlbar.cpp25
-rw-r--r--src/urlbar.h28
-rw-r--r--src/urllineedit.cpp6
9 files changed, 150 insertions, 187 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2f4ebb9b..edcfd561 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -11,11 +11,10 @@ SET( rekonq_SRCS
networkaccessmanager.cpp
searchlineedit.cpp
findbar.cpp
- findwidget.cpp
+ searchbar.cpp
settings.cpp
squeezelabel.cpp
- tabwidget.cpp
- toolbarsearch.cpp
+ tabwidget.cpp
urllineedit.cpp
webview.cpp
main.cpp
diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp
index 46510384..4ea1d444 100644
--- a/src/browsermainwindow.cpp
+++ b/src/browsermainwindow.cpp
@@ -27,7 +27,7 @@
#include "history.h"
#include "settings.h"
#include "tabwidget.h"
-#include "toolbarsearch.h"
+// #include "toolbarsearch.h"
#include "webview.h"
// UI Includes
@@ -289,9 +289,6 @@ void BrowserMainWindow::setupMenu()
viewMenu->addSeparator();
m_stop = (KAction *) viewMenu->addAction( KIcon( "process-stop" ), i18n("&Stop") );
-// QList<QKeySequence> shortcuts;
-// shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_Period));
-// shortcuts.append(Qt::Key_Escape);
m_stop->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) );
m_tabWidget->addWebAction(m_stop, QWebPage::Stop);
@@ -397,10 +394,12 @@ void BrowserMainWindow::setupToolBar()
m_navigationBar->addWidget(m_tabWidget->lineEditStack());
- m_toolbarSearch = new ToolbarSearch(m_navigationBar);
- m_navigationBar->addWidget(m_toolbarSearch);
-
- connect(m_toolbarSearch, SIGNAL(search(const QUrl&)), SLOT(loadUrl(const QUrl&)));
+ m_searchBar = new SearchBar(m_navigationBar);
+ m_navigationBar->addWidget(m_searchBar);
+ connect(m_searchBar, SIGNAL(search(const QUrl&)), this, SLOT(loadUrl(const QUrl&)));
+// m_toolbarSearch = new ToolbarSearch(m_navigationBar);
+// m_navigationBar->addWidget(m_toolbarSearch);
+// connect(m_toolbarSearch, SIGNAL(search(const QUrl&)), SLOT(loadUrl(const QUrl&)));
}
@@ -766,8 +765,8 @@ void BrowserMainWindow::slotHome()
void BrowserMainWindow::slotWebSearch()
{
- m_toolbarSearch->lineEdit()->selectAll();
- m_toolbarSearch->lineEdit()->setFocus();
+// m_toolbarSearch->lineEdit()->selectAll();
+// m_toolbarSearch->lineEdit()->setFocus();
}
diff --git a/src/browsermainwindow.h b/src/browsermainwindow.h
index cc206626..c5db7bba 100644
--- a/src/browsermainwindow.h
+++ b/src/browsermainwindow.h
@@ -24,6 +24,7 @@
// Local Includes
#include "findbar.h"
+#include "searchbar.h"
// KDE Includes
#include <KMainWindow>
@@ -40,7 +41,7 @@
class AutoSaver;
class QWebFrame;
class TabWidget;
-class ToolbarSearch;
+// class ToolbarSearch;
class WebView;
/*!
@@ -126,7 +127,8 @@ private:
private:
KToolBar *m_navigationBar;
- ToolbarSearch *m_toolbarSearch;
+// ToolbarSearch *m_toolbarSearch;
+ SearchBar *m_searchBar;
TabWidget *m_tabWidget;
AutoSaver *m_autoSaver;
diff --git a/src/searchbar.cpp b/src/searchbar.cpp
new file mode 100644
index 00000000..deb8d631
--- /dev/null
+++ b/src/searchbar.cpp
@@ -0,0 +1,62 @@
+/* ============================================================
+ *
+ * This file is a part of the reKonq project
+ *
+ * Copyright (C) 2008 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 2, 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.
+ *
+ * ============================================================ */
+
+// Local Includes
+#include "searchbar.h"
+#include "searchbar.moc"
+
+// Qt Includes
+#include <QVBoxLayout>
+
+SearchBar::SearchBar(QWidget *parent) :
+ QWidget(parent),
+ m_lineEdit(0)
+{
+ m_lineEdit = new KLineEdit(this);
+ m_lineEdit->setClearButtonShown( true );
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(m_lineEdit);
+ setLayout(layout);
+
+ connect( lineEdit() , SIGNAL( returnPressed() ) , this , SLOT( searchNow() ) );
+}
+
+SearchBar::~SearchBar()
+{
+}
+
+void SearchBar::searchNow()
+{
+ QString searchText = m_lineEdit->text();
+
+ QUrl 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);
+
+}
+
+KLineEdit *SearchBar::lineEdit()
+{
+ return m_lineEdit;
+}
+
diff --git a/src/toolbarsearch.h b/src/searchbar.h
index 81f06180..40235891 100644
--- a/src/toolbarsearch.h
+++ b/src/searchbar.h
@@ -2,7 +2,6 @@
 *
 * This file is a part of the reKonq project
 *
- * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
* Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com>
 *
*
@@ -18,46 +17,36 @@
 *
 * ============================================================ */
-#ifndef TOOLBARSEARCH_H
-#define TOOLBARSEARCH_H
-#include "searchlineedit.h"
+#ifndef SEARCHBAR_H
+#define SEARCHBAR_H
-QT_BEGIN_NAMESPACE
-class QUrl;
-class QAction;
-class QStringListModel;
-QT_END_NAMESPACE
+// KDE Includes
+#include <KLineEdit>
-class AutoSaver;
+// Qt Includes
+#include <QWidget>
+#include <QUrl>
-class ToolbarSearch : public SearchLineEdit
+class SearchBar : public QWidget
{
- Q_OBJECT
-
-signals:
- void search(const QUrl &url);
+Q_OBJECT
public:
- ToolbarSearch(QWidget *parent = 0);
- ~ToolbarSearch();
+ SearchBar(QWidget *parent = 0);
+ ~SearchBar();
+
+ KLineEdit *lineEdit();
public slots:
- void clear();
void searchNow();
-private slots:
- void save();
- void aboutToShowMenu();
- void triggeredMenuAction(QAction *action);
-
private:
- void load();
+ KLineEdit *m_lineEdit;
- AutoSaver *m_autosaver;
- int m_maxSavedSearches;
- QStringListModel *m_stringListModel;
-};
+signals:
+ void search(const QUrl &url);
-#endif // TOOLBARSEARCH_H
+};
+#endif
diff --git a/src/toolbarsearch.cpp b/src/toolbarsearch.cpp
deleted file mode 100644
index 4fd3aa51..00000000
--- a/src/toolbarsearch.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/* ============================================================
- *
- * This file is a part of the reKonq project
- *
- * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
- * Copyright (C) 2008 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 2, 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.
- *
- * ============================================================ */
-
-// Local Includes
-#include "toolbarsearch.h"
-#include "autosaver.h"
-
-// Qt Includes
-#include <QSettings>
-#include <QUrl>
-#include <QCompleter>
-#include <QMenu>
-#include <QStringListModel>
-#include <QWebSettings>
-
-/*
- ToolbarSearch is a very basic search widget that also contains a small history.
- Searches are turned into urls that use Google to perform search
- */
-ToolbarSearch::ToolbarSearch(QWidget *parent)
- : SearchLineEdit(parent)
- , m_autosaver(new AutoSaver(this))
- , m_maxSavedSearches(10)
- , m_stringListModel(new QStringListModel(this))
-{
- QMenu *m = menu();
- connect(m, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenu()));
- connect(m, SIGNAL(triggered(QAction*)), this, SLOT(triggeredMenuAction(QAction*)));
-
- QCompleter *completer = new QCompleter(m_stringListModel, this);
- completer->setCompletionMode(QCompleter::InlineCompletion);
- lineEdit()->setCompleter(completer);
-
- connect(lineEdit(), SIGNAL(returnPressed()), SLOT(searchNow()));
- setInactiveText("Google");
- load();
-}
-
-ToolbarSearch::~ToolbarSearch()
-{
- m_autosaver->saveIfNeccessary();
-}
-
-void ToolbarSearch::save()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("toolbarsearch"));
- settings.setValue(QLatin1String("recentSearches"), m_stringListModel->stringList());
- settings.setValue(QLatin1String("maximumSaved"), m_maxSavedSearches);
- settings.endGroup();
-}
-
-void ToolbarSearch::load()
-{
- QSettings settings;
- settings.beginGroup(QLatin1String("toolbarsearch"));
- QStringList list = settings.value(QLatin1String("recentSearches")).toStringList();
- m_maxSavedSearches = settings.value(QLatin1String("maximumSaved"), m_maxSavedSearches).toInt();
- m_stringListModel->setStringList(list);
- settings.endGroup();
-}
-
-void ToolbarSearch::searchNow()
-{
- QString searchText = lineEdit()->text();
- QStringList newList = m_stringListModel->stringList();
- if (newList.contains(searchText))
- newList.removeAt(newList.indexOf(searchText));
- newList.prepend(searchText);
- if (newList.size() >= m_maxSavedSearches)
- newList.removeLast();
-
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (!globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
- m_stringListModel->setStringList(newList);
- m_autosaver->changeOccurred();
- }
-
- QUrl 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 ToolbarSearch::aboutToShowMenu()
-{
- lineEdit()->selectAll();
- QMenu *m = menu();
- m->clear();
- QStringList list = m_stringListModel->stringList();
- if (list.isEmpty()) {
- m->addAction( tr("No Recent Searches") );
- return;
- }
-
- QAction *recent = m->addAction( tr("Recent Searches") );
- recent->setEnabled(false);
- for (int i = 0; i < list.count(); ++i) {
- QString text = list.at(i);
- m->addAction(text)->setData(text);
- }
- m->addSeparator();
- m->addAction( tr("Clear Recent Searches"), this, SLOT(clear()));
-}
-
-void ToolbarSearch::triggeredMenuAction(QAction *action)
-{
- QVariant v = action->data();
- if (v.canConvert<QString>()) {
- QString text = v.toString();
- lineEdit()->setText(text);
- searchNow();
- }
-}
-
-void ToolbarSearch::clear()
-{
- m_stringListModel->setStringList(QStringList());
- m_autosaver->changeOccurred();;
-}
diff --git a/src/urlbar.cpp b/src/urlbar.cpp
new file mode 100644
index 00000000..62b28614
--- /dev/null
+++ b/src/urlbar.cpp
@@ -0,0 +1,25 @@
+/* ============================================================
+ *
+ * This file is a part of the reKonq project
+ *
+ * Copyright (C) 2008 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 2, 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.
+ *
+ * ============================================================ */
+
+
+
+
+
+
+
diff --git a/src/urlbar.h b/src/urlbar.h
new file mode 100644
index 00000000..13c4c320
--- /dev/null
+++ b/src/urlbar.h
@@ -0,0 +1,28 @@
+/* ============================================================
+ *
+ * This file is a part of the reKonq project
+ *
+ * Copyright (C) 2008 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 2, 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 URLBAR_H
+#define URLBAR_H
+
+
+
+
+
+
+#endif
diff --git a/src/urllineedit.cpp b/src/urllineedit.cpp
index bd48bb03..88ce28c4 100644
--- a/src/urllineedit.cpp
+++ b/src/urllineedit.cpp
@@ -64,10 +64,8 @@ ExLineEdit::ExLineEdit(QWidget *parent)
// clearButton
m_clearButton = new ClearButton(this);
- connect(m_clearButton, SIGNAL(clicked()),
- m_lineEdit, SLOT(clear()));
- connect(m_lineEdit, SIGNAL(textChanged(const QString&)),
- m_clearButton, SLOT(textChanged(const QString&)));
+ connect(m_clearButton, SIGNAL(clicked()), m_lineEdit, SLOT(clear()));
+ connect(m_lineEdit, SIGNAL(textChanged(const QString&)), m_clearButton, SLOT(textChanged(const QString&)));
}
void ExLineEdit::setLeftWidget(QWidget *widget)