summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainwindow.cpp59
-rw-r--r--src/mainwindow.h20
-rw-r--r--src/webview.cpp22
-rw-r--r--src/webview.h2
4 files changed, 68 insertions, 35 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index a21657a7..40ecfb81 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -246,7 +246,7 @@ void MainWindow::setupActions()
// Standard Actions
KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection());
KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection());
- KStandardAction::print(this, SLOT(slotFilePrintPreview()), actionCollection());
+ KStandardAction::print(this, SLOT(printRequested()), actionCollection());
KStandardAction::quit(this , SLOT(close()), actionCollection());
KStandardAction::find(m_findBar, SLOT(show()) , actionCollection());
KStandardAction::findNext(this, SLOT(slotFindNext()) , actionCollection());
@@ -376,6 +376,11 @@ void MainWindow::setupTools()
toolsMenu->addAction(fontMenu);
toolsMenu->addSeparator();
+
+ toolsMenu->addAction(actionByName(QLatin1String("private_browsing")));
+ toolsMenu->addAction(actionByName(QLatin1String("clear_private_data")));
+
+ toolsMenu->addSeparator();
KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Web Development"), this);
webMenu->addAction(actionByName(QLatin1String("web_inspector")));
@@ -383,12 +388,7 @@ void MainWindow::setupTools()
toolsMenu->addAction(webMenu);
toolsMenu->addSeparator();
-
- toolsMenu->addAction(actionByName(QLatin1String("private_browsing")));
- toolsMenu->addAction(actionByName(QLatin1String("clear_private_data")));
-
- toolsMenu->addSeparator();
-
+
toolsMenu->addAction(actionByName(QLatin1String("bm_bar")));
toolsMenu->addAction(actionByName(QLatin1String("show_history_panel")));
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::FullScreen)));
@@ -561,29 +561,40 @@ void MainWindow::slotFileOpen()
}
-void MainWindow::slotFilePrintPreview()
-{
- if (!currentTab())
- return;
-
- QPrinter printer;
- QPrintPreviewDialog previewdlg(&printer, this);
- connect(&previewdlg, SIGNAL(paintRequested(QPrinter *)),
- currentTab(), SLOT(print(QPrinter *)));
- previewdlg.exec();
-}
+// void MainWindow::slotFilePrintPreview()
+// {
+// if (!currentTab())
+// return;
+//
+// QPrinter printer;
+// QPrintPreviewDialog previewdlg(&printer, this);
+// connect(&previewdlg, SIGNAL(paintRequested(QPrinter *)),
+// currentTab(), SLOT(print(QPrinter *)));
+// previewdlg.exec();
+// }
void MainWindow::printRequested(QWebFrame *frame)
{
- QPrinter printer;
+ if (!currentTab())
+ return;
- QPointer<QPrintDialog> dialog = KdePrint::createPrintDialog(&printer, this);
- if (dialog->exec() == KDialog::Ok)
+ QWebFrame *printFrame = 0;
+ if(frame == 0)
+ {
+ printFrame = currentTab()->page()->mainFrame();
+ }
+ else
{
- frame->print(&printer);
+ printFrame = frame;
}
- delete dialog;
+
+ QPrinter printer;
+ QPrintPreviewDialog previewdlg(&printer, this);
+
+ connect(&previewdlg, SIGNAL(paintRequested(QPrinter *)), printFrame, SLOT(print(QPrinter *)));
+
+ previewdlg.exec();
}
@@ -1011,8 +1022,6 @@ void MainWindow::clearPrivateData()
QWebSettings::clearIconDatabase();
}
}
- // this let crash rekonq.
-// delete dialog;
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index be51bdd2..d248b067 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -93,7 +93,8 @@ public slots:
*/
void notifyMessage(const QString &msg, Rekonq::Notify status = Rekonq::Info);
-
+ void printRequested(QWebFrame *frame = 0);
+
protected:
bool queryClose();
void keyPressEvent(QKeyEvent *event);
@@ -111,21 +112,22 @@ private slots:
void slotOpenPrevious();
void slotOpenNext();
- // File Menu slots
- void slotFileOpen();
- void slotFilePrintPreview();
- void slotFileSaveAs();
- void printRequested(QWebFrame *frame);
-
- // Edit Menu slots
+ // Find Action slots
void slotFind(const QString &);
void slotFindNext();
void slotFindPrevious();
- // View Menu slots
+ // Zoom slots
void slotViewTextBigger();
void slotViewTextNormal();
void slotViewTextSmaller();
+
+
+ // File Menu slots
+ void slotFileOpen();
+// void slotFilePrintPreview();
+ void slotFileSaveAs();
+
void slotViewPageSource();
void slotViewFullScreen(bool enable);
diff --git a/src/webview.cpp b/src/webview.cpp
index 6b4d5ad7..6cf6afbf 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -117,7 +117,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
a->setText(i18n("Open Link in New &Tab"));
a->setIcon(KIcon("window-new"));
menu.addAction(a);
-
+
a = pageAction(QWebPage::DownloadLinkToDisk);
a->setIcon(KIcon("document-save"));
menu.addAction(a);
@@ -243,6 +243,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
{
//page actions
menu.addAction(mainwindow->actionByName("new_tab"));
+
if(mainwindow->isFullScreen())
{
menu.addAction(mainwindow->actionByName("fullscreen"));
@@ -254,8 +255,21 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(mainwindow->actionByName("history_forward"));
menu.addAction(mainwindow->actionByName("view_redisplay"));
+ KActionMenu *frameMenu = new KActionMenu(i18n("Frame"), this);
+
+ a = pageAction(QWebPage::OpenFrameInNewWindow);
+ a->setText(i18n("Open in new tab"));
+ a->setIcon(KIcon("view-right-new"));
+ frameMenu->addAction(a);
+
+ a = new KAction( KIcon("document-print-frame"), i18n("Print frame"), this);
+ connect(a, SIGNAL(triggered()), this, SLOT(printFrame()));
+ frameMenu->addAction(a);
+ menu.addAction(frameMenu);
+
menu.addSeparator();
+ menu.addAction(mainwindow->actionByName("page_source"));
QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark");
menu.addAction(addBookmarkAction);
@@ -342,3 +356,9 @@ void WebView::slotLoadFinished(bool)
{
m_progress=0;
}
+
+
+void WebView::printFrame()
+{
+ Application::instance()->mainWindow()->printRequested(page()->currentFrame());
+}
diff --git a/src/webview.h b/src/webview.h
index 4f283aae..259c1d83 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -72,6 +72,8 @@ private slots:
void slotUpdateProgress(int progress);
void slotLoadFinished(bool);
+ void printFrame();
+
private:
WebPage *m_page;
int m_progress;