Diffstat (limited to 'noncore/graphics/drawpad/drawpad.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpad.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp index 71c9695..139c752 100644 --- a/noncore/graphics/drawpad/drawpad.cpp +++ b/noncore/graphics/drawpad/drawpad.cpp | |||
@@ -15,52 +15,53 @@ | |||
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 <opie/colordialog.h> | 33 | #include <opie/colordialog.h> |
34 | #include <opie/colorpopupmenu.h> | 34 | #include <opie/colorpopupmenu.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 <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #include <qmenubar.h> | ||
40 | #include <qpe/qpetoolbar.h> | 39 | #include <qpe/qpetoolbar.h> |
41 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/qpeapplication.h> | ||
42 | 42 | ||
43 | #include <qmenubar.h> | ||
43 | #include <qaction.h> | 44 | #include <qaction.h> |
44 | #include <qfile.h> | 45 | #include <qfile.h> |
45 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
46 | #include <qspinbox.h> | 47 | #include <qspinbox.h> |
47 | #include <qtoolbutton.h> | 48 | #include <qtoolbutton.h> |
48 | #include <qtooltip.h> | 49 | #include <qtooltip.h> |
49 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
50 | 51 | ||
51 | DrawPad::DrawPad(QWidget* parent, const char* name, WFlags fl ) | 52 | DrawPad::DrawPad(QWidget* parent, const char* name, WFlags fl ) |
52 | : QMainWindow(parent, name, WStyle_ContextHelp) | 53 | : QMainWindow(parent, name, WStyle_ContextHelp) |
53 | { | 54 | { |
54 | // init members | 55 | // init members |
55 | 56 | ||
56 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); | 57 | m_pDrawPadCanvas = new DrawPadCanvas(this, this); |
57 | 58 | ||
58 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); | 59 | connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView())); |
59 | 60 | ||
60 | setCentralWidget(m_pDrawPadCanvas); | 61 | setCentralWidget(m_pDrawPadCanvas); |
61 | 62 | ||
62 | // init menu | 63 | // init menu |
63 | 64 | ||
64 | setToolBarsMovable(false); | 65 | setToolBarsMovable(false); |
65 | 66 | ||
66 | QToolBar* menuToolBar = new QToolBar(this); | 67 | QToolBar* menuToolBar = new QToolBar(this); |
@@ -580,77 +581,73 @@ void DrawPad::updateView() | |||
580 | m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); | 581 | m_pPreviousPageAction->setEnabled(m_pDrawPadCanvas->goPreviousPageEnabled()); |
581 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | 582 | m_pNextPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); |
582 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); | 583 | m_pLastPageAction->setEnabled(m_pDrawPadCanvas->goNextPageEnabled()); |
583 | } | 584 | } |
584 | 585 | ||
585 | void DrawPad::deleteAll() | 586 | void DrawPad::deleteAll() |
586 | { | 587 | { |
587 | QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), | 588 | QMessageBox messageBox(tr("Delete All"), tr("Do you want to delete\nall the pages?"), |
588 | QMessageBox::Information, QMessageBox::Yes, | 589 | QMessageBox::Information, QMessageBox::Yes, |
589 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, | 590 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default, |
590 | QMessageBox::NoButton, this); | 591 | QMessageBox::NoButton, this); |
591 | 592 | ||
592 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); | 593 | messageBox.setButtonText(QMessageBox::Yes, tr("Yes")); |
593 | messageBox.setButtonText(QMessageBox::No, tr("No")); | 594 | messageBox.setButtonText(QMessageBox::No, tr("No")); |
594 | 595 | ||
595 | if (messageBox.exec() == QMessageBox::Yes) { | 596 | if (messageBox.exec() == QMessageBox::Yes) { |
596 | m_pDrawPadCanvas->deleteAll(); | 597 | m_pDrawPadCanvas->deleteAll(); |
597 | } | 598 | } |
598 | } | 599 | } |
599 | 600 | ||
600 | void DrawPad::importPage() | 601 | void DrawPad::importPage() |
601 | { | 602 | { |
602 | ImportDialog importDialog(this); | 603 | ImportDialog importDialog(this); |
603 | 604 | ||
604 | importDialog.showMaximized(); | 605 | if ( QPEApplication::execDialog( &importDialog ) == QDialog::Accepted ) { |
605 | |||
606 | if (importDialog.exec() == QDialog::Accepted) { | ||
607 | const DocLnk* docLnk = importDialog.selected(); | 606 | const DocLnk* docLnk = importDialog.selected(); |
608 | 607 | ||
609 | if (docLnk) { | 608 | if (docLnk) { |
610 | m_pDrawPadCanvas->importPage(docLnk->file()); | 609 | m_pDrawPadCanvas->importPage(docLnk->file()); |
611 | delete docLnk; | 610 | delete docLnk; |
612 | } | 611 | } |
613 | } | 612 | } |
614 | } | 613 | } |
615 | 614 | ||
616 | void DrawPad::exportPage() | 615 | void DrawPad::exportPage() |
617 | { | 616 | { |
618 | ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this); | 617 | ExportDialog exportDialog(m_pDrawPadCanvas->pagePosition(), m_pDrawPadCanvas->pageCount(), this); |
619 | 618 | ||
620 | exportDialog.showMaximized(); | 619 | if ( QPEApplication::execDialog( &exportDialog ) == QDialog::Accepted ) { |
621 | |||
622 | if (exportDialog.exec() == QDialog::Accepted) { | ||
623 | m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(), | 620 | m_pDrawPadCanvas->exportPage(exportDialog.selectedFromPage(), exportDialog.selectedToPage(), |
624 | exportDialog.selectedName(), exportDialog.selectedFormat()); | 621 | exportDialog.selectedName(), exportDialog.selectedFormat()); |
625 | } | 622 | } |
626 | } | 623 | } |
627 | 624 | ||
628 | void DrawPad::thumbnailView() | 625 | void DrawPad::thumbnailView() |
629 | { | 626 | { |
630 | ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this); | 627 | ThumbnailView thumbnailView(this, m_pDrawPadCanvas, this); |
631 | 628 | ||
632 | thumbnailView.showMaximized(); | 629 | QPEApplication::showWidget( &thumbnailView ); |
633 | thumbnailView.exec(); | 630 | thumbnailView.exec(); |
634 | } | 631 | } |
635 | 632 | ||
636 | void DrawPad::pageInformation() | 633 | void DrawPad::pageInformation() |
637 | { | 634 | { |
638 | PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage()); | 635 | PageInformationDialog pageInformationDialog(m_pDrawPadCanvas->currentPage()); |
639 | 636 | ||
640 | if (pageInformationDialog.exec() == QDialog::Accepted) { | 637 | if (pageInformationDialog.exec() == QDialog::Accepted) { |
641 | m_pDrawPadCanvas->currentPage()->setTitle(pageInformationDialog.selectedTitle()); | 638 | m_pDrawPadCanvas->currentPage()->setTitle(pageInformationDialog.selectedTitle()); |
642 | } | 639 | } |
643 | } | 640 | } |
644 | 641 | ||
645 | void DrawPad::loadConfig() | 642 | void DrawPad::loadConfig() |
646 | { | 643 | { |
647 | Config config("drawpad"); | 644 | Config config("drawpad"); |
648 | config.setGroup("General"); | 645 | config.setGroup("General"); |
649 | 646 | ||
650 | m_pAntiAliasingAction->setOn(config.readBoolEntry("AntiAliasing", false)); | 647 | m_pAntiAliasingAction->setOn(config.readBoolEntry("AntiAliasing", false)); |
651 | m_pPenWidthSpinBox->setValue(config.readNumEntry("PenWidth", 1)); | 648 | m_pPenWidthSpinBox->setValue(config.readNumEntry("PenWidth", 1)); |
652 | changePenColor(QColor(config.readEntry("PenColor", Qt::black.name()))); | 649 | changePenColor(QColor(config.readEntry("PenColor", Qt::black.name()))); |
653 | changeBrushColor(QColor(config.readEntry("BrushColor", Qt::white.name()))); | 650 | changeBrushColor(QColor(config.readEntry("BrushColor", Qt::white.name()))); |
654 | m_pDrawPadCanvas->selectPage(config.readNumEntry("PagePosition", 1)); | 651 | m_pDrawPadCanvas->selectPage(config.readNumEntry("PagePosition", 1)); |
655 | } | 652 | } |
656 | 653 | ||