40
40
struct DocumentJobPrivate {
45
44
DocumentJob::DocumentJob()
47
, d(new DocumentJobPrivate) {
48
KDialogJobUiDelegate* delegate = new KDialogJobUiDelegate;
49
delegate->setWindow(KApplication::kApplication()->activeWindow());
50
delegate->setAutoErrorHandlingEnabled(true);
51
setUiDelegate(delegate);
55
DocumentJob::~DocumentJob() {
60
Document::Ptr DocumentJob::document() const {
65
void DocumentJob::setDocument(const Document::Ptr& doc) {
70
void DocumentJob::start() {
71
QMetaObject::invokeMethod(this, "doStart", Qt::QueuedConnection);
75
bool DocumentJob::checkDocumentEditor() {
76
if (!document()->editor()) {
77
setError(NoDocumentEditorError);
78
setErrorText(i18nc("@info", "Gwenview cannot edit this kind of image."));
85
void ThreadedDocumentJob::doStart() {
86
QFuture<void> future = QtConcurrent::run(this, &ThreadedDocumentJob::threadedStart);
87
QFutureWatcher<void>* watcher = new QFutureWatcher<void>(this);
88
watcher->setFuture(future);
89
connect(watcher, SIGNAL(finished()), SLOT(emitResult()));
46
, d(new DocumentJobPrivate)
48
KDialogJobUiDelegate* delegate = new KDialogJobUiDelegate;
49
delegate->setWindow(KApplication::kApplication()->activeWindow());
50
delegate->setAutoErrorHandlingEnabled(true);
51
setUiDelegate(delegate);
54
DocumentJob::~DocumentJob()
59
Document::Ptr DocumentJob::document() const
64
void DocumentJob::setDocument(const Document::Ptr& doc)
69
void DocumentJob::start()
71
QMetaObject::invokeMethod(this, "doStart", Qt::QueuedConnection);
74
bool DocumentJob::checkDocumentEditor()
76
if (!document()->editor()) {
77
setError(NoDocumentEditorError);
78
setErrorText(i18nc("@info", "Gwenview cannot edit this kind of image."));
84
void ThreadedDocumentJob::doStart()
86
QFuture<void> future = QtConcurrent::run(this, &ThreadedDocumentJob::threadedStart);
87
QFutureWatcher<void>* watcher = new QFutureWatcher<void>(this);
88
watcher->setFuture(future);
89
connect(watcher, SIGNAL(finished()), SLOT(emitResult()));