summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp6
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.cpp50
-rw-r--r--noncore/graphics/drawpad/drawpadcanvas.h2
-rw-r--r--noncore/graphics/drawpad/newpagedialog.cpp5
-rw-r--r--noncore/graphics/drawpad/newpagedialog.h1
-rw-r--r--noncore/graphics/drawpad/page.cpp6
-rw-r--r--noncore/graphics/drawpad/page.h4
-rw-r--r--noncore/graphics/drawpad/thumbnailview.cpp4
8 files changed, 57 insertions, 21 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index 369e7f0..45fb886 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -14,24 +14,25 @@
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 "pageinformationdialog.h" 27#include "pageinformationdialog.h"
27#include "pointtool.h" 28#include "pointtool.h"
28#include "rectangletool.h" 29#include "rectangletool.h"
29#include "texttool.h" 30#include "texttool.h"
30#include "thumbnailview.h" 31#include "thumbnailview.h"
31 32
32#include <opie/colordialog.h> 33#include <opie/colordialog.h>
33#include <opie/colorpopupmenu.h> 34#include <opie/colorpopupmenu.h>
34 35
35#include <qpe/applnk.h> 36#include <qpe/applnk.h>
36#include <qpe/global.h> 37#include <qpe/global.h>
37#include <qpe/qpemenubar.h> 38#include <qpe/qpemenubar.h>
@@ -272,26 +273,26 @@ DrawPad::~DrawPad()
272 m_pDrawPadCanvas->save(&file); 273 m_pDrawPadCanvas->save(&file);
273 file.close(); 274 file.close();
274 } 275 }
275} 276}
276 277
277void DrawPad::newPage() 278void DrawPad::newPage()
278{ 279{
279 QRect rect = m_pDrawPadCanvas->contentsRect(); 280 QRect rect = m_pDrawPadCanvas->contentsRect();
280 281
281 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); 282 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this);
282 283
283 if (newPageDialog.exec() == QDialog::Accepted) { 284 if (newPageDialog.exec() == QDialog::Accepted) {
284 m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), 285 m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(),
285 newPageDialog.selectedColor()); 286 newPageDialog.selectedHeight(), newPageDialog.selectedColor());
286 } 287 }
287} 288}
288 289
289void DrawPad::clearPage() 290void DrawPad::clearPage()
290{ 291{
291 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), 292 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"),
292 QMessageBox::Information, QMessageBox::Yes, 293 QMessageBox::Information, QMessageBox::Yes,
293 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 294 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
294 QMessageBox::NoButton, this); 295 QMessageBox::NoButton, this);
295 296
296 messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); 297 messageBox.setButtonText(QMessageBox::Yes, tr("Yes"));
297 messageBox.setButtonText(QMessageBox::No, tr("No")); 298 messageBox.setButtonText(QMessageBox::No, tr("No"));
@@ -595,14 +596,15 @@ void DrawPad::thumbnailView()
595{ 596{
596 ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this); 597 ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this);
597 598
598 thumbnailView.showMaximized(); 599 thumbnailView.showMaximized();
599 thumbnailView.exec(); 600 thumbnailView.exec();
600} 601}
601 602
602void DrawPad::pageInformation() 603void DrawPad::pageInformation()
603{ 604{
604 PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage()); 605 PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage());
605 606
606 if (pageInformationDialog.exec() == QDialog::Accepted) { 607 if (pageInformationDialog.exec() == QDialog::Accepted) {
608 m_pDrawPadCanvas->currentPage()->setTitle(pageInformationDialog.selectedTitle());
607 } 609 }
608} 610}
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp
index bcb6877..dcf0871 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.cpp
+++ b/noncore/graphics/drawpad/drawpadcanvas.cpp
@@ -38,28 +38,32 @@ public:
38 38
39 QList<Page> pages(); 39 QList<Page> pages();
40 40
41 bool startElement(const QString& namespaceURI, const QString& localName, 41 bool startElement(const QString& namespaceURI, const QString& localName,
42 const QString& qName, const QXmlAttributes& atts); 42 const QString& qName, const QXmlAttributes& atts);
43 bool endElement(const QString& namespaceURI, const QString& localName, 43 bool endElement(const QString& namespaceURI, const QString& localName,
44 const QString& qName); 44 const QString& qName);
45 bool characters(const QString& ch); 45 bool characters(const QString& ch);
46 46
47private: 47private:
48 enum State { 48 enum State {
49 Unknown, 49 Unknown,
50 InTitle,
51 InDate,
50 InData 52 InData
51 }; 53 };
52 54
53 State m_state; 55 State m_state;
56 QString m_title;
57 QDateTime m_date;
54 ulong m_dataLenght; 58 ulong m_dataLenght;
55 QString m_dataFormat; 59 QString m_dataFormat;
56 QList<Page> m_pages; 60 QList<Page> m_pages;
57}; 61};
58 62
59DrawPadCanvasXmlHandler::DrawPadCanvasXmlHandler() 63DrawPadCanvasXmlHandler::DrawPadCanvasXmlHandler()
60{ 64{
61 m_state = Unknown; 65 m_state = Unknown;
62} 66}
63 67
64DrawPadCanvasXmlHandler::~DrawPadCanvasXmlHandler() 68DrawPadCanvasXmlHandler::~DrawPadCanvasXmlHandler()
65{ 69{
@@ -67,53 +71,68 @@ DrawPadCanvasXmlHandler::~DrawPadCanvasXmlHandler()
67 71
68QList<Page> DrawPadCanvasXmlHandler::pages() 72QList<Page> DrawPadCanvasXmlHandler::pages()
69{ 73{
70 return m_pages; 74 return m_pages;
71} 75}
72 76
73bool DrawPadCanvasXmlHandler::startElement(const QString& namespaceURI, const QString& localName, 77bool DrawPadCanvasXmlHandler::startElement(const QString& namespaceURI, const QString& localName,
74 const QString& qName, const QXmlAttributes& atts) 78 const QString& qName, const QXmlAttributes& atts)
75{ 79{
76 Q_CONST_UNUSED(namespaceURI) 80 Q_CONST_UNUSED(namespaceURI)
77 Q_CONST_UNUSED(localName) 81 Q_CONST_UNUSED(localName)
78 82
79 if (qName.compare("data") == 0) { 83 if (qName == "image") {
84 m_title = QString();
85 m_date = QDateTime(QDate(1970, 1, 1));
86 } else if (qName == "title") {
87 m_state = InTitle;
88 } else if (qName == "date") {
89 m_state = InDate;
90 } else if (qName == "data") {
80 m_state = InData; 91 m_state = InData;
81 m_dataLenght = atts.value("length").toULong(); 92 m_dataLenght = atts.value("length").toULong();
82 m_dataFormat = atts.value("format"); 93 m_dataFormat = atts.value("format");
83 94
84 if (m_dataFormat.isEmpty()) { 95 if (m_dataFormat.isEmpty()) {
85 m_dataFormat = "XPM"; 96 m_dataFormat = "XPM";
86 } 97 }
87 } 98 }
88 99
89 return true; 100 return true;
90} 101}
91 102
92bool DrawPadCanvasXmlHandler::endElement(const QString& namespaceURI, const QString& localName, 103bool DrawPadCanvasXmlHandler::endElement(const QString& namespaceURI, const QString& localName,
93 const QString& qName) 104 const QString& qName)
94{ 105{
95 Q_CONST_UNUSED(namespaceURI) 106 Q_CONST_UNUSED(namespaceURI)
96 Q_CONST_UNUSED(localName) 107 Q_CONST_UNUSED(localName)
97 108
98 if (qName.compare("data") == 0) { 109 if (qName == "title") {
110 m_state = Unknown;
111 } else if (qName == "date") {
112 m_state = Unknown;
113 } else if (qName == "data") {
99 m_state = Unknown; 114 m_state = Unknown;
100 } 115 }
101 116
102 return true; 117 return true;
103} 118}
104 119
105bool DrawPadCanvasXmlHandler::characters(const QString& ch) 120bool DrawPadCanvasXmlHandler::characters(const QString& ch)
106{ 121{
107 if (m_state == InData) { 122 if (m_state == InTitle) {
123 m_title = ch;
124 } else if (m_state == InDate) {
125 m_date = m_date.addSecs(ch.toInt());
126 } else if (m_state == InData) {
108 QByteArray byteArray(ch.length() / 2); 127 QByteArray byteArray(ch.length() / 2);
109 128
110 for (int i = 0; i < (int)ch.length() / 2; i++) { 129 for (int i = 0; i < (int)ch.length() / 2; i++) {
111 char h = ch[2 * i].latin1(); 130 char h = ch[2 * i].latin1();
112 char l = ch[2 * i + 1].latin1(); 131 char l = ch[2 * i + 1].latin1();
113 uchar r = 0; 132 uchar r = 0;
114 133
115 if (h <= '9') { 134 if (h <= '9') {
116 r += h - '0'; 135 r += h - '0';
117 } else { 136 } else {
118 r += h - 'a' + 10; 137 r += h - 'a' + 10;
119 } 138 }
@@ -136,25 +155,26 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch)
136 if (m_dataLenght < ch.length() * 5) { 155 if (m_dataLenght < ch.length() * 5) {
137 m_dataLenght = ch.length() * 5; 156 m_dataLenght = ch.length() * 5;
138 } 157 }
139 158
140 QByteArray byteArrayUnzipped(m_dataLenght); 159 QByteArray byteArrayUnzipped(m_dataLenght);
141 ::uncompress((uchar*)byteArrayUnzipped.data(), &m_dataLenght, (uchar*)byteArray.data(), byteArray.size()); 160 ::uncompress((uchar*)byteArrayUnzipped.data(), &m_dataLenght, (uchar*)byteArray.data(), byteArray.size());
142 161
143 image.loadFromData((const uchar*)byteArrayUnzipped.data(), m_dataLenght, m_dataFormat); 162 image.loadFromData((const uchar*)byteArrayUnzipped.data(), m_dataLenght, m_dataFormat);
144 } else { 163 } else {
145 image.loadFromData((const uchar*)byteArray.data(), m_dataLenght, m_dataFormat); 164 image.loadFromData((const uchar*)byteArray.data(), m_dataLenght, m_dataFormat);
146 } 165 }
147 166
148 Page* page = new Page(image.width(), image.height()); 167 Page* page = new Page(m_title, image.width(), image.height());
168 page->setLastModified(m_date);
149 page->convertFromImage(image); 169 page->convertFromImage(image);
150 m_pages.append(page); 170 m_pages.append(page);
151 } 171 }
152 172
153 return true; 173 return true;
154} 174}
155 175
156DrawPadCanvas::DrawPadCanvas(DrawPad* drawPad, QWidget* parent, const char* name) 176DrawPadCanvas::DrawPadCanvas(DrawPad* drawPad, QWidget* parent, const char* name)
157 : QScrollView(parent, name) 177 : QScrollView(parent, name)
158{ 178{
159 m_pDrawPad = drawPad; 179 m_pDrawPad = drawPad;
160 m_pages.setAutoDelete(true); 180 m_pages.setAutoDelete(true);
@@ -173,65 +193,69 @@ void DrawPadCanvas::load(QIODevice* ioDevice)
173 textStream.setCodec(QTextCodec::codecForName("UTF-8")); 193 textStream.setCodec(QTextCodec::codecForName("UTF-8"));
174 194
175 QXmlInputSource xmlInputSource(textStream); 195 QXmlInputSource xmlInputSource(textStream);
176 QXmlSimpleReader xmlSimpleReader; 196 QXmlSimpleReader xmlSimpleReader;
177 DrawPadCanvasXmlHandler drawPadCanvasXmlHandler; 197 DrawPadCanvasXmlHandler drawPadCanvasXmlHandler;
178 198
179 xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler); 199 xmlSimpleReader.setContentHandler(&drawPadCanvasXmlHandler);
180 xmlSimpleReader.parse(xmlInputSource); 200 xmlSimpleReader.parse(xmlInputSource);
181 201
182 m_pages = drawPadCanvasXmlHandler.pages(); 202 m_pages = drawPadCanvasXmlHandler.pages();
183 203
184 if (m_pages.isEmpty()) { 204 if (m_pages.isEmpty()) {
185 m_pages.append(new Page(contentsRect().size())); 205 m_pages.append(new Page("", contentsRect().size()));
186 m_pages.current()->fill(Qt::white); 206 m_pages.current()->fill(Qt::white);
187 } 207 }
188 208
189 m_pageBackups.clear(); 209 m_pageBackups.clear();
190 m_pageBackups.append(new Page(*(m_pages.current()))); 210 m_pageBackups.append(new Page(*(m_pages.current())));
191 211
192 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 212 resizeContents(m_pages.current()->width(), m_pages.current()->height());
193 viewport()->update(); 213 viewport()->update();
194 214
195 emit pagesChanged(); 215 emit pagesChanged();
196 emit pageBackupsChanged(); 216 emit pageBackupsChanged();
197} 217}
198 218
199void DrawPadCanvas::initialPage() 219void DrawPadCanvas::initialPage()
200{ 220{
201 m_pages.append(new Page(236, 232)); 221 m_pages.append(new Page("", 236, 232));
202 m_pages.current()->fill(Qt::white); 222 m_pages.current()->fill(Qt::white);
203 223
204 m_pageBackups.clear(); 224 m_pageBackups.clear();
205 m_pageBackups.append(new Page(*(m_pages.current()))); 225 m_pageBackups.append(new Page(*(m_pages.current())));
206 226
207 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 227 resizeContents(m_pages.current()->width(), m_pages.current()->height());
208 viewport()->update(); 228 viewport()->update();
209 229
210 emit pagesChanged(); 230 emit pagesChanged();
211 emit pageBackupsChanged(); 231 emit pageBackupsChanged();
212} 232}
213 233
214void DrawPadCanvas::save(QIODevice* ioDevice) 234void DrawPadCanvas::save(QIODevice* ioDevice)
215{ 235{
216 QTextStream textStream(ioDevice); 236 QTextStream textStream(ioDevice);
217 textStream.setCodec(QTextCodec::codecForName("UTF-8")); 237 textStream.setCodec(QTextCodec::codecForName("UTF-8"));
218 238
219 textStream << "<drawpad>" << endl; 239 textStream << "<drawpad>" << endl;
220 textStream << " <images>" << endl; 240 textStream << " <images>" << endl;
221 241
222 QListIterator<Page> bufferIterator(m_pages); 242 QListIterator<Page> bufferIterator(m_pages);
223 243
224 for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) { 244 for (bufferIterator.toFirst(); bufferIterator.current() != 0; ++bufferIterator) {
225 textStream << " <image>" << endl; 245 textStream << " <image>" << endl;
246 textStream << " <title>" << bufferIterator.current()->title() << "</title>" << endl;
247
248 int intDate = QDateTime(QDate(1970, 1, 1)).secsTo(bufferIterator.current()->lastModified());
249 textStream << " <date>" << intDate << "</date>" << endl;
226 250
227 QImage image = bufferIterator.current()->convertToImage(); 251 QImage image = bufferIterator.current()->convertToImage();
228 QByteArray byteArray; 252 QByteArray byteArray;
229 QBuffer buffer(byteArray); 253 QBuffer buffer(byteArray);
230 QImageIO imageIO(&buffer, "PNG"); 254 QImageIO imageIO(&buffer, "PNG");
231 255
232 buffer.open(IO_WriteOnly); 256 buffer.open(IO_WriteOnly);
233 imageIO.setImage(image); 257 imageIO.setImage(image);
234 imageIO.write(); 258 imageIO.write();
235 buffer.close(); 259 buffer.close();
236 260
237 textStream << " <data length=\"" << byteArray.size() << "\" format=\"PNG\">"; 261 textStream << " <data length=\"" << byteArray.size() << "\" format=\"PNG\">";
@@ -332,58 +356,60 @@ void DrawPadCanvas::selectPage(Page* page)
332 m_pageBackups.clear(); 356 m_pageBackups.clear();
333 m_pageBackups.append(new Page(*(m_pages.current()))); 357 m_pageBackups.append(new Page(*(m_pages.current())));
334 358
335 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 359 resizeContents(m_pages.current()->width(), m_pages.current()->height());
336 viewport()->update(); 360 viewport()->update();
337 361
338 emit pagesChanged(); 362 emit pagesChanged();
339 emit pageBackupsChanged(); 363 emit pageBackupsChanged();
340} 364}
341 365
342void DrawPadCanvas::backupPage() 366void DrawPadCanvas::backupPage()
343{ 367{
344 QPixmap* currentBackup = m_pageBackups.current(); 368 m_pages.current()->setLastModified(QDateTime::currentDateTime());
369
370 Page* currentBackup = m_pageBackups.current();
345 while (m_pageBackups.last() != currentBackup) { 371 while (m_pageBackups.last() != currentBackup) {
346 m_pageBackups.removeLast(); 372 m_pageBackups.removeLast();
347 } 373 }
348 374
349 while (m_pageBackups.count() >= (5 + 1)) { 375 while (m_pageBackups.count() >= (5 + 1)) {
350 m_pageBackups.removeFirst(); 376 m_pageBackups.removeFirst();
351 } 377 }
352 378
353 m_pageBackups.append(new Page(*(m_pages.current()))); 379 m_pageBackups.append(new Page(*(m_pages.current())));
354 380
355 emit pageBackupsChanged(); 381 emit pageBackupsChanged();
356} 382}
357 383
358void DrawPadCanvas::deleteAll() 384void DrawPadCanvas::deleteAll()
359{ 385{
360 m_pages.clear(); 386 m_pages.clear();
361 387
362 m_pages.append(new Page(contentsRect().size())); 388 m_pages.append(new Page("", contentsRect().size()));
363 m_pages.current()->fill(Qt::white); 389 m_pages.current()->fill(Qt::white);
364 390
365 m_pageBackups.clear(); 391 m_pageBackups.clear();
366 m_pageBackups.append(new Page(*(m_pages.current()))); 392 m_pageBackups.append(new Page(*(m_pages.current())));
367 393
368 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 394 resizeContents(m_pages.current()->width(), m_pages.current()->height());
369 viewport()->update(); 395 viewport()->update();
370 396
371 emit pagesChanged(); 397 emit pagesChanged();
372 emit pageBackupsChanged(); 398 emit pageBackupsChanged();
373} 399}
374 400
375void DrawPadCanvas::newPage(uint width, uint height, const QColor& color) 401void DrawPadCanvas::newPage(QString title, uint width, uint height, const QColor& color)
376{ 402{
377 m_pages.insert(m_pages.at() + 1, new Page(width, height)); 403 m_pages.insert(m_pages.at() + 1, new Page(title, width, height));
378 m_pages.current()->fill(color); 404 m_pages.current()->fill(color);
379 405
380 m_pageBackups.clear(); 406 m_pageBackups.clear();
381 m_pageBackups.append(new Page(*(m_pages.current()))); 407 m_pageBackups.append(new Page(*(m_pages.current())));
382 408
383 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 409 resizeContents(m_pages.current()->width(), m_pages.current()->height());
384 viewport()->update(); 410 viewport()->update();
385 411
386 emit pagesChanged(); 412 emit pagesChanged();
387 emit pageBackupsChanged(); 413 emit pageBackupsChanged();
388} 414}
389 415
@@ -396,25 +422,25 @@ void DrawPadCanvas::clearPage()
396 422
397 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 423 resizeContents(m_pages.current()->width(), m_pages.current()->height());
398 viewport()->update(); 424 viewport()->update();
399 425
400 emit pageBackupsChanged(); 426 emit pageBackupsChanged();
401} 427}
402 428
403void DrawPadCanvas::deletePage() 429void DrawPadCanvas::deletePage()
404{ 430{
405 m_pages.remove(m_pages.current()); 431 m_pages.remove(m_pages.current());
406 432
407 if (m_pages.isEmpty()) { 433 if (m_pages.isEmpty()) {
408 m_pages.append(new Page(contentsRect().size())); 434 m_pages.append(new Page("", contentsRect().size()));
409 m_pages.current()->fill(Qt::white); 435 m_pages.current()->fill(Qt::white);
410 } 436 }
411 437
412 m_pageBackups.clear(); 438 m_pageBackups.clear();
413 m_pageBackups.append(new Page(*(m_pages.current()))); 439 m_pageBackups.append(new Page(*(m_pages.current())));
414 440
415 resizeContents(m_pages.current()->width(), m_pages.current()->height()); 441 resizeContents(m_pages.current()->width(), m_pages.current()->height());
416 viewport()->update(); 442 viewport()->update();
417 443
418 emit pagesChanged(); 444 emit pagesChanged();
419 emit pageBackupsChanged(); 445 emit pageBackupsChanged();
420} 446}
diff --git a/noncore/graphics/drawpad/drawpadcanvas.h b/noncore/graphics/drawpad/drawpadcanvas.h
index 39cf752..dcaff5c 100644
--- a/noncore/graphics/drawpad/drawpadcanvas.h
+++ b/noncore/graphics/drawpad/drawpadcanvas.h
@@ -43,25 +43,25 @@ public:
43 bool goNextPageEnabled(); 43 bool goNextPageEnabled();
44 44
45 Page* currentPage(); 45 Page* currentPage();
46 QList<Page> pages(); 46 QList<Page> pages();
47 uint pagePosition(); 47 uint pagePosition();
48 uint pageCount(); 48 uint pageCount();
49 49
50 void selectPage(Page* page); 50 void selectPage(Page* page);
51 void backupPage(); 51 void backupPage();
52 52
53public slots: 53public slots:
54 void deleteAll(); 54 void deleteAll();
55 void newPage(uint width, uint height, const QColor& color); 55 void newPage(QString title, uint width, uint height, const QColor& color);
56 void clearPage(); 56 void clearPage();
57 void deletePage(); 57 void deletePage();
58 void movePageUp(); 58 void movePageUp();
59 void movePageDown(); 59 void movePageDown();
60 60
61 void undo(); 61 void undo();
62 void redo(); 62 void redo();
63 63
64 void goFirstPage(); 64 void goFirstPage();
65 void goPreviousPage(); 65 void goPreviousPage();
66 void goNextPage(); 66 void goNextPage();
67 void goLastPage(); 67 void goLastPage();
diff --git a/noncore/graphics/drawpad/newpagedialog.cpp b/noncore/graphics/drawpad/newpagedialog.cpp
index ff31aad..e6e7fcb 100644
--- a/noncore/graphics/drawpad/newpagedialog.cpp
+++ b/noncore/graphics/drawpad/newpagedialog.cpp
@@ -76,24 +76,29 @@ NewPageDialog::NewPageDialog(uint width, uint height, const QColor& penColor,
76 contentLayout->addWidget(penColorRadioButton); 76 contentLayout->addWidget(penColorRadioButton);
77 contentLayout->addWidget(brushColorRadioButton); 77 contentLayout->addWidget(brushColorRadioButton);
78 78
79 mainLayout->addWidget(generalGroupBox); 79 mainLayout->addWidget(generalGroupBox);
80 mainLayout->addWidget(sizeGroupBox); 80 mainLayout->addWidget(sizeGroupBox);
81 mainLayout->addWidget(m_pContentButtonGroup); 81 mainLayout->addWidget(m_pContentButtonGroup);
82} 82}
83 83
84NewPageDialog::~NewPageDialog() 84NewPageDialog::~NewPageDialog()
85{ 85{
86} 86}
87 87
88QString NewPageDialog::selectedTitle()
89{
90 return (m_pTitleLineEdit->text());
91}
92
88uint NewPageDialog::selectedWidth() 93uint NewPageDialog::selectedWidth()
89{ 94{
90 return (m_pWidthSpinBox->value()); 95 return (m_pWidthSpinBox->value());
91} 96}
92 97
93uint NewPageDialog::selectedHeight() 98uint NewPageDialog::selectedHeight()
94{ 99{
95 return (m_pHeightSpinBox->value()); 100 return (m_pHeightSpinBox->value());
96} 101}
97 102
98const QColor& NewPageDialog::selectedColor() 103const QColor& NewPageDialog::selectedColor()
99{ 104{
diff --git a/noncore/graphics/drawpad/newpagedialog.h b/noncore/graphics/drawpad/newpagedialog.h
index fe8f562..c8f84b8 100644
--- a/noncore/graphics/drawpad/newpagedialog.h
+++ b/noncore/graphics/drawpad/newpagedialog.h
@@ -20,24 +20,25 @@ class QButtonGroup;
20class QLineEdit; 20class QLineEdit;
21class QSpinBox; 21class QSpinBox;
22 22
23class NewPageDialog : public QDialog 23class NewPageDialog : public QDialog
24{ 24{
25 Q_OBJECT 25 Q_OBJECT
26 26
27public: 27public:
28 NewPageDialog(uint width, uint height, const QColor& foregroundColor, 28 NewPageDialog(uint width, uint height, const QColor& foregroundColor,
29 const QColor& backgroundColor, QWidget* parent = 0, const char* name = 0); 29 const QColor& backgroundColor, QWidget* parent = 0, const char* name = 0);
30 ~NewPageDialog(); 30 ~NewPageDialog();
31 31
32 QString selectedTitle();
32 uint selectedWidth(); 33 uint selectedWidth();
33 uint selectedHeight(); 34 uint selectedHeight();
34 const QColor& selectedColor(); 35 const QColor& selectedColor();
35 36
36private: 37private:
37 QLineEdit* m_pTitleLineEdit; 38 QLineEdit* m_pTitleLineEdit;
38 39
39 QSpinBox* m_pWidthSpinBox; 40 QSpinBox* m_pWidthSpinBox;
40 QSpinBox* m_pHeightSpinBox; 41 QSpinBox* m_pHeightSpinBox;
41 42
42 QColor m_penColor; 43 QColor m_penColor;
43 QColor m_brushColor; 44 QColor m_brushColor;
diff --git a/noncore/graphics/drawpad/page.cpp b/noncore/graphics/drawpad/page.cpp
index 7034a20..601d1c3 100644
--- a/noncore/graphics/drawpad/page.cpp
+++ b/noncore/graphics/drawpad/page.cpp
@@ -10,33 +10,35 @@
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 * * 11 * *
12 ***************************************************************************/ 12 ***************************************************************************/
13 13
14#include "page.h" 14#include "page.h"
15 15
16Page::Page() 16Page::Page()
17 : QPixmap() 17 : QPixmap()
18{ 18{
19 m_lastModified = QDateTime::currentDateTime(); 19 m_lastModified = QDateTime::currentDateTime();
20} 20}
21 21
22Page::Page(int w, int h) 22Page::Page(QString title, int w, int h)
23 : QPixmap(w, h) 23 : QPixmap(w, h)
24{ 24{
25 m_title = title;
25 m_lastModified = QDateTime::currentDateTime(); 26 m_lastModified = QDateTime::currentDateTime();
26} 27}
27 28
28Page::Page(const QSize& size) 29Page::Page(QString title, const QSize& size)
29 : QPixmap(size) 30 : QPixmap(size)
30{ 31{
32 m_title = title;
31 m_lastModified = QDateTime::currentDateTime(); 33 m_lastModified = QDateTime::currentDateTime();
32} 34}
33 35
34Page::~Page() 36Page::~Page()
35{ 37{
36} 38}
37 39
38QString Page::title() const 40QString Page::title() const
39{ 41{
40 return m_title; 42 return m_title;
41} 43}
42 44
diff --git a/noncore/graphics/drawpad/page.h b/noncore/graphics/drawpad/page.h
index 020ab1f..20a37b5 100644
--- a/noncore/graphics/drawpad/page.h
+++ b/noncore/graphics/drawpad/page.h
@@ -13,26 +13,26 @@
13 13
14#ifndef PAGE_H 14#ifndef PAGE_H
15#define PAGE_H 15#define PAGE_H
16 16
17#include <qpixmap.h> 17#include <qpixmap.h>
18 18
19#include <qdatetime.h> 19#include <qdatetime.h>
20 20
21class Page : public QPixmap 21class Page : public QPixmap
22{ 22{
23public: 23public:
24 Page(); 24 Page();
25 Page(int w, int h); 25 Page(QString title, int w, int h);
26 Page(const QSize& size); 26 Page(QString title, const QSize& size);
27 27
28 ~Page(); 28 ~Page();
29 29
30 QString title() const; 30 QString title() const;
31 QDateTime lastModified() const; 31 QDateTime lastModified() const;
32 32
33 void setTitle(QString title); 33 void setTitle(QString title);
34 void setLastModified(QDateTime lastModified); 34 void setLastModified(QDateTime lastModified);
35 35
36private: 36private:
37 QString m_title; 37 QString m_title;
38 QDateTime m_lastModified; 38 QDateTime m_lastModified;
diff --git a/noncore/graphics/drawpad/thumbnailview.cpp b/noncore/graphics/drawpad/thumbnailview.cpp
index 35955e8..81ec79f 100644
--- a/noncore/graphics/drawpad/thumbnailview.cpp
+++ b/noncore/graphics/drawpad/thumbnailview.cpp
@@ -312,26 +312,26 @@ void ThumbnailView::exec()
312 qApp->enter_loop(); 312 qApp->enter_loop();
313 } 313 }
314} 314}
315 315
316void ThumbnailView::newPage() 316void ThumbnailView::newPage()
317{ 317{
318 QRect rect = m_pDrawPadCanvas->contentsRect(); 318 QRect rect = m_pDrawPadCanvas->contentsRect();
319 319
320 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(), 320 NewPageDialog newPageDialog(rect.width(), rect.height(), m_pDrawPad->pen().color(),
321 m_pDrawPad->brush().color(), this); 321 m_pDrawPad->brush().color(), this);
322 322
323 if (newPageDialog.exec() == QDialog::Accepted) { 323 if (newPageDialog.exec() == QDialog::Accepted) {
324 m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), 324 m_pDrawPadCanvas->newPage(newPageDialog.selectedTitle(), newPageDialog.selectedWidth(),
325 newPageDialog.selectedColor()); 325 newPageDialog.selectedHeight(), newPageDialog.selectedColor());
326 m_pPageListBox->updateView(); 326 m_pPageListBox->updateView();
327 updateView(); 327 updateView();
328 } 328 }
329} 329}
330 330
331void ThumbnailView::clearPage() 331void ThumbnailView::clearPage()
332{ 332{
333 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe selected page?"), 333 QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe selected page?"),
334 QMessageBox::Information, QMessageBox::Yes, 334 QMessageBox::Information, QMessageBox::Yes,
335 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, 335 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default,
336 QMessageBox::NoButton, this); 336 QMessageBox::NoButton, this);
337 337