From bba7ddd2e05a548219dda89cdb5182f220f122d7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 7 Aug 2012 15:05:40 +0200 Subject: Add actions to the web window, STEP 1 (the easiest ones...) --- src/webwindow/webwindow.cpp | 58 +++++++++++++++++++++++++++++++++++++++------ src/webwindow/webwindow.h | 3 +++ 2 files changed, 54 insertions(+), 7 deletions(-) (limited to 'src/webwindow') diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index 8d6ca22c..dc023ff6 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include #include #include @@ -175,7 +177,7 @@ void WebWindow::setupActions() // Standard Actions KStandardAction::open(this, SLOT(fileOpen()), actionCollection()); KStandardAction::saveAs(this, SLOT(fileSaveAs()), actionCollection()); - KStandardAction::print(this, SLOT(printRequested()), actionCollection()); + KStandardAction::print(_tab, SLOT(printFrame()), actionCollection()); KStandardAction::quit(rApp, SLOT(queryQuit()), actionCollection()); a = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, actionCollection()); @@ -218,10 +220,15 @@ void WebWindow::setupActions() a = new KAction(KIcon("edit-clear"), i18n("Clear Private Data..."), this); a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Delete); actionCollection()->addAction(QL1S("clear_private_data"), a); - connect(a, SIGNAL(triggered(bool)), this, SLOT(clearPrivateData())); + connect(a, SIGNAL(triggered(bool)), rApp, SLOT(clearPrivateData())); + + // Bookmark ========== + a = KStandardAction::addBookmark(_bar, SLOT(manageBookmarks()), actionCollection()); + KShortcut bkShortcut(Qt::CTRL + Qt::Key_D); + a->setShortcut(bkShortcut); // -// +// --- // + // + // @@ -236,11 +243,11 @@ void WebWindow::setupActions() // &Tools // + // -// -// +// ------- +// --------- // + -// -// + +// xxxxxxxxxxx +// ------- // // // @@ -693,3 +700,40 @@ void WebWindow::openLocation() _bar->selectAll(); _bar->setFocus(); } + + +void WebWindow::viewPageSource() +{ + QString code = _tab->page()->mainFrame()->toHtml(); + + KTemporaryFile tmpFile; + tmpFile.setAutoRemove(false); + if (!tmpFile.open()) + return; + + QTextStream out(&tmpFile); + out << code; + tmpFile.close(); + KUrl tmpUrl(tmpFile.fileName()); + + KParts::ReadOnlyPart *pa = KMimeTypeTrader::createPartInstanceFromQuery(QL1S("text/plain"), _tab, this, QString()); + if (pa) + { + // FIXME DO SOMETHING... +// WebTab *srcTab = m_view->newWebTab(true); +// srcTab->page()->setIsOnRekonqPage(true); +// srcTab->setPart(pa, tmpUrl); +// srcTab->urlBar()->setQUrl(url.pathOrUrl()); +// m_view->setTabText(m_view->currentIndex(), i18n("Source of: ") + url.prettyUrl()); +// updateHistoryActions(); + } + else + KRun::runUrl(tmpUrl, QL1S("text/plain"), this, false); +} + + +void WebWindow::viewFullScreen(bool makeFullScreen) +{ +// FIXME setWidgetsVisible(!makeFullScreen); + KToggleFullScreenAction::setFullScreen(this, makeFullScreen); +} diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h index b618ab42..cd7235b3 100644 --- a/src/webwindow/webwindow.h +++ b/src/webwindow/webwindow.h @@ -108,6 +108,9 @@ private Q_SLOTS: void fileOpen(); void fileSaveAs(); + void viewPageSource(); + void viewFullScreen(bool enable); + Q_SIGNALS: void titleChanged(QString); -- cgit v1.2.1