Diffstat (limited to 'noncore/graphics/drawpad/drawpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index b325323..58c0d09 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -37,8 +37,9 @@ | |||
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | 38 | ||
39 | #include <qaction.h> | 39 | #include <qaction.h> |
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qmessagebox.h> | ||
41 | #include <qpainter.h> | 42 | #include <qpainter.h> |
42 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
43 | #include <qtoolbutton.h> | 44 | #include <qtoolbutton.h> |
44 | #include <qtooltip.h> | 45 | #include <qtooltip.h> |
@@ -65,9 +66,9 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
65 | 66 | ||
66 | QPopupMenu *toolsPopupMenu = new QPopupMenu(menuBar); | 67 | QPopupMenu *toolsPopupMenu = new QPopupMenu(menuBar); |
67 | 68 | ||
68 | QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); | 69 | QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); |
69 | connect(deleteAllAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deleteAll())); | 70 | connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); |
70 | deleteAllAction->addTo(toolsPopupMenu); | 71 | deleteAllAction->addTo(toolsPopupMenu); |
71 | 72 | ||
72 | toolsPopupMenu->insertSeparator(); | 73 | toolsPopupMenu->insertSeparator(); |
73 | 74 | ||
@@ -95,13 +96,13 @@ DrawPad::DrawPad(QWidget* parent, const char* name) | |||
95 | connect(newPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(newPage())); | 96 | connect(newPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(newPage())); |
96 | newPageAction->addTo(pageToolBar); | 97 | newPageAction->addTo(pageToolBar); |
97 | 98 | ||
98 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); | 99 | QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); |
99 | connect(clearPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(clearPage())); | 100 | connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); |
100 | clearPageAction->addTo(pageToolBar); | 101 | clearPageAction->addTo(pageToolBar); |
101 | 102 | ||
102 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadIconSet("trash"), QString::null, 0, this); | 103 | QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadIconSet("trash"), QString::null, 0, this); |
103 | connect(deletePageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deletePage())); | 104 | connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); |
104 | deletePageAction->addTo(pageToolBar); | 105 | deletePageAction->addTo(pageToolBar); |
105 | 106 | ||
106 | QPEToolBar* emptyToolBar = new QPEToolBar(this); | 107 | QPEToolBar* emptyToolBar = new QPEToolBar(this); |
107 | emptyToolBar->setHorizontalStretchable(true); | 108 | emptyToolBar->setHorizontalStretchable(true); |
@@ -266,8 +267,38 @@ DrawPad::~DrawPad() | |||
266 | file.close(); | 267 | file.close(); |
267 | } | 268 | } |
268 | } | 269 | } |
269 | 270 | ||
271 | void DrawPad::clearPage() | ||
272 | { | ||
273 | QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), | ||
274 | QMessageBox::Information, QMessageBox::Yes, | ||
275 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | ||
276 | QMessageBox::NoButton, this); | ||
277 | |||
278 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | ||
279 | messageBox.setButtonText(QMessageBox::No, tr("No")); | ||
280 | |||
281 | if (messageBox.exec() == QMessageBox::Yes) { | ||
282 | m_pDrawPadCanvas->clearPage(); | ||
283 | } | ||
284 | } | ||
285 | |||
286 | void DrawPad::deletePage() | ||
287 | { | ||
288 | QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), | ||
289 | QMessageBox::Information, QMessageBox::Yes, | ||
290 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | ||
291 | QMessageBox::NoButton, this); | ||
292 | |||
293 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | ||
294 | messageBox.setButtonText(QMessageBox::No, tr("No")); | ||
295 | |||
296 | if (messageBox.exec() == QMessageBox::Yes) { | ||
297 | m_pDrawPadCanvas->deletePage(); | ||
298 | } | ||
299 | } | ||
300 | |||
270 | void DrawPad::setPointTool() | 301 | void DrawPad::setPointTool() |
271 | { | 302 | { |
272 | if (m_pTool) { | 303 | if (m_pTool) { |
273 | delete m_pTool; | 304 | delete m_pTool; |
@@ -498,8 +529,23 @@ void DrawPad::updateCaption() | |||
498 | setCaption(tr("DrawPad") + " - " + tr("Page") + " " | 529 | setCaption(tr("DrawPad") + " - " + tr("Page") + " " |
499 | + QString::number(pagePosition) + "/" + QString::number(pageCount)); | 530 | + QString::number(pagePosition) + "/" + QString::number(pageCount)); |
500 | } | 531 | } |
501 | 532 | ||
533 | void DrawPad::deleteAll() | ||
534 | { | ||
535 | QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), | ||
536 | QMessageBox::Information, QMessageBox::Yes, | ||
537 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | ||
538 | QMessageBox::NoButton, this); | ||
539 | |||
540 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | ||
541 | messageBox.setButtonText(QMessageBox::No, tr("No")); | ||
542 | |||
543 | if (messageBox.exec() == QMessageBox::Yes) { | ||
544 | m_pDrawPadCanvas->deleteAll(); | ||
545 | } | ||
546 | } | ||
547 | |||
502 | void DrawPad::importPage() | 548 | void DrawPad::importPage() |
503 | { | 549 | { |
504 | ImportDialog importDialog(this); | 550 | ImportDialog importDialog(this); |
505 | 551 | ||
@@ -528,9 +574,9 @@ void DrawPad::exportPage() | |||
528 | } | 574 | } |
529 | 575 | ||
530 | void DrawPad::thumbnailView() | 576 | void DrawPad::thumbnailView() |
531 | { | 577 | { |
532 | ThumbnailView thumbnailView(m_pDrawPadCanvas->pages(), this); | 578 | ThumbnailView thumbnailView(m_pDrawPadCanvas, this); |
533 | 579 | ||
534 | thumbnailView.showMaximized(); | 580 | thumbnailView.showMaximized(); |
535 | thumbnailView.exec(); | 581 | thumbnailView.exec(); |
536 | } | 582 | } |