diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | data/slack-desc | 12 | ||||
-rw-r--r-- | rekonq.SlackBuild | 79 | ||||
-rw-r--r-- | scripts/RELEASE_HOWTO | 56 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/application.cpp | 20 | ||||
-rw-r--r-- | src/application.h | 5 | ||||
-rw-r--r-- | src/bookmarks.cpp | 2 | ||||
-rw-r--r-- | src/cleardata.ui | 4 | ||||
-rw-r--r-- | src/cookiejar.cpp | 2 | ||||
-rw-r--r-- | src/findbar.cpp | 4 | ||||
-rw-r--r-- | src/findbar.h | 5 | ||||
-rw-r--r-- | src/lineedit.cpp | 1 | ||||
-rw-r--r-- | src/main.cpp | 6 | ||||
-rw-r--r-- | src/mainview.cpp | 178 | ||||
-rw-r--r-- | src/mainview.h | 34 | ||||
-rw-r--r-- | src/mainwindow.cpp | 169 | ||||
-rw-r--r-- | src/mainwindow.h | 21 | ||||
-rw-r--r-- | src/networkaccessmanager.cpp | 25 | ||||
-rw-r--r-- | src/networkaccessmanager.h | 22 | ||||
-rw-r--r-- | src/panelhistory.cpp | 2 | ||||
-rw-r--r-- | src/rekonq.kcfg | 3 | ||||
-rw-r--r-- | src/rekonqui.rc | 102 | ||||
-rw-r--r-- | src/settings.cpp | 5 | ||||
-rw-r--r-- | src/settings_general.ui | 15 | ||||
-rw-r--r-- | src/stackedurlbar.cpp | 159 | ||||
-rw-r--r-- | src/stackedurlbar.h | 70 | ||||
-rw-r--r-- | src/urlbar.cpp | 71 | ||||
-rw-r--r-- | src/urlbar.h | 11 | ||||
-rw-r--r-- | src/webpage.cpp | 10 | ||||
-rw-r--r-- | src/webpage.h | 3 | ||||
-rw-r--r-- | src/webview.cpp | 25 | ||||
-rw-r--r-- | src/webview.h | 8 |
34 files changed, 426 insertions, 713 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a783bf27..52b24b6b 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 "52") SET(REKONQ_VERSION_STR "${REKONQ_MAJOR_VERSION}.${REKONQ_MINOR_VERSION}.${REKONQ_PATCH_VERSION}" @@ -27,7 +27,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2) SET(QT_MIN_VERSION 4.5.0) FIND_PACKAGE(Qt4 REQUIRED) -SET(KDE_MIN_VERSION 4.2.0) +SET(KDE_MIN_VERSION 4.3.1) FIND_PACKAGE(KDE4 REQUIRED) INCLUDE(MacroOptionalFindPackage) @@ -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..29492538 --- /dev/null +++ b/scripts/RELEASE_HOWTO @@ -0,0 +1,56 @@ +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 +* Bump Version Number (in the CMakeLists.txt && in src/main.cpp) (TODO: something better?) +* 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 + +* Test the following: + + $ ./configure && make + $ ./configure --enable-final --disable-debug && make + +* Check it works OK without any rekonq files in ~/.kde + +-------------------------------------------------------------------------------- + +FIXME SECTION 3: Once Happy with the Tarball + +* SFtp the tarball to: + - ftpamarok@ktown.kde.org/stable/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 + - BCC: kde-extra-gear@kde.org, kde-press-announce@kde.org +* Blog, update IRC channel topics, ... +* Update kde-apps.org + +-------------------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 45a2afb2..67a0c8df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,7 +20,6 @@ SET( rekonq_SRCS sidepanel.cpp panelhistory.cpp lineedit.cpp - stackedurlbar.cpp webpage.cpp ) @@ -72,4 +71,3 @@ TARGET_LINK_LIBRARIES ( rekonq INSTALL( TARGETS rekonq ${INSTALL_TARGETS_DEFAULT_ARGS} ) INSTALL( FILES rekonq.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) -INSTALL( FILES rekonqui.rc DESTINATION ${DATA_INSTALL_DIR}/rekonq ) diff --git a/src/application.cpp b/src/application.cpp index c072b9f7..35d52a23 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -220,7 +220,7 @@ KUrl Application::guessUrlFromString(const QString &string) } else // Might be a shorturl - try to detect the schema. { - int dotIndex = urlStr.indexOf(QLatin1Char('.')); + int dotIndex = urlStr.indexOf(QLatin1Char(':')); if (dotIndex != -1) { @@ -237,7 +237,7 @@ KUrl Application::guessUrlFromString(const QString &string) } // Fall back to QUrl's own tolerant parser. - KUrl url = KUrl(string); + KUrl url = KUrl(urlStr); return url; } @@ -250,7 +250,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) if ( !url.isValid() ) { - KMessageBox::error(0, i18n("Malformed URL\n%1", url.url())); + KMessageBox::error(0, i18n("Malformed URL:\n%1", url.url())); return; } @@ -289,7 +289,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) if ( !KProtocolInfo::isKnownProtocol( loadingUrl ) ) { - KMessageBox::error(0, i18n("Protocol not supported\n%1", url.protocol())); + KMessageBox::error(0, i18n("Protocol not supported:\n%1", url.protocol())); return; } @@ -298,22 +298,22 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) switch(type) { case Rekonq::SettingOpenTab: - webView = m_mainWindow->mainView()->newTab(!ReKonfig::openTabsBack()); + webView = m_mainWindow->mainView()->newWebView(!ReKonfig::openTabsBack()); if (!ReKonfig::openTabsBack()) { - m_mainWindow->mainView()->currentUrlBar()->setUrl(loadingUrl.prettyUrl()); + m_mainWindow->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl()); } break; case Rekonq::NewCurrentTab: - webView = m_mainWindow->mainView()->newTab(true); - m_mainWindow->mainView()->currentUrlBar()->setUrl(loadingUrl.prettyUrl()); + webView = m_mainWindow->mainView()->newWebView(true); + m_mainWindow->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl()); break; case Rekonq::NewBackTab: - webView = m_mainWindow->mainView()->newTab(false); + webView = m_mainWindow->mainView()->newWebView(false); break; case Rekonq::CurrentTab: webView = m_mainWindow->mainView()->currentWebView(); - m_mainWindow->mainView()->currentUrlBar()->setUrl(loadingUrl.prettyUrl()); + m_mainWindow->mainView()->urlBar()->setUrl(loadingUrl.prettyUrl()); break; }; diff --git a/src/application.h b/src/application.h index cd617b7a..44173373 100644 --- a/src/application.h +++ b/src/application.h @@ -26,11 +26,10 @@ * ============================================================ */ - - #ifndef APPLICATION_H #define APPLICATION_H + // KDE Includes #include <KUniqueApplication> #include <KIcon> @@ -120,7 +119,6 @@ public slots: const Rekonq::OpenType& type = Rekonq::CurrentTab ); - private slots: /** @@ -128,7 +126,6 @@ private slots: */ void postLaunch(); - private: KUrl guessUrlFromString(const QString &url); diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index c9db4a9b..a1f0e441 100644 --- a/src/bookmarks.cpp +++ b/src/bookmarks.cpp @@ -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/cleardata.ui b/src/cleardata.ui index 94a39c69..b27a8f63 100644 --- a/src/cleardata.ui +++ b/src/cleardata.ui @@ -24,7 +24,7 @@ <item> <widget class="QCheckBox" name="clearHistory"> <property name="text"> - <string>history</string> + <string>History</string> </property> <property name="checked"> <bool>true</bool> @@ -54,7 +54,7 @@ <item> <widget class="QCheckBox" name="clearWebIcons"> <property name="text"> - <string>Website Icons</string> + <string>Website icons</string> </property> <property name="checked"> <bool>true</bool> diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp index bef1c51c..5160d6ed 100644 --- a/src/cookiejar.cpp +++ b/src/cookiejar.cpp @@ -68,7 +68,6 @@ QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl & url) const if (reply.isValid()) { cookieList << reply.value().toUtf8(); - //kDebug() << reply.value(); } else { @@ -87,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/findbar.cpp b/src/findbar.cpp index 6d108a15..4ec93d87 100644 --- a/src/findbar.cpp +++ b/src/findbar.cpp @@ -34,7 +34,7 @@ #include <KIcon> #include <KPushButton> #include <klocalizedstring.h> -#include <KXmlGuiWindow> +#include <KMainWindow> #include <KApplication> // Qt Includes @@ -47,7 +47,7 @@ #include <QtCore/QString> -FindBar::FindBar(KXmlGuiWindow *mainwindow) +FindBar::FindBar(KMainWindow *mainwindow) : QWidget(mainwindow) , m_lineEdit(new KLineEdit(this)) , m_matchCase(new QCheckBox(i18n("&Match case"), this)) diff --git a/src/findbar.h b/src/findbar.h index 6d92a645..0818d010 100644 --- a/src/findbar.h +++ b/src/findbar.h @@ -38,7 +38,7 @@ #include <QtGui/QKeyEvent> // Forward Declarations -class KXmlGuiWindow; +class KMainWindow; class QKeyEvent; class QString; @@ -48,7 +48,7 @@ class FindBar : public QWidget Q_OBJECT public: - FindBar(KXmlGuiWindow *mainwindow); + FindBar(KMainWindow *mainwindow); ~FindBar(); KLineEdit *lineEdit() const; bool matchCase() const; @@ -71,4 +71,3 @@ private: }; #endif - 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 092c03c8..2c3d797c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,10 +34,10 @@ static const char description[] = - I18N_NOOP("WebKit based Web Browser for KDE"); + I18N_NOOP("A lightweight Web Browser for KDE based on Webkit"); -static const char version[] = "0.1.97"; +static const char version[] = "0.2.52"; int main(int argc, char **argv) @@ -87,7 +87,7 @@ int main(int argc, char **argv) ""); about.addCredit(ki18n("Abuus"), - ki18n("Webview mouse event support"), + ki18n("Webview mouse event support"), "buusmail@gmail.com", ""); diff --git a/src/mainview.cpp b/src/mainview.cpp index b8d063b8..9dfa797d 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -38,7 +38,6 @@ #include "application.h" #include "mainwindow.h" #include "history.h" -#include "stackedurlbar.h" #include "urlbar.h" #include "webview.h" @@ -65,9 +64,10 @@ MainView::MainView(QWidget *parent) : KTabWidget(parent) - , m_urlBars(new StackedUrlBar(this)) + , m_urlBar(new UrlBar(this)) , m_tabBar(new TabBar(this)) , m_addTabButton(new QToolButton(this)) + , m_currentTabIndex(0) { // setting tabbar setTabBar(m_tabBar); @@ -77,15 +77,20 @@ MainView::MainView(QWidget *parent) // connecting tabbar signals connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(slotCloseTab(int))); + connect(m_tabBar, SIGNAL(mouseMiddleClick(int)), this, SIGNAL(slotCloseTab(int))); + connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(slotCloneTab(int))); connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(slotCloseOtherTabs(int))); connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(slotReloadTab(int))); connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(slotReloadAllTabs())); connect(m_tabBar, SIGNAL(tabMoved(int, int)), this, SLOT(moveTab(int, int))); + // connecting urlbar signals + connect(urlBar(), SIGNAL(activated(const KUrl&)), Application::instance(), SLOT(loadUrl(const KUrl&))); + // current page index changing connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int))); - + setTabsClosable(true); connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(slotCloseTab(int))); @@ -140,25 +145,21 @@ void MainView::addTabButtonPosition() } -UrlBar *MainView::currentUrlBar() const -{ - return urlBar(-1); -} - - TabBar *MainView::tabBar() const { return m_tabBar; } + QToolButton *MainView::addTabButton() const { return m_addTabButton; } -StackedUrlBar *MainView::urlBarStack() const + +UrlBar *MainView::urlBar() const { - return m_urlBars; + return m_urlBar; } @@ -218,71 +219,11 @@ void MainView::slotWebStop() } -void MainView::slotWebBack() -{ - WebView *webView = currentWebView(); - QAction *action = webView->page()->action(QWebPage::Back); - action->trigger(); -} - - -void MainView::slotWebForward() -{ - WebView *webView = currentWebView(); - QAction *action = webView->page()->action(QWebPage::Forward); - action->trigger(); -} - - -void MainView::slotWebUndo() -{ - WebView *webView = currentWebView(); - QAction *action = webView->page()->action(QWebPage::Undo); - action->trigger(); -} - - -void MainView::slotWebRedo() -{ - WebView *webView = currentWebView(); - QAction *action = webView->page()->action(QWebPage::Redo); - action->trigger(); -} - - -void MainView::slotWebCut() -{ - WebView *webView = currentWebView(); - QAction *action = webView->page()->action(QWebPage::Cut); - action->trigger(); -} - - -void MainView::slotWebCopy() -{ - WebView *webView = currentWebView(); - QAction *action = webView->page()->action(QWebPage::Copy); - action->trigger(); -} - - -void MainView::slotWebPaste() -{ - WebView *webView = currentWebView(); - QAction *action = webView->page()->action(QWebPage::Paste); - action->trigger(); -} - - void MainView::clear() { - // clear the line edit history - for (int i = 0; i < m_urlBars->count(); ++i) - { - /// TODO What exactly do we need to clear here? - urlBar(i)->clearHistory(); - urlBar(i)->clear(); - } + /// TODO What exactly do we need to clear here? + m_urlBar->clearHistory(); + m_urlBar->clear(); } @@ -300,35 +241,48 @@ void MainView::slotReloadTab(int index) } +// TODO need some extra comments to better understand what happens here.. void MainView::slotCurrentChanged(int index) { WebView *webView = this->webView(index); if (!webView) return; - Q_ASSERT(m_urlBars->count() == count()); + WebView *oldWebView = this->webView(m_currentTabIndex); + m_currentTabIndex=index; - WebView *oldWebView = this->webView(m_urlBars->currentIndex()); if (oldWebView) - { + { + // disconnecting webview with urlbar + disconnect(oldWebView, SIGNAL(loadProgress(int)), urlBar(), SLOT(slotUpdateProgress(int))); + disconnect(oldWebView, SIGNAL(loadFinished(bool)), urlBar(), SLOT(slotLoadFinished(bool))); + disconnect(oldWebView, SIGNAL(urlChanged(const QUrl &)), urlBar(), SLOT(setUrl(const QUrl &))); + disconnect(oldWebView, SIGNAL(iconChanged()), urlBar(), SLOT(slotUpdateUrl())); + disconnect(oldWebView->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); } + // connecting webview with urlbar + connect(webView, SIGNAL(loadProgress(int)), urlBar(), SLOT(slotUpdateProgress(int))); + connect(webView, SIGNAL(loadFinished(bool)), urlBar(), SLOT(slotLoadFinished(bool))); + connect(webView, SIGNAL(urlChanged(const QUrl &)), urlBar(), SLOT(setUrl(const QUrl &))); + connect(webView, SIGNAL(iconChanged()), urlBar(), SLOT(slotUpdateUrl())); + connect(webView->page(), SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&))); emit setCurrentTitle(webView->title()); - m_urlBars->setCurrentIndex(index); - currentUrlBar()->setUrl(webView->url()); + urlBar()->setUrl(webView->url()); + urlBar()->setProgress(webView->progress()); emit showStatusBarMessage(webView->lastStatusBarText()); // notify UI to eventually switch stop/reload button - if(currentUrlBar()->isLoading()) + if(urlBar()->isLoading()) emit browserTabLoading(true); else emit browserTabLoading(false); @@ -338,22 +292,6 @@ void MainView::slotCurrentChanged(int index) } -UrlBar *MainView::urlBar(int index) const -{ - if (index == -1) - { - index = m_urlBars->currentIndex(); - } - UrlBar *urlBar = m_urlBars->urlBar(index); - if (urlBar) - { - return urlBar; - } - kWarning() << "URL bar with index" << index << "not found. Returning NULL. (line:" << __LINE__ << ")"; - return NULL; -} - - WebView *MainView::webView(int index) const { QWidget *widget = this->widget(index); @@ -367,21 +305,10 @@ WebView *MainView::webView(int index) const } -WebView *MainView::newTab(bool focused) +WebView *MainView::newWebView(bool focused) { - // line edit - UrlBar *urlBar = new UrlBar; // Ownership of widget is passed on to the QStackedWidget (addWidget method). - connect(urlBar, SIGNAL(activated(const KUrl&)), Application::instance(), SLOT(loadUrl(const KUrl&))); - m_urlBars->addUrlBar(urlBar); - WebView *webView = new WebView; // should be deleted on tab close? - // connecting webview with urlbar - connect(webView, SIGNAL(loadProgress(int)), urlBar, SLOT(slotUpdateProgress(int))); - connect(webView, SIGNAL(loadFinished(bool)), urlBar, SLOT(slotLoadFinished(bool))); - connect(webView, SIGNAL(urlChanged(const QUrl &)), urlBar, SLOT(setUrl(const QUrl &))); - connect(webView, SIGNAL(iconChanged()), urlBar, SLOT(slotUpdateUrl())); - // connecting webview with mainview connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); @@ -397,23 +324,35 @@ WebView *MainView::newTab(bool focused) connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); addTab(webView, i18n("(Untitled)")); - + if (focused) { setCurrentWidget(webView); } - - urlBar->setFocus(); emit tabsChanged(); showTabBar(); addTabButtonPosition(); - + return webView; } +void MainView::newTab() +{ + WebView *w = newWebView(); + + urlBar()->setUrl(KUrl("")); + urlBar()->setFocus(); + + if (ReKonfig::newTabsOpenHomePage()) + { + w->load(QUrl(ReKonfig::homePage())); + } +} + + void MainView::slotReloadAllTabs() { for (int i = 0; i < count(); ++i) @@ -429,7 +368,6 @@ void MainView::slotReloadAllTabs() void MainView::windowCloseRequested() { - WebPage *webPage = qobject_cast<WebPage*>(sender()); WebView *webView = qobject_cast<WebView*>(webPage->view()); int index = webViewIndex(webView); @@ -479,7 +417,7 @@ void MainView::slotCloneTab(int index) index = currentIndex(); if (index < 0 || index >= count()) return; - WebView *tab = newTab(); + WebView *tab = newWebView(); tab->setUrl(webView(index)->url()); showTabBar(); @@ -514,10 +452,6 @@ void MainView::slotCloseTab(int index) hasFocus = tab->hasFocus(); } - QWidget *urlBar = m_urlBars->urlBar(index); - m_urlBars->removeWidget(urlBar); - urlBar->deleteLater(); // urlBar is scheduled for deletion. - QWidget *webView = widget(index); removeTab(index); webView->deleteLater(); // webView is scheduled for deletion. @@ -652,14 +586,6 @@ void MainView::previousTab() } -void MainView::moveTab(int fromIndex, int toIndex) -{ - QWidget *lineEdit = m_urlBars->widget(fromIndex); - m_urlBars->removeWidget(lineEdit); - m_urlBars->insertWidget(toIndex, lineEdit); -} - - QLabel *MainView::animatedLoading(int index, bool addMovie) { if (index == -1) diff --git a/src/mainview.h b/src/mainview.h index 3e6b9efb..ae6019b7 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -45,8 +45,6 @@ class QUrl; class QWebFrame; class QLabel; - -class StackedUrlBar; class TabBar; class UrlBar; @@ -67,14 +65,11 @@ public: public: - UrlBar *urlBar(int index) const; - UrlBar *currentUrlBar() const; + UrlBar *urlBar() const; WebView *webView(int index) const; QToolButton *addTabButton() const; - // inlines TabBar *tabBar() const; - StackedUrlBar *urlBarStack() const; WebView *currentWebView() const; int webViewIndex(WebView *webView) const; @@ -86,7 +81,8 @@ public: void showTabBar(); void clear(); - + WebView *newWebView(bool focused = true); + signals: // tab widget signals void tabsChanged(); @@ -105,9 +101,8 @@ public slots: * Core browser slot. This create a new tab with a WebView inside * for browsing. * - * @return a pointer to the new WebView */ - WebView *newTab(bool focused = true); + void newTab(); void slotCloneTab(int index = -1); void slotCloseTab(int index = -1); @@ -120,13 +115,7 @@ public slots: // WEB slot actions void slotWebReload(); void slotWebStop(); - void slotWebBack(); - void slotWebForward(); - void slotWebUndo(); - void slotWebRedo(); - void slotWebCut(); - void slotWebCopy(); - void slotWebPaste(); + private slots: void slotCurrentChanged(int index); @@ -139,15 +128,6 @@ private slots: void windowCloseRequested(); - /** - * This functions move tab info "from index to index" - * - * @param fromIndex the index from which we move - * - * @param toIndex the index to which we move - */ - void moveTab(int fromIndex, int toIndex); - void postLaunch(); protected: @@ -171,12 +151,14 @@ private: */ QLabel *animatedLoading(int index, bool addMovie); - StackedUrlBar *m_urlBars; + UrlBar *m_urlBar; TabBar *m_tabBar; QString m_loadingGitPath; QToolButton *m_addTabButton; + + int m_currentTabIndex; }; #endif // MAINVIEW_H diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 29044745..b2c1fed1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -45,7 +45,6 @@ #include "findbar.h" #include "sidepanel.h" #include "urlbar.h" -#include "stackedurlbar.h" // Ui Includes #include "ui_cleardata.h" @@ -89,11 +88,16 @@ MainWindow::MainWindow() - : KXmlGuiWindow() - , m_view(new MainView(this)) - , m_findBar(new FindBar(this)) - , m_sidePanel(0) + : KMainWindow() + , m_view(new MainView(this)) + , m_findBar(new FindBar(this)) + , m_sidePanel(0) + , m_historyBackMenu(0) + , m_ac( new KActionCollection(this) ) { + // enable window size "auto-save" + setAutoSaveSettings(); + // updating rekonq configuration slotUpdateConfiguration(); @@ -117,27 +121,20 @@ MainWindow::MainWindow() // then, setup our actions setupActions(); - // setting up toolbars && location bar: this has to be done BEFORE setupGUI!! - setupBars(); - // Bookmark Menu KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(); bmMenu->setIcon(KIcon("rating")); actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu); ((KActionMenu *)actionByName("bookmarksActionMenu"))->setDelayed(false); - // Side Panel: this has to be done BEFORE setupGUI!! + // setting Side Panel setupSidePanel(); - // setting up rekonq tools: to be done BEFORE setupGUI! + // setting up rekonq tools setupTools(); - - // a call to KXmlGuiWindow::setupGUI() populates the GUI - // with actions, using KXMLGUI. - // It also applies the saved mainwindow settings, if any, and ask the - // mainwindow to automatically save settings if changed: window size, - // toolbar position, icon size, etc. - setupGUI(); + + // setting up rekonq toolbar(s) + setupToolbar(); // no more status bar.. setStatusBar(0); @@ -159,11 +156,27 @@ SidePanel *MainWindow::sidePanel() } -void MainWindow::postLaunch() +void MainWindow::setupToolbar() { - // setup history menu: this has to be done AFTER setupGUI!! - setupHistoryMenu(); + KToolBar *mainToolBar = new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea); + mainToolBar->setContextMenuPolicy(Qt::PreventContextMenu); + mainToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); + mainToolBar->addAction( actionByName("history_back") ); + mainToolBar->addAction( actionByName("history_forward") ); + mainToolBar->addSeparator(); + mainToolBar->addAction( actionByName("stop_reload") ); + mainToolBar->addAction( actionByName(KStandardAction::name(KStandardAction::Home)) ); + mainToolBar->addAction( actionByName("url_bar") ); + mainToolBar->addAction( actionByName("bookmarksActionMenu") ); + mainToolBar->addAction( actionByName("rekonq_tools") ); + + KToolBar::setToolBarsEditable(false); + KToolBar::setToolBarsLocked(true); +} + +void MainWindow::postLaunch() +{ // --------- connect signals and slots connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); @@ -176,13 +189,19 @@ void MainWindow::postLaunch() connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); // bookmarks loading - connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)), Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&))); + 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); + + // set CookieJar window Id + const qlonglong winId = window()->winId(); + Application::cookieJar()->setWindowId(winId); + Application::networkAccessManager()->metaData().insert("window-id", QString::number(winId)); } @@ -194,31 +213,33 @@ QSize MainWindow::sizeHint() const } -void MainWindow::setupBars() +KActionCollection *MainWindow::actionCollection () const { + return m_ac; +} + + +void MainWindow::setupActions() +{ + // this let shortcuts work.. + actionCollection()->addAssociatedWidget(this); + KAction *a; // location bar a = new KAction(i18n("Location Bar"), this); a->setShortcut(KShortcut(Qt::Key_F6)); - a->setDefaultWidget(m_view->urlBarStack()); + a->setDefaultWidget(m_view->urlBar()); actionCollection()->addAction(QLatin1String("url_bar"), a); // bookmarks bar KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction(); a = actionCollection()->addAction(QLatin1String("bookmarks_bar"), bookmarkBarAction); -} - - -void MainWindow::setupActions() -{ - KAction *a; // Standard Actions KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection()); - KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection()); - KStandardAction::printPreview(this, SLOT(slotFilePrintPreview()), actionCollection()); - KStandardAction::print(this, SLOT(slotFilePrint()), actionCollection()); + KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection()); + KStandardAction::print(this, SLOT(slotFilePrintPreview()), actionCollection()); KStandardAction::quit(this , SLOT(close()), actionCollection()); KStandardAction::find(m_findBar, SLOT(show()) , actionCollection()); KStandardAction::findNext(this, SLOT(slotFindNext()) , actionCollection()); @@ -235,13 +256,6 @@ void MainWindow::setupActions() // WEB Actions (NO KStandardActions..) a = KStandardAction::redisplay(m_view, SLOT(slotWebReload()), actionCollection()); a->setText(i18n("Reload")); - KStandardAction::back(m_view, SLOT(slotWebBack()), actionCollection()); - KStandardAction::forward(m_view, SLOT(slotWebForward()), actionCollection()); - KStandardAction::undo(m_view, SLOT(slotWebUndo()), actionCollection()); - KStandardAction::redo(m_view, SLOT(slotWebRedo()), actionCollection()); - KStandardAction::cut(m_view, SLOT(slotWebCut()), actionCollection()); - KStandardAction::copy(m_view, SLOT(slotWebCopy()), actionCollection()); - KStandardAction::paste(m_view, SLOT(slotWebPaste()), actionCollection()); a = new KAction(KIcon("process-stop"), i18n("&Stop"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Period)); @@ -297,6 +311,11 @@ void MainWindow::setupActions() connect(m_historyBackAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); actionCollection()->addAction(QLatin1String("history_back"), m_historyBackAction); + m_historyBackMenu = new KMenu(this); + m_historyBackAction->setMenu(m_historyBackMenu); + connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); + connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); + m_historyForwardAction = new KAction(KIcon("go-next"), i18n("Forward"), this); connect(m_historyForwardAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenNext())); actionCollection()->addAction(QLatin1String("history_forward"), m_historyForwardAction); @@ -331,13 +350,21 @@ void MainWindow::setupActions() void MainWindow::setupTools() { - KActionMenu *toolsMenu = new KActionMenu(KIcon("configure"), i18n("rekonq tools"), this); + KActionMenu *toolsMenu = new KActionMenu(KIcon("configure"), i18n("&Tools"), this); toolsMenu->setDelayed(false); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs))); - toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::PrintPreview))); + toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print))); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Find))); + KActionMenu *fontMenu = new KActionMenu(KIcon("page-zoom"), i18n("Zoom"), this); + fontMenu->addAction(actionByName(QLatin1String("smaller_font"))); + fontMenu->addAction(actionByName(QLatin1String("normal_font"))); + fontMenu->addAction(actionByName(QLatin1String("bigger_font"))); + toolsMenu->addAction(fontMenu); + + toolsMenu->addSeparator(); + KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Web Development"), this); webMenu->addAction(actionByName(QLatin1String("web_inspector"))); webMenu->addAction(actionByName(QLatin1String("page_source"))); @@ -355,8 +382,8 @@ void MainWindow::setupTools() toolsMenu->addSeparator(); - // TODO: decide if re-enable this when rekonq docs will be written - // toolsMenu->addAction(KStandardAction::helpContents(this, SLOT(appHelpActivated()), actionCollection())); + helpMenu()->setIcon(KIcon("help-browser")); + toolsMenu->addAction(helpMenu()->menuAction()); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences))); // adding rekonq_tools to rekonq actionCollection @@ -468,8 +495,8 @@ void MainWindow::slotUpdateBrowser() void MainWindow::slotOpenLocation() { - m_view->currentUrlBar()->selectAll(); - m_view->currentUrlBar()->setFocus(); + m_view->urlBar()->selectAll(); + m_view->urlBar()->setFocus(); } @@ -552,14 +579,6 @@ void MainWindow::slotFilePrintPreview() } -void MainWindow::slotFilePrint() -{ - if (!currentTab()) - return; - printRequested(currentTab()->page()->mainFrame()); -} - - void MainWindow::printRequested(QWebFrame *frame) { QPrinter printer; @@ -591,7 +610,7 @@ void MainWindow::slotPrivateBrowsing(bool enable) if (button == KMessageBox::Yes) { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); - m_view->currentUrlBar()->setBackgroundColor(Qt::lightGray); // palette().color(QPalette::Active, QPalette::Background)); + m_view->urlBar()->setBackgroundColor(Qt::lightGray); // palette().color(QPalette::Active, QPalette::Background)); } else { @@ -601,7 +620,7 @@ void MainWindow::slotPrivateBrowsing(bool enable) else { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); - m_view->currentUrlBar()->setBackgroundColor(palette().color(QPalette::Active, QPalette::Base)); + m_view->urlBar()->setBackgroundColor(palette().color(QPalette::Active, QPalette::Base)); m_lastSearch.clear(); m_view->clear(); @@ -876,7 +895,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event) return; } - KXmlGuiWindow::keyPressEvent(event); + KMainWindow::keyPressEvent(event); } @@ -1000,3 +1019,41 @@ void MainWindow::clearPrivateData() // this let crash rekonq. // delete dialog; } + + +void MainWindow::slotAboutToShowBackMenu() +{ + m_historyBackMenu->clear(); + if (!currentTab()) + return; + QWebHistory *history = currentTab()->history(); + int historyCount = history->count(); + for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) + { + QWebHistoryItem item = history->backItems(history->count()).at(i); + KAction *action = new KAction(this); + action->setData(-1*(historyCount - i - 1)); + QIcon icon = Application::instance()->icon(item.url()); + action->setIcon(icon); + action->setText(item.title()); + m_historyBackMenu->addAction(action); + } +} + + +void MainWindow::slotOpenActionUrl(QAction *action) +{ + int offset = action->data().toInt(); + QWebHistory *history = currentTab()->history(); + if (offset < 0) + { + history->goToItem(history->backItems(-1*offset).first()); // back + } + else + { + if (offset > 0) + { + history->goToItem(history->forwardItems(history->count() - offset + 1).back()); // forward + } + } +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 14c59cce..854745df 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -29,13 +29,16 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H + // Local Includes #include "bookmarks.h" #include "mainview.h" #include "webview.h" // KDE Includes -#include <KXmlGuiWindow> +#include <KMainWindow> +#include <KActionCollection> +#include <KToolBar> // Forward Declarations class QWebFrame; @@ -54,7 +57,7 @@ class WebView; * It handles the menus, toolbars, and status bars. * */ -class MainWindow : public KXmlGuiWindow +class MainWindow : public KMainWindow { Q_OBJECT @@ -66,12 +69,13 @@ public: WebView *currentTab() const; QAction *actionByName(const QString name); virtual QSize sizeHint() const; - + virtual KActionCollection *actionCollection () const; + private: void setupActions(); void setupHistoryMenu(); - void setupBars(); void setupTools(); + void setupToolbar(); void setupSidePanel(); SidePanel *sidePanel(); @@ -111,7 +115,6 @@ private slots: // File Menu slots void slotFileOpen(); void slotFilePrintPreview(); - void slotFilePrint(); void slotFileSaveAs(); void printRequested(QWebFrame *frame); @@ -138,6 +141,9 @@ private slots: // clear private data void clearPrivateData(); + void slotAboutToShowBackMenu(); + void slotOpenActionUrl(QAction *action); + private: MainView *m_view; FindBar *m_findBar; @@ -146,11 +152,14 @@ private: KAction *m_stopReloadAction; KAction *m_historyBackAction; KAction *m_historyForwardAction; - + KMenu *m_historyBackMenu; + QString m_lastSearch; QString m_homePage; QPointer<KPassivePopup> m_popup; + + KActionCollection *m_ac; }; #endif // MAINWINDOW_H diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 32bc15b5..c19cf508 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -56,7 +56,7 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) - : RekonqAccessManager(parent) + : AccessManager(parent) , m_diskCache(0) { connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), @@ -141,8 +141,8 @@ void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthent passwordWidget.iconLabel->setText(QString()); passwordWidget.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); - - QString introMessage = i18n("<qt>Enter username and password for %1 at %2</qt>", + //FIXME Replace the text below with an explanation of what exactly %1 and %2 stand for + QString introMessage = i18nc("%1=stuff %2=stuff2", "<qt>Enter username and password for %1 at %2</qt>", Qt::escape(reply->url().toString()), Qt::escape(reply->url().toString()) ); passwordWidget.introLabel->setText(introMessage); @@ -172,7 +172,7 @@ void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &prox proxyWdg.iconLabel->setText(QString()); proxyWdg.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32)); - + //FIXME Connect to proxy %1 using what? Best solution would be adding a %2 after the "using:" part and explain %1 and %2 in an i18nc call QString introMessage = i18n("<qt>Connect to proxy %1 using:</qt>", Qt::escape(proxy.hostName()) ); proxyWdg.introLabel->setText(introMessage); proxyWdg.introLabel->setWordWrap(true); @@ -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..7297262d 100644 --- a/src/networkaccessmanager.h +++ b/src/networkaccessmanager.h @@ -27,33 +27,32 @@ #ifndef NETWORKACCESSMANAGER_H #define NETWORKACCESSMANAGER_H -#include <kdeversion.h> -#if KDE_IS_VERSION(4, 2, 70) - #include <kio/accessmanager.h> - using namespace KIO; - typedef AccessManager RekonqAccessManager; -#else - #include <QtNetwork/QNetworkAccessManager> - typedef QNetworkAccessManager RekonqAccessManager; -#endif +// KDE Includes +#include <kio/accessmanager.h> // Forward Declarations class QNetworkDiskCache; -class NetworkAccessManager : public RekonqAccessManager +using namespace KIO; + + +class NetworkAccessManager : public AccessManager { Q_OBJECT 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 +63,7 @@ private slots: private: QNetworkDiskCache *m_diskCache; + KIO::MetaData m_metaData; }; #endif // NETWORKACCESSMANAGER_H diff --git a/src/panelhistory.cpp b/src/panelhistory.cpp index f9ac9da0..d6367669 100644 --- a/src/panelhistory.cpp +++ b/src/panelhistory.cpp @@ -51,7 +51,7 @@ PanelHistory::PanelHistory(QWidget *parent) // add search bar QHBoxLayout *hBoxLayout = new QHBoxLayout; hBoxLayout->setContentsMargins(5, 0, 0, 0); - QLabel *searchLabel = new QLabel(i18n("Search: ")); + QLabel *searchLabel = new QLabel(i18n("Search:")); hBoxLayout->addWidget(searchLabel); KLineEdit *search = new KLineEdit; hBoxLayout->addWidget(search); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 443c9f8d..b27c4fd5 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -23,6 +23,9 @@ <entry name="openTabsBack" type="Bool"> <default>false</default> </entry> + <entry name="newTabsOpenHomePage" type="Bool"> + <default>false</default> + </entry> <entry name="showUrlsPopup" type="Bool"> <default>true</default> </entry> diff --git a/src/rekonqui.rc b/src/rekonqui.rc deleted file mode 100644 index 6b250ab3..00000000 --- a/src/rekonqui.rc +++ /dev/null @@ -1,102 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE gui SYSTEM "kpartgui.dtd"> -<gui name="rekonq" version="44"> - -<MenuBar> - -<!-- ============ FILE menu =========== --> -<Menu name="file" noMerge="1"><text>&File</text> - <Action name="file_open" /> - <Action name="open_location" /> - <Separator/> - <Action name="new_tab" /> - <Action name="close_tab" /> - <Separator/> - <Action name="file_save_as" /> - <Separator/> - <Action name="file_print_preview" /> - <Action name="file_print" /> - <Separator/> - <Action name="file_quit" /> -</Menu> - -<!-- ============ EDIT menu =========== --> -<Menu name="edit" noMerge="1"><text>&Edit</text> - <Action name="edit_undo" /> - <Action name="edit_redo" /> - <Separator/> - <Action name="edit_cut" /> - <Action name="edit_copy" /> - <Action name="edit_paste" /> - <Separator/> - <Action name="edit_find" /> - <Action name="edit_find_next" /> - <Action name="edit_find_prev" /> -</Menu> - -<!-- ============ VIEW menu =========== --> -<Menu name="view" noMerge="1"><text>&View</text> - <Action name="view_redisplay" /> - <Action name="go_home" /> - <Separator/> - <Action name="bigger_font" /> - <Action name="normal_font" /> - <Action name="smaller_font" /> - <Separator/> - <Action name="page_source" /> -</Menu> - -<!-- ============ GO menu =========== --> -<Menu name="go" deleted="true"> -</Menu> - -<!-- ============ HISTORY menu =========== --> -<Action name="history" ><text>Hi&story</text> -</Action> - -<!-- ============ BOOKMARKS menu =========== --> -<Action name="bookmarksActionMenu" ><text>&Bookmarks</text> -</Action> - -<!-- ============ TOOLS menu =========== --> -<Menu name="tools" noMerge="1"><text>&Tools</text> - <Action name="web_inspector" /> - <Action name="private_browsing" /> - <Action name="clear_private_data" /> -</Menu> - -<!-- ============ SETTINGS menu =========== --> -<Menu name="settings" noMerge="1"><text>&Settings</text> - <Action name="options_show_menubar" /> - <Merge name="StandardToolBarMenuHandler" /> - <Merge/> - <Separator/> - <Action name="fullscreen" /> - <Separator/> - <Action name="options_configure_keybinding" /> - <Action name="options_configure_toolbars" /> - <Action name="options_configure" /> -</Menu> - -</MenuBar> - -<!-- ============ Main ToolBar =========== --> -<ToolBar name="mainToolBar" position="top" iconText="iconOnly" newline="true" noMerge="1"> -<text>Main Toolbar</text> - <Action name="history_back" /> - <Action name="history_forward" /> - <Separator /> - <Action name="stop_reload" /> - <Action name="go_home" /> - <Action name="url_bar" /> - <Action name="bookmarksActionMenu" /> - <Action name="rekonq_tools" /> -</ToolBar> - -<!-- ============ Bookmarks ToolBar =========== --> -<ToolBar name="bookmarksToolBar" fullWidth="true" iconText="icontextright" iconSize="16" newline="true" hidden="true" noEdit="true"> - <text>Bookmark Toolbar</text> - <Action noEdit="true" name="bookmarks_bar" /> -</ToolBar> - -</gui> diff --git a/src/settings.cpp b/src/settings.cpp index b5316ff5..51281379 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -121,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); } @@ -146,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_general.ui b/src/settings_general.ui index d40dff99..23904354 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -17,10 +17,10 @@ <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> - <string>Places</string> + <string>Home Page</string> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> + <item row="1" column="0"> <widget class="QLabel" name="label_3"> <property name="text"> <string>Home page:</string> @@ -30,7 +30,7 @@ </property> </widget> </item> - <item row="0" column="1"> + <item row="1" column="1"> <widget class="KLineEdit" name="kcfg_homePage"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> @@ -40,7 +40,7 @@ </property> </widget> </item> - <item row="1" column="1"> + <item row="2" column="1"> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QPushButton" name="setHomeToCurrentPageButton"> @@ -64,6 +64,13 @@ </item> </layout> </item> + <item row="0" column="1"> + <widget class="QCheckBox" name="kcfg_newTabsOpenHomePage"> + <property name="text"> + <string>New Tabs open Home Page</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/src/stackedurlbar.cpp b/src/stackedurlbar.cpp deleted file mode 100644 index 18912ccd..00000000 --- a/src/stackedurlbar.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com> -* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* ============================================================ */ - - -// Self Includes -#include "stackedurlbar.h" -#include "stackedurlbar.moc" - -// Local Includes -#include "application.h" -#include "history.h" -#include "urlbar.h" - -// KDE Includes -#include <KDebug> - - -StackedUrlBar::StackedUrlBar(QWidget *parent) - : QStackedWidget(parent) - , m_completion(0) - , m_completionModel(0) -{ -} - - -StackedUrlBar::~StackedUrlBar() -{ - delete m_completion; - delete m_completionModel; -} - - -UrlBar *StackedUrlBar::currentUrlBar() -{ - return urlBar(currentIndex()); -} - - -UrlBar *StackedUrlBar::urlBar(int index) -{ - UrlBar *urlBar = qobject_cast<UrlBar*>(QStackedWidget::widget(index)); - if (!urlBar) - { - kWarning() << "URL bar with index" << index << "not found. Returning NULL. line:" << __LINE__; - } - - return urlBar; -} - - -void StackedUrlBar::addUrlBar(UrlBar* urlBar) -{ - QStackedWidget::addWidget(urlBar); - - // setup completion objects - urlBar->setCompletionObject(completion()); -} - - -void StackedUrlBar::setCurrentUrlBar(UrlBar* urlBar) -{ - QStackedWidget::setCurrentWidget(urlBar); -} - - -void StackedUrlBar::removeUrlBar(UrlBar* urlBar) -{ - QStackedWidget::removeWidget(urlBar); -} - - -void StackedUrlBar::clear() -{ - currentUrlBar()->clearHistory(); - - for (int i = 0; i < count(); ++i) - { - urlBar(i)->clear(); - } -} - - -QList<const UrlBar* > StackedUrlBar::urlBars() -{ - QList<const UrlBar *> list; - for (int i = 0; i < count(); ++i) - { - const UrlBar* u = urlBar(i); - list.append(u); - } - return list; -} - - -KCompletion *StackedUrlBar::completion() -{ - // make sure completion was created - if (!m_completion) - { - m_completion = new KCompletion(); - m_completion->setCompletionMode(KGlobalSettings::CompletionPopupAuto); - m_completion->setOrder(KCompletion::Weighted); - m_completion->setIgnoreCase(true); - - kDebug() << "Initialize completion list..."; - - HistoryCompletionModel *model = completionModel(); - int count = model->rowCount(); - - kDebug() << "...initialize history items" << count; - - // change order to insertion to avoid confusion of the addItem method - // in weighted it expects format string:number and it thinks http it the whole string - m_completion->setOrder(KCompletion::Insertion); - for (int i = 0; i < count; ++i) - { - QString item = model->data(model->index(i, 0)).toString(); - item.remove(QRegExp("^http://|/$")); - m_completion->addItem(item); - } - m_completion->setOrder(KCompletion::Weighted); - } - - return m_completion; -} - - -HistoryCompletionModel *StackedUrlBar::completionModel() -{ - if (!m_completionModel) - { - m_completionModel = new HistoryCompletionModel(this); - m_completionModel->setSourceModel(Application::historyManager()->historyFilterModel()); - } - return m_completionModel; -} diff --git a/src/stackedurlbar.h b/src/stackedurlbar.h deleted file mode 100644 index bda4b8fc..00000000 --- a/src/stackedurlbar.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com> -* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> -* -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License or (at your option) version 3 or any later version -* accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy -* defined in Section 14 of version 3 of the license. -* -* 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. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -* -* ============================================================ */ - - -#ifndef STACKEDURLBAR_H -#define STACKEDURLBAR_H - -// Qt Includes -#include <QStackedWidget> - -// Forward Declarations -class KCompletion; -class HistoryCompletionModel; -class UrlBar; - - -class StackedUrlBar : public QStackedWidget -{ - Q_OBJECT - -public: - StackedUrlBar(QWidget *parent = 0); - ~StackedUrlBar(); - -public: - UrlBar *currentUrlBar(); - UrlBar *urlBar(int index); - void addUrlBar(UrlBar *urlBar); - void setCurrentUrlBar(UrlBar *urlBar); - void removeUrlBar(UrlBar *urlBar); - - QList<const UrlBar *> urlBars(); - - KCompletion *completion(); - HistoryCompletionModel *completionModel(); - -public slots: - void clear(); - -private: - Q_DISABLE_COPY(StackedUrlBar) - - KCompletion *m_completion; - HistoryCompletionModel *m_completionModel; -}; - -#endif // STACKEDURLBAR_H diff --git a/src/urlbar.cpp b/src/urlbar.cpp index 94f248e3..4b253773 100644 --- a/src/urlbar.cpp +++ b/src/urlbar.cpp @@ -51,15 +51,21 @@ QColor UrlBar::s_defaultBaseColor; + UrlBar::UrlBar(QWidget *parent) : KHistoryComboBox(true, parent) , m_lineEdit(new LineEdit) , m_progress(0) + , m_completion(0) + , m_completionModel(0) { setUrlDropsEnabled(true); setAutoDeleteCompletionObject(true); - setMinimumWidth(180); + //cosmetic + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setMinimumWidth(180); + setTrapReturnKey(true); setupLineEdit(); @@ -72,7 +78,8 @@ UrlBar::UrlBar(QWidget *parent) // setup completion box completionBox()->setTabHandling(true); // Konqueror bug #167135 - + setCompletionObject(completion()); + // set dropdown list background QPalette p = view()->palette(); p.setColor(QPalette::Base, palette().color(QPalette::Base)); @@ -132,14 +139,18 @@ void UrlBar::setupLineEdit() void UrlBar::setUrl(const QUrl& url) { - if (url.isEmpty()) - return; - m_currentUrl = url; slotUpdateUrl(); } +void UrlBar::setProgress(int progress) +{ + m_progress = progress; + repaint(); +} + + void UrlBar::slotUpdateUrl() { if (count()) @@ -163,7 +174,7 @@ void UrlBar::slotUpdateUrl() } -inline void UrlBar::slotActivated(const QString& url) +void UrlBar::slotActivated(const QString& url) { if (url.isEmpty()) return; @@ -176,7 +187,7 @@ inline void UrlBar::slotActivated(const QString& url) } -inline void UrlBar::slotCleared() +void UrlBar::slotCleared() { // clear the history on user's request from context menu clear(); @@ -184,7 +195,7 @@ inline void UrlBar::slotCleared() } -inline void UrlBar::slotLoadFinished(bool) +void UrlBar::slotLoadFinished(bool) { // reset progress bar after small delay m_progress = 0; @@ -192,7 +203,7 @@ inline void UrlBar::slotLoadFinished(bool) } -inline void UrlBar::slotUpdateProgress(int progress) +void UrlBar::slotUpdateProgress(int progress) { m_progress = progress; repaint(); @@ -279,3 +290,45 @@ bool UrlBar::isLoading() } return true; } + + +KCompletion *UrlBar::completion() +{ + // make sure completion was created + if (!m_completion) + { + m_completion = new KCompletion(); + m_completion->setCompletionMode(KGlobalSettings::CompletionPopupAuto); + m_completion->setOrder(KCompletion::Weighted); + m_completion->setIgnoreCase(true); + + kDebug() << "Initialize completion list..."; + HistoryCompletionModel *model = completionModel(); + int count = model->rowCount(); + kDebug() << "...initialize history items" << count; + + // change order to insertion to avoid confusion of the addItem method + // in weighted it expects format string:number and it thinks http it the whole string + m_completion->setOrder(KCompletion::Insertion); + for (int i = 0; i < count; ++i) + { + QString item = model->data(model->index(i, 0)).toString(); + item.remove(QRegExp("^http://|/$")); + m_completion->addItem(item); + } + + m_completion->setOrder(KCompletion::Weighted); + } + return m_completion; +} + + +HistoryCompletionModel *UrlBar::completionModel() +{ + if (!m_completionModel) + { + m_completionModel = new HistoryCompletionModel(this); + m_completionModel->setSourceModel(Application::historyManager()->historyFilterModel()); + } + return m_completionModel; +} diff --git a/src/urlbar.h b/src/urlbar.h index 50ba40f7..41d7945e 100644 --- a/src/urlbar.h +++ b/src/urlbar.h @@ -44,7 +44,8 @@ // Forward Declarations class QLinearGradient; class QWidget; - +class KCompletion; +class HistoryCompletionModel; class UrlBar : public KHistoryComboBox { @@ -59,7 +60,10 @@ public: QSize sizeHint() const; void setBackgroundColor(QColor); bool isLoading(); - + KCompletion *completion(); + HistoryCompletionModel *completionModel(); + void setProgress(int progress); + signals: void activated(const KUrl&); @@ -90,6 +94,9 @@ private: KUrl m_currentUrl; int m_progress; + + KCompletion *m_completion; + HistoryCompletionModel *m_completionModel; }; #endif diff --git a/src/webpage.cpp b/src/webpage.cpp index 33711f7d..d3e49e10 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -65,7 +65,7 @@ #include <QtGui/QClipboard> #include <QtGui/QKeyEvent> -#include <QUiLoader> +#include <QtUiTools/QUiLoader> WebPage::WebPage(QObject *parent) @@ -91,13 +91,13 @@ 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; } - - m_requestedUrl = request.url(); if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) { @@ -127,7 +127,9 @@ WebPage *WebPage::newWindow(WebWindowType type) kDebug() << "Modal Dialog ---------------------------------------"; } - WebView *w = Application::instance()->mainWindow()->mainView()->newTab(!ReKonfig::openTabsBack()); + // FIXME: regression introduced. No more following rekonq setting about tab focus + // the FIX should be moving loadUrl code from Application to acceptNavigationRequest + WebView *w = Application::instance()->mainWindow()->mainView()->newWebView(!ReKonfig::openTabsBack()); return w->page(); } diff --git a/src/webpage.h b/src/webpage.h index d1642966..7137da3d 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -32,8 +32,6 @@ #define WEBPAGE_H -// KDE Includes - // Qt Includes #include <QWebPage> #include <QUrl> @@ -43,6 +41,7 @@ class QWebFrame; class QNetworkReply; class QUrl; + class WebPage : public QWebPage { Q_OBJECT diff --git a/src/webview.cpp b/src/webview.cpp index dca8b6fb..1c9440f4 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" @@ -57,15 +55,16 @@ #include <QtGui/QAction> - - WebView::WebView(QWidget* parent) : QWebView(parent) , m_page(new WebPage(this)) + , m_progress(0) { setPage(m_page); connect(page(), SIGNAL(statusBarMessage(const QString&)), this, SLOT(setStatusBarText(const QString&))); + connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotUpdateProgress(int))); + connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); } @@ -86,6 +85,12 @@ KUrl WebView::url() const } +int WebView::progress() +{ + return m_progress; +} + + QString WebView::lastStatusBarText() const { return m_statusBarText; @@ -326,3 +331,15 @@ void WebView::slotSearch() KUrl urlSearch = KUrl::fromEncoded(search.toUtf8()); Application::instance()->loadUrl(urlSearch, Rekonq::NewCurrentTab); } + + +void WebView::slotUpdateProgress(int p) +{ + m_progress=p; +} + + +void WebView::slotLoadFinished(bool) +{ + m_progress=0; +} diff --git a/src/webview.h b/src/webview.h index 5a2638b8..4f283aae 100644 --- a/src/webview.h +++ b/src/webview.h @@ -28,6 +28,7 @@ #ifndef WEBVIEW_H #define WEBVIEW_H + // KDE Includes #include <KUrl> @@ -48,6 +49,7 @@ public: WebPage *page(); KUrl url() const; QString lastStatusBarText() const; + int progress(); signals: // switching tabs @@ -67,10 +69,12 @@ protected: private slots: void setStatusBarText(const QString &string); void slotSearch(); - + void slotUpdateProgress(int progress); + void slotLoadFinished(bool); + private: WebPage *m_page; - + int m_progress; QString m_statusBarText; }; |