diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-08-30 19:02:15 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-08-30 19:02:15 +0200 |
commit | b1dfaeca4986086c78e33b54fc6814bca412eaae (patch) | |
tree | b1a9a69f9404e763be5d2920d806543142ec5f34 /src/mainwindow.cpp | |
parent | rekonq 0.2.53 with bookmarks bar fixed (and ALL the bars, too!!) (diff) | |
download | rekonq-b1dfaeca4986086c78e33b54fc6814bca412eaae.tar.xz |
- A better print slot
- contextual frame actions (just 2, for now)
- works on contextual menu
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 59 |
1 files changed, 34 insertions, 25 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; } |