diff options
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | data/slack-desc | 12 | ||||
-rw-r--r-- | rekonq.SlackBuild | 79 | ||||
-rw-r--r-- | scripts/RELEASE_HOWTO | 66 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/application.cpp | 42 | ||||
-rw-r--r-- | src/bookmarks.cpp | 12 | ||||
-rw-r--r-- | src/bookmarks.h | 7 | ||||
-rw-r--r-- | src/cookiejar.cpp | 3 | ||||
-rw-r--r-- | src/lineedit.cpp | 1 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/mainview.cpp | 14 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 22 | ||||
-rw-r--r-- | src/networkaccessmanager.cpp | 17 | ||||
-rw-r--r-- | src/networkaccessmanager.h | 6 | ||||
-rw-r--r-- | src/rekonq.kcfg | 10 | ||||
-rw-r--r-- | src/settings.cpp | 13 | ||||
-rw-r--r-- | src/settings.h | 3 | ||||
-rw-r--r-- | src/settings_general.ui | 58 | ||||
-rw-r--r-- | src/settings_privacy.ui | 87 | ||||
-rw-r--r-- | src/urlbar.cpp | 17 | ||||
-rw-r--r-- | src/urlbar.h | 3 | ||||
-rw-r--r-- | src/webpage.cpp | 141 | ||||
-rw-r--r-- | src/webpage.h | 14 | ||||
-rw-r--r-- | src/webview.cpp | 2 |
27 files changed, 317 insertions, 323 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a783bf27..68516293 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,8 @@ PROJECT( rekonq ) # rekonq info SET(REKONQ_MAJOR_VERSION "0") -SET(REKONQ_MINOR_VERSION "1") -SET(REKONQ_PATCH_VERSION "97") +SET(REKONQ_MINOR_VERSION "2") +SET(REKONQ_PATCH_VERSION "0") SET(REKONQ_VERSION_STR "${REKONQ_MAJOR_VERSION}.${REKONQ_MINOR_VERSION}.${REKONQ_PATCH_VERSION}" @@ -4,7 +4,7 @@ - KDE Web shortcuts support - Contextual action menu(s) - tons of bugs fixed - +- KDE cookie support 0.1 - moved to KDE svn diff --git a/data/slack-desc b/data/slack-desc deleted file mode 100644 index 3136b228..00000000 --- a/data/slack-desc +++ /dev/null @@ -1,12 +0,0 @@ - |-------------------------------------------------------------------| -rekonq: rekonq (Webkit KDE Browser) -rekonq: -rekonq: rekonq is a lightweight KDE browser based on webkit -rekonq: -rekonq: -rekonq: -rekonq: -rekonq: -rekonq: -rekonq: -rekonq: diff --git a/rekonq.SlackBuild b/rekonq.SlackBuild deleted file mode 100644 index 2de6ceae..00000000 --- a/rekonq.SlackBuild +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# Slackware build script for $NAME -# Heavily based on the Slackware 12.2 SlackBuild -# Written by Andrea Diamantini - adjam7_AT_gmail_DOT_com - -NAME=rekonq -VERSION=0.0.4 -ARCH=${ARCH:-i486} -BUILD=1ad - -# working dirs -CWD=$(pwd) -TMP=$CWD/tmp -BUILDIR=$TMP/build -PKG=$TMP/package-$NAME - -KDEPREFIX=$(kde4-config --prefix) - -JOBS=${JOBS:-2} # Might not be wanted or needed in some cases - -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" -elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-O3 -march=i686 -pipe -fomit-frame-pointer" -elif [ "$ARCH" = "athlon64" ]; then - SLKCFLAGS="-O2 -march=athlon64 -pipe" -elif [ "$ARCH" = "athlonxp" ]; then - SLKCFLAGS="-O3 -march=athlon-xp -pipe -fomit-frame-pointer" -elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2" -fi - -rm -rf $TMP -mkdir -p $TMP $PKG $BUILDIR - -cd $BUILDIR - -# configure option for $NAME -cmake \ --DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ --DCMAKE_INSTALL_PREFIX=$KDEPREFIX \ --DCMAKE_BUILD_TYPE=release \ -$CWD - -# Compile the application and install it into the $PKG directory -nice make -j $JOBS || exit 1 -make install DESTDIR=$PKG || exit 1 - -# Strip binaries and libraries -( cd $PKG - find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true - find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null -) - - -# Copy program documentation into the package -# Also, include the SlackBuild script in the documentation directory -mkdir -p $PKG/usr/doc/$NAME-$VERSION -cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README \ -$PKG/usr/doc/$NAME-$VERSION -cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild - -# Copy the slack-desc (and a custom doinst.sh if necessary) into ./install -mkdir -p $PKG/install -cat $CWD/data/slack-desc > $PKG/install/slack-desc - -# Make the package; -# If package symlinks need to be created during install *before* -# your custom contents of doinst.sh runs, then add the -p switch to -# the makepkg command below -- see makepkg(8) for details -cd $PKG -/sbin/makepkg -l y -c n $CWD/$NAME-$VERSION-$ARCH-$BUILD.tgz - -# remove unnecessary tmp dir.. -rm -rf $TMP - -# echo "done" -echo "done! Yuppy!!" - diff --git a/scripts/RELEASE_HOWTO b/scripts/RELEASE_HOWTO new file mode 100644 index 00000000..b9db2628 --- /dev/null +++ b/scripts/RELEASE_HOWTO @@ -0,0 +1,66 @@ +INSPIRED FROM AMAROK ONE + +Section 0: A few days in advance + +* Check that release date doesn't clash with KDE's schedule +* Notify translators and update http://techbase.kde.org/Schedules/Extragear + +-------------------------------------------------------------------------------- + +SECTION 1: Preparation + +* Check the README file is still relevant +(?) * Run the "fixuifiles" script from the source-root +* Bump Version Number (in the CMakeLists.txt && in src/main.cpp) +* Commit the source to GIT + +-------------------------------------------------------------------------------- + +FIXME SECTION 2: Creating and Testing the Tarball + +* Run the "release_script.sh" + VERSION=qualcosina + git tag -s $VERSION + git archive --prefix=rekonq-$VERSION/ $VERSION | bzip2 > releases/rekonq-$VERSION.tar.bz2 + git archive --prefix=rekonq-$VERSION/ $VERSION | gzip > releases/rekonq-$VERSION.tar.gz + +* Test the following: + + $ ./configure && make + $ ./configure --enable-final --disable-debug && make + +* Check it works OK without any amarok files in ~/.kde + +-------------------------------------------------------------------------------- + +FIXME SECTION 3: Once Happy with the Tarball + +* SFtp the tarball to: + - ftpamarok@ktown.kde.org/stable/amarok/VERSION/src + - ftpamarok@ktown.kde.org/unstable/amarok/VERSION/src + (If you don't have access, mail sysadmin@kde.org) + +* Notify packagers +* Write release notes and dot story (and notify KDE-press list if necessary) +* Add new version to Bugzilla + +-------------------------------------------------------------------------------- + +Section 4: The Release Day + +* Update download page on the wiki +* Update the rekonq.kde.org front-page +* Send a witty, intelligent and diligently crafted email to the following lists: + - To: kde-announce-apps@kde.org, rekonq@kde.org + - CC: amarok-promo@kde.org + - BCC: kde-extra-gear@kde.org, kde-network@kde.org, kde-press-announce@kde.org + * Blog, update IRC channel topics, ... + * Update kde-apps.org + +-------------------------------------------------------------------------------- + +APPENDIX B (TODO create an analogue script) + +To create a changelog in html format for updating the various articles and websites, +run generate_changelog.rb. +It will output a file called ChangeLog.html. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ce7b1f8d..45a2afb2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,7 +30,6 @@ KDE4_ADD_UI_FILES( rekonq_SRCS proxy.ui settings_general.ui settings_fonts.ui - settings_privacy.ui settings_proxy.ui settings_webkit.ui cleardata.ui diff --git a/src/application.cpp b/src/application.cpp index df47a119..812081de 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -201,31 +201,26 @@ KUrl Application::guessUrlFromString(const QString &string) QString urlStr = string.trimmed(); QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*")); + // Might be a file. + if (QFile::exists(urlStr)) + { + QFileInfo info(urlStr); + return KUrl::fromPath(info.absoluteFilePath()); + } + // Check if it looks like a qualified URL. Try parsing it and see. - bool hasSchema = test.exactMatch(urlStr); - - if (hasSchema) + if (test.exactMatch(urlStr)) { - QUrl qurl(urlStr, QUrl::TolerantMode); - KUrl url(qurl); - + KUrl url(urlStr); + if (url.isValid()) { return url; } } - - // Might be a file. - if (QFile::exists(urlStr)) - { - QFileInfo info(urlStr); - return KUrl::fromPath(info.absoluteFilePath()); - } - - // Might be a shorturl - try to detect the schema. - if (!hasSchema) + else // Might be a shorturl - try to detect the schema. { - int dotIndex = urlStr.indexOf(QLatin1Char('.')); + int dotIndex = urlStr.indexOf(QLatin1Char(':')); if (dotIndex != -1) { @@ -240,17 +235,10 @@ KUrl Application::guessUrlFromString(const QString &string) } } } - + // Fall back to QUrl's own tolerant parser. - QUrl qurl = QUrl(string, QUrl::TolerantMode); - KUrl url(qurl); + KUrl url = KUrl(urlStr); - // finally for cases where the user just types in a hostname add http - if (qurl.scheme().isEmpty()) - { - qurl = QUrl(QLatin1String("http://") + string, QUrl::TolerantMode); - url = KUrl(qurl); - } return url; } @@ -305,7 +293,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) return; } - WebView *webView; + WebView *webView = 0; switch(type) { diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index d5bd107e..a1f0e441 100644 --- a/src/bookmarks.cpp +++ b/src/bookmarks.cpp @@ -64,10 +64,10 @@ void BookmarkOwner::openBookmark(const KBookmark & bookmark, Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers) { - Q_UNUSED(mouseButtons) - Q_UNUSED(keyboardModifiers) - - emit openUrl(bookmark.url()); + if (keyboardModifiers & Qt::ControlModifier || mouseButtons == Qt::MidButton) + emit openUrl(bookmark.url(), Rekonq::SettingOpenTab); + else + emit openUrl(bookmark.url(), Rekonq::CurrentTab); } @@ -183,7 +183,7 @@ BookmarkProvider::BookmarkProvider(QWidget *parent) // setup menu m_owner = new BookmarkOwner(this); - connect(m_owner, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&))); + connect(m_owner, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), this, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &))); m_bookmarkMenu = new BookmarkMenu(m_manager, m_owner, m_menu, m_actionCollection); // setup toolbar @@ -261,6 +261,8 @@ void BookmarkProvider::contextMenu(const QPoint &point) if (!action) return; KMenu *menu = m_bookmarkMenu->viewContextMenu(action); + if (!menu) + return; menu->popup(m_bookmarkToolBar->mapToGlobal(point)); } diff --git a/src/bookmarks.h b/src/bookmarks.h index 9db71ab5..13562f06 100644 --- a/src/bookmarks.h +++ b/src/bookmarks.h @@ -29,6 +29,9 @@ #ifndef BOOKMARKS_H #define BOOKMARKS_H +// Local Includes +#include "application.h" + // Qt Includes #include <QWidget> @@ -115,7 +118,7 @@ signals: * @param url the URL to load * */ - void openUrl(const KUrl &); + void openUrl(const KUrl &, const Rekonq::OpenType &); private: @@ -206,7 +209,7 @@ signals: * * @param url the URL to load */ - void openUrl(const KUrl &url); + void openUrl(const KUrl &, const Rekonq::OpenType &); public slots: diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp index 7007bc61..5160d6ed 100644 --- a/src/cookiejar.cpp +++ b/src/cookiejar.cpp @@ -56,6 +56,7 @@ CookieJar::CookieJar(QObject* parent) CookieJar::~CookieJar() { + delete m_kcookiejar; } @@ -67,7 +68,6 @@ QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl & url) const if (reply.isValid()) { cookieList << reply.value().toUtf8(); - //kDebug() << reply.value(); } else { @@ -86,7 +86,6 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> & cookieList, cons cookieHeader = "Set-Cookie: "; cookieHeader += cookie.toRawForm(); m_kcookiejar->call("addCookies", url.toString(), cookieHeader, m_windowId); - //kDebug() << "url: " << url.host() << ", cookie: " << cookieHeader; } return !m_kcookiejar->lastError().isValid(); diff --git a/src/lineedit.cpp b/src/lineedit.cpp index 186ac143..b691e090 100644 --- a/src/lineedit.cpp +++ b/src/lineedit.cpp @@ -45,6 +45,7 @@ LineEdit::LineEdit(QWidget* parent) setMinimumWidth(200); setFocusPolicy(Qt::WheelFocus); setHandleSignals(true); + setClearButtonShown(true); } diff --git a/src/main.cpp b/src/main.cpp index 2bf926ab..0758abfa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ static const char description[] = I18N_NOOP("WebKit based Web Browser for KDE"); -static const char version[] = "0.1.97"; +static const char version[] = "0.2.0"; int main(int argc, char **argv) diff --git a/src/mainview.cpp b/src/mainview.cpp index 5b08e17a..efabf0f1 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -327,6 +327,12 @@ void MainView::slotCurrentChanged(int index) currentUrlBar()->setUrl(webView->url()); emit showStatusBarMessage(webView->lastStatusBarText()); + // notify UI to eventually switch stop/reload button + if(currentUrlBar()->isLoading()) + emit browserTabLoading(true); + else + emit browserTabLoading(false); + // set focus to the current webview webView->setFocus(); } @@ -361,6 +367,10 @@ WebView *MainView::webView(int index) const } +// FIXME (0.3 target, after OneUrlBar). Divide in 2 functions: +// 1. the slot void newTab() to create a "new empty focused tab" +// 2. the public method WebView *newWebView() to just create a new webview +// without working with the focus and loading an url WebView *MainView::newTab(bool focused) { // line edit @@ -541,7 +551,7 @@ void MainView::webViewLoadStarted() } } - emit browserLoading(true); + emit browserTabLoading(true); if (index != currentIndex()) return; @@ -564,7 +574,7 @@ void MainView::webViewLoadFinished(bool ok) } webViewIconChanged(); - emit browserLoading(false); + emit browserTabLoading(false); // don't display messages for background tabs if (index != currentIndex()) diff --git a/src/mainview.h b/src/mainview.h index 982fd9eb..3e6b9efb 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -96,7 +96,7 @@ signals: void setCurrentTitle(const QString &url); void showStatusBarMessage(const QString &message, Rekonq::Notify status = Rekonq::Info); void linkHovered(const QString &link); - void browserLoading(bool); + void browserTabLoading(bool); void printRequested(QWebFrame *frame); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7a45d945..3ac46a1b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -176,13 +176,18 @@ void MainWindow::postLaunch() connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); // bookmarks loading - connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&)), Application::instance(), SLOT(loadUrl(const KUrl&))); + connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)), + Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&))); // setting up toolbars to NOT have context menu enabled setContextMenuPolicy(Qt::DefaultContextMenu); // accept d'n'd setAcceptDrops(true); + + const qlonglong winId = window()->winId(); + Application::cookieJar()->setWindowId(winId); + Application::networkAccessManager()->metaData().insert("window-id", QString::number(winId)); } @@ -252,7 +257,7 @@ void MainWindow::setupActions() m_stopReloadAction = new KAction(this); actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction); m_stopReloadAction->setShortcutConfigurable(false); - connect(m_view, SIGNAL(browserLoading(bool)), this, SLOT(slotBrowserLoading(bool))); + connect(m_view, SIGNAL(browserTabLoading(bool)), this, SLOT(slotBrowserLoading(bool))); slotBrowserLoading(false); //first init for blank start page // ============== Custom Actions @@ -367,7 +372,7 @@ void MainWindow::setupTools() void MainWindow::setupSidePanel() { // Setup history side panel - m_sidePanel = new SidePanel(i18n("History"), this); + m_sidePanel = new SidePanel(i18n("History Panel"), this); connect(m_sidePanel, SIGNAL(openUrl(const KUrl&)), Application::instance(), SLOT(loadUrl(const KUrl&))); connect(m_sidePanel, SIGNAL(destroyed()), Application::instance(), SLOT(slotSaveConfiguration())); @@ -375,7 +380,6 @@ void MainWindow::setupSidePanel() // setup side panel actions KAction* a = (KAction *) m_sidePanel->toggleViewAction(); - a->setText( i18n("History Panel") ); a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H)); // WARNING : is this the right shortcut ?? a->setIcon(KIcon("view-history")); actionCollection()->addAction(QLatin1String("show_history_panel"), a); @@ -451,7 +455,6 @@ void MainWindow::slotUpdateConfiguration() // ====== load Settings on main classes Application::networkAccessManager()->loadSettings(); -// FIXME (?) Application::cookieJar()->loadSettings(); Application::historyManager()->loadSettings(); } @@ -908,12 +911,13 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) return; } - if(m_popup) - delete m_popup; + KPassivePopup *popup_sav = m_popup; m_popup = new KPassivePopup(this); m_popup->setAutoDelete(true); + connect(Application::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)), m_popup, SLOT(hide())); + QPixmap px; QString pixPath; @@ -953,6 +957,10 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) QPoint p(x,y); m_popup->show(p); + + if(popup_sav) + delete popup_sav; + } diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index eefa0d8e..473fa770 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -202,3 +202,20 @@ void NetworkAccessManager::slotSSLErrors(QNetworkReply *reply, const QList<QSslE reply->ignoreSslErrors(); } #endif + + +KIO::MetaData& NetworkAccessManager::metaData() +{ + return m_metaData; +}; + + +QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData) +{ + // FIXME: rude hack. Waiting for a real POST behaviour fix ;) + if(op == PostOperation) + { + return QNetworkAccessManager::createRequest(op,req,outgoingData); + } + return AccessManager::createRequest(op,req,outgoingData); +} diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h index 1eea9a0d..a6c264f2 100644 --- a/src/networkaccessmanager.h +++ b/src/networkaccessmanager.h @@ -48,12 +48,15 @@ class NetworkAccessManager : public RekonqAccessManager public: NetworkAccessManager(QObject *parent = 0); - + KIO::MetaData& metaData(); void resetDiskCache(); public slots: void loadSettings(); +protected: + virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0); + private slots: void authenticationRequired(QNetworkReply *reply, QAuthenticator *auth); void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth); @@ -64,6 +67,7 @@ private slots: private: QNetworkDiskCache *m_diskCache; + KIO::MetaData m_metaData; }; #endif // NETWORKACCESSMANAGER_H diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 50fa6621..ec2b9a3b 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> -<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 - http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - <kcfgfile name="rekonqrc"/> +<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd"> +<kcfg> <!-- Includes --> <include>QtWebKit</include> <include>KUrl</include> +<kcfgfile name="rekonqrc"/> + + <!-- General Settings --> <group name="General"> <entry name="homePage" type="String"> diff --git a/src/settings.cpp b/src/settings.cpp index e0f9e8e7..51281379 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -43,7 +43,6 @@ //Ui Includes #include "ui_settings_general.h" #include "ui_settings_fonts.h" -#include "ui_settings_privacy.h" #include "ui_settings_proxy.h" #include "ui_settings_webkit.h" @@ -65,7 +64,6 @@ class Private private: Ui::general generalUi; Ui::fonts fontsUi; - Ui::privacy privacyUi; Ui::proxy proxyUi; Ui::webkit webkitUi; KCModuleProxy *ebrowsingModule; @@ -94,12 +92,6 @@ Private::Private(SettingsDialog *parent) pageItem = parent->addPage(widget , i18n("Fonts")); pageItem->setIcon(KIcon("preferences-desktop-font")); - widget = new QWidget; - privacyUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("History")); - pageItem->setIcon(KIcon("view-history")); - KCModuleInfo cookiesInfo("cookies.desktop"); cookiesModule = new KCModuleProxy(cookiesInfo,parent); pageItem = parent->addPage(cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit())); @@ -129,7 +121,7 @@ Private::Private(SettingsDialog *parent) pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit())); pageItem->setIcon(KIcon(ebrowsingInfo.icon())); - parent->setMinimumSize(800,550); + parent->setMinimumSize(800,500); } @@ -154,7 +146,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) connect(d->cookiesModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); - + connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); + setWebSettingsToolTips(); } diff --git a/src/settings.h b/src/settings.h index 3b476ec1..0be89173 100644 --- a/src/settings.h +++ b/src/settings.h @@ -43,7 +43,8 @@ class SettingsDialog : public KConfigDialog public: SettingsDialog(QWidget *parent = 0); ~SettingsDialog(); - virtual bool hasChanged (); + + virtual bool hasChanged(); private: Private* const d; diff --git a/src/settings_general.ui b/src/settings_general.ui index 90136755..d40dff99 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -107,6 +107,59 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>History</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Remove history items:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KComboBox" name="kcfg_expireHistory"> + <item> + <property name="text"> + <string>After one day</string> + </property> + </item> + <item> + <property name="text"> + <string>After one week</string> + </property> + </item> + <item> + <property name="text"> + <string>After two weeks</string> + </property> + </item> + <item> + <property name="text"> + <string>After one month</string> + </property> + </item> + <item> + <property name="text"> + <string>After one year</string> + </property> + </item> + <item> + <property name="text"> + <string>Manually</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -127,6 +180,11 @@ <extends>QLineEdit</extends> <header>klineedit.h</header> </customwidget> + <customwidget> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> + </customwidget> </customwidgets> <resources/> <connections/> diff --git a/src/settings_privacy.ui b/src/settings_privacy.ui deleted file mode 100644 index a716dc8d..00000000 --- a/src/settings_privacy.ui +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>privacy</class> - <widget class="QWidget" name="privacy"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>461</width> - <height>313</height> - </rect> - </property> - <property name="windowTitle"> - <string>Privacy</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>History</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Remove history items:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="KComboBox" name="kcfg_expireHistory"> - <item> - <property name="text"> - <string>After one day</string> - </property> - </item> - <item> - <property name="text"> - <string>After one week</string> - </property> - </item> - <item> - <property name="text"> - <string>After two weeks</string> - </property> - </item> - <item> - <property name="text"> - <string>After one month</string> - </property> - </item> - <item> - <property name="text"> - <string>After one year</string> - </property> - </item> - <item> - <property name="text"> - <string>Manually</string> - </property> - </item> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>136</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src/urlbar.cpp b/src/urlbar.cpp index 28c63b78..94f248e3 100644 --- a/src/urlbar.cpp +++ b/src/urlbar.cpp @@ -225,7 +225,7 @@ void UrlBar::paintEvent(QPaintEvent *event) painter.setPen(Qt::transparent); QRect backgroundRect = lineEdit()->frameGeometry(); - int mid = backgroundRect.width() / 100 * m_progress; + int mid = backgroundRect.width() * m_progress / 100; QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height()); painter.drawRect(progressRect); painter.end(); @@ -244,10 +244,7 @@ void UrlBar::focusOutEvent(QFocusEvent *event) QSize UrlBar::sizeHint() const { - QSize size(lineEdit()->sizeHint()); - // make it (more or less) the same height with search bar (at least on oxygen) -// size.setHeight(size.height() + 2); - return size; + return lineEdit()->sizeHint(); } @@ -266,9 +263,19 @@ QLinearGradient UrlBar::generateGradient(const QColor &color, int height) return gradient; } + void UrlBar::setBackgroundColor(QColor c) { s_defaultBaseColor=c; repaint(); } + +bool UrlBar::isLoading() +{ + if(m_progress == 0) + { + return false; + } + return true; +} diff --git a/src/urlbar.h b/src/urlbar.h index 42ac9af7..50ba40f7 100644 --- a/src/urlbar.h +++ b/src/urlbar.h @@ -58,7 +58,8 @@ public: KUrl url() const; QSize sizeHint() const; void setBackgroundColor(QColor); - + bool isLoading(); + signals: void activated(const KUrl&); diff --git a/src/webpage.cpp b/src/webpage.cpp index 160294e2..c81d93da 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -48,7 +48,7 @@ #include <KStandardDirs> #include <KUrl> #include <KDebug> - +#include <KToolInvocation> #include <KDE/KParts/BrowserRun> #include <KDE/KMimeTypeTrader> @@ -72,6 +72,7 @@ WebPage::WebPage(QObject *parent) : QWebPage(parent) , m_keyboardModifiers(Qt::NoModifier) , m_pressedButtons(Qt::NoButton) + , m_requestedUrl() { setForwardUnsupportedContent(true); @@ -83,8 +84,21 @@ WebPage::WebPage(QObject *parent) } +WebPage::~WebPage() +{ +} + + bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type) { + m_requestedUrl = request.url(); + + if (m_requestedUrl.scheme() == QLatin1String("mailto")) + { + KToolInvocation::invokeMailer(m_requestedUrl); + return false; + } + if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) { Application::instance()->loadUrl(request.url(), Rekonq::SettingOpenTab); @@ -118,52 +132,77 @@ WebPage *WebPage::newWindow(WebWindowType type) } -// FIXME: dear slot, you need to handle unsupported content a bit better.. void WebPage::slotHandleUnsupportedContent(QNetworkReply *reply) { - - const KUrl url(reply->request().url()); - kDebug() << "title:" << url; - kDebug() << "error:" << reply->errorString(); - - QString filename = url.fileName(); - QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString(); - KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimetype); - - KParts::BrowserRun::AskSaveResult res = KParts::BrowserRun::askSave( - url, - offer, - mimetype, - filename - ); - switch (res) + if (reply->error() == QNetworkReply::NoError) { - case KParts::BrowserRun::Save: - slotDownloadRequested(reply->request()); - return; - case KParts::BrowserRun::Cancel: - return; - default: // non extant case - break; - } + const KUrl url(reply->request().url()); + QString filename = url.fileName(); + QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString(); + KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimetype); - KUrl::List list; - list.append(url); - KRun::run(*offer,url,0); + if( offer.isNull() ) // no service can handle this. We can just download it.. + { + slotDownloadRequested(reply->request()); + } + else + { + switch ( KParts::BrowserRun::askSave( url, offer, mimetype, filename ) ) + { + case KParts::BrowserRun::Save: + slotDownloadRequested(reply->request()); + return; + case KParts::BrowserRun::Cancel: + return; + default: // non extant case + break; + } + // case KParts::BrowserRun::Open + KUrl::List list; + list.append(url); + KRun::run(*offer,url,0); + } + } return; } void WebPage::manageNetworkErrors(QNetworkReply* reply) { - if(reply->error() == QNetworkReply::NoError) + if( reply->error() == QNetworkReply::NoError ) return; - - viewErrorPage(reply); + + if( reply->url() != m_requestedUrl ) // prevent favicon loading + return; + + if( reply->error() == QNetworkReply::ContentNotFoundError ) + { + QList<QWebFrame*> frames; + frames.append(mainFrame()); + while (!frames.isEmpty()) + { + QWebFrame *firstFrame = frames.takeFirst(); + + if (firstFrame->url() == reply->url()) + { + firstFrame->setHtml(errorPage(reply), reply->url()); + return; + } + QList<QWebFrame *> children = firstFrame->childFrames(); + foreach(QWebFrame *frame, children) + { + frames.append(frame); + } + } + } + else + { + mainFrame()->setHtml(errorPage(reply), reply->url()); + } } -void WebPage::viewErrorPage(QNetworkReply *reply) +QString WebPage::errorPage(QNetworkReply *reply) { // display "not found" page QString notfoundFilePath = KStandardDirs::locate("data", "rekonq/htmls/notfound.html"); @@ -172,35 +211,18 @@ void WebPage::viewErrorPage(QNetworkReply *reply) if (!isOpened) { kWarning() << "Couldn't open the notfound.html file"; - return; + return QString(""); } QString title = i18n("Error loading page: ") + reply->url().toString(); QString imagePath = KIconLoader::global()->iconPath("rekonq", KIconLoader::NoGroup, false); QString html = QString(QLatin1String(file.readAll())) - .arg(title) - .arg("file://" + imagePath) - .arg(reply->errorString()) - .arg(reply->url().toString()); - - // test - QList<QWebFrame*> frames; - frames.append(mainFrame()); - while (!frames.isEmpty()) - { - QWebFrame *firstFrame = frames.takeFirst(); - if (firstFrame->url() == reply->url()) - { - firstFrame->setHtml(html, reply->url()); - return; - } - QList<QWebFrame *> children = firstFrame->childFrames(); - foreach(QWebFrame *frame, children) - { - frames.append(frame); - } - } + .arg(title) + .arg("file://" + imagePath) + .arg(reply->errorString()) + .arg(reply->url().toString()); + return html; } @@ -237,6 +259,7 @@ QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QS } +// TODO FIXME: sometimes url.fileName() fails to retrieve url file name void WebPage::slotDownloadRequested(const QNetworkRequest &request) { const KUrl url(request.url()); @@ -250,9 +273,3 @@ void WebPage::slotDownloadRequested(const QNetworkRequest &request) job->addMetaData("cache", "cache"); // Use entry from cache if available. job->uiDelegate()->setAutoErrorHandlingEnabled(true); } - - -QString WebPage::chooseFile(QWebFrame *frame, const QString &suggestedFile) -{ - return KFileDialog::getOpenFileName(suggestedFile, QString(), frame->page()->view()); -} diff --git a/src/webpage.h b/src/webpage.h index d21fc44d..d1642966 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -36,11 +36,12 @@ // Qt Includes #include <QWebPage> +#include <QUrl> // Forward Declarations class QWebFrame; class QNetworkReply; - +class QUrl; class WebPage : public QWebPage { @@ -48,7 +49,8 @@ class WebPage : public QWebPage public: explicit WebPage(QObject *parent = 0); - + ~WebPage(); + public slots: void manageNetworkErrors(QNetworkReply* reply); @@ -60,9 +62,6 @@ protected: const QNetworkRequest &request, NavigationType type); - QString chooseFile(QWebFrame *frame, - const QString &suggestedFile); - void javaScriptAlert(QWebFrame *frame, const QString &msg); @@ -84,12 +83,13 @@ protected Q_SLOTS: private: friend class WebView; - - void viewErrorPage(QNetworkReply *); + QString errorPage(QNetworkReply *); // keyboard/mouse modifiers Qt::KeyboardModifiers m_keyboardModifiers; Qt::MouseButtons m_pressedButtons; + + QUrl m_requestedUrl; }; #endif diff --git a/src/webview.cpp b/src/webview.cpp index dca8b6fb..75dc0979 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -36,8 +36,6 @@ #include "application.h" #include "mainwindow.h" #include "mainview.h" -#include "cookiejar.h" -#include "networkaccessmanager.h" #include "history.h" #include "webpage.h" |