Merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-error-detection into lp:ubuntu-docviewer-app

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 197
Merged at revision: 197
Proposed branch: lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-error-detection
Merge into: lp:ubuntu-docviewer-app
Diff against target: 569 lines (+207/-58)
13 files modified
.bzrignore (+1/-0)
CMakeLists.txt (+3/-0)
src/app/qml/common/ErrorDialog.qml (+0/-2)
src/app/qml/loView/LOViewPage.qml (+25/-0)
src/app/qml/ubuntu-docviewer-app.qml (+6/-2)
src/plugin/libreofficetoolkit-qml-plugin/CMakeLists.txt (+1/-0)
src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp (+52/-12)
src/plugin/libreofficetoolkit-qml-plugin/lodocument.h (+16/-7)
src/plugin/libreofficetoolkit-qml-plugin/loerror.h (+37/-0)
src/plugin/libreofficetoolkit-qml-plugin/loview.cpp (+44/-24)
src/plugin/libreofficetoolkit-qml-plugin/loview.h (+15/-7)
src/plugin/libreofficetoolkit-qml-plugin/plugin.cpp (+5/-3)
src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml (+2/-1)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-docviewer-app/reboot-lok-error-detection
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Roman Shchekin Approve
Review via email: mp+277295@code.launchpad.net

Commit message

* [loviewer] Adding error detection
* [loviewer] Removed updateZoomIfAutomatic() function in LOView, its code was a bit cryptic
* Added a debug option in CMakeLists
* added '*.user.*' filter in .bzrignore file

Description of the change

* [loviewer] Adding error detection
* [loviewer] Removed updateZoomIfAutomatic() function in LOView, its code was a bit cryptic
* Added a debug option in CMakeLists
* added '*.user.*' filter in .bzrignore file

To post a comment you must log in.
197. By Stefano Verzegnassi

Provide a more extended description of the error

Revision history for this message
Roman Shchekin (mrqtros) wrote :

See my inline note (not important).

review: Approve
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2014-10-28 22:10:16 +0000
3+++ .bzrignore 2015-11-13 17:32:36 +0000
4@@ -1,6 +1,7 @@
5 Makefile
6 ubuntu-docviewer-app
7 *.user
8+*.user.*
9 moc_file.cpp
10 launcher/build-docviewer-launcher-Desktop-Debug/
11 launcher/build-docviewer-launcher-Desktop-Release/
12
13=== modified file 'CMakeLists.txt'
14--- CMakeLists.txt 2015-10-03 12:37:24 +0000
15+++ CMakeLists.txt 2015-11-13 17:32:36 +0000
16@@ -14,6 +14,9 @@
17 set(CMAKE_AUTOMOC ON)
18 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra -fPIC")
19
20+# Debugging purpose. Keep commented unless you need it.
21+# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
22+
23 include(FindPkgConfig)
24 # Standard install paths
25 include(GNUInstallDirs)
26
27=== renamed file 'src/app/qml/common/FileNotFoundDialog.qml' => 'src/app/qml/common/ErrorDialog.qml'
28--- src/app/qml/common/FileNotFoundDialog.qml 2015-10-10 12:03:30 +0000
29+++ src/app/qml/common/ErrorDialog.qml 2015-11-13 17:32:36 +0000
30@@ -18,11 +18,9 @@
31 import Ubuntu.Components 1.2
32 import Ubuntu.Components.Popups 1.0
33
34-// We may want to refactor this dialog for a more generic usage, when we'll need it.
35 Dialog {
36 id: errorDialog
37 title: i18n.tr("Error")
38- text: i18n.tr("File does not exist")
39
40 Button {
41 text: i18n.tr("Close")
42
43=== modified file 'src/app/qml/loView/LOViewPage.qml'
44--- src/app/qml/loView/LOViewPage.qml 2015-10-19 11:44:11 +0000
45+++ src/app/qml/loView/LOViewPage.qml 2015-11-13 17:32:36 +0000
46@@ -164,6 +164,31 @@
47 loPageContent.forceActiveFocus()
48 }
49
50+ onErrorChanged: {
51+ var errorString;
52+
53+ switch(error) {
54+ case LibreOffice.Error.LibreOfficeNotFound:
55+ errorString = i18n.tr("LibreOffice binaries not found.")
56+ break;
57+ case LibreOffice.Error.LibreOfficeNotInitialized:
58+ errorString = i18n.tr("Error while loading LibreOffice.")
59+ break;
60+ case LibreOffice.Error.DocumentNotLoaded:
61+ errorString = i18n.tr("Document not loaded.\nThe requested document may be corrupt.")
62+ break;
63+ }
64+
65+ if (errorString) {
66+ loPage.pageStack.pop()
67+
68+ // We create the dialog in the MainView, so that it isn't
69+ // initialized by 'loPage' and keep on working after the
70+ // page is destroyed.
71+ mainView.showErrorDialog(errorString);
72+ }
73+ }
74+
75 Scrollbar { flickableItem: loView; parent: loView.parent }
76 Scrollbar { flickableItem: loView; parent: loView.parent; align: Qt.AlignBottom }
77 }
78
79=== modified file 'src/app/qml/ubuntu-docviewer-app.qml'
80--- src/app/qml/ubuntu-docviewer-app.qml 2015-10-20 18:21:17 +0000
81+++ src/app/qml/ubuntu-docviewer-app.qml 2015-11-13 17:32:36 +0000
82@@ -98,6 +98,11 @@
83 mainView.pickMode = true
84 }
85
86+ function showErrorDialog(message) {
87+ PopupUtils.open(Qt.resolvedUrl("common/ErrorDialog.qml"),
88+ mainView, { parent: mainView, text: message });
89+ }
90+
91 // On screen rotation, force updating of header/U8 indicators panel visibility
92 onIsLandscapeChanged: setHeaderVisibility(true);
93
94@@ -122,8 +127,7 @@
95 onMimetypeChanged: LoadComponent.load(mimetype.name)
96 onErrorChanged: {
97 if (error == -1)
98- PopupUtils.open(Qt.resolvedUrl("common/FileNotFoundDialog.qml"),
99- mainView, { parent: mainView });
100+ mainView.showErrorDialog(i18n.tr("File does not exist."));
101 }
102 }
103
104
105=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/CMakeLists.txt'
106--- src/plugin/libreofficetoolkit-qml-plugin/CMakeLists.txt 2015-10-18 20:58:32 +0000
107+++ src/plugin/libreofficetoolkit-qml-plugin/CMakeLists.txt 2015-11-13 17:32:36 +0000
108@@ -28,6 +28,7 @@
109 set(libreofficetoolkitqmlplugin_HDRS
110 twips.h
111 config.h
112+ loerror.h
113 )
114
115 add_library(libreofficetoolkitqmlplugin MODULE
116
117=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp'
118--- src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp 2015-10-27 13:27:27 +0000
119+++ src/plugin/libreofficetoolkit-qml-plugin/lodocument.cpp 2015-11-13 17:32:36 +0000
120@@ -26,8 +26,6 @@
121 #include <LibreOfficeKit/LibreOfficeKitInit.h>
122 #include <LibreOfficeKit/LibreOfficeKit.hxx>
123
124-// TODO: Error management
125-
126 #ifdef DEBUG_TILE_BENCHMARK
127 #include <QElapsedTimer>
128 #endif
129@@ -37,6 +35,7 @@
130 LODocument::LODocument()
131 : m_path("")
132 , m_currentPart(-1)
133+ , m_error(LibreOfficeError::NoError)
134 , m_document(nullptr)
135 {
136 // This space is intentionally empty.
137@@ -58,7 +57,7 @@
138 Q_EMIT pathChanged();
139
140 // Load the new document
141- this->loadDocument(m_path);
142+ loadDocument(m_path);
143 }
144
145 int LODocument::currentPart() {
146@@ -78,21 +77,48 @@
147 }
148
149 // Load the document
150-bool LODocument::loadDocument(const QString &pathName)
151+void LODocument::loadDocument(const QString &pathName)
152 {
153 qDebug() << "Loading document...";
154+ setError(LibreOfficeError::NoError);
155
156 if (pathName.isEmpty()) {
157 qDebug() << "Can't load the document, path is empty.";
158- return false;
159- }
160-
161+ return;
162+ }
163+
164+
165+ /* Get LibreOffice path */
166+ const char* loPath = Config::getLibreOfficePath();
167+
168+ if (loPath == NULL) {
169+ setError(LibreOfficeError::LibreOfficeNotFound);
170+ return;
171+ }
172+
173+
174+ /* Load LibreOffice */
175 if (!s_office)
176- s_office = lok::lok_cpp_init(Config::getLibreOfficePath(),
177- Config::getLibreOfficeProfilePath());
178-
179+ s_office = lok::lok_cpp_init(loPath, Config::getLibreOfficeProfilePath());
180+
181+ if (s_office == NULL) {
182+ setError(LibreOfficeError::LibreOfficeNotInitialized);
183+ qDebug() << "[lok-qml]: LibreOffice not initialized.";
184+ return;
185+ }
186+
187+
188+ /* Load the document */
189 m_document = s_office->documentLoad(m_path.toUtf8().constData());
190
191+ if (m_document == NULL) {
192+ setError(LibreOfficeError::DocumentNotLoaded);
193+ qDebug() << "[lok-qml]: Document not loaded.";
194+ return;
195+ }
196+
197+
198+ /* Do the further initialization */
199 m_docType = DocumentType(m_document->getDocumentType());
200 Q_EMIT documentTypeChanged();
201
202@@ -101,7 +127,16 @@
203 m_document->initializeForRendering();
204 qDebug() << "Document loaded successfully !";
205
206- return true;
207+ return;
208+}
209+
210+void LODocument::setError(const LibreOfficeError::Error &error)
211+{
212+ if (m_error == error)
213+ return;
214+
215+ m_error = error;
216+ Q_EMIT errorChanged();
217 }
218
219 // Return the type of the loaded document (e.g. text document,
220@@ -210,7 +245,12 @@
221
222 return QString::fromUtf8(m_document->getPartName(index));
223 }
224-
225+
226+LibreOfficeError::Error LODocument::error() const
227+{
228+ return m_error;
229+}
230+
231 // TODO: Is there some documentation on safe formats or filterOptions that can
232 // be used?
233 bool LODocument::saveAs(QString url, QString format = QString(), QString filterOptions = QString())
234
235=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/lodocument.h'
236--- src/plugin/libreofficetoolkit-qml-plugin/lodocument.h 2015-10-04 16:11:47 +0000
237+++ src/plugin/libreofficetoolkit-qml-plugin/lodocument.h 2015-11-13 17:32:36 +0000
238@@ -20,6 +20,8 @@
239
240 #include <QObject>
241
242+#include "loerror.h"
243+
244 namespace lok {
245 class Office;
246 class Document;
247@@ -30,12 +32,13 @@
248 Q_OBJECT
249 Q_DISABLE_COPY(LODocument)
250
251- Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
252- Q_PROPERTY(int currentPart READ currentPart WRITE setCurrentPart NOTIFY currentPartChanged)
253+ Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
254+ Q_PROPERTY(int currentPart READ currentPart WRITE setCurrentPart NOTIFY currentPartChanged)
255 // Declare partsCount as constant at the moment, since LOK-plugin is just a viewer for now.
256- Q_PROPERTY(int partsCount READ partsCount CONSTANT)
257- Q_PROPERTY(int documentPart READ documentPart WRITE setDocumentPart NOTIFY documentPartChanged)
258- Q_PROPERTY(DocumentType documentType READ documentType NOTIFY documentTypeChanged)
259+ Q_PROPERTY(int partsCount READ partsCount CONSTANT)
260+ Q_PROPERTY(int documentPart READ documentPart WRITE setDocumentPart NOTIFY documentPartChanged)
261+ Q_PROPERTY(DocumentType documentType READ documentType NOTIFY documentTypeChanged)
262+ Q_PROPERTY(LibreOfficeError::Error error READ error NOTIFY errorChanged)
263 Q_ENUMS(DocumentType)
264
265 public:
266@@ -70,6 +73,8 @@
267 QString getPartName(int index) const;
268 void setPart(int index);
269
270+ LibreOfficeError::Error error() const;
271+
272 Q_INVOKABLE bool saveAs(QString url, QString format, QString filterOptions);
273
274 Q_SIGNALS:
275@@ -77,13 +82,17 @@
276 void currentPartChanged();
277 void documentTypeChanged();
278 void documentPartChanged();
279+ void errorChanged();
280
281 private:
282 QString m_path;
283 int m_currentPart;
284 DocumentType m_docType;
285-
286- bool loadDocument(const QString &pathNAme);
287+ LibreOfficeError::Error m_error;
288+
289+ void loadDocument(const QString &pathNAme);
290+
291+ void setError(const LibreOfficeError::Error &error);
292
293 lok::Document *m_document;
294
295
296=== added file 'src/plugin/libreofficetoolkit-qml-plugin/loerror.h'
297--- src/plugin/libreofficetoolkit-qml-plugin/loerror.h 1970-01-01 00:00:00 +0000
298+++ src/plugin/libreofficetoolkit-qml-plugin/loerror.h 2015-11-13 17:32:36 +0000
299@@ -0,0 +1,37 @@
300+/*
301+ * Copyright (C) 2015 Canonical, Ltd.
302+ *
303+ * This program is free software: you can redistribute it and/or modify it
304+ * under the terms of the GNU General Public License version 3, as published
305+ * by the Free Software Foundation.
306+ *
307+ * This program is distributed in the hope that it will be useful, but
308+ * WITHOUT ANY WARRANTY; without even the implied warranties of
309+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
310+ * PURPOSE. See the GNU General Public License for more details.
311+ *
312+ * You should have received a copy of the GNU General Public License along
313+ * with this program. If not, see <http://www.gnu.org/licenses/>.
314+ *
315+ */
316+
317+#ifndef LOERROR_H
318+#define LOERROR_H
319+
320+#include <QObject>
321+
322+class LibreOfficeError : public QObject
323+{
324+ Q_OBJECT
325+ Q_ENUMS(Error)
326+
327+public:
328+ enum Error {
329+ NoError = 0,
330+ LibreOfficeNotFound = 1,
331+ LibreOfficeNotInitialized = 2,
332+ DocumentNotLoaded = 3
333+ };
334+};
335+
336+#endif // LOERROR_H
337
338=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/loview.cpp'
339--- src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2015-10-18 21:27:16 +0000
340+++ src/plugin/libreofficetoolkit-qml-plugin/loview.cpp 2015-11-13 17:32:36 +0000
341@@ -40,6 +40,7 @@
342 , m_cacheBuffer(TILE_SIZE * 3)
343 , m_visibleArea(0, 0, 0, 0)
344 , m_bufferArea(0, 0, 0, 0)
345+ , m_error(LibreOfficeError::NoError)
346 {
347 Q_UNUSED(parent)
348
349@@ -86,9 +87,22 @@
350 if (m_document)
351 m_document->disconnect(this);
352
353+ setError(LibreOfficeError::NoError);
354+
355 m_document = QSharedPointer<LODocument>(new LODocument());
356 m_document->setPath(path);
357
358+ /* A lot of things happens when we set the path property in
359+ * m_document. Need to check if an error has been emitted. */
360+ if (m_document->error() != LibreOfficeError::NoError) {
361+ setError(m_document->error());
362+
363+ m_document.clear();
364+
365+ // Stop doing anything below.
366+ return;
367+ }
368+
369 // TODO MOVE
370 m_partsModel = new LOPartsModel(m_document);
371 Q_EMIT partsModelChanged();
372@@ -164,8 +178,16 @@
373 Q_EMIT cacheBufferChanged();
374 }
375
376+LibreOfficeError::Error LOView::error() const
377+{
378+ return m_error;
379+}
380+
381 void LOView::adjustZoomToWidth()
382- {
383+{
384+ if (!m_document)
385+ return;
386+
387 setZoomMode(LOView::FitToWidth);
388
389 zoomValueToFitWidth = getZoomToFitWidth(m_parentFlickable->width(),
390@@ -173,26 +195,6 @@
391
392 setZoomFactor(zoomValueToFitWidth);
393 qDebug() << "Adjust zoom to width - value:" << zoomValueToFitWidth;
394- }
395-
396-bool LOView::updateZoomIfAutomatic()
397-{
398- // This function is only used in LOView::updateVisibleRect()
399- // It returns a bool, so that we can stop the execution of that function,
400- // which will be triggered again when we'll automatically update the zoom value.
401- if (m_zoomMode == LOView::FitToWidth) {
402- zoomValueToFitWidth = getZoomToFitWidth(m_parentFlickable->width(),
403- m_document->documentSize().width());
404-
405- if (m_zoomFactor != zoomValueToFitWidth) {
406- setZoomFactor(zoomValueToFitWidth);
407-
408- qDebug() << "Adjust automatic zoom to width - value:" << zoomValueToFitWidth;
409- return true;
410- }
411- }
412-
413- return false;
414 }
415
416 void LOView::updateViewSize()
417@@ -210,7 +212,7 @@
418
419 void LOView::updateVisibleRect()
420 {
421- if (!m_parentFlickable)
422+ if (!m_parentFlickable || !m_document)
423 return;
424
425 // Changes in parentFlickable width/height trigger directly LOView::updateVisibleRect(),
426@@ -222,8 +224,17 @@
427 // If that happens, stop the execution of this function, since the change of
428 // zoomFactor will trigger the updateViewSize() function, which triggers this
429 // function again.
430- if (this->updateZoomIfAutomatic())
431- return;
432+ if (m_zoomMode == LOView::FitToWidth) {
433+ zoomValueToFitWidth = getZoomToFitWidth(m_parentFlickable->width(),
434+ m_document->documentSize().width());
435+
436+ if (m_zoomFactor != zoomValueToFitWidth) {
437+ setZoomFactor(zoomValueToFitWidth);
438+
439+ qDebug() << "Adjust automatic zoom to width - value:" << zoomValueToFitWidth;
440+ return;
441+ }
442+ }
443
444 // Check if current tiles have a different zoom value
445 if (!m_tiles.isEmpty()) {
446@@ -381,6 +392,15 @@
447 }
448 }
449
450+void LOView::setError(const LibreOfficeError::Error &error)
451+{
452+ if (m_error == error)
453+ return;
454+
455+ m_error = error;
456+ Q_EMIT errorChanged();
457+}
458+
459 LOView::~LOView()
460 {
461 delete m_partsModel;
462
463=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/loview.h'
464--- src/plugin/libreofficetoolkit-qml-plugin/loview.h 2015-10-11 11:27:29 +0000
465+++ src/plugin/libreofficetoolkit-qml-plugin/loview.h 2015-11-13 17:32:36 +0000
466@@ -23,6 +23,7 @@
467 #include <QQmlContext>
468 #include <QQmlEngine>
469
470+#include "loerror.h"
471 #include "renderengine.h"
472 #include "lopartsmodel.h"
473 #include "lopartsimageprovider.h"
474@@ -34,12 +35,13 @@
475 {
476 Q_OBJECT
477 Q_ENUMS(ZoomMode)
478- Q_PROPERTY(QQuickItem* parentFlickable READ parentFlickable WRITE setParentFlickable NOTIFY parentFlickableChanged)
479- Q_PROPERTY(LODocument* document READ document /*WRITE setDocument*/ NOTIFY documentChanged)
480- Q_PROPERTY(LOPartsModel* partsModel READ partsModel NOTIFY partsModelChanged)
481- Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged)
482- Q_PROPERTY(ZoomMode zoomMode READ zoomMode NOTIFY zoomModeChanged)
483- Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
484+ Q_PROPERTY(QQuickItem* parentFlickable READ parentFlickable WRITE setParentFlickable NOTIFY parentFlickableChanged)
485+ Q_PROPERTY(LODocument* document READ document /*WRITE setDocument*/ NOTIFY documentChanged)
486+ Q_PROPERTY(LOPartsModel* partsModel READ partsModel NOTIFY partsModelChanged)
487+ Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged)
488+ Q_PROPERTY(ZoomMode zoomMode READ zoomMode NOTIFY zoomModeChanged)
489+ Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
490+ Q_PROPERTY(LibreOfficeError::Error error READ error NOTIFY errorChanged)
491
492 public:
493 LOView(QQuickItem *parent = 0);
494@@ -66,6 +68,8 @@
495 int cacheBuffer() const;
496 void setCacheBuffer(int cacheBuffer);
497
498+ LibreOfficeError::Error error() const;
499+
500 Q_INVOKABLE void adjustZoomToWidth();
501
502 Q_SIGNALS:
503@@ -75,6 +79,7 @@
504 void zoomFactorChanged();
505 void zoomModeChanged();
506 void cacheBufferChanged();
507+ void errorChanged();
508
509 private Q_SLOTS:
510 void updateViewSize();
511@@ -99,6 +104,8 @@
512 QRect m_visibleArea;
513 QRect m_bufferArea;
514
515+ LibreOfficeError::Error m_error;
516+
517 QTimer m_updateTimer;
518
519 QMap<int, SGTileItem*> m_tiles;
520@@ -106,8 +113,9 @@
521 void generateTiles(int x1, int y1, int x2, int y2, int tilesPerWidth);
522 void createTile(int index, QRect rect);
523 void setZoomMode(const ZoomMode zoomMode);
524- bool updateZoomIfAutomatic();
525 void clearView();
526+
527+ void setError(const LibreOfficeError::Error &error);
528 };
529
530 #endif // LOVIEW_H
531
532=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/plugin.cpp'
533--- src/plugin/libreofficetoolkit-qml-plugin/plugin.cpp 2015-10-05 20:53:25 +0000
534+++ src/plugin/libreofficetoolkit-qml-plugin/plugin.cpp 2015-11-13 17:32:36 +0000
535@@ -22,15 +22,17 @@
536 #include "lodocument.h"
537 #include "loview.h"
538 #include "lopartsmodel.h"
539+#include "loerror.h"
540
541 void LOPlugin::registerTypes(const char *uri)
542 {
543 Q_ASSERT(uri == QLatin1String("DocumentViewer.LibreOffice"));
544
545 //@uri DocumentViewer.LibreOffice
546- qmlRegisterType<LODocument>(uri, 1, 0, "Document");
547- qmlRegisterType<LOView>(uri, 1, 0, "View");
548- qmlRegisterUncreatableType<LOPartsModel>(uri, 1, 0, "PartsModel", "You shouldn't create LOPartsModel in QML");
549+ qmlRegisterType <LODocument> (uri, 1, 0, "Document");
550+ qmlRegisterType <LOView> (uri, 1, 0, "View");
551+ qmlRegisterUncreatableType <LOPartsModel> (uri, 1, 0, "PartsModel", "You shouldn't create LOPartsModel in QML");
552+ qmlRegisterUncreatableType <LibreOfficeError> (uri, 1, 0, "Error", "Not creatable as an object, use only to retrieve error enums (e.g. LibreOffice.Error.DocumentNotFound)");
553 }
554
555 void LOPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
556
557=== modified file 'src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml'
558--- src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml 2015-10-05 06:42:33 +0000
559+++ src/plugin/libreofficetoolkit-qml-plugin/qml/Viewer.qml 2015-11-13 17:32:36 +0000
560@@ -23,8 +23,9 @@
561 property alias document: view.document
562 property alias zoomFactor: view.zoomFactor
563 property alias cacheBuffer: view.cacheBuffer
564- property alias partsModel: view.partsModel
565+ property alias partsModel: view.partsModel
566 property alias zoomMode: view.zoomMode
567+ property alias error: view.error
568
569 property string documentPath: ""
570

Subscribers

People subscribed via source and target branches