Changeset View
Changeset View
Standalone View
Standalone View
components/Document.cpp
Show All 37 Lines | |||||
38 | #include "impl/SpreadsheetImpl.h" | 38 | #include "impl/SpreadsheetImpl.h" | ||
39 | #include "impl/PresentationImpl.h" | 39 | #include "impl/PresentationImpl.h" | ||
40 | 40 | | |||
41 | using namespace Calligra::Components; | 41 | using namespace Calligra::Components; | ||
42 | 42 | | |||
43 | class Document::Private | 43 | class Document::Private | ||
44 | { | 44 | { | ||
45 | public: | 45 | public: | ||
46 | Private(Document* qq) : q{qq}, impl{nullptr}, status{DocumentStatus::Unloaded} | 46 | Private(Document* qq) : q{qq}, impl{nullptr}, status{DocumentStatus::Unloaded}, readOnly{false} | ||
47 | { } | 47 | { } | ||
48 | 48 | | |||
49 | void updateImpl(); | 49 | void updateImpl(); | ||
50 | 50 | | |||
51 | Document* q; | 51 | Document* q; | ||
52 | 52 | | |||
53 | QUrl source; | 53 | QUrl source; | ||
54 | DocumentImpl* impl; | 54 | DocumentImpl* impl; | ||
55 | DocumentStatus::Status status; | 55 | DocumentStatus::Status status; | ||
56 | bool readOnly; | ||||
56 | }; | 57 | }; | ||
pvuorela: Looks like this is on top of Sailfish patched Calligra, upstream doesn't have lastError. Could… | |||||
denexter: Updated relative to an unpatched Calligra, | |||||
57 | 58 | | |||
58 | Document::Document(QObject* parent) | 59 | Document::Document(QObject* parent) | ||
59 | : QObject{parent}, d{new Private{this}} | 60 | : QObject{parent}, d{new Private{this}} | ||
60 | { | 61 | { | ||
61 | 62 | | |||
62 | } | 63 | } | ||
63 | 64 | | |||
64 | Document::~Document() | 65 | Document::~Document() | ||
Show All 14 Lines | 77 | if(value != d->source) { | |||
79 | 80 | | |||
80 | d->status = DocumentStatus::Loading; | 81 | d->status = DocumentStatus::Loading; | ||
81 | emit statusChanged(); | 82 | emit statusChanged(); | ||
82 | 83 | | |||
83 | d->updateImpl(); | 84 | d->updateImpl(); | ||
84 | emit documentTypeChanged(); | 85 | emit documentTypeChanged(); | ||
85 | 86 | | |||
86 | if(d->impl) { | 87 | if(d->impl) { | ||
88 | d->impl->setReadOnly(d->readOnly); | ||||
87 | if(d->impl->load(d->source)) { | 89 | if(d->impl->load(d->source)) { | ||
88 | d->status = DocumentStatus::Loaded; | 90 | d->status = DocumentStatus::Loaded; | ||
89 | connect(d->impl->canvasController()->canvas()->shapeManager(), SIGNAL(selectionChanged()), SIGNAL(textEditorChanged())); | 91 | connect(d->impl->canvasController()->canvas()->shapeManager(), SIGNAL(selectionChanged()), SIGNAL(textEditorChanged())); | ||
90 | } else { | 92 | } else { | ||
91 | d->status = DocumentStatus::Failed; | 93 | d->status = DocumentStatus::Failed; | ||
92 | } | 94 | } | ||
93 | } else { | 95 | } else { | ||
94 | d->status = DocumentStatus::Unloaded; | 96 | d->status = DocumentStatus::Unloaded; | ||
95 | } | 97 | } | ||
96 | 98 | | |||
97 | emit indexCountChanged(); | 99 | emit indexCountChanged(); | ||
98 | emit statusChanged(); | 100 | emit statusChanged(); | ||
99 | } | 101 | } | ||
100 | } | 102 | } | ||
101 | 103 | | |||
104 | bool Document::readOnly() const | ||||
105 | { | ||||
106 | return d->readOnly; | ||||
107 | } | ||||
108 | | ||||
109 | void Document::setReadOnly(bool readOnly) | ||||
110 | { | ||||
111 | if (d->readOnly != readOnly) { | ||||
112 | d->readOnly = readOnly; | ||||
113 | | ||||
114 | emit readOnlyChanged(); | ||||
115 | } | ||||
116 | } | ||||
117 | | ||||
102 | DocumentType::Type Document::documentType() const | 118 | DocumentType::Type Document::documentType() const | ||
103 | { | 119 | { | ||
104 | if(d->impl) { | 120 | if(d->impl) { | ||
105 | return d->impl->documentType(); | 121 | return d->impl->documentType(); | ||
106 | } | 122 | } | ||
107 | 123 | | |||
108 | return DocumentType::Unknown; | 124 | return DocumentType::Unknown; | ||
109 | } | 125 | } | ||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |
Looks like this is on top of Sailfish patched Calligra, upstream doesn't have lastError. Could otherwise resolve that conflict myself, but the arc tool doesn't seem to play along well, losing the metadata by doing the commit myself.