Commit 5206a9b2 authored by Volker Krause's avatar Volker Krause

Port event printing away from KDELibs4Support.

parent d5dc5b09
......@@ -28,9 +28,7 @@
//#include <calendarviews/prefs.h>
#include <KDEPrintDialog>
#include <KMessageBox>
#include <KPrintPreview>
#include <KStandardGuiItem>
#include <QVBoxLayout>
......@@ -38,6 +36,7 @@
#include <QGridLayout>
#include <QGroupBox>
#include <QPrintDialog>
#include <QPrintPreviewDialog>
#include <QSplitter>
#include <QStackedWidget>
#include <KConfigGroup>
......@@ -155,12 +154,14 @@ void CalPrinter::doPrint(PrintPlugin *selectedStyle,
}
if (preview) {
QPointer<KPrintPreview> printPreview = new KPrintPreview(&printer);
selectedStyle->doPrint(&printer);
QPointer<QPrintPreviewDialog> printPreview = new QPrintPreviewDialog(&printer);
connect(printPreview.data(), &QPrintPreviewDialog::paintRequested, this, [selectedStyle, &printer]() {
selectedStyle->doPrint(&printer);
});
printPreview->exec();
delete printPreview;
} else {
QPointer<QPrintDialog> printDialog = KdePrint::createPrintDialog(&printer, mParent);
QPointer<QPrintDialog> printDialog = new QPrintDialog(&printer, mParent);
if (printDialog->exec() == QDialog::Accepted) {
selectedStyle->doPrint(&printer);
}
......
......@@ -268,15 +268,10 @@ void ActionManager::initActions()
mACollection->addAction(QStringLiteral("korganizer_print"), a);
a = mACollection->addAction(KStandardAction::PrintPreview, mCalendarView, SLOT(print()));
mACollection->addAction(QStringLiteral("korganizer_print_preview"), a);
a->setEnabled(
!KMimeTypeTrader::self()->query(QStringLiteral("application/pdf"), QStringLiteral("KParts/ReadOnlyPart")).isEmpty());
} else {
KStandardAction::open(this, SLOT(file_open()), mACollection);
KStandardAction::print(mCalendarView, SLOT(print()), mACollection);
QAction *preview =
KStandardAction::printPreview(mCalendarView, SLOT(printPreview()), mACollection);
preview->setEnabled(
!KMimeTypeTrader::self()->query(QStringLiteral("application/pdf"), QStringLiteral("KParts/ReadOnlyPart")).isEmpty());
KStandardAction::printPreview(mCalendarView, SLOT(printPreview()), mACollection);
}
//~~~~~~~~~~~~~~~~~~~~~~~~ IMPORT / EXPORT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment