summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormatgic78 <matgic78@gmail.com>2010-01-15 17:20:51 +0100
committermatgic78 <matgic78@gmail.com>2010-02-06 11:22:47 +0100
commit544094302a51b919b1eea86b313ec10d47533a08 (patch)
tree3532f1fb834ebc3ef9e46c6cc85edf92019c3a78 /src
parenttmp commit (diff)
downloadrekonq-544094302a51b919b1eea86b313ec10d47533a08.tar.xz
A new approach for choosing previews : a bar appears, then you browse to the page you want to preview, and then you click a button
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/mainwindow.cpp5
-rw-r--r--src/mainwindow.h8
-rw-r--r--src/protocolhandler.cpp33
-rw-r--r--src/rekonqpage/newtabpage.cpp36
-rw-r--r--src/rekonqpage/newtabpage.h11
-rw-r--r--src/rekonqpage/previewchooser.cpp157
-rw-r--r--src/rekonqpage/previewchooser.h70
-rw-r--r--src/rekonqpage/previewselectorbar.cpp138
-rw-r--r--src/rekonqpage/previewselectorbar.h60
-rw-r--r--src/webpage.cpp16
-rw-r--r--src/webpage.h2
-rw-r--r--src/websnap.cpp11
-rw-r--r--src/websnap.h7
14 files changed, 268 insertions, 288 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2ad18a02..00cfbf77 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -31,7 +31,7 @@ SET( rekonq_KDEINIT_SRCS
history/historypanel.cpp
#----------------------------------------
rekonqpage/newtabpage.cpp
- rekonqpage/previewchooser.cpp
+ rekonqpage/previewselectorbar.cpp
#----------------------------------------
settings/settingsdialog.cpp
#----------------------------------------
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index ffc9f508..e11f6d19 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -98,6 +98,7 @@ MainWindow::MainWindow()
: KMainWindow()
, m_view( new MainView(this) )
, m_findBar( new FindBar(this) )
+ , m_previewSelectorBar( new PreviewSelectorBar(this) )
, m_historyPanel(0)
, m_bookmarksPanel(0)
, m_webInspectorPanel(0)
@@ -122,6 +123,7 @@ MainWindow::MainWindow()
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(m_view);
+ layout->addWidget(m_previewSelectorBar);
layout->addWidget(m_findBar);
centralWidget->setLayout(layout);
@@ -617,6 +619,9 @@ void MainWindow::updateActions()
QAction *historyForwardAction = actionByName(KStandardAction::name(KStandardAction::Forward));
historyForwardAction->setEnabled(currentTab()->view()->history()->canGoForward());
+
+ if(m_previewSelectorBar->isVisible())
+ m_previewSelectorBar->setPage(currentTab()->page());
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 7083591d..3a828afe 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -1,4 +1,5 @@
-/* ============================================================
+
+class PreviewSelectorBar;/* ============================================================
*
* This file is a part of the rekonq project
*
@@ -32,6 +33,7 @@
// Local Includes
#include "application.h"
+#include "previewselectorbar.h"
// KDE Includes
#include <KMainWindow>
@@ -152,7 +154,9 @@ private slots:
private:
MainView *m_view;
FindBar *m_findBar;
-
+
+ PreviewSelectorBar *m_previewSelectorBar;
+
HistoryPanel *m_historyPanel;
BookmarksPanel *m_bookmarksPanel;
WebInspectorPanel *m_webInspectorPanel;
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index c90afd19..a9339cfa 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -108,36 +108,9 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
// "about" handling
if ( _url.protocol() == QLatin1String("about") )
{
- if( _url == KUrl("about:home") )
- {
- switch(ReKonfig::newTabStartPage())
- {
- case 0: // favorites
- _url = KUrl("about:favorites");
- break;
- case 1: // closed tabs
- _url = KUrl("about:closedTabs");
- break;
- case 2: // history
- _url = KUrl("about:history");
- break;
- case 3: // bookmarks
- _url = KUrl("about:bookmarks");
- break;
- default: // unuseful
- break;
- }
- }
- if( _url == KUrl("about:closedTabs")
- || _url == KUrl("about:history")
- || _url == KUrl("about:bookmarks")
- || _url == KUrl("about:favorites")
- )
- {
- NewTabPage p(frame);
- p.generate(_url);
- return true;
- }
+ NewTabPage p(frame);
+ p.generate(_url);
+ return true;
}
return false;
diff --git a/src/rekonqpage/newtabpage.cpp b/src/rekonqpage/newtabpage.cpp
index 78928bca..b075c186 100644
--- a/src/rekonqpage/newtabpage.cpp
+++ b/src/rekonqpage/newtabpage.cpp
@@ -36,7 +36,8 @@
#include "application.h"
#include "mainwindow.h"
#include "mainview.h"
-#include "previewchooser.h"
+#include "websnap.h"
+#include "previewselectorbar.h"
// KDE Includes
#include <KStandardDirs>
@@ -48,7 +49,6 @@
// Qt Includes
#include <QFile>
-#include <websnap.h>
NewTabPage::NewTabPage(QWebFrame *frame)
@@ -86,10 +86,8 @@ void NewTabPage::generate(KUrl url)
if(url.directory() == QString("preview/modify"))
{
int index = url.fileName().toInt();
- QString url = m_root.findFirst("#preview" + QVariant(index).toString() + " > a").attribute("href");
- PreviewChooser *pc = new PreviewChooser(index, url);
- connect(pc, SIGNAL(urlChoosed(int,KUrl)), SLOT(setPreview(int,KUrl)));
- pc->show();
+ Application::instance()->mainWindow()->findChild<PreviewSelectorBar *>()
+ ->enable(index, qobject_cast< WebPage* >(m_root.webFrame()->page()));
return;
}
}
@@ -260,9 +258,6 @@ void NewTabPage::snapFinished()
void NewTabPage::removePreview(int index)
{
- QWebElement prev = m_root.findFirst("#preview" + QVariant(index).toString());
-
-
QStringList names = ReKonfig::previewNames();
QStringList urls = ReKonfig::previewUrls();
@@ -272,9 +267,9 @@ void NewTabPage::removePreview(int index)
ReKonfig::setPreviewNames(names);
ReKonfig::setPreviewUrls(urls);
- // sync file data
ReKonfig::self()->writeConfig();
+ QWebElement prev = m_root.findFirst("#preview" + QVariant(index).toString());
prev.replace(emptyPreview(index));
}
@@ -285,18 +280,33 @@ void NewTabPage::setPreview(int index, KUrl url)
return;
QWebElement prev = m_root.findFirst("#preview" + QVariant(index).toString());
+ prev.replace(loadingPreview(index, url));
+
+}
+
+
+void NewTabPage::setPreview(int index, WebPage* page)
+{
+ KUrl url = page->mainFrame()->url();
+ WebSnap::savePreview(WebSnap::renderPreview(*page), url);
+
+ QStringList names = ReKonfig::previewNames();
QStringList urls = ReKonfig::previewUrls();
+
urls.replace(index, url.toMimeDataString());
+ names.replace(index, page->mainFrame()->title());
+
+ ReKonfig::setPreviewNames(names);
ReKonfig::setPreviewUrls(urls);
+
ReKonfig::self()->writeConfig();
-
- prev.replace(loadingPreview(index, url));
-
+ setPreview(index, url);
}
+
void NewTabPage::browsingMenu(const KUrl &currentUrl)
{
QList<QWebElement> navItems;
diff --git a/src/rekonqpage/newtabpage.h b/src/rekonqpage/newtabpage.h
index cdc3cb31..742d9209 100644
--- a/src/rekonqpage/newtabpage.h
+++ b/src/rekonqpage/newtabpage.h
@@ -55,10 +55,19 @@ public:
*/
void generate(KUrl url = KUrl("about:home"));
-protected slots:
+public slots:
void snapFinished();
void removePreview(int index);
+
+ /**
+ Used for recently closed tabs
+ */
void setPreview(int index, KUrl url);
+
+ /**
+ Used for favorites
+ */
+ void setPreview(int index, WebPage *page);
protected: // these are the function to build the new tab page
void browsingMenu(const KUrl &currentUrl);
diff --git a/src/rekonqpage/previewchooser.cpp b/src/rekonqpage/previewchooser.cpp
deleted file mode 100644
index 79bdb068..00000000
--- a/src/rekonqpage/previewchooser.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* 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 "previewchooser.h"
-
-// Local Includes
-#include "rekonq.h"
-#include <bookmarkstreemodel.h>
-#include <bookmarksproxy.h>
-#include <mainview.h>
-#include <webtab.h>
-
-// Qt Includes
-#include <QLabel>
-#include <QVBoxLayout>
-
-// KDE Includes
-#include <KLineEdit>
-#include <KLocalizedString>
-
-
-PreviewChooser::PreviewChooser(int previewIndex, QString url)
- : KDialog(0)
- , m_treeView(new QTreeView)
- , m_model(new QStandardItemModel)
- , m_previewIndex(previewIndex)
-{
- setMinimumSize(350, 100);
- setWindowTitle(i18n("Set Page to preview"));
- setModal(true);
-
- setButtons(KDialog::Cancel | KDialog::Apply | KDialog::Ok);
- //setDefaultButton(KDialog::Ok);
- connect(this, SIGNAL(buttonClicked(KDialog::ButtonCode)), this, SLOT(buttonClicked(KDialog::ButtonCode)));
-
- m_treeView->setUniformRowHeights(true);
- m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
- m_treeView->setTextElideMode(Qt::ElideRight);
- m_treeView->setHeaderHidden(true);
- m_treeView->setIndentation(0);
-
- QWidget *mainWidget = new QWidget(this);
-
- // add url bar
- QHBoxLayout *urlLayout = new QHBoxLayout;
- urlLayout->setContentsMargins(5, 0, 0, 0);
- QLabel *searchLabel = new QLabel(i18n("adress:"));
- urlLayout->addWidget(searchLabel);
- m_line = new KLineEdit;
-
- // setup view
- QVBoxLayout *vBoxLayout = new QVBoxLayout;
- vBoxLayout->setContentsMargins(0, 0, 0, 0);
- vBoxLayout->addLayout(urlLayout);
- vBoxLayout->addWidget(m_treeView);
- mainWidget->setLayout(vBoxLayout);
- setMainWidget(mainWidget);
-
- refreshModel();
- connect(Application::instance()->mainWindow()->mainView(), SIGNAL(tabsChanged()), SLOT(refreshModel()));
-
- m_treeView->setModel(m_model);
-
- connect(m_treeView, SIGNAL(activated(QModelIndex)), SLOT(setUrl(QModelIndex)));
-
- connect(m_line, SIGNAL(textChanged(QString)), SLOT(urlChanged()));
- urlLayout->addWidget(m_line);
-
- if(url.isEmpty() || url.startsWith("about:"))
- m_line->setText(QString("http://"));
- else
- {
- m_line->setText(url);
- m_line->setSelection(8, m_line->text().size());
- }
-
- enableButtonApply(false);
- setFocusProxy(mainWidget);
- mainWidget->setFocusProxy(m_line);
-}
-
-
-PreviewChooser::~PreviewChooser()
-{
- delete m_model;
-}
-
-
-
-void PreviewChooser::refreshModel()
-{
- m_model->clear();
- MainView *mv = Application::instance()->mainWindow()->mainView();
- for(int i=0; i < mv->count(); ++i)
- {
- WebView *view = qobject_cast<WebView *>(mv->webTab(i)->view());
-
- if(view->url().scheme() != "about")
- {
- QStandardItem *it = new QStandardItem(Application::icon(view->url()), view->title());
- it->setData(QVariant(view->url()), Qt::ToolTipRole);
- m_model->appendRow(it);
- }
- }
-}
-
-void PreviewChooser::setUrl(QModelIndex i)
-{
- if(!i.data().canConvert(QVariant::String))
- return;
-
- m_line->setText(i.data(Qt::ToolTipRole).toString());
-}
-
-
-void PreviewChooser::buttonClicked(KDialog::ButtonCode code)
-{
- if(code == KDialog::Apply || (code == KDialog::Ok && isButtonEnabled(KDialog::Apply)))
- {
- emit urlChoosed(m_previewIndex, KUrl(m_line->text()));
- enableButtonApply(false);
- }
-
- if(code == KDialog::Cancel || code == KDialog::Ok)
- {
- close();
- deleteLater();
- }
-}
-
-
-void PreviewChooser::urlChanged()
-{
- enableButtonApply(true);
-}
-
diff --git a/src/rekonqpage/previewchooser.h b/src/rekonqpage/previewchooser.h
deleted file mode 100644
index 3eae71db..00000000
--- a/src/rekonqpage/previewchooser.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* 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 PREVIEWCHOOSER_H
-#define PREVIEWCHOOSER_H
-
-
-// Local Includes
-#include "application.h"
-
-// KDE Includes
-#include <KLineEdit>
-#include <KDialog>
-
-// Qt Includes
-#include <QWidget>
-#include <QTreeView>
-#include <QStandardItemModel>
-
-// Forward Declarations
-class KUrl;
-
-
-class PreviewChooser : public KDialog
-{
-Q_OBJECT
-
-public:
- explicit PreviewChooser(int previewIndex, QString url);
- virtual ~PreviewChooser();
-
-signals:
- void urlChoosed(int, const KUrl &);
-
-public slots:
- void refreshModel();
- void setUrl(QModelIndex i);
- void buttonClicked(KDialog::ButtonCode code);
- void urlChanged();
-
-private:
- QTreeView *m_treeView;
- QStandardItemModel *m_model;
-
- KLineEdit *m_line;
-
- int m_previewIndex;
-};
-
-#endif // PREVIEWCHOOSER_H
diff --git a/src/rekonqpage/previewselectorbar.cpp b/src/rekonqpage/previewselectorbar.cpp
new file mode 100644
index 00000000..04e7f0ac
--- /dev/null
+++ b/src/rekonqpage/previewselectorbar.cpp
@@ -0,0 +1,138 @@
+/*
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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 of the License, 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+// Auto Includes
+#include "previewselectorbar.h"
+
+// KDE Includes
+#include <KIcon>
+#include <KLocalizedString>
+
+// Qt Includes
+#include <QToolButton>
+#include <QHBoxLayout>
+#include <QString>
+
+
+PreviewSelectorBar::PreviewSelectorBar(QWidget* parent)
+ : QWidget(parent)
+ , m_button(0)
+ , m_label(0)
+ , m_page(0)
+{
+ hide();
+}
+
+
+void PreviewSelectorBar::setup()
+{
+ if(m_button != 0)
+ return;
+
+ m_label = new QLabel(i18n("Please go to the page you want to preview"), this);
+ m_label->setWordWrap(true);
+
+ QToolButton *closeButton = new QToolButton(this);
+ closeButton->setAutoRaise(true);
+ closeButton->setIcon(KIcon("dialog-close"));
+ connect(closeButton, SIGNAL(clicked(bool)), SLOT(hide()));
+
+ m_button = new QPushButton(KIcon("insert-image"), i18n("Set to this page"), this);
+ connect(m_button, SIGNAL(clicked(bool)), SLOT(clicked()));
+
+ // layout
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ layout->addWidget(closeButton);
+ layout->addStretch();
+ layout->addWidget(m_label);
+ layout->addWidget(m_button);
+
+ setLayout(layout);
+}
+
+
+void PreviewSelectorBar::setPage(WebPage* page)
+{
+ m_page = page;
+ verifyUrl();
+}
+
+
+void PreviewSelectorBar::verifyUrl()
+{
+ if(m_page->mainFrame()->url().scheme() != "about")
+ {
+ m_button->setEnabled(true);
+ m_button->setToolTip("");
+ }
+ else
+ {
+ m_button->setEnabled(false);
+ m_button->setToolTip(i18n("You can't set this page as preview"));
+ }
+}
+
+
+void PreviewSelectorBar::enable(int previewIndex, WebPage* page)
+{
+ if(m_page != 0)
+ disconnect(m_page, 0, this, 0);
+
+
+ setup();
+ m_previewIndex = previewIndex;
+ m_page = page;
+
+ verifyUrl();
+
+ show();
+
+ connect(page, SIGNAL(loadStarted()), SLOT(loadProgress()));
+ connect(page, SIGNAL(loadProgress(int)), SLOT(loadProgress()));
+ connect(page, SIGNAL(loadFinished(bool)), SLOT(loadFinished()));
+ connect(page->mainFrame(), SIGNAL(urlChanged(QUrl)), SLOT(verifyUrl()));
+}
+
+
+void PreviewSelectorBar::loadProgress()
+{
+ m_button->setEnabled(false);
+ m_button->setToolTip(i18n("Page is loading..."));
+}
+
+
+
+void PreviewSelectorBar::loadFinished()
+{
+ m_button->setEnabled(true);
+ m_button->setToolTip("");
+
+ verifyUrl();
+}
+
+
+void PreviewSelectorBar::clicked()
+{
+ m_page->newTabPage()->setPreview(m_previewIndex, m_page);
+ m_page->mainFrame()->load(KUrl("about:favorites"));
+ hide();
+}
+
+
diff --git a/src/rekonqpage/previewselectorbar.h b/src/rekonqpage/previewselectorbar.h
new file mode 100644
index 00000000..aa011fe4
--- /dev/null
+++ b/src/rekonqpage/previewselectorbar.h
@@ -0,0 +1,60 @@
+/*
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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 of the License, 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.
+
+ 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 PREVIEWSELECTORBAR_H
+#define PREVIEWSELECTORBAR_H
+
+// Local Includes
+#include "webpage.h"
+
+// Qt Includes
+#include <QWidget>
+#include <QPushButton>
+#include <QLabel>
+
+class PreviewSelectorBar : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ PreviewSelectorBar(QWidget *parent = 0);
+
+ void setPage(WebPage *page);
+
+ public slots:
+ void enable(int previewIndex, WebPage *page);
+ void clicked();
+
+ void loadProgress();
+ void loadFinished();
+
+ void verifyUrl();
+
+ private:
+ void setup();
+
+ QPushButton *m_button;
+ QLabel *m_label;
+
+ int m_previewIndex;
+ WebPage *m_page;
+
+};
+
+#endif // PREVIEWSELECTORBAR_H
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 59df13e7..340e9805 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -72,7 +72,7 @@
WebPage::WebPage(QObject *parent)
: KWebPage(parent, KWalletIntegration)
- , m_newTabPage(0)
+ , m_newTabPage(new NewTabPage(mainFrame() ))
{
setForwardUnsupportedContent(true);
@@ -104,6 +104,12 @@ WebPage::~WebPage()
}
+NewTabPage* WebPage::newTabPage()
+{
+ return m_newTabPage;
+}
+
+
bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
{
// advise users on resubmitting data
@@ -115,14 +121,6 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
if(risp == KMessageBox::Cancel)
return false;
}
-
- if (request.url().scheme() == QLatin1String("about"))
- {
- if(m_newTabPage == 0)
- m_newTabPage = new NewTabPage(frame);
- m_newTabPage->generate(request.url());
- return false;
- }
if (frame && m_protHandler.preHandling( request, frame ))
{
diff --git a/src/webpage.h b/src/webpage.h
index 5671b5d9..da91ea5c 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -55,6 +55,8 @@ class WebPage : public KWebPage
public:
explicit WebPage(QObject *parent = 0);
~WebPage();
+
+ NewTabPage *newTabPage();
public slots:
void manageNetworkErrors(QNetworkReply *reply);
diff --git a/src/websnap.cpp b/src/websnap.cpp
index 0d72ef3a..ff4746ca 100644
--- a/src/websnap.cpp
+++ b/src/websnap.cpp
@@ -42,10 +42,6 @@
#include <QFile>
-#define WIDTH 200
-#define HEIGHT 150
-
-
WebSnap::WebSnap(const QUrl &url)
: QObject()
{
@@ -115,6 +111,13 @@ QPixmap WebSnap::renderPreview(const QWebPage &page,int w, int h)
}
+void WebSnap::savePreview(QPixmap pm, KUrl url)
+{
+ QFile::remove(fileForUrl(url).toLocalFile());
+ pm.save(fileForUrl(url).toLocalFile());
+}
+
+
KUrl WebSnap::fileForUrl(KUrl url)
{
QString filePath =
diff --git a/src/websnap.h b/src/websnap.h
index 04fded57..b8ada30f 100644
--- a/src/websnap.h
+++ b/src/websnap.h
@@ -37,6 +37,9 @@
#include <QImage>
#include <QWebPage>
+#define WIDTH 200
+#define HEIGHT 150
+
/**
* This class renders a site producing an image based
@@ -53,12 +56,14 @@ public:
QPixmap previewImage(); // TODO : remove
- static QPixmap renderPreview(const QWebPage &page, int w, int h);
+ static QPixmap renderPreview(const QWebPage &page, int w = WIDTH, int h = HEIGHT);
static KUrl fileForUrl(KUrl url);
static QString guessNameFromUrl(QUrl url);
+ static void savePreview(QPixmap pm, KUrl url);
+
QString snapTitle();
QUrl snapUrl();