47
47
* You can of course use threading inside your task implementation to speed it
50
class GWENVIEWLIB_EXPORT DocumentJob : public KCompositeJob {
50
class GWENVIEWLIB_EXPORT DocumentJob : public KCompositeJob
54
NoDocumentEditorError = UserDefinedError + 1
59
Document::Ptr document() const;
55
NoDocumentEditorError = UserDefinedError + 1
60
Document::Ptr document() const;
65
* Implement this method to provide the task behavior.
66
* You *must* emit the done() signal when your work is finished, but it
67
* does not have to be finished when run() returns.
68
* If you are not emitting it from the GUI thread, then use a queued
69
* connection to emit it.
71
virtual void doStart() = 0;
66
* Implement this method to provide the task behavior.
67
* You *must* emit the done() signal when your work is finished, but it
68
* does not have to be finished when run() returns.
69
* If you are not emitting it from the GUI thread, then use a queued
70
* connection to emit it.
72
virtual void doStart() = 0;
74
* slot-ification of emitResult()
75
* slot-ification of emitResult()
82
* Convenience method which checks document()->editor() is valid
83
* and set the job error properties if it's not.
84
* @return true if the editor is valid.
86
bool checkDocumentEditor();
83
* Convenience method which checks document()->editor() is valid
84
* and set the job error properties if it's not.
85
* @return true if the editor is valid.
87
bool checkDocumentEditor();
89
void setDocument(const Document::Ptr&);
91
DocumentJobPrivate* const d;
93
friend class Document;
90
void setDocument(const Document::Ptr&);
92
DocumentJobPrivate* const d;
94
friend class Document;
98
98
* A document job whose action is started in a separate thread
100
class ThreadedDocumentJob : public DocumentJob {
100
class ThreadedDocumentJob : public DocumentJob
103
* Must be reimplemented to apply the action to the document.
104
* This method is never called from the GUI thread.
106
virtual void threadedStart() = 0;
104
* Must be reimplemented to apply the action to the document.
105
* This method is never called from the GUI thread.
107
virtual void threadedStart() = 0;
109
virtual void doStart();
110
virtual void doStart();
116
115
#endif /* DOCUMENTJOB_H */