Diffstat (limited to 'noncore/graphics/drawpad/drawpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 58c0d09..ef55268 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -19,12 +19,13 @@ | |||
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 "pointtool.h" | 26 | #include "pointtool.h" |
26 | #include "rectangletool.h" | 27 | #include "rectangletool.h" |
27 | #include "texttool.h" | 28 | #include "texttool.h" |
28 | #include "thumbnailview.h" | 29 | #include "thumbnailview.h" |
29 | 30 | ||
30 | #include <opie/colordialog.h> | 31 | #include <opie/colordialog.h> |
@@ -90,13 +91,13 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
90 | 91 | ||
91 | // init page toolbar | 92 | // init page toolbar |
92 | 93 | ||
93 | QPEToolBar* pageToolBar = new QPEToolBar(this); | 94 | QPEToolBar* pageToolBar = new QPEToolBar(this); |
94 | 95 | ||
95 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this); | 96 | QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this); |
96 | connect(newPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(newPage())); | 97 | connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage())); |
97 | newPageAction->addTo(pageToolBar); | 98 | newPageAction->addTo(pageToolBar); |
98 | 99 | ||
99 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); | 100 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); |
100 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); | 101 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); |
101 | clearPageAction->addTo(pageToolBar); | 102 | clearPageAction->addTo(pageToolBar); |
102 | 103 | ||
@@ -265,12 +266,24 @@ DrawPad::~DrawPad() | |||
265 | if (file.open(IO_WriteOnly)) { | 266 | if (file.open(IO_WriteOnly)) { |
266 | m_pDrawPadCanvas->save(&file); | 267 | m_pDrawPadCanvas->save(&file); |
267 | file.close(); | 268 | file.close(); |
268 | } | 269 | } |
269 | } | 270 | } |
270 | 271 | ||
272 | void DrawPad::newPage() | ||
273 | { | ||
274 | QRect rect = m_pDrawPadCanvas->contentsRect(); | ||
275 | |||
276 | NewPageDialog newPageDialog(rect.width(), rect.height(), m_pen.color(), m_brush.color(), this); | ||
277 | |||
278 | if (newPageDialog.exec() == QDialog::Accepted) { | ||
279 | m_pDrawPadCanvas->newPage(newPageDialog.selectedWidth(), newPageDialog.selectedHeight(), | ||
280 | newPageDialog.selectedColor()); | ||
281 | } | ||
282 | } | ||
283 | |||
271 | void DrawPad::clearPage() | 284 | void DrawPad::clearPage() |
272 | { | 285 | { |
273 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), | 286 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), |
274 | QMessageBox::Information, QMessageBox::Yes, | 287 | QMessageBox::Information, QMessageBox::Yes, |
275 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 288 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
276 | QMessageBox::NoButton, this); | 289 | QMessageBox::NoButton, this); |
@@ -572,11 +585,11 @@ void DrawPad::exportPage() | |||
572 | exportDialog.selectedName(), exportDialog.selectedFormat()); | 585 | exportDialog.selectedName(), exportDialog.selectedFormat()); |
573 | } | 586 | } |
574 | } | 587 | } |
575 | 588 | ||
576 | void DrawPad::thumbnailView() | 589 | void DrawPad::thumbnailView() |
577 | { | 590 | { |
578 | ThumbnailView thumbnailView(m_pDrawPadCanvas, this); | 591 | ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this); |
579 | 592 | ||
580 | thumbnailView.showMaximized(); | 593 | thumbnailView.showMaximized(); |
581 | thumbnailView.exec(); | 594 | thumbnailView.exec(); |
582 | } | 595 | } |