author | leseb <leseb> | 2002-06-07 20:30:30 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-07 20:30:30 (UTC) |
commit | 9dcd598f9b815511cae884d26b18e3c8913b9fcf (patch) (side-by-side diff) | |
tree | 4b18e7fa7c864b2dca4da76bc89c2a975e80a73c /noncore/graphics/drawpad/drawpad.cpp | |
parent | 640d964cfdc7467f6cacb513087cd3acda2c04f0 (diff) | |
download | opie-9dcd598f9b815511cae884d26b18e3c8913b9fcf.zip opie-9dcd598f9b815511cae884d26b18e3c8913b9fcf.tar.gz opie-9dcd598f9b815511cae884d26b18e3c8913b9fcf.tar.bz2 |
Make progress in thumbnail view
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 @@ -35,12 +35,13 @@ #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qaction.h> #include <qfile.h> +#include <qmessagebox.h> #include <qpainter.h> #include <qspinbox.h> #include <qtoolbutton.h> #include <qtooltip.h> DrawPad::DrawPad(QWidget* parent, const char* name) @@ -63,13 +64,13 @@ DrawPad::DrawPad(QWidget* parent, const char* name) QPEToolBar* menuToolBar = new QPEToolBar(this); QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar); QPopupMenu *toolsPopupMenu = new QPopupMenu(menuBar); QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this); - connect(deleteAllAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deleteAll())); + connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll())); deleteAllAction->addTo(toolsPopupMenu); toolsPopupMenu->insertSeparator(); QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this); connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage())); @@ -93,17 +94,17 @@ DrawPad::DrawPad(QWidget* parent, const char* name) QAction* newPageAction = new QAction(tr("New Page"), Resource::loadIconSet("new"), QString::null, 0, this); connect(newPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(newPage())); newPageAction->addTo(pageToolBar); QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadIconSet("drawpad/clear"), QString::null, 0, this); - connect(clearPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(clearPage())); + connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage())); clearPageAction->addTo(pageToolBar); QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadIconSet("trash"), QString::null, 0, this); - connect(deletePageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(deletePage())); + connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage())); deletePageAction->addTo(pageToolBar); QPEToolBar* emptyToolBar = new QPEToolBar(this); emptyToolBar->setHorizontalStretchable(true); // init navigation toolbar @@ -264,12 +265,42 @@ DrawPad::~DrawPad() if (file.open(IO_WriteOnly)) { m_pDrawPadCanvas->save(&file); file.close(); } } +void DrawPad::clearPage() +{ + QMessageBox messageBox(tr("Clear Page"), tr("Do you want to clear\nthe current page?"), + QMessageBox::Information, QMessageBox::Yes, + QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, + QMessageBox::NoButton, this); + + messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); + messageBox.setButtonText(QMessageBox::No, tr("No")); + + if (messageBox.exec() == QMessageBox::Yes) { + m_pDrawPadCanvas->clearPage(); + } +} + +void DrawPad::deletePage() +{ + QMessageBox messageBox(tr("Delete Page"), tr("Do you want to delete\nthe current page?"), + QMessageBox::Information, QMessageBox::Yes, + QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, + QMessageBox::NoButton, this); + + messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); + messageBox.setButtonText(QMessageBox::No, tr("No")); + + if (messageBox.exec() == QMessageBox::Yes) { + m_pDrawPadCanvas->deletePage(); + } +} + void DrawPad::setPointTool() { if (m_pTool) { delete m_pTool; } @@ -496,12 +527,27 @@ void DrawPad::updateCaption() uint pageCount = m_pDrawPadCanvas->pageCount(); setCaption(tr("DrawPad") + " - " + tr("Page") + " " + QString::number(pagePosition) + "/" + QString::number(pageCount)); } +void DrawPad::deleteAll() +{ + QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), + QMessageBox::Information, QMessageBox::Yes, + QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, + QMessageBox::NoButton, this); + + messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); + messageBox.setButtonText(QMessageBox::No, tr("No")); + + if (messageBox.exec() == QMessageBox::Yes) { + m_pDrawPadCanvas->deleteAll(); + } +} + void DrawPad::importPage() { ImportDialog importDialog(this); importDialog.showMaximized(); @@ -526,11 +572,11 @@ void DrawPad::exportPage() exportDialog.selectedName(), exportDialog.selectedFormat()); } } void DrawPad::thumbnailView() { - ThumbnailView thumbnailView(m_pDrawPadCanvas->pages(), this); + ThumbnailView thumbnailView(m_pDrawPadCanvas, this); thumbnailView.showMaximized(); thumbnailView.exec(); } |