summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp6
-rw-r--r--noncore/graphics/drawpad/drawpad.h3
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp6
-rw-r--r--noncore/graphics/drawpad/main.cpp1
5 files changed, 11 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 7c26832..de27eb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,46 +1,47 @@
1 2004-??-??The Opie Team <opie@handhelds.org> 1 2004-??-??The Opie Team <opie@handhelds.org>
2 2
3 * Fixed Drawpad initialization (Bug #1314) (mickeyl)
3 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 4 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
4 * Added Conversion tool for pim-data (eilers) 5 * Added Conversion tool for pim-data (eilers)
5 * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers) 6 * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers)
6 7
7 2004-25-04The Opie Team <opie@handhelds.org> 8 2004-25-04The Opie Team <opie@handhelds.org>
8 9
9 * Released as Version 1.1.3 (devel) 10 * Released as Version 1.1.3 (devel)
10 * Introduced first implementation of SQL-Support using SQLite (eilers) 11 * Introduced first implementation of SQL-Support using SQLite (eilers)
11 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 12 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
12 * Added a real system graffiti character set (brad) 13 * Added a real system graffiti character set (brad)
13 * Added Generic Keyconfig Widget (zecke) 14 * Added Generic Keyconfig Widget (zecke)
14 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) 15 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke)
15 * Added new Bible reader app - opie-dagger (drw) 16 * Added new Bible reader app - opie-dagger (drw)
16 * Added a new Image Viewer. Work is ongoing (zecke,alwin) 17 * Added a new Image Viewer. Work is ongoing (zecke,alwin)
17 * Added namespace usage in libopie2 and everywhere (zecke,alwin) 18 * Added namespace usage in libopie2 and everywhere (zecke,alwin)
18 * Enabled the possibility to pass command line arguments to applications (mickeyl) 19 * Enabled the possibility to pass command line arguments to applications (mickeyl)
19 * Added an about applet showing some credits and information about Opie (mickeyl) 20 * Added an about applet showing some credits and information about Opie (mickeyl)
20 * Added benchmarking functionality to sysinfo (mickeyl) 21 * Added benchmarking functionality to sysinfo (mickeyl)
21 * Added applet and configuration application for switching hardware keyboard layouts (alwin) 22 * Added applet and configuration application for switching hardware keyboard layouts (alwin)
22 * Ported applications from libopie1 to libopie2* (drw,ar,alwin) 23 * Ported applications from libopie1 to libopie2* (drw,ar,alwin)
23 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) 24 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe)
24 * Clean-up of package information in control files (drw) 25 * Clean-up of package information in control files (drw)
25 * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 26 * Repaired mediummount which was broken since integrating the quicklauncher (alwin)
26 * Improved big-screen support (zecke,ar) 27 * Improved big-screen support (zecke,ar)
27 * Improved multikeyboard support, added keyboard layout switching applet (mouse) 28 * Improved multikeyboard support, added keyboard layout switching applet (mouse)
28 * Added a new mail client based on libetpan (harlekin,alwin,jgf) 29 * Added a new mail client based on libetpan (harlekin,alwin,jgf)
29 * Added new package manager - opie-packagemanager (drw) 30 * Added new package manager - opie-packagemanager (drw)
30 * Improved light-n-power for C7x0 (mickeyl) 31 * Improved light-n-power for C7x0 (mickeyl)
31 * Added automatic rotation support for C7x0 (treke) 32 * Added automatic rotation support for C7x0 (treke)
32 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) 33 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl)
33 * Added scanning the wireless network neighbourhood to networksettings (mickeyl) 34 * Added scanning the wireless network neighbourhood to networksettings (mickeyl)
34 35
35 2003-11-29The Opie Team <opie@handhelds.org> 36 2003-11-29The Opie Team <opie@handhelds.org>
36 37
37 * Released as Version 1.0.3 38 * Released as Version 1.0.3
38 * Improved i18n (various contributors) 39 * Improved i18n (various contributors)
39 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) 40 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin)
40 * Made the Documents Tab optional (mickeyl) 41 * Made the Documents Tab optional (mickeyl)
41 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) 42 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken)
42 43
43 2003-08-04The Opie Team <opie@handhelds.org> 44 2003-08-04The Opie Team <opie@handhelds.org>
44 45
45 * Released as Version 1.0.0 46 * Released as Version 1.0.0
46 * Including a PPP module for easy dial up (tille,harlekin,zecke) 47 * Including a PPP module for easy dial up (tille,harlekin,zecke)
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index d9d0ce0..c0f42d9 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -1,668 +1,670 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "drawpad.h" 14#include "drawpad.h"
15 15
16#include "drawpadcanvas.h" 16#include "drawpadcanvas.h"
17#include "ellipsetool.h" 17#include "ellipsetool.h"
18#include "erasetool.h" 18#include "erasetool.h"
19#include "exportdialog.h" 19#include "exportdialog.h"
20#include "filledellipsetool.h" 20#include "filledellipsetool.h"
21#include "filledrectangletool.h" 21#include "filledrectangletool.h"
22#include "filltool.h" 22#include "filltool.h"
23#include "importdialog.h" 23#include "importdialog.h"
24#include "linetool.h" 24#include "linetool.h"
25#include "newpagedialog.h" 25#include "newpagedialog.h"
26#include "page.h" 26#include "page.h"
27#include "pageinformationdialog.h" 27#include "pageinformationdialog.h"
28#include "pointtool.h" 28#include "pointtool.h"
29#include "rectangletool.h" 29#include "rectangletool.h"
30#include "texttool.h" 30#include "texttool.h"
31#include "thumbnailview.h" 31#include "thumbnailview.h"
32 32
33#include <opie2/qcolordialog.h> 33#include <opie2/qcolordialog.h>
34#include <opie2/ocolorpopupmenu.h> 34#include <opie2/ocolorpopupmenu.h>
35 35
36#include <qpe/applnk.h> 36#include <qpe/applnk.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qtoolbar.h> 38#include <qtoolbar.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41 41
42#include <qmenubar.h> 42#include <qmenubar.h>
43#include <qaction.h> 43#include <qaction.h>
44#include <qfile.h> 44#include <qfile.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qspinbox.h> 46#include <qspinbox.h>
47#include <qtoolbutton.h> 47#include <qtoolbutton.h>
48#include <qtooltip.h> 48#include <qtooltip.h>
49#include <qwhatsthis.h> 49#include <qwhatsthis.h>
50 50
51using namespace Opie::Ui; 51using namespace Opie::Ui;
52using namespace Opie::Ui;
53DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ ) 52DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ )
54 : QMainWindow(parent, name, WStyle_ContextHelp) 53 : QMainWindow(parent, name, WStyle_ContextHelp)
55{ 54{
56 // init members 55 // init members
57 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), 56 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
58 this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) ); 57 this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) );
59 58
60 m_pDrawPadCanvas = new DrawPadCanvas(this, this); 59 m_pDrawPadCanvas = new DrawPadCanvas(this, this);
61 60
62 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); 61 connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));
63 62
64 setCentralWidget(m_pDrawPadCanvas); 63 setCentralWidget(m_pDrawPadCanvas);
65 64
66 // init menu 65 // init menu
67 66
68 setToolBarsMovable(false); 67 setToolBarsMovable(false);
69 68
70 QToolBar* menuToolBar = new QToolBar(this); 69 QToolBar* menuToolBar = new QToolBar(this);
71 QMenuBar* menuBar = new QMenuBar(menuToolBar); 70 QMenuBar* menuBar = new QMenuBar(menuToolBar);
72 71
73 QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar); 72 QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar);
74 73
75 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); 74 QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
76 connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); 75 connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll()));
77 deleteAllAction->addTo(toolsPopupMenu); 76 deleteAllAction->addTo(toolsPopupMenu);
78 77
79 toolsPopupMenu->insertSeparator(); 78 toolsPopupMenu->insertSeparator();
80 79
81 QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); 80 QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this);
82 connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); 81 connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage()));
83 importPageAction->addTo(toolsPopupMenu); 82 importPageAction->addTo(toolsPopupMenu);
84 83
85 QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this); 84 QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this);
86 connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage())); 85 connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage()));
87 exportPageAction->addTo(toolsPopupMenu); 86 exportPageAction->addTo(toolsPopupMenu);
88 87
89 toolsPopupMenu->insertSeparator(); 88 toolsPopupMenu->insertSeparator();
90 89
91 QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this); 90 QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this);
92 connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView())); 91 connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView()));
93 thumbnailViewAction->addTo(toolsPopupMenu); 92 thumbnailViewAction->addTo(toolsPopupMenu);
94 93
95 QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this); 94 QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this);
96 connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation())); 95 connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation()));
97 pageInformationAction->addTo(toolsPopupMenu); 96 pageInformationAction->addTo(toolsPopupMenu);
98 97
99 toolsPopupMenu->insertSeparator(); 98 toolsPopupMenu->insertSeparator();
100 99
101 m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this); 100 m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this);
102 m_pAntiAliasingAction->setToggleAction(true); 101 m_pAntiAliasingAction->setToggleAction(true);
103 m_pAntiAliasingAction->addTo(toolsPopupMenu); 102 m_pAntiAliasingAction->addTo(toolsPopupMenu);
104 103
105 menuBar->insertItem(tr("Tools"), toolsPopupMenu); 104 menuBar->insertItem(tr("Tools"), toolsPopupMenu);
106 105
107 // init page toolbar 106 // init page toolbar
108 107
109 QToolBar* pageToolBar = new QToolBar(this); 108 QToolBar* pageToolBar = new QToolBar(this);
110 109
111 QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this); 110 QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this);
112 connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); 111 connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage()));
113 newPageAction->addTo(pageToolBar); 112 newPageAction->addTo(pageToolBar);
114 newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) ); 113 newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) );
115 114
116 QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this); 115 QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this);
117 connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); 116 connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage()));
118 clearPageAction->addTo(pageToolBar); 117 clearPageAction->addTo(pageToolBar);
119 clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) ); 118 clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) );
120 119
121 QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this); 120 QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this);
122 connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); 121 connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage()));
123 deletePageAction->addTo(pageToolBar); 122 deletePageAction->addTo(pageToolBar);
124 deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) ); 123 deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) );
125 124
126 QToolBar* emptyToolBar = new QToolBar(this); 125 QToolBar* emptyToolBar = new QToolBar(this);
127 emptyToolBar->setHorizontalStretchable(true); 126 emptyToolBar->setHorizontalStretchable(true);
128 127
129 // init navigation toolbar 128 // init navigation toolbar
130 129
131 QToolBar* navigationToolBar = new QToolBar(this); 130 QToolBar* navigationToolBar = new QToolBar(this);
132 131
133 m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this); 132 m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this);
134 connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo())); 133 connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo()));
135 m_pUndoAction->addTo(navigationToolBar); 134 m_pUndoAction->addTo(navigationToolBar);
136 m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) ); 135 m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) );
137 136
138 m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this); 137 m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this);
139 connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo())); 138 connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo()));
140 m_pRedoAction->addTo(navigationToolBar); 139 m_pRedoAction->addTo(navigationToolBar);
141 m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) ); 140 m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) );
142 141
143 m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this); 142 m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this);
144 connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage())); 143 connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage()));
145 m_pFirstPageAction->addTo(navigationToolBar); 144 m_pFirstPageAction->addTo(navigationToolBar);
146 m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) ); 145 m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) );
147 146
148 m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this); 147 m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this);
149 connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage())); 148 connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage()));
150 m_pPreviousPageAction->addTo(navigationToolBar); 149 m_pPreviousPageAction->addTo(navigationToolBar);
151 m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) ); 150 m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) );
152 151
153 m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this); 152 m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this);
154 connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage())); 153 connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage()));
155 m_pNextPageAction->addTo(navigationToolBar); 154 m_pNextPageAction->addTo(navigationToolBar);
156 m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) ); 155 m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) );
157 156
158 m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this); 157 m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this);
159 connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage())); 158 connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage()));
160 m_pLastPageAction->addTo(navigationToolBar); 159 m_pLastPageAction->addTo(navigationToolBar);
161 m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) ); 160 m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) );
162 161
163 // init draw mode toolbar 162 // init draw mode toolbar
164 163
165 QToolBar* drawModeToolBar = new QToolBar(this); 164 QToolBar* drawModeToolBar = new QToolBar(this);
166 165
167 m_pLineToolButton = new QToolButton(drawModeToolBar); 166 m_pLineToolButton = new QToolButton(drawModeToolBar);
168 m_pLineToolButton->setToggleButton(true); 167 m_pLineToolButton->setToggleButton(true);
169 QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) ); 168 QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) );
170 169
171 170
172 QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton); 171 QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton);
173 172
174 m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this); 173 m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this);
175 connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool())); 174 connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool()));
176 m_pPointToolAction->addTo(linePopupMenu); 175 m_pPointToolAction->addTo(linePopupMenu);
177 176
178 m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this); 177 m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this);
179 connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool())); 178 connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool()));
180 m_pLineToolAction->addTo(linePopupMenu); 179 m_pLineToolAction->addTo(linePopupMenu);
181 180
182 m_pLineToolButton->setPopup(linePopupMenu); 181 m_pLineToolButton->setPopup(linePopupMenu);
183 m_pLineToolButton->setPopupDelay(0); 182 m_pLineToolButton->setPopupDelay(0);
184 183
185 m_pRectangleToolButton = new QToolButton(drawModeToolBar); 184 m_pRectangleToolButton = new QToolButton(drawModeToolBar);
186 m_pRectangleToolButton->setToggleButton(true); 185 m_pRectangleToolButton->setToggleButton(true);
187 QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) ); 186 QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) );
188 187
189 QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton); 188 QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton);
190 189
191 m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this); 190 m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this);
192 connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool())); 191 connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool()));
193 m_pRectangleToolAction->addTo(rectanglePopupMenu); 192 m_pRectangleToolAction->addTo(rectanglePopupMenu);
194 193
195 m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this); 194 m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this);
196 connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool())); 195 connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool()));
197 m_pFilledRectangleToolAction->addTo(rectanglePopupMenu); 196 m_pFilledRectangleToolAction->addTo(rectanglePopupMenu);
198 197
199 m_pRectangleToolButton->setPopup(rectanglePopupMenu); 198 m_pRectangleToolButton->setPopup(rectanglePopupMenu);
200 m_pRectangleToolButton->setPopupDelay(0); 199 m_pRectangleToolButton->setPopupDelay(0);
201 200
202 m_pEllipseToolButton = new QToolButton(drawModeToolBar); 201 m_pEllipseToolButton = new QToolButton(drawModeToolBar);
203 m_pEllipseToolButton->setToggleButton(true); 202 m_pEllipseToolButton->setToggleButton(true);
204 QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) ); 203 QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) );
205 204
206 QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton); 205 QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton);
207 206
208 m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this); 207 m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this);
209 connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool())); 208 connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool()));
210 m_pEllipseToolAction->addTo(ellipsePopupMenu); 209 m_pEllipseToolAction->addTo(ellipsePopupMenu);
211 210
212 m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this); 211 m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this);
213 connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool())); 212 connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool()));
214 m_pFilledEllipseToolAction->addTo(ellipsePopupMenu); 213 m_pFilledEllipseToolAction->addTo(ellipsePopupMenu);
215 214
216 m_pEllipseToolButton->setPopup(ellipsePopupMenu); 215 m_pEllipseToolButton->setPopup(ellipsePopupMenu);
217 m_pEllipseToolButton->setPopupDelay(0); 216 m_pEllipseToolButton->setPopupDelay(0);
218 217
219 m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this); 218 m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this);
220 m_pTextToolAction->setToggleAction(true); 219 m_pTextToolAction->setToggleAction(true);
221 connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool())); 220 connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool()));
222 m_pTextToolAction->addTo(drawModeToolBar); 221 m_pTextToolAction->addTo(drawModeToolBar);
223 m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) ); 222 m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) );
224 223
225 m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this); 224 m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this);
226 m_pFillToolAction->setToggleAction(true); 225 m_pFillToolAction->setToggleAction(true);
227 connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool())); 226 connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool()));
228 m_pFillToolAction->addTo(drawModeToolBar); 227 m_pFillToolAction->addTo(drawModeToolBar);
229 m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) ); 228 m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) );
230 229
231 m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this); 230 m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this);
232 m_pEraseToolAction->setToggleAction(true); 231 m_pEraseToolAction->setToggleAction(true);
233 connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool())); 232 connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool()));
234 m_pEraseToolAction->addTo(drawModeToolBar); 233 m_pEraseToolAction->addTo(drawModeToolBar);
235 m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) ); 234 m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) );
236 235
237 m_pTool = 0; 236 m_pTool = 0;
238 setRectangleTool(); 237 setRectangleTool();
239 setEllipseTool(); 238 setEllipseTool();
240 setPointTool(); 239 setPointTool();
241 240
242 emptyToolBar = new QToolBar(this); 241 emptyToolBar = new QToolBar(this);
243 emptyToolBar->setHorizontalStretchable(true); 242 emptyToolBar->setHorizontalStretchable(true);
244 emptyToolBar->addSeparator(); 243 emptyToolBar->addSeparator();
245 244
246 // init draw parameters toolbar 245 // init draw parameters toolbar
247 246
248 QToolBar* drawParametersToolBar = new QToolBar(this); 247 QToolBar* drawParametersToolBar = new QToolBar(this);
249 248
250 m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar); 249 m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar);
251 connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int))); 250 connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int)));
252 251
253 QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width")); 252 QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width"));
254 m_pPenWidthSpinBox->setValue(1); 253 m_pPenWidthSpinBox->setValue(1);
255 m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus); 254 m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus);
256 QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) ); 255 QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) );
257 256
258 m_pPenColorToolButton = new QToolButton(drawParametersToolBar); 257 m_pPenColorToolButton = new QToolButton(drawParametersToolBar);
259 m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor")); 258 m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor"));
260 QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) ); 259 QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) );
261 260
262 Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton); 261 Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, m_pPenColorToolButton);
263 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&))); 262 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&)));
264 263
265 QToolTip::add(m_pPenColorToolButton, tr("Pen Color")); 264 QToolTip::add(m_pPenColorToolButton, tr("Pen Color"));
266 m_pPenColorToolButton->setPopup(penColorPopupMenu); 265 m_pPenColorToolButton->setPopup(penColorPopupMenu);
267 m_pPenColorToolButton->setPopupDelay(0); 266 m_pPenColorToolButton->setPopupDelay(0);
268 267
269 changePenColor(Qt::black); 268 changePenColor(Qt::black);
270 269
271 m_pBrushColorToolButton = new QToolButton(drawParametersToolBar); 270 m_pBrushColorToolButton = new QToolButton(drawParametersToolBar);
272 m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor")); 271 m_pBrushColorToolButton->setPixmap(Resource::loadPixmap("drawpad/brushcolor"));
273 QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) ); 272 QWhatsThis::add( m_pBrushColorToolButton, tr( "Click here to select the color used when filling in areas." ) );
274 273
275 Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton); 274 Opie::OColorPopupMenu* brushColorPopupMenu = new Opie::OColorPopupMenu(Qt::white, m_pBrushColorToolButton);
276 connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&))); 275 connect(brushColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changeBrushColor(const QColor&)));
277 276
278 QToolTip::add(m_pBrushColorToolButton, tr("Fill Color")); 277 QToolTip::add(m_pBrushColorToolButton, tr("Fill Color"));
279 m_pBrushColorToolButton->setPopup(brushColorPopupMenu); 278 m_pBrushColorToolButton->setPopup(brushColorPopupMenu);
280 m_pBrushColorToolButton->setPopupDelay(0); 279 m_pBrushColorToolButton->setPopupDelay(0);
281 280
282 changeBrushColor(Qt::white); 281 changeBrushColor(Qt::white);
283 282
284 finishStartup(); 283 // delay the rest of the initialization and do it from within the mainloop
284 // if we don't do this, the widget layout may not be constructed upon
285 // and we will end up with a wrong QScrollview page size (Mickeyl)
286 QTimer::singleShot( 100, this, SLOT( finishStartup() ) );
285} 287}
286 288
287 289
288void DrawPad::finishStartup() 290void DrawPad::finishStartup()
289{ 291{
290 // init pages 292 // init pages
291 293
292 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 294 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
293 295
294 if (file.open(IO_ReadOnly)) { 296 if (file.open(IO_ReadOnly)) {
295 m_pDrawPadCanvas->load(&file); 297 m_pDrawPadCanvas->load(&file);
296 file.close(); 298 file.close();
297 } else { 299 } else {
298 m_pDrawPadCanvas->initialPage(); 300 m_pDrawPadCanvas->initialPage();
299 } 301 }
300 302
301 loadConfig(); 303 loadConfig();
302 304
303} 305}
304 306
305DrawPad::~DrawPad() 307DrawPad::~DrawPad()
306{ 308{
307 saveConfig(); 309 saveConfig();
308 310
309 QFile file(Global::applicationFileName("drawpad", "drawpad.xml")); 311 QFile file(Global::applicationFileName("drawpad", "drawpad.xml"));
310 312
311 if (file.open(IO_WriteOnly)) { 313 if (file.open(IO_WriteOnly)) {
312 m_pDrawPadCanvas->save(&file); 314 m_pDrawPadCanvas->save(&file);
313 file.close(); 315 file.close();
314 } 316 }
315} 317}
316 318
317bool DrawPad::antiAliasing() 319bool DrawPad::antiAliasing()
318{ 320{
319 return (m_pAntiAliasingAction->isOn()); 321 return (m_pAntiAliasingAction->isOn());
320} 322}
321 323
322void DrawPad::newPage() 324void DrawPad::newPage()
323{ 325{
324 QRect rect = m_pDrawPadCanvas->contentsRect(); 326 QRect rect = m_pDrawPadCanvas->contentsRect();
325 327
326 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); 328 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this);
327 329
328 if (newPageDialog.exec() == QDialog::Accepted) { 330 if (newPageDialog.exec() == QDialog::Accepted) {
329 m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(), 331 m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(),
330 newPageDialog.selectedHeight(), newPageDialog.selectedColor()); 332 newPageDialog.selectedHeight(), newPageDialog.selectedColor());
331 } 333 }
332} 334}
333 335
334void DrawPad::clearPage() 336void DrawPad::clearPage()
335{ 337{
336 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), 338 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"),
337 QMessageBox::Information, QMessageBox::Yes, 339 QMessageBox::Information, QMessageBox::Yes,
338 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 340 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
339 QMessageBox::NoButton, this); 341 QMessageBox::NoButton, this);
340 342
341 messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); 343 messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
342 messageBox.setButtonText(QMessageBox::No, tr("No")); 344 messageBox.setButtonText(QMessageBox::No, tr("No"));
343 345
344 if (messageBox.exec() == QMessageBox::Yes) { 346 if (messageBox.exec() == QMessageBox::Yes) {
345 m_pDrawPadCanvas->clearPage(); 347 m_pDrawPadCanvas->clearPage();
346 } 348 }
347} 349}
348 350
349void DrawPad::deletePage() 351void DrawPad::deletePage()
350{ 352{
351 QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), 353 QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"),
352 QMessageBox::Information, QMessageBox::Yes, 354 QMessageBox::Information, QMessageBox::Yes,
353 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 355 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
354 QMessageBox::NoButton, this); 356 QMessageBox::NoButton, this);
355 357
356 messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); 358 messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
357 messageBox.setButtonText(QMessageBox::No, tr("No")); 359 messageBox.setButtonText(QMessageBox::No, tr("No"));
358 360
359 if (messageBox.exec() == QMessageBox::Yes) { 361 if (messageBox.exec() == QMessageBox::Yes) {
360 m_pDrawPadCanvas->deletePage(); 362 m_pDrawPadCanvas->deletePage();
361 } 363 }
362} 364}
363 365
364void DrawPad::setPointTool() 366void DrawPad::setPointTool()
365{ 367{
366 if (m_pTool) { 368 if (m_pTool) {
367 delete m_pTool; 369 delete m_pTool;
368 } 370 }
369 371
370 m_pTool = new PointTool(this, m_pDrawPadCanvas); 372 m_pTool = new PointTool(this, m_pDrawPadCanvas);
371 373
372 m_pLineToolButton->setIconSet(m_pPointToolAction->iconSet()); 374 m_pLineToolButton->setIconSet(m_pPointToolAction->iconSet());
373 QToolTip::add(m_pLineToolButton, m_pPointToolAction->text()); 375 QToolTip::add(m_pLineToolButton, m_pPointToolAction->text());
374 376
375 disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); 377 disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0);
376 connect(m_pLineToolButton, SIGNAL(clicked()), m_pPointToolAction, SIGNAL(activated())); 378 connect(m_pLineToolButton, SIGNAL(clicked()), m_pPointToolAction, SIGNAL(activated()));
377 379
378 m_pLineToolButton->setOn(true); 380 m_pLineToolButton->setOn(true);
379 m_pRectangleToolButton->setOn(false); 381 m_pRectangleToolButton->setOn(false);
380 m_pEllipseToolButton->setOn(false); 382 m_pEllipseToolButton->setOn(false);
381 m_pTextToolAction->setOn(false); 383 m_pTextToolAction->setOn(false);
382 m_pFillToolAction->setOn(false); 384 m_pFillToolAction->setOn(false);
383 m_pEraseToolAction->setOn(false); 385 m_pEraseToolAction->setOn(false);
384} 386}
385 387
386void DrawPad::setLineTool() 388void DrawPad::setLineTool()
387{ 389{
388 if (m_pTool) { 390 if (m_pTool) {
389 delete m_pTool; 391 delete m_pTool;
390 } 392 }
391 393
392 m_pTool = new LineTool(this, m_pDrawPadCanvas); 394 m_pTool = new LineTool(this, m_pDrawPadCanvas);
393 395
394 m_pLineToolButton->setIconSet(m_pLineToolAction->iconSet()); 396 m_pLineToolButton->setIconSet(m_pLineToolAction->iconSet());
395 QToolTip::add(m_pLineToolButton, m_pLineToolAction->text()); 397 QToolTip::add(m_pLineToolButton, m_pLineToolAction->text());
396 398
397 disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0); 399 disconnect(m_pLineToolButton, SIGNAL(clicked()), 0, 0);
398 connect(m_pLineToolButton, SIGNAL(clicked()), m_pLineToolAction, SIGNAL(activated())); 400 connect(m_pLineToolButton, SIGNAL(clicked()), m_pLineToolAction, SIGNAL(activated()));
399 401
400 m_pLineToolButton->setOn(true); 402 m_pLineToolButton->setOn(true);
401 m_pRectangleToolButton->setOn(false); 403 m_pRectangleToolButton->setOn(false);
402 m_pEllipseToolButton->setOn(false); 404 m_pEllipseToolButton->setOn(false);
403 m_pTextToolAction->setOn(false); 405 m_pTextToolAction->setOn(false);
404 m_pFillToolAction->setOn(false); 406 m_pFillToolAction->setOn(false);
405 m_pEraseToolAction->setOn(false); 407 m_pEraseToolAction->setOn(false);
406} 408}
407 409
408void DrawPad::setRectangleTool() 410void DrawPad::setRectangleTool()
409{ 411{
410 if (m_pTool) { 412 if (m_pTool) {
411 delete m_pTool; 413 delete m_pTool;
412 } 414 }
413 415
414 m_pTool = new RectangleTool(this, m_pDrawPadCanvas); 416 m_pTool = new RectangleTool(this, m_pDrawPadCanvas);
415 417
416 m_pRectangleToolButton->setIconSet(m_pRectangleToolAction->iconSet()); 418 m_pRectangleToolButton->setIconSet(m_pRectangleToolAction->iconSet());
417 QToolTip::add(m_pRectangleToolButton, m_pRectangleToolAction->text()); 419 QToolTip::add(m_pRectangleToolButton, m_pRectangleToolAction->text());
418 420
419 disconnect(m_pRectangleToolButton, SIGNAL(clicked()), 0, 0); 421 disconnect(m_pRectangleToolButton, SIGNAL(clicked()), 0, 0);
420 connect(m_pRectangleToolButton, SIGNAL(clicked()), m_pRectangleToolAction, SIGNAL(activated())); 422 connect(m_pRectangleToolButton, SIGNAL(clicked()), m_pRectangleToolAction, SIGNAL(activated()));
421 423
422 m_pLineToolButton->setOn(false); 424 m_pLineToolButton->setOn(false);
423 m_pRectangleToolButton->setOn(true); 425 m_pRectangleToolButton->setOn(true);
424 m_pEllipseToolButton->setOn(false); 426 m_pEllipseToolButton->setOn(false);
425 m_pTextToolAction->setOn(false); 427 m_pTextToolAction->setOn(false);
426 m_pFillToolAction->setOn(false); 428 m_pFillToolAction->setOn(false);
427 m_pEraseToolAction->setOn(false); 429 m_pEraseToolAction->setOn(false);
428} 430}
429 431
430void DrawPad::setFilledRectangleTool() 432void DrawPad::setFilledRectangleTool()
431{ 433{
432 if (m_pTool) { 434 if (m_pTool) {
433 delete m_pTool; 435 delete m_pTool;
434 } 436 }
435 437
436 m_pTool = new FilledRectangleTool(this, m_pDrawPadCanvas); 438 m_pTool = new FilledRectangleTool(this, m_pDrawPadCanvas);
437 439
438 m_pRectangleToolButton->setIconSet(m_pFilledRectangleToolAction->iconSet()); 440 m_pRectangleToolButton->setIconSet(m_pFilledRectangleToolAction->iconSet());
439 QToolTip::add(m_pRectangleToolButton, m_pFilledRectangleToolAction->text()); 441 QToolTip::add(m_pRectangleToolButton, m_pFilledRectangleToolAction->text());
440 442
441 disconnect(m_pRectangleToolButton, SIGNAL(clicked()), 0, 0); 443 disconnect(m_pRectangleToolButton, SIGNAL(clicked()), 0, 0);
442 connect(m_pRectangleToolButton, SIGNAL(clicked()), m_pFilledRectangleToolAction, SIGNAL(activated())); 444 connect(m_pRectangleToolButton, SIGNAL(clicked()), m_pFilledRectangleToolAction, SIGNAL(activated()));
443 445
444 m_pLineToolButton->setOn(false); 446 m_pLineToolButton->setOn(false);
445 m_pRectangleToolButton->setOn(true); 447 m_pRectangleToolButton->setOn(true);
446 m_pEllipseToolButton->setOn(false); 448 m_pEllipseToolButton->setOn(false);
447 m_pTextToolAction->setOn(false); 449 m_pTextToolAction->setOn(false);
448 m_pFillToolAction->setOn(false); 450 m_pFillToolAction->setOn(false);
449 m_pEraseToolAction->setOn(false); 451 m_pEraseToolAction->setOn(false);
450} 452}
451 453
452void DrawPad::setEllipseTool() 454void DrawPad::setEllipseTool()
453{ 455{
454 if (m_pTool) { 456 if (m_pTool) {
455 delete m_pTool; 457 delete m_pTool;
456 } 458 }
457 459
458 m_pTool = new EllipseTool(this, m_pDrawPadCanvas); 460 m_pTool = new EllipseTool(this, m_pDrawPadCanvas);
459 461
460 m_pEllipseToolButton->setIconSet(m_pEllipseToolAction->iconSet()); 462 m_pEllipseToolButton->setIconSet(m_pEllipseToolAction->iconSet());
461 QToolTip::add(m_pEllipseToolButton, m_pEllipseToolAction->text()); 463 QToolTip::add(m_pEllipseToolButton, m_pEllipseToolAction->text());
462 464
463 disconnect(m_pEllipseToolButton, SIGNAL(clicked()), 0, 0); 465 disconnect(m_pEllipseToolButton, SIGNAL(clicked()), 0, 0);
464 connect(m_pEllipseToolButton, SIGNAL(clicked()), m_pEllipseToolAction, SIGNAL(activated())); 466 connect(m_pEllipseToolButton, SIGNAL(clicked()), m_pEllipseToolAction, SIGNAL(activated()));
465 467
466 m_pLineToolButton->setOn(false); 468 m_pLineToolButton->setOn(false);
467 m_pRectangleToolButton->setOn(false); 469 m_pRectangleToolButton->setOn(false);
468 m_pEllipseToolButton->setOn(true); 470 m_pEllipseToolButton->setOn(true);
469 m_pTextToolAction->setOn(false); 471 m_pTextToolAction->setOn(false);
470 m_pFillToolAction->setOn(false); 472 m_pFillToolAction->setOn(false);
471 m_pEraseToolAction->setOn(false); 473 m_pEraseToolAction->setOn(false);
472} 474}
473 475
474void DrawPad::setFilledEllipseTool() 476void DrawPad::setFilledEllipseTool()
475{ 477{
476 if (m_pTool) { 478 if (m_pTool) {
477 delete m_pTool; 479 delete m_pTool;
478 } 480 }
479 481
480 m_pTool = new FilledEllipseTool(this, m_pDrawPadCanvas); 482 m_pTool = new FilledEllipseTool(this, m_pDrawPadCanvas);
481 483
482 m_pEllipseToolButton->setIconSet(m_pFilledEllipseToolAction->iconSet()); 484 m_pEllipseToolButton->setIconSet(m_pFilledEllipseToolAction->iconSet());
483 QToolTip::add(m_pEllipseToolButton, m_pFilledEllipseToolAction->text()); 485 QToolTip::add(m_pEllipseToolButton, m_pFilledEllipseToolAction->text());
484 486
485 disconnect(m_pEllipseToolButton, SIGNAL(clicked()), 0, 0); 487 disconnect(m_pEllipseToolButton, SIGNAL(clicked()), 0, 0);
486 connect(m_pEllipseToolButton, SIGNAL(clicked()), m_pFilledEllipseToolAction, SIGNAL(activated())); 488 connect(m_pEllipseToolButton, SIGNAL(clicked()), m_pFilledEllipseToolAction, SIGNAL(activated()));
487 489
488 m_pLineToolButton->setOn(false); 490 m_pLineToolButton->setOn(false);
489 m_pRectangleToolButton->setOn(false); 491 m_pRectangleToolButton->setOn(false);
490 m_pEllipseToolButton->setOn(true); 492 m_pEllipseToolButton->setOn(true);
491 m_pTextToolAction->setOn(false); 493 m_pTextToolAction->setOn(false);
492 m_pFillToolAction->setOn(false); 494 m_pFillToolAction->setOn(false);
493 m_pEraseToolAction->setOn(false); 495 m_pEraseToolAction->setOn(false);
494} 496}
495 497
496void DrawPad::setTextTool() 498void DrawPad::setTextTool()
497{ 499{
498 if (m_pTool) { 500 if (m_pTool) {
499 delete m_pTool; 501 delete m_pTool;
500 } 502 }
501 503
502 m_pTool = new TextTool(this, m_pDrawPadCanvas); 504 m_pTool = new TextTool(this, m_pDrawPadCanvas);
503 505
504 m_pLineToolButton->setOn(false); 506 m_pLineToolButton->setOn(false);
505 m_pRectangleToolButton->setOn(false); 507 m_pRectangleToolButton->setOn(false);
506 m_pEllipseToolButton->setOn(false); 508 m_pEllipseToolButton->setOn(false);
507 m_pTextToolAction->setOn(true); 509 m_pTextToolAction->setOn(true);
508 m_pFillToolAction->setOn(false); 510 m_pFillToolAction->setOn(false);
509 m_pEraseToolAction->setOn(false); 511 m_pEraseToolAction->setOn(false);
510} 512}
511 513
512void DrawPad::setFillTool() 514void DrawPad::setFillTool()
513{ 515{
514 if (m_pTool) { 516 if (m_pTool) {
515 delete m_pTool; 517 delete m_pTool;
516 } 518 }
517 519
518 m_pTool = new FillTool(this, m_pDrawPadCanvas); 520 m_pTool = new FillTool(this, m_pDrawPadCanvas);
519 521
520 m_pLineToolButton->setOn(false); 522 m_pLineToolButton->setOn(false);
521 m_pRectangleToolButton->setOn(false); 523 m_pRectangleToolButton->setOn(false);
522 m_pEllipseToolButton->setOn(false); 524 m_pEllipseToolButton->setOn(false);
523 m_pTextToolAction->setOn(false); 525 m_pTextToolAction->setOn(false);
524 m_pFillToolAction->setOn(true); 526 m_pFillToolAction->setOn(true);
525 m_pEraseToolAction->setOn(false); 527 m_pEraseToolAction->setOn(false);
526} 528}
527 529
528void DrawPad::setEraseTool() 530void DrawPad::setEraseTool()
529{ 531{
530 if (m_pTool) { 532 if (m_pTool) {
531 delete m_pTool; 533 delete m_pTool;
532 } 534 }
533 535
534 m_pTool = new EraseTool(this, m_pDrawPadCanvas); 536 m_pTool = new EraseTool(this, m_pDrawPadCanvas);
535 537
536 m_pLineToolButton->setOn(false); 538 m_pLineToolButton->setOn(false);
537 m_pRectangleToolButton->setOn(false); 539 m_pRectangleToolButton->setOn(false);
538 m_pEllipseToolButton->setOn(false); 540 m_pEllipseToolButton->setOn(false);
539 m_pTextToolAction->setOn(false); 541 m_pTextToolAction->setOn(false);
540 m_pFillToolAction->setOn(false); 542 m_pFillToolAction->setOn(false);
541 m_pEraseToolAction->setOn(true); 543 m_pEraseToolAction->setOn(true);
542} 544}
543 545
544void DrawPad::changePenWidth(int value) 546void DrawPad::changePenWidth(int value)
545{ 547{
546 m_pen.setWidth(value); 548 m_pen.setWidth(value);
547} 549}
548 550
549void DrawPad::changePenColor(const QColor& color) 551void DrawPad::changePenColor(const QColor& color)
550{ 552{
551 m_pen.setColor(color); 553 m_pen.setColor(color);
552 554
553 QPainter painter; 555 QPainter painter;
554 painter.begin(m_pPenColorToolButton->pixmap()); 556 painter.begin(m_pPenColorToolButton->pixmap());
555 painter.fillRect(QRect(0, 12, 14, 2), m_pen.color()); 557 painter.fillRect(QRect(0, 12, 14, 2), m_pen.color());
556 painter.end(); 558 painter.end();
557 559
558 m_pPenColorToolButton->popup()->hide(); 560 m_pPenColorToolButton->popup()->hide();
559} 561}
560 562
561void DrawPad::changeBrushColor(const QColor& color) 563void DrawPad::changeBrushColor(const QColor& color)
562{ 564{
563 m_brush = QBrush(color); 565 m_brush = QBrush(color);
564 566
565 QPainter painter; 567 QPainter painter;
566 painter.begin(m_pBrushColorToolButton->pixmap()); 568 painter.begin(m_pBrushColorToolButton->pixmap());
567 painter.fillRect(QRect(0, 12, 14, 2), m_brush.color()); 569 painter.fillRect(QRect(0, 12, 14, 2), m_brush.color());
568 painter.end(); 570 painter.end();
569 571
570 m_pBrushColorToolButton->popup()->hide(); 572 m_pBrushColorToolButton->popup()->hide();
571} 573}
572 574
573void DrawPad::updateView() 575void DrawPad::updateView()
574{ 576{
575 uint pagePosition = m_pDrawPadCanvas->pagePosition(); 577 uint pagePosition = m_pDrawPadCanvas->pagePosition();
576 uint pageCount = m_pDrawPadCanvas->pageCount(); 578 uint pageCount = m_pDrawPadCanvas->pageCount();
577 579
578 setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) ); 580 setCaption( tr( "DrawPad - Page %1/%2" ).arg( pagePosition ).arg( pageCount ) );
579 581
580 m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled()); 582 m_pUndoAction->setEnabled(m_pDrawPadCanvas->currentPage()->undoEnabled());
581 m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled()); 583 m_pRedoAction->setEnabled(m_pDrawPadCanvas->currentPage()->redoEnabled());
582 584
583 m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); 585 m_pFirstPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled());
584 m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); 586 m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled());
585 m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); 587 m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled());
586 m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); 588 m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled());
587} 589}
588 590
589void DrawPad::deleteAll() 591void DrawPad::deleteAll()
590{ 592{
591 QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), 593 QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"),
592 QMessageBox::Information, QMessageBox::Yes, 594 QMessageBox::Information, QMessageBox::Yes,
593 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 595 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
594 QMessageBox::NoButton, this); 596 QMessageBox::NoButton, this);
595 597
596 messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); 598 messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
597 messageBox.setButtonText(QMessageBox::No, tr("No")); 599 messageBox.setButtonText(QMessageBox::No, tr("No"));
598 600
599 if (messageBox.exec() == QMessageBox::Yes) { 601 if (messageBox.exec() == QMessageBox::Yes) {
600 m_pDrawPadCanvas->deleteAll(); 602 m_pDrawPadCanvas->deleteAll();
601 } 603 }
602} 604}
603 605
604void DrawPad::importPage() 606void DrawPad::importPage()
605{ 607{
606 ImportDialog importDialog(this); 608 ImportDialog importDialog(this);
607 609
608 if ( QPEApplication::execDialog( &importDialog ) == QDialog::Accepted ) { 610 if ( QPEApplication::execDialog( &importDialog ) == QDialog::Accepted ) {
609 const DocLnk* docLnk = importDialog.selected(); 611 const DocLnk* docLnk = importDialog.selected();
610 612
611 if (docLnk) { 613 if (docLnk) {
612 m_pDrawPadCanvas->importPage(docLnk->file()); 614 m_pDrawPadCanvas->importPage(docLnk->file());
613 delete docLnk; 615 delete docLnk;
614 } 616 }
615 } 617 }
616} 618}
617 619
618void DrawPad::exportPage() 620void DrawPad::exportPage()
619{ 621{
620 ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this); 622 ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this);
621 623
622 if ( QPEApplication::execDialog( &exportDialog ) == QDialog::Accepted ) { 624 if ( QPEApplication::execDialog( &exportDialog ) == QDialog::Accepted ) {
623 m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(), 625 m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(),
624 exportDialog.selectedName(), exportDialog.selectedFormat()); 626 exportDialog.selectedName(), exportDialog.selectedFormat());
625 } 627 }
626} 628}
627 629
628void DrawPad::thumbnailView() 630void DrawPad::thumbnailView()
629{ 631{
630 ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this); 632 ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this);
631 633
632 QPEApplication::showWidget( &thumbnailView ); 634 QPEApplication::showWidget( &thumbnailView );
633 thumbnailView.exec(); 635 thumbnailView.exec();
634} 636}
635 637
636void DrawPad::pageInformation() 638void DrawPad::pageInformation()
637{ 639{
638 PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage()); 640 PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage());
639 641
640 if (pageInformationDialog.exec() == QDialog::Accepted) { 642 if (pageInformationDialog.exec() == QDialog::Accepted) {
641 m_pDrawPadCanvas->currentPage()->setTitle(pageInformationDialog.selectedTitle()); 643 m_pDrawPadCanvas->currentPage()->setTitle(pageInformationDialog.selectedTitle());
642 } 644 }
643} 645}
644 646
645void DrawPad::loadConfig() 647void DrawPad::loadConfig()
646{ 648{
647 Config config("drawpad"); 649 Config config("drawpad");
648 config.setGroup("General"); 650 config.setGroup("General");
649 651
650 m_pAntiAliasingAction->setOn(config.readBoolEntry("AntiAliasing", false)); 652 m_pAntiAliasingAction->setOn(config.readBoolEntry("AntiAliasing", false));
651 m_pPenWidthSpinBox->setValue(config.readNumEntry("PenWidth", 1)); 653 m_pPenWidthSpinBox->setValue(config.readNumEntry("PenWidth", 1));
652 changePenColor(QColor(config.readEntry("PenColor", Qt::black.name()))); 654 changePenColor(QColor(config.readEntry("PenColor", Qt::black.name())));
653 changeBrushColor(QColor(config.readEntry("BrushColor", Qt::white.name()))); 655 changeBrushColor(QColor(config.readEntry("BrushColor", Qt::white.name())));
654 m_pDrawPadCanvas->selectPage(config.readNumEntry("PagePosition", 1)); 656 m_pDrawPadCanvas->selectPage(config.readNumEntry("PagePosition", 1));
655} 657}
656 658
657void DrawPad::saveConfig() 659void DrawPad::saveConfig()
658{ 660{
659 Config config("drawpad"); 661 Config config("drawpad");
660 config.setGroup("General"); 662 config.setGroup("General");
661 663
662 config.writeEntry("PagePosition", (int)m_pDrawPadCanvas->pagePosition()); 664 config.writeEntry("PagePosition", (int)m_pDrawPadCanvas->pagePosition());
663 config.writeEntry("AntiAliasing", antiAliasing()); 665 config.writeEntry("AntiAliasing", antiAliasing());
664 config.writeEntry("PenWidth", (int)m_pen.width()); 666 config.writeEntry("PenWidth", (int)m_pen.width());
665 config.writeEntry("PenColor", m_pen.color().name()); 667 config.writeEntry("PenColor", m_pen.color().name());
666 config.writeEntry("BrushColor", m_brush.color().name()); 668 config.writeEntry("BrushColor", m_brush.color().name());
667} 669}
668 670
diff --git a/noncore/graphics/drawpad/drawpad.h b/noncore/graphics/drawpad/drawpad.h
index ba9e47d..63d3057 100644
--- a/noncore/graphics/drawpad/drawpad.h
+++ b/noncore/graphics/drawpad/drawpad.h
@@ -1,114 +1,115 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#ifndef DRAWPAD_H 14#ifndef DRAWPAD_H
15#define DRAWPAD_H 15#define DRAWPAD_H
16 16
17#include <qmainwindow.h> 17#include <qmainwindow.h>
18#include <qpen.h> 18#include <qpen.h>
19 19
20class DrawPadCanvas; 20class DrawPadCanvas;
21class Tool; 21class Tool;
22 22
23class QAction; 23class QAction;
24class QColor; 24class QColor;
25class QSpinBox; 25class QSpinBox;
26class QToolButton; 26class QToolButton;
27class QWidgetStack; 27class QWidgetStack;
28 28
29class DrawPad : public QMainWindow 29class DrawPad : public QMainWindow
30{ 30{
31 Q_OBJECT 31 Q_OBJECT
32 32
33public: 33public:
34 DrawPad(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 34 DrawPad(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
35 ~DrawPad(); 35 ~DrawPad();
36 36
37 static QString appName() { return QString::fromLatin1("drawpad"); } 37 static QString appName() { return QString::fromLatin1("drawpad"); }
38 38
39 Tool* tool() { return m_pTool; } 39 Tool* tool() { return m_pTool; }
40 QPen pen() { return m_pen; } 40 QPen pen() { return m_pen; }
41 QBrush brush() { return m_brush; } 41 QBrush brush() { return m_brush; }
42 42
43 bool antiAliasing(); 43 bool antiAliasing();
44 void finishStartup();
45 44
46private slots: 45private slots:
46 void finishStartup();
47
47 void newPage(); 48 void newPage();
48 void clearPage(); 49 void clearPage();
49 void deletePage(); 50 void deletePage();
50 51
51 void slotAppMessage( const QCString&, const QByteArray& ); 52 void slotAppMessage( const QCString&, const QByteArray& );
52 53
53 void setPointTool(); 54 void setPointTool();
54 void setLineTool(); 55 void setLineTool();
55 void setRectangleTool(); 56 void setRectangleTool();
56 void setFilledRectangleTool(); 57 void setFilledRectangleTool();
57 void setEllipseTool(); 58 void setEllipseTool();
58 void setFilledEllipseTool(); 59 void setFilledEllipseTool();
59 void setTextTool(); 60 void setTextTool();
60 void setFillTool(); 61 void setFillTool();
61 void setEraseTool(); 62 void setEraseTool();
62 63
63 void changePenWidth(int value); 64 void changePenWidth(int value);
64 void changePenColor(const QColor& color); 65 void changePenColor(const QColor& color);
65 void changeBrushColor(const QColor& color); 66 void changeBrushColor(const QColor& color);
66 67
67 void updateView(); 68 void updateView();
68 69
69 void deleteAll(); 70 void deleteAll();
70 void importPage(); 71 void importPage();
71 void exportPage(); 72 void exportPage();
72 void thumbnailView(); 73 void thumbnailView();
73 void pageInformation(); 74 void pageInformation();
74 75
75private: 76private:
76 void loadConfig(); 77 void loadConfig();
77 void saveConfig(); 78 void saveConfig();
78 79
79 DrawPadCanvas* m_pDrawPadCanvas; 80 DrawPadCanvas* m_pDrawPadCanvas;
80 81
81 Tool* m_pTool; 82 Tool* m_pTool;
82 QPen m_pen; 83 QPen m_pen;
83 QBrush m_brush; 84 QBrush m_brush;
84 85
85 QAction* m_pAntiAliasingAction; 86 QAction* m_pAntiAliasingAction;
86 87
87 QAction* m_pUndoAction; 88 QAction* m_pUndoAction;
88 QAction* m_pRedoAction; 89 QAction* m_pRedoAction;
89 90
90 QAction* m_pFirstPageAction; 91 QAction* m_pFirstPageAction;
91 QAction* m_pPreviousPageAction; 92 QAction* m_pPreviousPageAction;
92 QAction* m_pNextPageAction; 93 QAction* m_pNextPageAction;
93 QAction* m_pLastPageAction; 94 QAction* m_pLastPageAction;
94 95
95 QAction* m_pPointToolAction; 96 QAction* m_pPointToolAction;
96 QAction* m_pLineToolAction; 97 QAction* m_pLineToolAction;
97 QAction* m_pRectangleToolAction; 98 QAction* m_pRectangleToolAction;
98 QAction* m_pFilledRectangleToolAction; 99 QAction* m_pFilledRectangleToolAction;
99 QAction* m_pEllipseToolAction; 100 QAction* m_pEllipseToolAction;
100 QAction* m_pFilledEllipseToolAction; 101 QAction* m_pFilledEllipseToolAction;
101 QAction* m_pTextToolAction; 102 QAction* m_pTextToolAction;
102 QAction* m_pFillToolAction; 103 QAction* m_pFillToolAction;
103 QAction* m_pEraseToolAction; 104 QAction* m_pEraseToolAction;
104 105
105 QToolButton* m_pLineToolButton; 106 QToolButton* m_pLineToolButton;
106 QToolButton* m_pRectangleToolButton; 107 QToolButton* m_pRectangleToolButton;
107 QToolButton* m_pEllipseToolButton; 108 QToolButton* m_pEllipseToolButton;
108 QToolButton* m_pPenColorToolButton; 109 QToolButton* m_pPenColorToolButton;
109 QToolButton* m_pBrushColorToolButton; 110 QToolButton* m_pBrushColorToolButton;
110 111
111 QSpinBox* m_pPenWidthSpinBox; 112 QSpinBox* m_pPenWidthSpinBox;
112}; 113};
113 114
114#endif // DRAWPAD_H 115#endif // DRAWPAD_H
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index 423ef26..5d0c6e4 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -135,398 +135,400 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch)
135 r += l - '0'; 135 r += l - '0';
136 } else { 136 } else {
137 r += l - 'a' + 10; 137 r += l - 'a' + 10;
138 } 138 }
139 139
140 byteArray[i] = r; 140 byteArray[i] = r;
141 } 141 }
142 142
143 QImage image; 143 QImage image;
144 image.loadFromData((const uchar*)byteArray.data(), m_dataLenght, m_dataFormat); 144 image.loadFromData((const uchar*)byteArray.data(), m_dataLenght, m_dataFormat);
145 145
146 Page* page = new Page(m_title, image.width(), image.height()); 146 Page* page = new Page(m_title, image.width(), image.height());
147 page->setLastModified(m_date); 147 page->setLastModified(m_date);
148 page->pixmap()->convertFromImage(image); 148 page->pixmap()->convertFromImage(image);
149 m_pages.append(page); 149 m_pages.append(page);
150 } 150 }
151 151
152 return true; 152 return true;
153} 153}
154 154
155DrawPadCanvas::DrawPadCanvas(DrawPad* drawPad, QWidget* parent, const char* name) 155DrawPadCanvas::DrawPadCanvas(DrawPad* drawPad, QWidget* parent, const char* name)
156 : QScrollView(parent, name) 156 : QScrollView(parent, name)
157{ 157{
158 m_pDrawPad = drawPad; 158 m_pDrawPad = drawPad;
159 m_pages.setAutoDelete(true); 159 m_pages.setAutoDelete(true);
160 160
161 viewport()->setBackgroundMode(QWidget::NoBackground); 161 viewport()->setBackgroundMode(QWidget::NoBackground);
162} 162}
163 163
164DrawPadCanvas::~DrawPadCanvas() 164DrawPadCanvas::~DrawPadCanvas()
165{ 165{
166} 166}
167 167
168void DrawPadCanvas::load(QIODevice* ioDevice) 168void DrawPadCanvas::load(QIODevice* ioDevice)
169{ 169{
170 QTextStream textStream(ioDevice); 170 QTextStream textStream(ioDevice);
171 textStream.setCodec(QTextCodec::codecForName("UTF-8")); 171 textStream.setCodec(QTextCodec::codecForName("UTF-8"));
172 172
173 QXmlInputSource xmlInputSource(textStream); 173 QXmlInputSource xmlInputSource(textStream);
174 QXmlSimpleReader xmlSimpleReader; 174 QXmlSimpleReader xmlSimpleReader;
175 DrawPadCanvasXmlHandler drawPadCanvasXmlHandler; 175 DrawPadCanvasXmlHandler drawPadCanvasXmlHandler;
176 176
177 xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler); 177 xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler);
178 xmlSimpleReader.parse(xmlInputSource); 178 xmlSimpleReader.parse(xmlInputSource);
179 179
180 m_pages = drawPadCanvasXmlHandler.pages(); 180 m_pages = drawPadCanvasXmlHandler.pages();
181 181
182 if (m_pages.isEmpty()) { 182 if (m_pages.isEmpty()) {
183 m_pages.append(new Page("", 183 m_pages.append(new Page("",
184 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), 184 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
185 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); 185 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
186 m_pages.current()->pixmap()->fill(Qt::white); 186 m_pages.current()->pixmap()->fill(Qt::white);
187 } 187 }
188 188
189 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 189 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
190 viewport()->update(); 190 viewport()->update();
191 191
192 emit pagesChanged(); 192 emit pagesChanged();
193} 193}
194 194
195void DrawPadCanvas::initialPage() 195void DrawPadCanvas::initialPage()
196{ 196{
197 m_pages.append(new Page("", 197 m_pages.append(new Page("",
198 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), 198 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
199 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); 199 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
200 //236, 232)); no more fixed sizes 200 //236, 232)); no more fixed sizes
201 201
202 m_pages.current()->pixmap()->fill(Qt::white); 202 m_pages.current()->pixmap()->fill(Qt::white);
203 203
204 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 204 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
205 viewport()->update(); 205 viewport()->update();
206 206
207 emit pagesChanged(); 207 emit pagesChanged();
208} 208}
209 209
210void DrawPadCanvas::save(QIODevice* ioDevice) 210void DrawPadCanvas::save(QIODevice* ioDevice)
211{ 211{
212 QTextStream textStream(ioDevice); 212 QTextStream textStream(ioDevice);
213 textStream.setCodec(QTextCodec::codecForName("UTF-8")); 213 textStream.setCodec(QTextCodec::codecForName("UTF-8"));
214 214
215 textStream << "<drawpad>" << endl; 215 textStream << "<drawpad>" << endl;
216 textStream << " <images>" << endl; 216 textStream << " <images>" << endl;
217 217
218 QListIterator<Page> bufferIterator(m_pages); 218 QListIterator<Page> bufferIterator(m_pages);
219 219
220 for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) { 220 for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) {
221 textStream << " <image>" << endl; 221 textStream << " <image>" << endl;
222 textStream << " <title>" << bufferIterator.current()->title() << "</title>" << endl; 222 textStream << " <title>" << bufferIterator.current()->title() << "</title>" << endl;
223 223
224 int intDate = QDateTime(QDate(1970, 1, 1)).secsTo(bufferIterator.current()->lastModified()); 224 int intDate = QDateTime(QDate(1970, 1, 1)).secsTo(bufferIterator.current()->lastModified());
225 textStream << " <date>" << intDate << "</date>" << endl; 225 textStream << " <date>" << intDate << "</date>" << endl;
226 226
227 QImage image = bufferIterator.current()->pixmap()->convertToImage(); 227 QImage image = bufferIterator.current()->pixmap()->convertToImage();
228 QByteArray byteArray; 228 QByteArray byteArray;
229 QBuffer buffer(byteArray); 229 QBuffer buffer(byteArray);
230 QImageIO imageIO(&buffer, "PNG"); 230 QImageIO imageIO(&buffer, "PNG");
231 231
232 buffer.open(IO_WriteOnly); 232 buffer.open(IO_WriteOnly);
233 imageIO.setImage(image); 233 imageIO.setImage(image);
234 imageIO.write(); 234 imageIO.write();
235 buffer.close(); 235 buffer.close();
236 236
237 textStream << " <data length=\"" << byteArray.size() << "\" format=\"PNG\">"; 237 textStream << " <data length=\"" << byteArray.size() << "\" format=\"PNG\">";
238 238
239 static const char hexchars[] = "0123456789abcdef"; 239 static const char hexchars[] = "0123456789abcdef";
240 240
241 for (int i = 0; i < (int)byteArray.size(); i++ ) { 241 for (int i = 0; i < (int)byteArray.size(); i++ ) {
242 uchar s = (uchar)byteArray[i]; 242 uchar s = (uchar)byteArray[i];
243 textStream << hexchars[s >> 4]; 243 textStream << hexchars[s >> 4];
244 textStream << hexchars[s & 0x0f]; 244 textStream << hexchars[s & 0x0f];
245 } 245 }
246 246
247 textStream << "</data>" << endl; 247 textStream << "</data>" << endl;
248 textStream << " </image>" << endl; 248 textStream << " </image>" << endl;
249 } 249 }
250 250
251 textStream << " </images>" << endl; 251 textStream << " </images>" << endl;
252 textStream << "</drawpad>"; 252 textStream << "</drawpad>";
253} 253}
254 254
255void DrawPadCanvas::importPage(const QString& fileName) 255void DrawPadCanvas::importPage(const QString& fileName)
256{ 256{
257 Page* importedPage = new Page(); 257 Page* importedPage = new Page();
258 258
259 importedPage->pixmap()->load(fileName); 259 importedPage->pixmap()->load(fileName);
260 m_pages.insert(m_pages.at() + 1, importedPage); 260 m_pages.insert(m_pages.at() + 1, importedPage);
261 261
262 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 262 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
263 viewport()->update(); 263 viewport()->update();
264 264
265 emit pagesChanged(); 265 emit pagesChanged();
266} 266}
267 267
268void DrawPadCanvas::importPixmap( const QPixmap& pix ) { 268void DrawPadCanvas::importPixmap( const QPixmap& pix ) {
269 Page* importedPage = new Page(); 269 Page* importedPage = new Page();
270 270
271 (*importedPage->pixmap()) = pix; 271 (*importedPage->pixmap()) = pix;
272 m_pages.insert(m_pages.at()+1, importedPage ); 272 m_pages.insert(m_pages.at()+1, importedPage );
273 resizeContents(m_pages.current()->pixmap()->width(), 273 resizeContents(m_pages.current()->pixmap()->width(),
274 m_pages.current()->pixmap()->height() ); 274 m_pages.current()->pixmap()->height() );
275 viewport()->update(); 275 viewport()->update();
276 276
277 emit pagesChanged(); 277 emit pagesChanged();
278} 278}
279 279
280void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,const QString& format) 280void DrawPadCanvas::exportPage(uint fromPage, uint toPage, const QString& name,const QString& format)
281{ 281{
282 if (fromPage == toPage) { 282 if (fromPage == toPage) {
283 DocLnk docLnk; 283 DocLnk docLnk;
284 MimeType mimeType(format); 284 MimeType mimeType(format);
285 285
286 docLnk.setName(name); 286 docLnk.setName(name);
287 docLnk.setType(mimeType.id()); 287 docLnk.setType(mimeType.id());
288 288
289 FileManager fileManager; 289 FileManager fileManager;
290 QIODevice* ioDevice = fileManager.saveFile(docLnk); 290 QIODevice* ioDevice = fileManager.saveFile(docLnk);
291 QImageIO imageIO(ioDevice, format); 291 QImageIO imageIO(ioDevice, format);
292 292
293 QImage image = m_pages.current()->pixmap()->convertToImage(); 293 QImage image = m_pages.current()->pixmap()->convertToImage();
294 imageIO.setImage(image); 294 imageIO.setImage(image);
295 imageIO.write(); 295 imageIO.write();
296 delete ioDevice; 296 delete ioDevice;
297 } else { 297 } else {
298 for (uint i = fromPage; i <= toPage; i++) { 298 for (uint i = fromPage; i <= toPage; i++) {
299 DocLnk docLnk; 299 DocLnk docLnk;
300 MimeType mimeType(format); 300 MimeType mimeType(format);
301 301
302 docLnk.setName(name + QString::number(i)); 302 docLnk.setName(name + QString::number(i));
303 docLnk.setType(mimeType.id()); 303 docLnk.setType(mimeType.id());
304 304
305 FileManager fileManager; 305 FileManager fileManager;
306 QIODevice* ioDevice = fileManager.saveFile(docLnk); 306 QIODevice* ioDevice = fileManager.saveFile(docLnk);
307 QImageIO imageIO(ioDevice, format); 307 QImageIO imageIO(ioDevice, format);
308 308
309 QImage image = m_pages.at(i - 1)->pixmap()->convertToImage(); 309 QImage image = m_pages.at(i - 1)->pixmap()->convertToImage();
310 imageIO.setImage(image); 310 imageIO.setImage(image);
311 imageIO.write(); 311 imageIO.write();
312 delete ioDevice; 312 delete ioDevice;
313 } 313 }
314 } 314 }
315} 315}
316 316
317Page* DrawPadCanvas::currentPage() 317Page* DrawPadCanvas::currentPage()
318{ 318{
319 return m_pages.current(); 319 return m_pages.current();
320} 320}
321 321
322QList<Page> DrawPadCanvas::pages() 322QList<Page> DrawPadCanvas::pages()
323{ 323{
324 return m_pages; 324 return m_pages;
325} 325}
326 326
327uint DrawPadCanvas::pagePosition() 327uint DrawPadCanvas::pagePosition()
328{ 328{
329 return (m_pages.at() + 1); 329 return (m_pages.at() + 1);
330} 330}
331 331
332uint DrawPadCanvas::pageCount() 332uint DrawPadCanvas::pageCount()
333{ 333{
334 return m_pages.count(); 334 return m_pages.count();
335} 335}
336 336
337void DrawPadCanvas::selectPage(Page* page) 337void DrawPadCanvas::selectPage(Page* page)
338{ 338{
339 m_pages.findRef(page); 339 m_pages.findRef(page);
340 340
341 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 341 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
342 viewport()->update(); 342 viewport()->update();
343 343
344 emit pagesChanged(); 344 emit pagesChanged();
345} 345}
346 346
347void DrawPadCanvas::backupPage() 347void DrawPadCanvas::backupPage()
348{ 348{
349 m_pages.current()->backup(); 349 m_pages.current()->backup();
350 350
351 emit pagesChanged(); 351 emit pagesChanged();
352} 352}
353 353
354void DrawPadCanvas::selectPage(uint pagePosition) 354void DrawPadCanvas::selectPage(uint pagePosition)
355{ 355{
356 m_pages.at(pagePosition - 1); 356 m_pages.at(pagePosition - 1);
357 357
358 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 358 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
359 viewport()->update(); 359 viewport()->update();
360 360
361 emit pagesChanged(); 361 emit pagesChanged();
362} 362}
363 363
364void DrawPadCanvas::deleteAll() 364void DrawPadCanvas::deleteAll()
365{ 365{
366 m_pages.clear(); 366 m_pages.clear();
367 367
368 m_pages.append(new Page("", 368 m_pages.append(new Page("",
369 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), 369 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
370 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); 370 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
371 371
372 m_pages.current()->pixmap()->fill(Qt::white); 372 m_pages.current()->pixmap()->fill(Qt::white);
373 373
374 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 374 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
375 viewport()->update(); 375 viewport()->update();
376 376
377 emit pagesChanged(); 377 emit pagesChanged();
378} 378}
379 379
380void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color) 380void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color)
381{ 381{
382 m_pages.insert(m_pages.at() + 1, new Page(title, width, height)); 382 m_pages.insert(m_pages.at() + 1, new Page(title, width, height));
383 m_pages.current()->pixmap()->fill(color); 383 m_pages.current()->pixmap()->fill(color);
384 384
385 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 385 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
386 viewport()->update(); 386 viewport()->update();
387 387
388 emit pagesChanged(); 388 emit pagesChanged();
389} 389}
390 390
391void DrawPadCanvas::clearPage() 391void DrawPadCanvas::clearPage()
392{ 392{
393 m_pages.current()->pixmap()->fill(Qt::white); 393 m_pages.current()->pixmap()->fill(Qt::white);
394 394
395 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 395 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
396 viewport()->update(); 396 viewport()->update();
397} 397}
398 398
399void DrawPadCanvas::deletePage() 399void DrawPadCanvas::deletePage()
400{ 400{
401 m_pages.remove(m_pages.current()); 401 m_pages.remove(m_pages.current());
402 402
403 if (m_pages.isEmpty()) { 403 if (m_pages.isEmpty()) {
404 m_pages.append(new Page("", 404 m_pages.append(new Page("",
405 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0), 405 clipper()->width()+(verticalScrollBar()->isVisible()?verticalScrollBar()->width():0),
406 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0))); 406 clipper()->height()+(horizontalScrollBar()->isVisible()?horizontalScrollBar()->height():0)));
407 407
408 m_pages.current()->pixmap()->fill(Qt::white); 408 m_pages.current()->pixmap()->fill(Qt::white);
409 } 409 }
410 410
411 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 411 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
412 viewport()->update(); 412 viewport()->update();
413 413
414 emit pagesChanged(); 414 emit pagesChanged();
415} 415}
416 416
417void DrawPadCanvas::movePageUp() 417void DrawPadCanvas::movePageUp()
418{ 418{
419 int index = m_pages.at(); 419 int index = m_pages.at();
420 Page* page = m_pages.take(); 420 Page* page = m_pages.take();
421 m_pages.insert(index - 1, page); 421 m_pages.insert(index - 1, page);
422 422
423 emit pagesChanged(); 423 emit pagesChanged();
424} 424}
425 425
426void DrawPadCanvas::movePageDown() 426void DrawPadCanvas::movePageDown()
427{ 427{
428 int index = m_pages.at(); 428 int index = m_pages.at();
429 Page* page = m_pages.take(); 429 Page* page = m_pages.take();
430 m_pages.insert(index + 1, page); 430 m_pages.insert(index + 1, page);
431 431
432 emit pagesChanged(); 432 emit pagesChanged();
433} 433}
434 434
435bool DrawPadCanvas::goPreviousPageEnabled() 435bool DrawPadCanvas::goPreviousPageEnabled()
436{ 436{
437 return (m_pages.current() != m_pages.getFirst()); 437 return (m_pages.current() != m_pages.getFirst());
438} 438}
439 439
440bool DrawPadCanvas::goNextPageEnabled() 440bool DrawPadCanvas::goNextPageEnabled()
441{ 441{
442 return (m_pages.current() != m_pages.getLast()); 442 return (m_pages.current() != m_pages.getLast());
443} 443}
444 444
445void DrawPadCanvas::undo() 445void DrawPadCanvas::undo()
446{ 446{
447 m_pages.current()->undo(); 447 m_pages.current()->undo();
448 448
449 viewport()->update(); 449 viewport()->update();
450 450
451 emit pagesChanged(); 451 emit pagesChanged();
452} 452}
453 453
454void DrawPadCanvas::redo() 454void DrawPadCanvas::redo()
455{ 455{
456 m_pages.current()->redo(); 456 m_pages.current()->redo();
457 457
458 viewport()->update(); 458 viewport()->update();
459 459
460 emit pagesChanged(); 460 emit pagesChanged();
461} 461}
462 462
463void DrawPadCanvas::goFirstPage() 463void DrawPadCanvas::goFirstPage()
464{ 464{
465 m_pages.first(); 465 m_pages.first();
466 466
467 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 467 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
468 viewport()->update(); 468 viewport()->update();
469 469
470 emit pagesChanged(); 470 emit pagesChanged();
471} 471}
472 472
473void DrawPadCanvas::goPreviousPage() 473void DrawPadCanvas::goPreviousPage()
474{ 474{
475 m_pages.prev(); 475 m_pages.prev();
476 476
477 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 477 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
478 viewport()->update(); 478 viewport()->update();
479 479
480 emit pagesChanged(); 480 emit pagesChanged();
481} 481}
482 482
483void DrawPadCanvas::goNextPage() 483void DrawPadCanvas::goNextPage()
484{ 484{
485 m_pages.next(); 485 m_pages.next();
486 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 486 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
487 viewport()->update(); 487 viewport()->update();
488 488
489 emit pagesChanged(); 489 emit pagesChanged();
490} 490}
491 491
492void DrawPadCanvas::goLastPage() 492void DrawPadCanvas::goLastPage()
493{ 493{
494 m_pages.last(); 494 m_pages.last();
495 495
496 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 496 resizeContents(m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height());
497 viewport()->update(); 497 viewport()->update();
498 498
499 emit pagesChanged(); 499 emit pagesChanged();
500} 500}
501 501
502void DrawPadCanvas::contentsMousePressEvent(QMouseEvent* e) 502void DrawPadCanvas::contentsMousePressEvent(QMouseEvent* e)
503{ 503{
504 m_pDrawPad->tool()->mousePressEvent(e); 504 m_pDrawPad->tool()->mousePressEvent(e);
505} 505}
506 506
507void DrawPadCanvas::contentsMouseReleaseEvent(QMouseEvent* e) 507void DrawPadCanvas::contentsMouseReleaseEvent(QMouseEvent* e)
508{ 508{
509 m_pDrawPad->tool()->mouseReleaseEvent(e); 509 m_pDrawPad->tool()->mouseReleaseEvent(e);
510} 510}
511 511
512void DrawPadCanvas::contentsMouseMoveEvent(QMouseEvent* e) 512void DrawPadCanvas::contentsMouseMoveEvent(QMouseEvent* e)
513{ 513{
514 m_pDrawPad->tool()->mouseMoveEvent(e); 514 m_pDrawPad->tool()->mouseMoveEvent(e);
515} 515}
516 516
517void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 517void DrawPadCanvas::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
518{ 518{
519 Page* currentPage = m_pages.current();
520 if ( !currentPage ) return; // no page yet --> initialization not finished (Mickeyl)
519 QRect clipRect(cx, cy, cw, ch); 521 QRect clipRect(cx, cy, cw, ch);
520 QRect pixmapRect(0, 0, m_pages.current()->pixmap()->width(), m_pages.current()->pixmap()->height()); 522 QRect pixmapRect(0, 0, currentPage->pixmap()->width(), m_pages.current()->pixmap()->height());
521 QRect drawRect = pixmapRect.intersect(clipRect); 523 QRect drawRect = pixmapRect.intersect(clipRect);
522 524
523 p->drawPixmap(drawRect.topLeft(), *(m_pages.current()->pixmap()), drawRect); 525 p->drawPixmap(drawRect.topLeft(), *(currentPage->pixmap()), drawRect);
524 526
525 if (drawRect.right() < clipRect.right()) { 527 if (drawRect.right() < clipRect.right()) {
526 p->fillRect(drawRect.right() + 1, cy, cw - drawRect.width(), ch, colorGroup().dark()); 528 p->fillRect(drawRect.right() + 1, cy, cw - drawRect.width(), ch, colorGroup().dark());
527 } 529 }
528 530
529 if (drawRect.bottom() < clipRect.bottom()) { 531 if (drawRect.bottom() < clipRect.bottom()) {
530 p->fillRect(cx, drawRect.bottom() + 1, cw, ch - drawRect.height(), colorGroup().dark()); 532 p->fillRect(cx, drawRect.bottom() + 1, cw, ch - drawRect.height(), colorGroup().dark());
531 } 533 }
532} 534}
diff --git a/noncore/graphics/drawpad/main.cpp b/noncore/graphics/drawpad/main.cpp
index e48bb2e..f468022 100644
--- a/noncore/graphics/drawpad/main.cpp
+++ b/noncore/graphics/drawpad/main.cpp
@@ -1,20 +1,19 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * DrawPad - a drawing program for Opie Environment * 3 * DrawPad - a drawing program for Opie Environment *
4 * * 4 * *
5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> * 5 * (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
6 * * 6 * *
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "drawpad.h" 14#include "drawpad.h"
15 15
16#include <opie2/oapplicationfactory.h> 16#include <opie2/oapplicationfactory.h>
17 17
18using namespace Opie::Core; 18using namespace Opie::Core;
19using namespace Opie::Core;
20OPIE_EXPORT_APP( OApplicationFactory<DrawPad> ) 19OPIE_EXPORT_APP( OApplicationFactory<DrawPad> )