diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/application.cpp | 2 | ||||
-rw-r--r-- | src/historymenu.cpp | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 37 | ||||
-rw-r--r-- | src/mainwindow.h | 28 | ||||
-rw-r--r-- | src/rekonq.kcfg | 9 | ||||
-rw-r--r-- | src/searchbar.cpp | 131 | ||||
-rw-r--r-- | src/searchbar.h | 68 | ||||
-rw-r--r-- | src/settings.cpp | 28 | ||||
-rw-r--r-- | src/settings_general.ui | 41 |
10 files changed, 57 insertions, 290 deletions
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/application.cpp b/src/application.cpp index bc77f60a..afd6a2cc 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -190,7 +190,7 @@ KIcon Application::icon(const KUrl &url) KIcon icon = KIcon(QWebSettings::iconForUrl(url)); if (icon.isNull()) { - icon = KIcon("kde"); + icon = KIcon("text-html"); } return icon; } diff --git a/src/historymenu.cpp b/src/historymenu.cpp index b5edae3f..4f11d82c 100644 --- a/src/historymenu.cpp +++ b/src/historymenu.cpp @@ -86,7 +86,7 @@ void HistoryMenu::postPopulated() void HistoryMenu::clearHistory() { - int res = KMessageBox::warningYesNo(this, i18n("Are you sure you want to delete history?"), i18n("History") ); + int res = KMessageBox::warningYesNo(this, i18n("Are you sure you want to clear the history?"), i18n("Clear History") ); if (res == KMessageBox::Yes) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 44ca861c..82f95cfa 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(); @@ -165,10 +164,6 @@ void MainWindow::postLaunch() connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); - // "status bar" messages (new notifyMessage system) - connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); - connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&))); - // update toolbar actions signals connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); @@ -195,7 +190,7 @@ QSize MainWindow::sizeHint() const } -void MainWindow::setupToolBars() +void MainWindow::setupBars() { KAction *a; @@ -205,13 +200,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 +348,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")); @@ -375,6 +363,23 @@ void MainWindow::slotUpdateConfiguration() mainView()->showTabBar(); mainView()->setMakeBackTab( ReKonfig::openTabsBack() ); + // "status bar" messages (new notifyMessage system) + if(ReKonfig::showUrlsPopup()) + { + connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), + this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); + connect(m_view, SIGNAL(linkHovered(const QString&)), + this, SLOT(notifyMessage(const QString&))); + } + else + { + disconnect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), + this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); + disconnect(m_view, SIGNAL(linkHovered(const QString&)), + this, SLOT(notifyMessage(const QString&))); + } + + // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); 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/rekonq.kcfg b/src/rekonq.kcfg index 499258d2..d6e3a8ae 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -14,12 +14,6 @@ <entry name="homePage" type="String"> <default>http://www.kde.org/</default> </entry> - <entry name="downloadDir" type="Path"> - <default>$HOME</default> - </entry> - <entry name="downloadToDefaultDir" type="Bool"> - <default>false</default> - </entry> <entry name="alwaysShowTabBar" type="Bool"> <default>true</default> </entry> @@ -29,6 +23,9 @@ <entry name="openTabsBack" type="Bool"> <default>false</default> </entry> + <entry name="showUrlsPopup" type="Bool"> + <default>false</default> + </entry> </group> <!-- Fonts Settings --> 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 diff --git a/src/settings.cpp b/src/settings.cpp index 297b81d9..dda00a0e 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -145,16 +145,16 @@ void SettingsDialog::setWebSettingsToolTips() { d->webkitUi.kcfg_autoLoadImages->setToolTip(i18n("Specifies whether images are automatically loaded in web pages")); d->webkitUi.kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs.")); - d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables Java applets.")); - d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables plugins in web pages.")); - d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("Allows JavaScript programs to open new windows.")); - d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("Allows JavaScript programs to read from and to write to the clipboard.")); - d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("Includes hyperlinks in the keyboard focus chain.")); - d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("Applies the zoom factor on a frame to only the text or all content.")); - d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("Draws also background color and images when the page is printed.")); - d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Support for the HTML 5 offline storage feature.")); - d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Support for the HTML 5 web application cache feature.")); - d->webkitUi.kcfg_localStorageDatabaseEnabled->setToolTip(i18n("Support for the HTML 5 local storage feature.")); + d->webkitUi.kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets.")); + d->webkitUi.kcfg_pluginsEnabled->setToolTip(i18n("Enables support for plugins in web pages.")); + d->webkitUi.kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows.")); + d->webkitUi.kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard.")); + d->webkitUi.kcfg_linksIncludedInFocusChain->setToolTip(i18n("If enabled, hyperlinks are included in the keyboard focus chain.")); + d->webkitUi.kcfg_zoomTextOnly->setToolTip(i18n("If enabled, the zoom factor on a frame is only applied to the text.")); + d->webkitUi.kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed.")); + d->webkitUi.kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature.")); + d->webkitUi.kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature.")); + d->webkitUi.kcfg_localStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature.")); } @@ -162,9 +162,9 @@ void SettingsDialog::setWebSettingsToolTips() void SettingsDialog::readConfig() { // ======= General - d->generalUi.downloadDirUrlRequester->setMode(KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly); - d->generalUi.downloadDirUrlRequester->setUrl(ReKonfig::downloadDir()); - connect(d->generalUi.downloadDirUrlRequester, SIGNAL(textChanged(QString)), this, SLOT(saveSettings())); +// d->generalUi.downloadDirUrlRequester->setMode(KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly); +// d->generalUi.downloadDirUrlRequester->setUrl(ReKonfig::downloadDir()); +// connect(d->generalUi.downloadDirUrlRequester, SIGNAL(textChanged(QString)), this, SLOT(saveSettings())); // ======= Fonts d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); @@ -180,7 +180,7 @@ void SettingsDialog::readConfig() void SettingsDialog::saveSettings() { // General - ReKonfig::setDownloadDir(d->generalUi.downloadDirUrlRequester->url().prettyUrl()); +// ReKonfig::setDownloadDir(d->generalUi.downloadDirUrlRequester->url().prettyUrl()); // Save ReKonfig::self()->writeConfig(); diff --git a/src/settings_general.ui b/src/settings_general.ui index 95723e78..d6ce4e49 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -64,26 +64,6 @@ </item> </layout> </item> - <item row="2" column="1"> - <widget class="KUrlRequester" name="downloadDirUrlRequester"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Save downloads to:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QCheckBox" name="kcfg_downloadToDefaultDir"> - <property name="text"> - <string>Ask where to save downloads</string> - </property> - </widget> - </item> </layout> </widget> </item> @@ -111,6 +91,22 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>General Settings</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QCheckBox" name="kcfg_showUrlsPopup"> + <property name="text"> + <string>show urls in popup hovering links</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -131,11 +127,6 @@ <extends>QLineEdit</extends> <header>klineedit.h</header> </customwidget> - <customwidget> - <class>KUrlRequester</class> - <extends>QFrame</extends> - <header>kurlrequester.h</header> - </customwidget> </customwidgets> <resources/> <connections/> |