summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/cookiejar.h1
-rw-r--r--src/history.cpp2
-rw-r--r--src/history.ui74
-rw-r--r--src/historydialog.cpp129
-rw-r--r--src/historydialog.h57
-rw-r--r--src/historymenu.cpp24
-rw-r--r--src/historymenu.h6
-rw-r--r--src/kaccessmanager.h2
-rw-r--r--src/main.cpp2
-rw-r--r--src/mainview.cpp91
-rw-r--r--src/mainview.h21
-rw-r--r--src/mainwindow.cpp54
-rw-r--r--src/mainwindow.h6
-rw-r--r--src/modelmenu.cpp6
-rw-r--r--src/networkmanager.cpp9
-rw-r--r--src/networkmanager.h11
-rw-r--r--src/rekonqui.rc10
-rw-r--r--src/tabbar.cpp19
-rw-r--r--src/webpage.cpp47
-rw-r--r--src/webpage.h12
-rw-r--r--src/webview.h8
22 files changed, 138 insertions, 456 deletions
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/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 9ed479a2..d67e65d0 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>&amp;Remove</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="removeAllButton">
- <property name="text">
- <string>Remove &amp;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..6a4e9a6f 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.5";
int main(int argc, char **argv)
diff --git a/src/mainview.cpp b/src/mainview.cpp
index d15444ab..636a4812 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)
{
@@ -387,6 +406,7 @@ WebView *MainView::newWebView(Rekonq::OpenType type)
emit tabsChanged();
showTabBar();
+ addTabButtonPosition();
return webView;
}
@@ -446,6 +466,7 @@ void MainView::slotCloseOtherTabs(int index)
}
showTabBar();
+ addTabButtonPosition();
}
@@ -460,6 +481,7 @@ void MainView::slotCloneTab(int index)
tab->setUrl(webView(index)->url());
showTabBar();
+ addTabButtonPosition();
}
@@ -488,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);
@@ -520,6 +528,7 @@ void MainView::slotCloseTab(int index)
}
showTabBar();
+ addTabButtonPosition();
}
@@ -636,28 +645,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::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..9ee2f12a 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;
@@ -133,8 +133,8 @@ public slots:
private slots:
void slotCurrentChanged(int index);
- void aboutToShowRecentTabsMenu();
- void aboutToShowRecentTriggeredAction(QAction *action); // need QAction!
+// void aboutToShow/*Rec*/entTabsMenu();
+// void aboutToShowRecentTriggeredAction(QAction *action); // need QAction!
void webViewLoadStarted();
void webViewLoadProgress(int progress);
@@ -163,6 +163,8 @@ protected:
private:
+ void addTabButtonPosition();
+
/**
* This function creates (if not exists) and returns a QLabel
* with a loading QMovie.
@@ -175,19 +177,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 b60e3469..4f9d0711 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -251,6 +251,7 @@ void MainWindow::setupActions()
// stop reload Action
m_stopReloadAction = new KAction(KIcon("view-refresh"), i18n("Reload"), this);
+ m_stopReloadAction->setShortcut(KShortcut(Qt::Key_F5));
actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction);
m_stopReloadAction->setShortcutConfigurable(false);
@@ -292,11 +293,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 +320,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 +338,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);
}
@@ -356,7 +359,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);
}
@@ -754,44 +756,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::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();
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 7fcc432c..aade6fd8 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -40,7 +40,6 @@ class QWebFrame;
class KUrl;
class KAction;
class KActionMenu;
-class KIcon;
class KMenu;
class HistoryMenu;
@@ -90,11 +89,11 @@ private slots:
void slotUpdateActions();
void slotUpdateWindowTitle(const QString &title = QString());
void slotOpenLocation();
- void slotAboutToShowBackMenu();
+// void slotAboutToShowBackMenu();
void geometryChangeRequested(const QRect &geometry);
// history related
- void slotOpenActionUrl(QAction *action);
+// void slotOpenActionUrl(QAction *action);
void slotOpenPrevious();
void slotOpenNext();
@@ -131,7 +130,6 @@ private:
FindBar *m_findBar;
SidePanel *m_sidePanel;
- KMenu *m_historyBackMenu;
KMenu *m_windowMenu;
KActionMenu *m_historyActionMenu;
diff --git a/src/modelmenu.cpp b/src/modelmenu.cpp
index 9ff37037..8f174797 100644
--- a/src/modelmenu.cpp
+++ b/src/modelmenu.cpp
@@ -171,18 +171,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))
+/* 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..2a366229 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>
@@ -70,9 +70,6 @@
<Action name="options_show_statusbar" />
<Merge name="StandardToolBarMenuHandler" />
<Merge/>
- <Menu name="side_panels"><text>Side &amp;Panels</text>
- <Action name="show_history_panel" />
- </Menu>
<Separator/>
<Action name="fullscreen" />
<Separator/>
@@ -88,11 +85,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..39511760 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..8ed53a2d 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -34,18 +34,11 @@
#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 +58,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;