Changeset View
Changeset View
Standalone View
Standalone View
src/ExportManager.cpp
Show All 25 Lines | |||||
26 | #include <QTemporaryFile> | 26 | #include <QTemporaryFile> | ||
27 | #include <QApplication> | 27 | #include <QApplication> | ||
28 | #include <QClipboard> | 28 | #include <QClipboard> | ||
29 | #include <QPainter> | 29 | #include <QPainter> | ||
30 | #include <QFileDialog> | 30 | #include <QFileDialog> | ||
31 | #include <QBuffer> | 31 | #include <QBuffer> | ||
32 | #include <QRegularExpression> | 32 | #include <QRegularExpression> | ||
33 | #include <QRegularExpressionMatch> | 33 | #include <QRegularExpressionMatch> | ||
34 | #include <QMimeData> | ||||
35 | #include <QString> | ||||
34 | 36 | | |||
35 | #include <KSharedConfig> | 37 | #include <KSharedConfig> | ||
36 | #include <KConfigGroup> | 38 | #include <KConfigGroup> | ||
37 | #include <KIO/ListJob> | 39 | #include <KIO/ListJob> | ||
38 | #include <KIO/MkpathJob> | 40 | #include <KIO/MkpathJob> | ||
39 | #include <KIO/FileCopyJob> | 41 | #include <KIO/FileCopyJob> | ||
40 | #include <KIO/StatJob> | 42 | #include <KIO/StatJob> | ||
41 | 43 | | |||
▲ Show 20 Lines • Show All 444 Lines • ▼ Show 20 Line(s) | 479 | if (saveUrl.isValid()) { | |||
486 | } | 488 | } | ||
487 | } | 489 | } | ||
488 | } | 490 | } | ||
489 | return false; | 491 | return false; | ||
490 | } | 492 | } | ||
491 | 493 | | |||
492 | // misc helpers | 494 | // misc helpers | ||
493 | 495 | | |||
494 | void ExportManager::doCopyToClipboard() | 496 | void ExportManager::doCopyToClipboard(bool notify) | ||
495 | { | 497 | { | ||
496 | QApplication::clipboard()->setPixmap(mSavePixmap, QClipboard::Clipboard); | 498 | auto data = new QMimeData(); | ||
499 | data->setImageData(mSavePixmap.toImage()); | ||||
500 | data->setData(QStringLiteral("x-kde-force-image-copy"), QByteArray()); | ||||
501 | QApplication::clipboard()->setMimeData(data, QClipboard::Clipboard); | ||||
ngraham: In general we prefer to use enums rather than straight bool arguments. | |||||
I used bool because notify was already defined as bool and refactoring as enum would take some more work that's unrelated to this revision. kdautovic: I used bool because notify was already defined as bool and refactoring as enum would take some… | |||||
502 | | ||||
503 | if (notify) { | ||||
504 | emit forceNotify(QUrl()); | ||||
505 | } | ||||
497 | } | 506 | } | ||
498 | 507 | | |||
499 | void ExportManager::doPrint(QPrinter *printer) | 508 | void ExportManager::doPrint(QPrinter *printer) | ||
500 | { | 509 | { | ||
501 | QPainter painter; | 510 | QPainter painter; | ||
502 | 511 | | |||
503 | if (!(painter.begin(printer))) { | 512 | if (!(painter.begin(printer))) { | ||
504 | emit errorMessage(i18n("Printing failed. The printer failed to initialize.")); | 513 | emit errorMessage(i18n("Printing failed. The printer failed to initialize.")); | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |
In general we prefer to use enums rather than straight bool arguments.