diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 68 | ||||
-rw-r--r-- | TODO | 25 | ||||
-rw-r--r-- | src/CMakeLists.txt | 33 | ||||
-rw-r--r-- | src/application.cpp | 2 | ||||
-rw-r--r-- | src/application.h | 2 | ||||
-rw-r--r-- | src/history.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/mainview.cpp | 67 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 97 | ||||
-rw-r--r-- | src/mainwindow.h | 30 | ||||
-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 | 8 | ||||
-rw-r--r-- | src/settings_general.ui | 41 | ||||
-rw-r--r-- | src/urlbar.cpp | 4 | ||||
-rw-r--r-- | src/urlbar.h | 1 | ||||
-rw-r--r-- | src/webpage.cpp | 36 | ||||
-rw-r--r-- | src/webpage.h | 5 |
21 files changed, 200 insertions, 434 deletions
@@ -5,5 +5,6 @@ src/.ctagsdb .directory *.tmp build/ +qtcreator-build/ CMakeLists.txt.user CMakeCache.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b3d7ff4..6681e5a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ PROJECT( rekonq ) # rekonq info SET(REKONQ_MAJOR_VERSION "0") SET(REKONQ_MINOR_VERSION "1") -SET(REKONQ_PATCH_VERSION "6") +SET(REKONQ_PATCH_VERSION "7") SET(REKONQ_VERSION_STR "${REKONQ_MAJOR_VERSION}.${REKONQ_MINOR_VERSION}.${REKONQ_PATCH_VERSION}" @@ -37,9 +37,22 @@ INCLUDE(FindPackageHandleStandardArgs) INCLUDE(KDE4Defaults) INCLUDE(MacroLibrary) +# ================================================================================================= +# KDE Version + +if(${KDE_VERSION_MINOR} GREATER "2") + SET(KDE_OLD_VERSION false) +else(${KDE_VERSION_MINOR} GREATER "2") + if(${KDE_VERSION_RELEASE} GREATER "69") + SET(KDE_OLD_VERSION false) + else(${KDE_VERSION_RELEASE} GREATER "69") + SET(KDE_OLD_VERSION true) + endif(${KDE_VERSION_RELEASE} GREATER "69") +endif(${KDE_VERSION_MINOR} GREATER "2") +# ================================================================================================= + # --------------- KNetworkAccessManager -if(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") -else(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +if(KDE_OLD_VERSION) find_package(KdeNetwork REQUIRED) @@ -49,7 +62,8 @@ else(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") MESSAGE(STATUS " classes, instead of newly KIO::AccessManager. ") MESSAGE(STATUS "") -endif(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +endif(KDE_OLD_VERSION) + # ================================================================================================== @@ -110,21 +124,20 @@ ELSE(KDEWEBKIT_FOUND) ENDIF(KDEWEBKIT_FOUND) # --------------- KNetworkAccessManager -if(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") -else(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") -MESSAGE(STATUS "") -IF(KDENETWORK_FOUND) - MESSAGE(STATUS " KDE Network library found............. YES") -ELSE(KDENETWORK_FOUND) - MESSAGE(STATUS " KDE Network library found............. NO") - MESSAGE(STATUS "") - MESSAGE(SEND_ERROR " rekonq needs, from version 0.2, KDENETWORK if compiled with a KDE version minor than 4.2.69 ") - MESSAGE(STATUS " You can actually retrieve it from playground/libs/webkitkde/kdenetwork KDE svn") - MESSAGE(STATUS "") -ENDIF(KDENETWORK_FOUND) - -endif(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +if(KDE_OLD_VERSION) + MESSAGE(STATUS "") + IF(KDENETWORK_FOUND) + MESSAGE(STATUS " KDE Network library found............. YES") + ELSE(KDENETWORK_FOUND) + MESSAGE(STATUS " KDE Network library found............. NO") + MESSAGE(STATUS "") + MESSAGE(SEND_ERROR " rekonq needs, from version 0.2, KDENETWORK if compiled with a KDE version minor than 4.2.69 ") + MESSAGE(STATUS " You can actually retrieve it from playground/libs/webkitkde/kdenetwork KDE svn") + MESSAGE(STATUS "") + ENDIF(KDENETWORK_FOUND) + +endif(KDE_OLD_VERSION) MESSAGE(STATUS "") MESSAGE(STATUS "----------------------------------------------------------------------------------") @@ -133,28 +146,27 @@ MESSAGE(STATUS "") ##### FINAL RESULTS ##### -if(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +if(KDE_OLD_VERSION) - IF(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND) + IF(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND AND KDENETWORK_FOUND) MESSAGE(STATUS " rekonq will be compiled............... YES") SET(REKONQ_CAN_BE_COMPILED true) - ELSE(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND) + ELSE(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND AND KDENETWORK_FOUND) MESSAGE(FATAL_ERROR " rekonq will NOT be compiled!") SET(REKONQ_CAN_BE_COMPILED false) - ENDIF(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND) + ENDIF(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND AND KDENETWORK_FOUND) -else(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +else(KDE_OLD_VERSION) - IF(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND AND KDENETWORK_FOUND) + IF(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND) MESSAGE(STATUS " rekonq will be compiled............... YES") SET(REKONQ_CAN_BE_COMPILED true) - ELSE(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND AND KDENETWORK_FOUND) + ELSE(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND) MESSAGE(FATAL_ERROR " rekonq will NOT be compiled!") SET(REKONQ_CAN_BE_COMPILED false) - ENDIF(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND AND KDENETWORK_FOUND) - -endif(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") + ENDIF(QT_FOUND AND KDE4_FOUND AND KDEWEBKIT_FOUND) +endif(KDE_OLD_VERSION) MESSAGE(STATUS "") @@ -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 ed3205b8..f3f7544a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,14 +1,10 @@ ### ------- SETTING REKONQ FILES.. -if(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") - -SET( rekonq_NAM networkmanager.cpp ) - -else(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") - -SET( rekonq_NAM kaccessmanager.cpp ) - -endif(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +if(KDE_OLD_VERSION) + SET( rekonq_NAM kaccessmanager.cpp ) +else(KDE_OLD_VERSION) + SET( rekonq_NAM networkmanager.cpp ) +endif(KDE_OLD_VERSION) SET( rekonq_SRCS ${rekonq_NAM} @@ -26,7 +22,6 @@ SET( rekonq_SRCS modelmenu.cpp urlbar.cpp findbar.cpp - searchbar.cpp settings.cpp webview.cpp main.cpp @@ -66,13 +61,11 @@ INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR} ${KDEWEBKIT_INCLUDE_DIR} ) -if(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") -else(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +if(KDE_OLD_VERSION) INCLUDE_DIRECTORIES( ${KDENETWORK_INCLUDE_DIR} ) -endif(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") - +endif(KDE_OLD_VERSION) ### -------------- ADDING DEFINITIONS... @@ -81,13 +74,11 @@ ADD_DEFINITIONS ( ${KDE4_DEFINITIONS} ${KDEWEBKIT_DEFINITIONS} ) -if(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") -else(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +if(KDE_OLD_VERSION) ADD_DEFINITIONS ( ${KDENETWORK_DEFINITIONS} ) -endif(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") - +endif(KDE_OLD_VERSION) ### --------------- ADDING EXECUTABLE... @@ -107,13 +98,11 @@ TARGET_LINK_LIBRARIES ( rekonq ${KDEWEBKIT_LIBRARIES} ) -if(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") -else(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") +if(KDE_OLD_VERSION) TARGET_LINK_LIBRARIES( ${KDENETWORK_LIBRARIES} ) -endif(${KDE_VERSION_MINOR} EQUAL "2" AND ${KDE_VERSION_RELEASE} GREATER "69") - +endif(KDE_OLD_VERSION) ### ------------ INSTALL FILES... diff --git a/src/application.cpp b/src/application.cpp index b940794a..afd6a2cc 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -185,7 +185,7 @@ BookmarkProvider *Application::bookmarkProvider() } -KIcon Application::icon(const KUrl &url) const +KIcon Application::icon(const KUrl &url) { KIcon icon = KIcon(QWebSettings::iconForUrl(url)); if (icon.isNull()) diff --git a/src/application.h b/src/application.h index d2e66d3f..46d013e3 100644 --- a/src/application.h +++ b/src/application.h @@ -90,7 +90,7 @@ public: MainWindow *mainWindow(); WebView *newWebView(Rekonq::OpenType type = Rekonq::Default); - KIcon icon(const KUrl &url) const; + static KIcon icon(const KUrl &url); static KUrl guessUrlFromString(const QString &url); diff --git a/src/history.cpp b/src/history.cpp index 11cd3653..d67e65d0 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -500,7 +500,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const case Qt::DecorationRole: if (index.column() == 0) { - return Application::instance()->icon(item.url); + return Application::icon(item.url); } } return QVariant(); diff --git a/src/main.cpp b/src/main.cpp index d97017ca..71ba22b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,7 @@ static const char description[] = I18N_NOOP("WebKit based Web Browser for KDE"); -static const char version[] = "0.1.6"; +static const char version[] = "0.1.7"; int main(int argc, char **argv) diff --git a/src/mainview.cpp b/src/mainview.cpp index 75154528..a3c6e77e 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -46,6 +46,7 @@ #include <KActionCollection> #include <KDebug> #include <KStandardDirs> +#include <KToolInvocation> // Qt Includes #include <QtCore/QTimer> @@ -501,11 +502,10 @@ void MainView::slotCloseTab(int index) { if (tab->isModified()) { - int risp = KMessageBox::questionYesNo(this , + int risp = KMessageBox::questionYesNo(this, i18n("You have modified this page and when closing it you would lose the modification.\n" - "Do you really want to close this page?\n"), - i18n("Do you really want to close this page?") - ); + "Do you really want to close this page?\n"), + i18n("Do you really want to close this page?")); if (risp == KMessageBox::No) return; } @@ -586,7 +586,7 @@ void MainView::webViewIconChanged() int index = webViewIndex(webView); if (-1 != index) { - QIcon icon = Application::instance()->icon(webView->url()); + QIcon icon = Application::icon(webView->url()); QLabel *label = animatedLoading(index, false); QMovie *movie = label->movie(); delete movie; @@ -629,24 +629,71 @@ void MainView::webViewUrlChanged(const QUrl &url) } +// WARNING this method is ready to be refactored with real KServices implementation +// and moved to a RekonqRun class (0.3 target) void MainView::loadUrl(const KUrl &url) { if (url.isEmpty()) return; - currentUrlBar()->setUrl(url.prettyUrl()); + QString scheme = url.scheme(); - WebView *webView = currentWebView(); + if (scheme == QLatin1String("mailto")) + { + KToolInvocation::invokeMailer(url); + return; + } KUrl loadingUrl(url); + // create convenience fake api:// protocol for KDE apidox search and Qt docs + if (scheme == QLatin1String("api")) + { + QString path; + QString className = url.host().toLower(); + if (className[0] == 'k') + { + path = QString("http://api.kde.org/new.classmapper.php?class=%1").arg(className); + } + else if (className[0] == 'q') + { + path = QString("http://doc.trolltech.com/4.5/%1.html").arg(className); + } + loadingUrl.setUrl(path); + } + if (loadingUrl.isRelative()) { - QString fn = loadingUrl.url(KUrl::RemoveTrailingSlash); - loadingUrl.setUrl("//" + fn); - loadingUrl.setScheme("http"); + if(loadingUrl.path().contains('.')) + { + QString fn = loadingUrl.url(KUrl::RemoveTrailingSlash); + loadingUrl.setUrl("//" + fn); + loadingUrl.setScheme("http"); + } + else + { + scheme = QLatin1String("gg"); + } + } + + // create convenience fake gg:// protocol, waiting for KServices learning + if(scheme == QLatin1String("gg")) + { + QString str = loadingUrl.path(); + loadingUrl.setUrl( QString("http://google.com/search?&q=%1").arg(str) ); } + // create convenience fake wk:// protocol, waiting for KServices learning + if(scheme == QLatin1String("wk")) + { + QString str = loadingUrl.path(); + loadingUrl.setUrl( QString("http://en.wikipedia.org/wiki/%1").arg(str) ); + } + + currentUrlBar()->setUrl(loadingUrl.prettyUrl()); + + WebView *webView = currentWebView(); + if (webView) { webView->load(loadingUrl); diff --git a/src/mainview.h b/src/mainview.h index 7cb4e035..d338402a 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2008-2009 by Andrea Diamantini <adjam7 at gmail dot com> * Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> * * diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 519081d6..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); @@ -295,7 +283,7 @@ void MainWindow::setupActions() a = new KAction(KIcon("view-media-artist"), i18n("Private &Browsing"), this); a->setCheckable(true); actionCollection()->addAction(QLatin1String("private_browsing"), a); - connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing(bool))); + connect(a, SIGNAL(triggered(bool)), this, SLOT(slotPrivateBrowsing(bool))); // ================ history related actions m_historyBackAction = new KAction(KIcon("go-previous"), i18n("Back"), this); @@ -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(); @@ -483,10 +488,10 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) void MainWindow::slotFileOpen() { QString filePath = KFileDialog::getOpenFileName(KUrl(), - i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz); All files (*.*)"), + i18n("*.html *.htm *.svg *.png *.gif *.svgz|Web Resources (*.html *.htm *.svg *.png *.gif *.svgz)\n" \ + "*.*|All files (*.*)"), this, - i18n("Open Web Resource") - ); + i18n("Open Web Resource")); if (filePath.isEmpty()) return; @@ -531,7 +536,7 @@ void MainWindow::printRequested(QWebFrame *frame) void MainWindow::slotPrivateBrowsing(bool enable) { QWebSettings *settings = QWebSettings::globalSettings(); - if (enable) + if (enable && !settings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { QString title = i18n("Are you sure you want to turn on private browsing?"); QString text = "<b>" + title + i18n("</b><br><br>When private browsing is turned on," @@ -542,8 +547,8 @@ void MainWindow::slotPrivateBrowsing(bool enable) " Until you close the window, you can still click the Back and Forward buttons" \ " to return to the web pages you have opened."); - int button = KMessageBox::questionYesNo(this, text, title); - if (button == KMessageBox::Ok) + int button = KMessageBox::questionYesNo(this, text, title); + if (button == KMessageBox::Yes) { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); } @@ -577,15 +582,9 @@ void MainWindow::slotFindNext() if (!currentTab() && m_lastSearch.isEmpty()) return; - QWebPage::FindFlags options; + QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument; if (m_findBar->matchCase()) - { - options = QWebPage::FindCaseSensitively | QWebPage::FindWrapsAroundDocument; - } - else - { - options = QWebPage::FindWrapsAroundDocument; - } + options |= QWebPage::FindCaseSensitively; if (!currentTab()->findText(m_lastSearch, options)) { @@ -599,15 +598,9 @@ void MainWindow::slotFindPrevious() if (!currentTab() && m_lastSearch.isEmpty()) return; - QWebPage::FindFlags options; + QWebPage::FindFlags options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument; if (m_findBar->matchCase()) - { - options = QWebPage::FindCaseSensitively | QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument; - } - else - { - options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument; - } + options |= QWebPage::FindCaseSensitively; if (!currentTab()->findText(m_lastSearch, options)) { @@ -718,8 +711,8 @@ void MainWindow::slotToggleInspector(bool enable) if (enable) { int result = KMessageBox::questionYesNo(this, - i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" - "Do you want to reload all pages?"), + i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" \ + "Do you want to reload all pages?"), i18n("Web Inspector") ); @@ -810,17 +803,16 @@ bool MainWindow::queryClose() int answer = KMessageBox::questionYesNoCancel( this, - i18np( "Are you sure you want to close the window?\n" - "You have 1 tab open", - "Are you sure you want to close the window?\n" - "You have %1 tabs open", - m_view->count()), - i18n("Are you sure you want to close the window?"), - KStandardGuiItem::quit(), - KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), - KStandardGuiItem::cancel(), - "confirmClosingMultipleTabs" - ); + i18np("Are you sure you want to close the window?\n" \ + "You have 1 tab open", + "Are you sure you want to close the window?\n" \ + "You have %1 tabs open", + m_view->count()), + i18n("Are you sure you want to close the window?"), + KStandardGuiItem::quit(), + KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), + KStandardGuiItem::cancel(), + "confirmClosingMultipleTabs"); switch (answer) { @@ -891,7 +883,6 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) m_popup->setView(msg); int h = KGlobalSettings::generalFont().pointSize(); - kWarning() << "h: " << h; // setting popus in bottom-left position int x = geometry().x(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 4e32e215..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(); @@ -127,7 +107,6 @@ private slots: void slotFileOpen(); void slotFilePrintPreview(); void slotFilePrint(); - void slotPrivateBrowsing(bool); void slotFileSaveAs(); void printRequested(QWebFrame *frame); @@ -145,6 +124,7 @@ private slots: // Tools Menu slots void slotToggleInspector(bool enable); + void slotPrivateBrowsing(bool enable); // Settings Menu slots void slotShowMenubar(bool enable); @@ -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 1de69a7a..dda00a0e 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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/> diff --git a/src/urlbar.cpp b/src/urlbar.cpp index 0204d321..d107ba1a 100644 --- a/src/urlbar.cpp +++ b/src/urlbar.cpp @@ -137,11 +137,11 @@ void UrlBar::slotUpdateUrl() { if (count()) { - changeUrl(0, Application::instance()->icon(m_currentUrl), m_currentUrl); + changeUrl(0, Application::icon(m_currentUrl), m_currentUrl); } else { - insertUrl(0, Application::instance()->icon(m_currentUrl), m_currentUrl); + insertUrl(0, Application::icon(m_currentUrl), m_currentUrl); } setCurrentIndex(0); diff --git a/src/urlbar.h b/src/urlbar.h index 32d09af4..24fea38f 100644 --- a/src/urlbar.h +++ b/src/urlbar.h @@ -81,7 +81,6 @@ private: LineEdit *m_lineEdit; - QIcon m_currentIcon; KUrl m_currentUrl; int m_progress; }; diff --git a/src/webpage.cpp b/src/webpage.cpp index 8c6c0d2a..133a263c 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -40,7 +40,7 @@ #include <KUrl> #include <KActionCollection> #include <KDebug> -#include <KToolInvocation> + #include <KDE/KParts/BrowserRun> #include <KDE/KMimeTypeTrader> @@ -76,40 +76,6 @@ WebPage::WebPage(QObject *parent) } -bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type) -{ - - // TODO: implement ioslaves protocols - QString scheme = request.url().scheme(); - if (scheme == QLatin1String("mailto")) - { - KToolInvocation::invokeMailer(request.url()); - return false; - } - - // create convenience fake api:// protocol for KDE apidox search and Qt docs - if (scheme == QLatin1String("api")) - { - QString path; - QString className = request.url().host().toLower(); - if (className[0] == 'k') - { - path = QString("http://api.kde.org/new.classmapper.php?class=%1").arg(className); - } - else if (className[0] == 'q') - { - path = QString("http://doc.trolltech.com/4.5/%1.html").arg(className); - } - KUrl url(path); - - Application::instance()->mainWindow()->loadUrl(url); - return false; - } - - return QWebPage::acceptNavigationRequest(frame, request, type); -} - - KWebPage *WebPage::createWindow(QWebPage::WebWindowType type) { kDebug() << "creating window as new tab.. "; diff --git a/src/webpage.h b/src/webpage.h index 8fe9517d..c43212b6 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -48,13 +48,8 @@ public slots: void manageNetworkErrors(QNetworkReply* reply); protected: - bool acceptNavigationRequest(QWebFrame *frame, - const QNetworkRequest &request, - NavigationType type); - KWebPage *createWindow(QWebPage::WebWindowType type); - protected Q_SLOTS: virtual void slotHandleUnsupportedContent(QNetworkReply *reply); |