diff options
-rw-r--r-- | CMakeLists.txt | 68 | ||||
-rw-r--r-- | src/CMakeLists.txt | 32 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/mainview.cpp | 58 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 1 | ||||
-rw-r--r-- | src/webpage.cpp | 36 | ||||
-rw-r--r-- | src/webpage.h | 5 |
8 files changed, 107 insertions, 97 deletions
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 "") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ed3205b8..809e54af 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} @@ -66,13 +62,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 +75,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 +99,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/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 79afd2dc..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> @@ -628,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 2c46dc01..44ca861c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -878,7 +878,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/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); |