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 449 Lines • ▼ Show 20 Line(s) | 484 | if (saveUrl.isValid()) { | |||
491 | } | 493 | } | ||
492 | } | 494 | } | ||
493 | } | 495 | } | ||
494 | return false; | 496 | return false; | ||
495 | } | 497 | } | ||
496 | 498 | | |||
497 | // misc helpers | 499 | // misc helpers | ||
498 | 500 | | |||
499 | void ExportManager::doCopyToClipboard() | 501 | void ExportManager::doCopyToClipboard(bool notify) | ||
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… | |||||
500 | { | 502 | { | ||
501 | QApplication::clipboard()->setPixmap(mSavePixmap, QClipboard::Clipboard); | 503 | auto data = new QMimeData(); | ||
504 | data->setImageData(mSavePixmap.toImage()); | ||||
505 | data->setData(QStringLiteral("x-kde-force-image-copy"), QByteArray()); | ||||
506 | QApplication::clipboard()->setMimeData(data, QClipboard::Clipboard); | ||||
507 | | ||||
508 | if (notify) { | ||||
509 | emit forceNotify(QUrl()); | ||||
510 | } | ||||
502 | } | 511 | } | ||
503 | 512 | | |||
504 | void ExportManager::doPrint(QPrinter *printer) | 513 | void ExportManager::doPrint(QPrinter *printer) | ||
505 | { | 514 | { | ||
506 | QPainter painter; | 515 | QPainter painter; | ||
507 | 516 | | |||
508 | if (!(painter.begin(printer))) { | 517 | if (!(painter.begin(printer))) { | ||
509 | emit errorMessage(i18n("Printing failed. The printer failed to initialize.")); | 518 | 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.