summaryrefslogtreecommitdiff
path: root/noncore/graphics/drawpad/drawpadcanvas.cpp
authorzecke <zecke>2004-07-14 11:22:14 (UTC)
committer zecke <zecke>2004-07-14 11:22:14 (UTC)
commitca486a4558dc7aa23e3e5c677f6eedd26ed02746 (patch) (unidiff)
tree56afc5086ffcd07a5f205017f1940b86e9747628 /noncore/graphics/drawpad/drawpadcanvas.cpp
parentb09d76574ca6d2ebafca0640ea36c3b785e7f3a3 (diff)
downloadopie-ca486a4558dc7aa23e3e5c677f6eedd26ed02746.zip
opie-ca486a4558dc7aa23e3e5c677f6eedd26ed02746.tar.gz
opie-ca486a4558dc7aa23e3e5c677f6eedd26ed02746.tar.bz2
Problem: Opie-Drawpad loads its document delayed. This means a setDocument
like from the Screenshot Applet could be executed prior to the final initialisation of drawpad and the just added page vanishes. Solve: Take the fact into account and 1st) don't create an empty page if there is already a page which is the case with the setDocument call 2nd) if we load but already have pages we need to add the new pages
Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index 5d0c6e4..5b1aa7e 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -179,4 +179,20 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
179 179
180 /*
181 * we could have loaded something from setDocument already
182 * due the delayed loading we need to make sure we do
183 * not lose pages
184 */
185 if ( !m_pages.isEmpty() ) {
186 QList<Page> pages = drawPadCanvasXmlHandler.pages();
187 QListIterator<Page> it( pages );
188 Page *p;
189 while ( ( p = it.current() ) ) {
190 ++it;
191 m_pages.append( p );
192 }
193 }else
180 m_pages = drawPadCanvasXmlHandler.pages(); 194 m_pages = drawPadCanvasXmlHandler.pages();
181 195
196
197
182 if (m_pages.isEmpty()) { 198 if (m_pages.isEmpty()) {
@@ -196,2 +212,9 @@ void DrawPadCanvas::initialPage()
196{ 212{
213 /*
214 * by setDocument we've set a page already so
215 * don't add an empty one. This comes due the delayed initialisation
216 */
217 if (!m_pages.isEmpty() )
218 return;
219
197 m_pages.append(new Page("", 220 m_pages.append(new Page("",