diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | data/rekonq.desktop | 5 | ||||
-rw-r--r-- | icons/CMakeLists.txt | 2 | ||||
-rw-r--r-- | icons/pics/CMakeLists.txt | 4 | ||||
-rw-r--r-- | icons/pics/hi64-actions-download.png | bin | 0 -> 4518 bytes | |||
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/application.cpp | 1 | ||||
-rw-r--r-- | src/application.h | 13 | ||||
-rw-r--r-- | src/cookiejar.h | 1 | ||||
-rw-r--r-- | src/history.cpp | 2 | ||||
-rw-r--r-- | src/history.ui | 74 | ||||
-rw-r--r-- | src/historydialog.cpp | 129 | ||||
-rw-r--r-- | src/historydialog.h | 57 | ||||
-rw-r--r-- | src/historymenu.cpp | 24 | ||||
-rw-r--r-- | src/historymenu.h | 6 | ||||
-rw-r--r-- | src/kaccessmanager.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/mainview.cpp | 116 | ||||
-rw-r--r-- | src/mainview.h | 23 | ||||
-rw-r--r-- | src/mainwindow.cpp | 132 | ||||
-rw-r--r-- | src/mainwindow.h | 36 | ||||
-rw-r--r-- | src/modelmenu.cpp | 38 | ||||
-rw-r--r-- | src/networkmanager.cpp | 9 | ||||
-rw-r--r-- | src/networkmanager.h | 11 | ||||
-rw-r--r-- | src/rekonqui.rc | 13 | ||||
-rw-r--r-- | src/tabbar.cpp | 19 | ||||
-rw-r--r-- | src/webpage.cpp | 47 | ||||
-rw-r--r-- | src/webpage.h | 18 | ||||
-rw-r--r-- | src/webview.h | 8 |
29 files changed, 278 insertions, 519 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 512e25a0..9b3d7ff4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ PROJECT( rekonq ) # rekonq info SET(REKONQ_MAJOR_VERSION "0") SET(REKONQ_MINOR_VERSION "1") -SET(REKONQ_PATCH_VERSION "4") +SET(REKONQ_PATCH_VERSION "6") SET(REKONQ_VERSION_STR "${REKONQ_MAJOR_VERSION}.${REKONQ_MINOR_VERSION}.${REKONQ_PATCH_VERSION}" diff --git a/data/rekonq.desktop b/data/rekonq.desktop index cfb4dde0..b583dede 100644 --- a/data/rekonq.desktop +++ b/data/rekonq.desktop @@ -1,13 +1,18 @@ [Desktop Entry] Name=rekonq Name[sv]=Rekonq +Name[tr]=Rekonq +Name[x-test]=xxrekonqxx GenericName=Webkit KDE Browser +GenericName[de]=Webkit-Browser für KDE GenericName[et]=KDE Webkiti veebibrauser GenericName[km]=កម្មវិធីរុករក Webkit KDE GenericName[pt]=Navegador Web com WebKit GenericName[pt_BR]=Navegador Webkit do KDE GenericName[sv]=Webkit webbläsare för KDE +GenericName[tr]=Webkit KDE Tarayıcı GenericName[uk]=Переглядач мережі на WebKit для KDE +GenericName[x-test]=xxWebkit KDE Browserxx Icon=rekonq Type=Application Exec=rekonq %u diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index 9d7ead58..d575cf4d 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -1,2 +1,4 @@ # install standard icons KDE4_INSTALL_ICONS( ${ICON_INSTALL_DIR} ) + +ADD_SUBDIRECTORY( pics ) diff --git a/icons/pics/CMakeLists.txt b/icons/pics/CMakeLists.txt new file mode 100644 index 00000000..53d04224 --- /dev/null +++ b/icons/pics/CMakeLists.txt @@ -0,0 +1,4 @@ +INSTALL( + FILES hi64-actions-download.png + DESTINATION ${DATA_INSTALL_DIR}/rekonq/pics +) diff --git a/icons/pics/hi64-actions-download.png b/icons/pics/hi64-actions-download.png Binary files differnew file mode 100644 index 00000000..aa1101c1 --- /dev/null +++ b/icons/pics/hi64-actions-download.png diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 92fd9d53..ed3205b8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,6 @@ SET( rekonq_SRCS edittableview.cpp edittreeview.cpp history.cpp - historydialog.cpp historymenu.cpp bookmarks.cpp modelmenu.cpp @@ -44,7 +43,7 @@ SET( rekonq_SRCS KDE4_ADD_UI_FILES( rekonq_SRCS cookies.ui cookiesexceptions.ui - history.ui + #history.ui password.ui proxy.ui settings_general.ui diff --git a/src/application.cpp b/src/application.cpp index 94821653..5b458438 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -42,6 +42,7 @@ #include <KConfig> #include <kio/job.h> #include <kio/jobclasses.h> +#include <KPassivePopup> // Qt Includes #include <QtCore/QTimer> diff --git a/src/application.h b/src/application.h index a5658703..d2e66d3f 100644 --- a/src/application.h +++ b/src/application.h @@ -58,6 +58,19 @@ namespace Rekonq New, ///< open url in new tab and make it current Background ///< open url in new tab in background }; + + /** + * @short notifying message status + * Different message status + */ + + enum Notify + { + Success, ///< url successfully (down)loaded + Error, ///< url failed to (down)load + Download, ///< downloading url + Info ///< information, (default) + }; } diff --git a/src/cookiejar.h b/src/cookiejar.h index 56adc0b3..5bfe7749 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -29,7 +29,6 @@ #include <QtNetwork/QNetworkCookieJar> // Forward Declarations -class AutoSaver; class QUrl; diff --git a/src/history.cpp b/src/history.cpp index dcfe4c21..11cd3653 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -540,7 +540,7 @@ bool HistoryModel::removeRows(int row, int count, const QModelIndex &parent) // ----------------------------------------------------------------------------------------------- -#define MOVEDROWS 10 +#define MOVEDROWS 20 /* diff --git a/src/history.ui b/src/history.ui deleted file mode 100644 index 1f3e1016..00000000 --- a/src/history.ui +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>historyWidget</class> - <widget class="QWidget" name="Form"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>584</width> - <height>381</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout"> - <item> - <widget class="QPushButton" name="removeButton"> - <property name="text"> - <string>&Remove</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="removeAllButton"> - <property name="text"> - <string>Remove &All</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Search:</string> - </property> - </widget> - </item> - <item> - <widget class="KLineEdit" name="search"/> - </item> - </layout> - </item> - <item> - <widget class="EditTreeView" name="tree"/> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>KLineEdit</class> - <extends>QLineEdit</extends> - <header>klineedit.h</header> - </customwidget> - <customwidget> - <class>EditTreeView</class> - <extends>QTreeView</extends> - <header>edittreeview.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/src/historydialog.cpp b/src/historydialog.cpp deleted file mode 100644 index 6a150952..00000000 --- a/src/historydialog.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com> -* -* -* This program is free software; you can redistribute it -* and/or modify it under the terms of the GNU General -* Public License as published by the Free Software Foundation; -* either version 3, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* ============================================================ */ - - -// Auto Includes -#include "historydialog.h" -#include "historydialog.moc" - -// Local Includes -#include "history.h" -#include "application.h" - -// KDE Includes -#include <KAction> -#include <KUrl> - -// Qt Includes -#include <QtCore/QPoint> - -#include <QtGui/QWidget> -#include <QtGui/QClipboard> -#include <QtGui/QDesktopWidget> - - -HistoryDialog::HistoryDialog(QWidget *parent, HistoryManager *setHistory) - : KDialog(parent) - , m_historyWidg(new Ui::historyWidget) -{ - HistoryManager *history = setHistory; - if (!history) - history = Application::historyManager(); - - setCaption( i18n("History") ); - setButtons( KDialog::Close ); - - QWidget *widget = new QWidget; - m_historyWidg->setupUi(widget); - setMainWidget(widget); - - m_historyWidg->search->setClearButtonShown(true); - - m_historyWidg->tree->setUniformRowHeights(true); - m_historyWidg->tree->setSelectionBehavior(QAbstractItemView::SelectRows); - m_historyWidg->tree->setTextElideMode(Qt::ElideMiddle); - - QAbstractItemModel *model = history->historyTreeModel(); - TreeProxyModel *proxyModel = new TreeProxyModel(this); - - connect(m_historyWidg->search, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterFixedString(QString))); - connect(m_historyWidg->removeButton, SIGNAL(clicked()), m_historyWidg->tree, SLOT(removeOne())); - connect(m_historyWidg->removeAllButton, SIGNAL(clicked()), history, SLOT(clear())); - - proxyModel->setSourceModel(model); - m_historyWidg->tree->setModel(proxyModel); - m_historyWidg->tree->setExpanded(proxyModel->index(0, 0), true); - m_historyWidg->tree->setAlternatingRowColors(true); - - QFontMetrics fm(font()); - int header = fm.width(QLatin1Char('m')) * 25; - m_historyWidg->tree->header()->resizeSection(0, header); - m_historyWidg->tree->header()->setStretchLastSection(true); - - m_historyWidg->tree->setContextMenuPolicy(Qt::CustomContextMenu); - - connect(m_historyWidg->tree, SIGNAL(customContextMenuRequested(const QPoint &)), - this, SLOT(customContextMenuRequested(const QPoint &))); - - connect(m_historyWidg->tree, SIGNAL(activated(const QModelIndex&)), this, SLOT(open())); -} - - -void HistoryDialog::customContextMenuRequested(const QPoint &pos) -{ - KMenu menu; - QModelIndex index = m_historyWidg->tree->indexAt(pos); - index = index.sibling(index.row(), 0); - if (index.isValid() && !m_historyWidg->tree->model()->hasChildren(index)) - { - menu.addAction(i18n("Open"), this, SLOT(open())); - menu.addSeparator(); - menu.addAction(i18n("Copy"), this, SLOT(copy())); - } - menu.addAction(i18n("Delete"), m_historyWidg->tree, SLOT(removeOne())); - menu.exec(QCursor::pos()); -} - - -void HistoryDialog::open() -{ - QModelIndex index = m_historyWidg->tree->currentIndex(); - if (!index.parent().isValid()) - return; - emit openUrl(index.data(HistoryModel::UrlRole).toUrl()); -} - - -void HistoryDialog::copy() -{ - QModelIndex index = m_historyWidg->tree->currentIndex(); - if (!index.parent().isValid()) - return; - QString url = index.data(HistoryModel::UrlStringRole).toString(); - - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(url); -} - -QSize HistoryDialog::sizeHint() const -{ - QRect desktopRect = Application::desktop()->screenGeometry(); - QSize size = desktopRect.size() * 0.7; - return size; -} diff --git a/src/historydialog.h b/src/historydialog.h deleted file mode 100644 index 20f92d9d..00000000 --- a/src/historydialog.h +++ /dev/null @@ -1,57 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2009 by Andrea Diamantini <adjam7 at gmail dot com> -* -* -* This program is free software; you can redistribute it -* and/or modify it under the terms of the GNU General -* Public License as published by the Free Software Foundation; -* either version 3, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* ============================================================ */ - - - -#ifndef HISTORYDIALOG_H -#define HISTORYDIALOG_H - - -// Ui includes -#include "ui_history.h" - -// KDE Includes -#include <KDialog> - -class KUrl; -class QPoint; -class QWidget; -class HistoryManager; - -class HistoryDialog : public KDialog -{ - Q_OBJECT - -signals: - void openUrl(const KUrl &url); - -public: - explicit HistoryDialog(QWidget *parent = 0, HistoryManager *history = 0); - QSize sizeHint() const; - -private slots: - void customContextMenuRequested(const QPoint &pos); - void open(); - void copy(); - -private: - Ui::historyWidget *m_historyWidg; -}; - -#endif diff --git a/src/historymenu.cpp b/src/historymenu.cpp index 234236ac..b5edae3f 100644 --- a/src/historymenu.cpp +++ b/src/historymenu.cpp @@ -19,16 +19,22 @@ * ============================================================ */ +// Auto Includes #include "historymenu.h" #include "historymenu.moc" +// Local Includes #include "application.h" -#include "historydialog.h" +#include "mainwindow.h" +// Qt Includes #include <QtGui/QWidget> #include <QtCore/QModelIndex> +// KDE Includes #include <KUrl> +#include <KMessageBox> + HistoryMenu::HistoryMenu(QWidget *parent) : ModelMenu(parent) @@ -69,21 +75,23 @@ void HistoryMenu::postPopulated() if (m_history->history().count() > 0) addSeparator(); - KAction *showAllAction = new KAction(i18n("Show All History"), this); - connect(showAllAction, SIGNAL(triggered()), this, SLOT(showHistoryDialog())); + QAction *showAllAction = Application::instance()->mainWindow()->actionByName("show_history_panel"); addAction(showAllAction); KAction *clearAction = new KAction(i18n("Clear History"), this); - connect(clearAction, SIGNAL(triggered()), m_history, SLOT(clear())); + connect(clearAction, SIGNAL(triggered()), this, SLOT(clearHistory())); addAction(clearAction); } -void HistoryMenu::showHistoryDialog() +void HistoryMenu::clearHistory() { - HistoryDialog *dialog = new HistoryDialog(this); - connect(dialog, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openUrl(const KUrl&))); - dialog->show(); + int res = KMessageBox::warningYesNo(this, i18n("Are you sure you want to delete history?"), i18n("History") ); + + if (res == KMessageBox::Yes) + { + m_history->clear(); + } } diff --git a/src/historymenu.h b/src/historymenu.h index ec529b65..64395951 100644 --- a/src/historymenu.h +++ b/src/historymenu.h @@ -22,16 +22,20 @@ #ifndef HISTORYMENU_H #define HISTORYMENU_H +// Local Includes #include "history.h" +// Qt Includes #include <QtCore/QList> #include <QtGui/QAction> +// Forward Declarations class ModelMenu; class QWidget; class QModelIndex; class KUrl; + /** * Menu that is dynamically populated from the history * @@ -54,7 +58,7 @@ protected: private slots: void activated(const QModelIndex &index); - void showHistoryDialog(); + void clearHistory(); private: HistoryManager *m_history; diff --git a/src/kaccessmanager.h b/src/kaccessmanager.h index 8325c890..ed5c208d 100644 --- a/src/kaccessmanager.h +++ b/src/kaccessmanager.h @@ -27,8 +27,6 @@ #include <kdenetwork/knetworkreply.h> // Forward Declarations -class QNetworkRequest; -class QIODevice; class NetworkAccessManager : public KNetworkAccessManager diff --git a/src/main.cpp b/src/main.cpp index d21bb580..d97017ca 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,7 @@ static const char description[] = I18N_NOOP("WebKit based Web Browser for KDE"); -static const char version[] = "0.1.4"; +static const char version[] = "0.1.6"; int main(int argc, char **argv) diff --git a/src/mainview.cpp b/src/mainview.cpp index 6f3ad926..75154528 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -61,10 +61,9 @@ MainView::MainView(QWidget *parent) : KTabWidget(parent) - , m_recentlyClosedTabsAction(0) - , m_recentlyClosedTabsMenu(new KMenu(this)) , m_urlBars(new StackedUrlBar(this)) , m_tabBar(new TabBar(this)) + , m_addTabButton(new QToolButton(this)) { // setting tabbar setTabBar(m_tabBar); @@ -97,12 +96,40 @@ MainView::~MainView() void MainView::postLaunch() { - // Recently Closed Tab Action - connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentTabsMenu())); - connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(aboutToShowRecentTriggeredAction(QAction *))); - m_recentlyClosedTabsAction = new KAction(i18n("Recently Closed Tabs"), this); - m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu); - m_recentlyClosedTabsAction->setEnabled(false); + m_addTabButton->setDefaultAction(Application::instance()->mainWindow()->actionByName("new_tab")); + m_addTabButton->setAutoRaise(true); + m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); +} + + +void MainView::addTabButtonPosition() +{ + static bool ButtonInCorner = false; + + QSize s1 = frameSize(); + int tabWidgetWidth = s1.width(); + + QSize s2 = tabBar()->sizeHint(); + int newPos = s2.width(); + + if( newPos > tabWidgetWidth ) + { + if(ButtonInCorner) + return; + setCornerWidget(m_addTabButton); + ButtonInCorner = true; + } + else + { + if(ButtonInCorner) + { + setCornerWidget(0); + m_addTabButton->show(); + ButtonInCorner = false; + } + m_addTabButton->move(newPos, 0); + } + } @@ -136,12 +163,6 @@ int MainView::webViewIndex(WebView *webView) const } -KAction *MainView::recentlyClosedTabsAction() const -{ - return m_recentlyClosedTabsAction; -} - - void MainView::setMakeBackTab(bool b) { m_makeBackTab = b; @@ -247,8 +268,6 @@ void MainView::slotWebPaste() void MainView::clear() { - // clear the recently closed tabs - m_recentlyClosedTabs.clear(); // clear the line edit history for (int i = 0; i < m_urlBars->count(); ++i) { @@ -284,7 +303,7 @@ void MainView::slotCurrentChanged(int index) WebView *oldWebView = this->webView(m_urlBars->currentIndex()); if (oldWebView) { - disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)), + 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&))); @@ -292,7 +311,7 @@ void MainView::slotCurrentChanged(int index) this, SIGNAL(loadProgress(int))); } - connect(webView, SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&))); + 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&))); connect(webView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); @@ -352,7 +371,6 @@ WebView *MainView::newWebView(Rekonq::OpenType type) // connecting webview with mainview connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); - connect(webView, SIGNAL(loadProgress(int)), this, SLOT(webViewLoadProgress(int))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool))); connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); @@ -387,6 +405,7 @@ WebView *MainView::newWebView(Rekonq::OpenType type) emit tabsChanged(); showTabBar(); + addTabButtonPosition(); return webView; } @@ -446,6 +465,7 @@ void MainView::slotCloseOtherTabs(int index) } showTabBar(); + addTabButtonPosition(); } @@ -460,6 +480,7 @@ void MainView::slotCloneTab(int index) tab->setUrl(webView(index)->url()); showTabBar(); + addTabButtonPosition(); } @@ -489,20 +510,6 @@ void MainView::slotCloseTab(int index) return; } hasFocus = tab->hasFocus(); - - m_recentlyClosedTabsAction->setEnabled(true); - m_recentlyClosedTabs.prepend(tab->url()); - - // don't add empty urls - if (tab->url().isValid()) - { - m_recentlyClosedTabs.prepend(tab->url()); - } - - if (m_recentlyClosedTabs.size() >= MainView::m_recentlyClosedTabsSize) - { - m_recentlyClosedTabs.removeLast(); - } } QWidget *urlBar = m_urlBars->urlBar(index); @@ -521,6 +528,7 @@ void MainView::slotCloseTab(int index) } showTabBar(); + addTabButtonPosition(); } @@ -544,22 +552,6 @@ void MainView::webViewLoadStarted() } -void MainView::webViewLoadProgress(int progress) -{ - WebView *webView = qobject_cast<WebView*>(sender()); - int index = webViewIndex(webView); - if (index != currentIndex() || index < 0) - { - return; - } - - double totalBytes = static_cast<double>(webView->page()->totalBytes() / 1024); - - QString message = i18n("Loading %1% (%2 %3)...", progress, totalBytes, QLatin1String("kB")); - emit showStatusBarMessage(message); -} - - void MainView::webViewLoadFinished(bool ok) { WebView *webView = qobject_cast<WebView*>(sender()); @@ -582,9 +574,9 @@ void MainView::webViewLoadFinished(bool ok) } if (ok) - emit showStatusBarMessage(i18n("Done")); + emit showStatusBarMessage(i18n("Done"), Rekonq::Success); else - emit showStatusBarMessage(i18n("Failed to load")); + emit showStatusBarMessage(i18n("Failed to load"), Rekonq::Error); } @@ -637,28 +629,6 @@ void MainView::webViewUrlChanged(const QUrl &url) } -void MainView::aboutToShowRecentTabsMenu() -{ - m_recentlyClosedTabsMenu->clear(); - for (int i = 0; i < m_recentlyClosedTabs.count(); ++i) - { - KAction *action = new KAction(m_recentlyClosedTabsMenu); - action->setData(m_recentlyClosedTabs.at(i)); - QIcon icon = Application::instance()->icon(m_recentlyClosedTabs.at(i)); - action->setIcon(icon); - action->setText(m_recentlyClosedTabs.at(i).prettyUrl()); - m_recentlyClosedTabsMenu->addAction(action); - } -} - - -void MainView::aboutToShowRecentTriggeredAction(QAction *action) -{ - KUrl url = action->data().toUrl(); - loadUrl(url); -} - - void MainView::loadUrl(const KUrl &url) { if (url.isEmpty()) diff --git a/src/mainview.h b/src/mainview.h index dfa498f7..7cb4e035 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -30,18 +30,18 @@ // KDE Includes #include <KTabWidget> +// Qt Includes +#include <QtGui/QToolButton> + // Forward Declarations -class QLineEdit; class QUrl; class QWebFrame; class QLabel; class KAction; -class KCompletion; class KMenu; class KUrl; -class HistoryCompletionModel; class StackedUrlBar; class TabBar; class UrlBar; @@ -91,7 +91,7 @@ signals: // current tab signals void setCurrentTitle(const QString &url); - void showStatusBarMessage(const QString &message); + void showStatusBarMessage(const QString &message, Rekonq::Notify status = Rekonq::Info); void linkHovered(const QString &link); void loadProgress(int progress); @@ -112,6 +112,7 @@ public slots: * @param url The url to load */ void loadUrl(const KUrl &url); + void slotCloneTab(int index = -1); void slotCloseTab(int index = -1); void slotCloseOtherTabs(int index); @@ -133,11 +134,8 @@ public slots: private slots: void slotCurrentChanged(int index); - void aboutToShowRecentTabsMenu(); - void aboutToShowRecentTriggeredAction(QAction *action); // need QAction! void webViewLoadStarted(); - void webViewLoadProgress(int progress); void webViewLoadFinished(bool ok); void webViewIconChanged(); void webViewTitleChanged(const QString &title); @@ -163,6 +161,8 @@ protected: private: + void addTabButtonPosition(); + /** * This function creates (if not exists) and returns a QLabel * with a loading QMovie. @@ -175,19 +175,14 @@ private: */ QLabel *animatedLoading(int index, bool addMovie); - static const int m_recentlyClosedTabsSize = 10; - KAction *m_recentlyClosedTabsAction; - - KMenu *m_recentlyClosedTabsMenu; - QList<KUrl> m_recentlyClosedTabs; - StackedUrlBar *m_urlBars; TabBar *m_tabBar; QString m_loadingGitPath; bool m_makeBackTab; + + QToolButton *m_addTabButton; }; #endif - diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index abc3fcd5..c7e3c945 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -57,6 +57,10 @@ #include <KGlobalSettings> #include <KPushButton> #include <KTemporaryFile> +#include <KJobUiDelegate> +#include <KPassivePopup> +#include <KStandardDirs> +#include <KIconLoader> #include <kdeprintdialog.h> #include <kprintpreview.h> @@ -158,9 +162,9 @@ void MainWindow::postLaunch() connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); - // status bar messages - connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); - connect(m_view, SIGNAL(linkHovered(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + // "status bar" messages (new notifyMessage system) + connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); + connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&))); // update toolbar actions signals connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); @@ -292,11 +296,7 @@ void MainWindow::setupActions() // ================ history related actions m_historyBackAction = new KAction(KIcon("go-previous"), i18n("Back"), this); - m_historyBackMenu = new KMenu(this); - m_historyBackAction->setMenu(m_historyBackMenu); connect(m_historyBackAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); - connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); - connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); actionCollection()->addAction(QLatin1String("history_back"), m_historyBackAction); m_historyForwardAction = new KAction(KIcon("go-next"), i18n("Forward"), this); @@ -323,6 +323,11 @@ void MainWindow::setupActions() a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); actionCollection()->addAction(QLatin1String("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); + + // ==================== Bookmarks Actions + a = new KAction(i18n("Add Bookmark"), this); + a->setIcon(KIcon("rating")); + actionCollection()->addAction(QLatin1String("add_bookmark"),a); } @@ -336,8 +341,9 @@ void MainWindow::setupSidePanel() addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel); // setup side panel actions - QAction* a = m_sidePanel->toggleViewAction(); - a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H)); + 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 ?? actionCollection()->addAction(QLatin1String("show_history_panel"), a); } @@ -346,7 +352,6 @@ void MainWindow::setupHistoryMenu() { HistoryMenu *historyMenu = new HistoryMenu(this); connect(historyMenu, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); - connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); // setting history menu position @@ -356,7 +361,6 @@ void MainWindow::setupHistoryMenu() QList<QAction*> historyActions; historyActions.append(actionCollection()->action("history_back")); historyActions.append(actionCollection()->action("history_forward")); - historyActions.append(m_view->recentlyClosedTabsAction()); historyMenu->setInitialActions(historyActions); } @@ -425,7 +429,13 @@ void MainWindow::slotOpenLocation() void MainWindow::slotFileSaveAs() { KUrl srcUrl = currentTab()->url(); - // FIXME implement download file + + const QString destUrl = KFileDialog::getSaveFileName(srcUrl.fileName(), QString(), this); + if (destUrl.isEmpty()) return; + KIO::Job *job = KIO::file_copy(srcUrl, KUrl(destUrl), -1, KIO::Overwrite); + job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache. + job->addMetaData("cache", "cache"); // Use entry from cache if available. + job->uiDelegate()->setAutoErrorHandlingEnabled(true); } @@ -447,12 +457,6 @@ void MainWindow::slotPreferences() } -void MainWindow::slotUpdateStatusbar(const QString &string) -{ - statusBar()->showMessage(string, 2000); -} - - void MainWindow::slotUpdateActions() { m_historyBackAction->setEnabled(currentTab()->history()->canGoBack()); @@ -582,7 +586,7 @@ void MainWindow::slotFindNext() if (!currentTab()->findText(m_lastSearch, options)) { - slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); + notifyMessage(QString(m_lastSearch) + i18n(" not found.")); } } @@ -604,7 +608,7 @@ void MainWindow::slotFindPrevious() if (!currentTab()->findText(m_lastSearch, options)) { - slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); + notifyMessage(QString(m_lastSearch) + i18n(" not found.")); } } @@ -639,7 +643,6 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) static bool menubarFlag; static bool mainToolBarFlag; static bool bookmarksToolBarFlag; - static bool statusBarFlag; static bool sidePanelFlag; if (makeFullScreen == true) @@ -648,13 +651,11 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) menubarFlag = menuBar()->isHidden(); mainToolBarFlag = toolBar("mainToolBar")->isHidden(); bookmarksToolBarFlag = toolBar("bookmarksToolBar")->isHidden(); - statusBarFlag = statusBar()->isHidden(); sidePanelFlag = sidePanel()->isHidden(); menuBar()->hide(); toolBar("mainToolBar")->hide(); toolBar("bookmarksToolBar")->hide(); - statusBar()->hide(); sidePanel()->hide(); } else @@ -665,8 +666,6 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) toolBar("mainToolBar")->show(); if (!bookmarksToolBarFlag) toolBar("bookmarksToolBar")->show(); - if (!statusBarFlag) - statusBar()->show(); if (!sidePanelFlag) sidePanel()->show(); } @@ -766,44 +765,6 @@ void MainWindow::slotLoadProgress(int progress) } -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 - } - } -} - - void MainWindow::slotOpenPrevious() { QWebHistory *history = currentTab()->history(); @@ -888,3 +849,48 @@ QAction *MainWindow::actionByName(const QString name) return new QAction(this); // return empty object instead of NULL pointer } + + +// FIXME: better implement me, please!! +void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) +{ + // deleting popus if empty msgs + if(msg.isEmpty()) + { + delete m_popup; + return; + } + + if(m_popup) + delete m_popup; + + m_popup = new KPassivePopup(this); + m_popup->setAutoDelete(true); + + QPixmap px; + QString pixPath; + + switch(status) + { + case Rekonq::Info: + break; + case Rekonq::Success: + break; + case Rekonq::Error: + break; + case Rekonq::Download: + break; + default: + kDebug() << "nothing to be notified.."; + break; + } + + m_popup->setView(msg); + + // setting popus in bottom-left position + int x = geometry().x(); + int y = geometry().y() + height() - 45; + QPoint p(x,y); + + m_popup->show(p); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 411cbe6c..4e32e215 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -40,8 +40,8 @@ class QWebFrame; class KUrl; class KAction; class KActionMenu; -class KIcon; class KMenu; +class KPassivePopup; class HistoryMenu; class FindBar; @@ -49,6 +49,23 @@ class SidePanel; class WebView; +// namespace Rekonq +// { +// /** +// * @short notifying message status +// * Different message status +// */ +// +// enum Notify +// { +// Success, ///< url successfully (down)loaded +// Error, ///< url failed to (down)load +// Download, ///< downloading url +// Info ///< information, (default) +// }; +// } + + /** * This class serves as the main window for rekonq. * It handles the menus, toolbars, and status bars. @@ -79,6 +96,17 @@ public slots: void loadUrl(const KUrl &url); void slotUpdateBrowser(); + /** + * Notifies a message in a popup + * + * @param msg The message to notify + * + * @param status The status message + * + */ + void notifyMessage(const QString &msg, Rekonq::Notify status = Rekonq::Info); + + protected: bool queryClose(); @@ -86,15 +114,12 @@ private slots: void postLaunch(); void slotUpdateConfiguration(); void slotLoadProgress(int); - void slotUpdateStatusbar(const QString &string); void slotUpdateActions(); void slotUpdateWindowTitle(const QString &title = QString()); void slotOpenLocation(); - void slotAboutToShowBackMenu(); void geometryChangeRequested(const QRect &geometry); // history related - void slotOpenActionUrl(QAction *action); void slotOpenPrevious(); void slotOpenNext(); @@ -131,7 +156,6 @@ private: FindBar *m_findBar; SidePanel *m_sidePanel; - KMenu *m_historyBackMenu; KMenu *m_windowMenu; KActionMenu *m_historyActionMenu; @@ -143,6 +167,8 @@ private: QString m_lastSearch; QString m_homePage; + + QPointer<KPassivePopup> m_popup; }; #endif // MAINWINDOW_H diff --git a/src/modelmenu.cpp b/src/modelmenu.cpp index 9ff37037..41c197f3 100644 --- a/src/modelmenu.cpp +++ b/src/modelmenu.cpp @@ -145,19 +145,25 @@ void ModelMenu::aboutToShow() postPopulated(); } + +// WARNING +// the code commented out here is to create a second separator in the history menu +// with ALL history, subdivided by days. void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu) { + Q_UNUSED(parentMenu) + if (!menu) { - QString title = parent.data().toString(); - menu = new QMenu(title, this); - QIcon icon = qvariant_cast<QIcon>(parent.data(Qt::DecorationRole)); - menu->setIcon(icon); - parentMenu->addMenu(menu); - QVariant v; - v.setValue(parent); - menu->menuAction()->setData(v); - connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); +// QString title = parent.data().toString(); +// menu = new QMenu(title, this); +// QIcon icon = qvariant_cast<QIcon>(parent.data(Qt::DecorationRole)); +// menu->setIcon(icon); +// parentMenu->addMenu(menu); +// QVariant v; +// v.setValue(parent); +// menu->menuAction()->setData(v); +// connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); return; } @@ -171,18 +177,18 @@ void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu for (int i = 0; i < end; ++i) { QModelIndex idx = m_model->index(i, 0, parent); - if (m_model->hasChildren(idx)) - { - createMenu(idx, -1, menu); - } - else - { +// if (m_model->hasChildren(idx)) +// { +// createMenu(idx, -1, menu); +// } +// else +// { if (m_separatorRole != 0 && idx.data(m_separatorRole).toBool()) addSeparator(); else menu->addAction(makeAction(idx)); - } +// } if (menu == this && i == m_firstSeparator - 1) addSeparator(); } diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp index bbe89816..2cf65e1c 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -51,13 +51,9 @@ #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QSslError> -#if KDE_IS_VERSION(4,2,70) -NetworkAccessManager::NetworkAccessManager(QObject *parent) - : KIO::AccessManager(parent) -#else + NetworkAccessManager::NetworkAccessManager(QObject *parent) - : KNetworkAccessManager(parent) -#endif + : AccessManager(parent) { connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); @@ -101,7 +97,6 @@ void NetworkAccessManager::loadSettings() } - void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthenticator *auth) { MainWindow *mainWindow = Application::instance()->mainWindow(); diff --git a/src/networkmanager.h b/src/networkmanager.h index 681d296a..62c01e99 100644 --- a/src/networkmanager.h +++ b/src/networkmanager.h @@ -19,18 +19,17 @@ * ============================================================ */ -#ifndef NETWORKACCESSMANAGER_H -#define NETWORKACCESSMANAGER_H +#ifndef NETWORKMANAGER_H +#define NETWORKMANAGER_H // KDE Includes #include <KIO/AccessManager> // Forward Declarations -class QNetworkRequest; -class QIODevice; +using namespace KIO; -class NetworkAccessManager : public KIO::AccessManager +class NetworkAccessManager : public AccessManager { Q_OBJECT @@ -50,4 +49,4 @@ private slots: }; -#endif // NETWORKACCESSMANAGER_H +#endif // NETWORKMANAGER_H diff --git a/src/rekonqui.rc b/src/rekonqui.rc index aa372538..67b07c1c 100644 --- a/src/rekonqui.rc +++ b/src/rekonqui.rc @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE gui SYSTEM "kpartgui.dtd"> -<gui name="rekonq" version="40"> +<gui name="rekonq" version="41"> <MenuBar> @@ -36,7 +36,7 @@ <!-- ============ VIEW menu =========== --> <Menu name="view" noMerge="1"><text>&View</text> - <Action name="stop_reload" /> + <Action name="view_redisplay" /> <Action name="go_home" /> <Separator/> <Action name="bigger_font" /> @@ -67,12 +67,8 @@ <!-- ============ SETTINGS menu =========== --> <Menu name="settings" noMerge="1"><text>&Settings</text> <Action name="options_show_menubar" /> - <Action name="options_show_statusbar" /> <Merge name="StandardToolBarMenuHandler" /> <Merge/> - <Menu name="side_panels"><text>Side &Panels</text> - <Action name="show_history_panel" /> - </Menu> <Separator/> <Action name="fullscreen" /> <Separator/> @@ -88,11 +84,12 @@ <text>Main Toolbar</text> <Action name="history_back" /> <Action name="history_forward" /> + <Separator /> <Action name="stop_reload" /> <Action name="go_home" /> - <Action name="new_tab" /> <Action name="url_bar" /> - <Action name="search_bar" /> + <Action name="add_bookmark" /> + <Action name="options_configure" /> </ToolBar> <!-- ============ Bookmarks ToolBar =========== --> diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 96e3d19c..2680dfb7 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -70,25 +70,8 @@ TabBar::~TabBar() QSize TabBar::tabSizeHint(int index) const { QSize s = m_parent->sizeHint(); - int w; - int n = count(); - - if (n > 6) - { - w = s.width() / 5; - } - else - { - if (n > 3) - { - w = s.width() / 4; - } - else - { - w = s.width() / 3; - } - } + int w = s.width() / 4; int h = KTabBar::tabSizeHint(index).height(); QSize ts = QSize(w, h); diff --git a/src/webpage.cpp b/src/webpage.cpp index d26b54aa..8c6c0d2a 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -42,6 +42,10 @@ #include <KDebug> #include <KToolInvocation> +#include <KDE/KParts/BrowserRun> +#include <KDE/KMimeTypeTrader> +#include <KDE/KRun> + #include <kdewebkit/kwebpage.h> #include <kdewebkit/kwebview.h> @@ -123,16 +127,39 @@ KWebPage *WebPage::createWindow(QWebPage::WebWindowType type) // FIXME: implement here (perhaps) mimetype discerning && file loading (KToolInvocation??) -// void WebPage::slotHandleUnsupportedContent(QNetworkReply *reply) -// { -// -// if (reply->error() == QNetworkReply::NoError) -// { -// return slotDownloadRequested(reply->request(), reply); -// } -// -// viewErrorPage(reply); -// } +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) + { + case KParts::BrowserRun::Save: + slotDownloadRequested(reply->request(), reply); + return; + case KParts::BrowserRun::Cancel: + return; + default: // non existant case + break; + } + + KUrl::List list; + list.append(url); + KRun::run(*offer,url,0); + return; +} void WebPage::manageNetworkErrors(QNetworkReply* reply) diff --git a/src/webpage.h b/src/webpage.h index 0723cb6d..8fe9517d 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -3,9 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net> * Copyright (C) 2008-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 @@ -24,6 +22,7 @@ #ifndef WEBPAGE_H #define WEBPAGE_H + // KDE Includes #include <KUrl> @@ -34,19 +33,9 @@ #include <QWebPage> // Forward Declarations -class MainWindow; -class Application; - -class KActionCollection; - class QWebFrame; -class QAuthenticator; -class QMouseEvent; -class QNetworkProxy; class QNetworkReply; -class WebView; - class WebPage : public KWebPage { @@ -65,8 +54,9 @@ protected: KWebPage *createWindow(QWebPage::WebWindowType type); -// protected Q_SLOTS: -// virtual void slotHandleUnsupportedContent(QNetworkReply *reply); + +protected Q_SLOTS: + virtual void slotHandleUnsupportedContent(QNetworkReply *reply); private: void viewErrorPage(QNetworkReply *); diff --git a/src/webview.h b/src/webview.h index b5ffa887..389db154 100644 --- a/src/webview.h +++ b/src/webview.h @@ -35,16 +35,8 @@ #include <QWebView> // Forward Declarations -class MainWindow; -class Application; -class KActionCollection; -class QWebFrame; -class QAuthenticator; -class QMouseEvent; -class QNetworkProxy; -class QNetworkReply; class WebPage; |