summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-sheet/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index 1fb2a3d..061748e 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -20,51 +20,51 @@
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21#include <qradiobutton.h> 21#include <qradiobutton.h>
22 22
23#include "cellformat.h" 23#include "cellformat.h"
24#include "numberdlg.h" 24#include "numberdlg.h"
25#include "textdlg.h" 25#include "textdlg.h"
26#include "sortdlg.h" 26#include "sortdlg.h"
27#include "finddlg.h" 27#include "finddlg.h"
28 28
29#define DEFAULT_NUM_ROWS 300 29#define DEFAULT_NUM_ROWS 300
30#define DEFAULT_NUM_COLS (26*3) 30#define DEFAULT_NUM_COLS (26*3)
31#define DEFAULT_NUM_SHEETS 3 31#define DEFAULT_NUM_SHEETS 3
32 32
33MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) 33MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl)
34 :QMainWindow(parent, n, fl) 34 :QMainWindow(parent, n, fl)
35{ 35{
36 // initialize variables 36 // initialize variables
37 documentModified=FALSE; 37 documentModified=FALSE;
38 38
39 // construct objects 39 // construct objects
40 currentDoc=0; 40 currentDoc=0;
41 fileSelector=new FileSelector("application/sheet-qt", this, QString::null); 41 fileSelector=new FileSelector("application/sheet-qt", this, QString::null);
42 ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); 42 ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE);
43 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); 43 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide()));
44 connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); 44 connect(fileSelector, SIGNAL(newSelected(const DocLnk&)), this, SLOT(selectorFileNew(const DocLnk&)));
45 connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); 45 connect(fileSelector, SIGNAL(fileSelected(const DocLnk&)), this, SLOT(selectorFileOpen(const DocLnk&)));
46 connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk &)),this,SLOT(slotImportExcel(const DocLnk &))); 46 connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk&)),this,SLOT(slotImportExcel(const DocLnk&)));
47 connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); 47 connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide()));
48 48
49 49
50 listSheets.setAutoDelete(TRUE); 50 listSheets.setAutoDelete(TRUE);
51 51
52 initActions(); 52 initActions();
53 initMenu(); 53 initMenu();
54 initEditToolbar(); 54 initEditToolbar();
55 initFunctionsToolbar(); 55 initFunctionsToolbar();
56 initStandardToolbar(); 56 initStandardToolbar();
57 initSheet(); 57 initSheet();
58 58
59 // set window title 59 // set window title
60 setCaption(tr("Opie Sheet")); 60 setCaption(tr("Opie Sheet"));
61 61
62 // create sheets 62 // create sheets
63 selectorFileNew(DocLnk()); 63 selectorFileNew(DocLnk());
64} 64}
65 65
66MainWindow::~MainWindow() 66MainWindow::~MainWindow()
67{ 67{
68 if (currentDoc) delete currentDoc; 68 if (currentDoc) delete currentDoc;
69} 69}
70 70
@@ -559,49 +559,49 @@ void MainWindow::initMenu()
559 addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr); 559 addFlyAction(tr("POISSON(x,n,Q?)"), tr("POISSON(x,n,Q?)"), "POISSON(",submenuFuncDistr);
560 submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr); 560 submenuFunc->insertItem(tr("&Distributions"), submenuFuncDistr);
561 561
562 562
563 563
564 menuInsert->insertSeparator(); 564 menuInsert->insertSeparator();
565 insertCells->addTo(menuInsert); 565 insertCells->addTo(menuInsert);
566 insertRows->addTo(menuInsert); 566 insertRows->addTo(menuInsert);
567 insertCols->addTo(menuInsert); 567 insertCols->addTo(menuInsert);
568 insertSheets->addTo(menuInsert); 568 insertSheets->addTo(menuInsert);
569} 569}
570 570
571void MainWindow::initStandardToolbar() 571void MainWindow::initStandardToolbar()
572{ 572{
573 toolbarStandard=new QToolBar(this); 573 toolbarStandard=new QToolBar(this);
574 toolbarStandard->setHorizontalStretchable(TRUE); 574 toolbarStandard->setHorizontalStretchable(TRUE);
575 moveToolBar(toolbarStandard, Top); 575 moveToolBar(toolbarStandard, Top);
576 576
577 fileNew->addTo(toolbarStandard); 577 fileNew->addTo(toolbarStandard);
578 fileOpen->addTo(toolbarStandard); 578 fileOpen->addTo(toolbarStandard);
579 fileSave->addTo(toolbarStandard); 579 fileSave->addTo(toolbarStandard);
580 580
581 comboSheets=new QComboBox(toolbarStandard); 581 comboSheets=new QComboBox(toolbarStandard);
582 toolbarStandard->setStretchableWidget(comboSheets); 582 toolbarStandard->setStretchableWidget(comboSheets);
583 connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &))); 583 connect(comboSheets, SIGNAL(activated(const QString&)), this, SLOT(slotSheetChanged(const QString&)));
584} 584}
585 585
586void MainWindow::initFunctionsToolbar() 586void MainWindow::initFunctionsToolbar()
587{ 587{
588 toolbarFunctions=new QToolBar(this); 588 toolbarFunctions=new QToolBar(this);
589 toolbarFunctions->setHorizontalStretchable(TRUE); 589 toolbarFunctions->setHorizontalStretchable(TRUE);
590 moveToolBar(toolbarFunctions, Bottom); 590 moveToolBar(toolbarFunctions, Bottom);
591 591
592 funcEqual->addTo(toolbarFunctions); 592 funcEqual->addTo(toolbarFunctions);
593 funcPlus->addTo(toolbarFunctions); 593 funcPlus->addTo(toolbarFunctions);
594 funcMinus->addTo(toolbarFunctions); 594 funcMinus->addTo(toolbarFunctions);
595 funcCross->addTo(toolbarFunctions); 595 funcCross->addTo(toolbarFunctions);
596 funcDivide->addTo(toolbarFunctions); 596 funcDivide->addTo(toolbarFunctions);
597 funcParanOpen->addTo(toolbarFunctions); 597 funcParanOpen->addTo(toolbarFunctions);
598 funcParanClose->addTo(toolbarFunctions); 598 funcParanClose->addTo(toolbarFunctions);
599 funcComma->addTo(toolbarFunctions); 599 funcComma->addTo(toolbarFunctions);
600 600
601 toolFunction=new QToolButton(toolbarFunctions); 601 toolFunction=new QToolButton(toolbarFunctions);
602 toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func-func" )); 602 toolFunction->setPixmap(Resource::loadPixmap( "opie-sheet/func-func" ));
603 toolFunction->setTextLabel(tr("Functions")); 603 toolFunction->setTextLabel(tr("Functions"));
604 toolFunction->setPopup(submenuFunc); 604 toolFunction->setPopup(submenuFunc);
605 toolFunction->setPopupDelay(0); 605 toolFunction->setPopupDelay(0);
606} 606}
607 607
@@ -618,50 +618,50 @@ void MainWindow::initEditToolbar()
618 toolbarEdit->setStretchableWidget(editData); 618 toolbarEdit->setStretchableWidget(editData);
619 connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); 619 connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept()));
620 620
621 editCellSelect->addTo(toolbarEdit); 621 editCellSelect->addTo(toolbarEdit);
622} 622}
623 623
624void MainWindow::slotHelpAbout() 624void MainWindow::slotHelpAbout()
625{ 625{
626 QDialog dialogAbout(this, 0, TRUE); 626 QDialog dialogAbout(this, 0, TRUE);
627 dialogAbout.resize(width()-40, height()-80); 627 dialogAbout.resize(width()-40, height()-80);
628 dialogAbout.setCaption(tr("About Opie Sheet")); 628 dialogAbout.setCaption(tr("About Opie Sheet"));
629 629
630 QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); 630 QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout);
631 label.setGeometry(dialogAbout.rect()); 631 label.setGeometry(dialogAbout.rect());
632 label.setAlignment(Qt::AlignCenter | Qt::WordBreak); 632 label.setAlignment(Qt::AlignCenter | Qt::WordBreak);
633 633
634 dialogAbout.exec(); 634 dialogAbout.exec();
635} 635}
636 636
637void MainWindow::initSheet() 637void MainWindow::initSheet()
638{ 638{
639 sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); 639 sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this);
640 setCentralWidget(sheet); 640 setCentralWidget(sheet);
641 641
642 connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &))); 642 connect(sheet, SIGNAL(currentDataChanged(const QString&)), editData, SLOT(setText(const QString&)));
643 connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &))); 643 connect(sheet, SIGNAL(cellClicked(const QString&)), this, SLOT(slotCellClicked(const QString&)));
644 connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); 644 connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified()));
645 645
646 connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); 646 connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut()));
647 connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); 647 connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy()));
648 connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); 648 connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear()));
649} 649}
650 650
651void MainWindow::slotEditAccept() 651void MainWindow::slotEditAccept()
652{ 652{
653 sheet->setData(editData->text()); 653 sheet->setData(editData->text());
654} 654}
655 655
656void MainWindow::slotEditCancel() 656void MainWindow::slotEditCancel()
657{ 657{
658 editData->setText(sheet->getData()); 658 editData->setText(sheet->getData());
659} 659}
660 660
661void MainWindow::slotCellSelect(bool lock) 661void MainWindow::slotCellSelect(bool lock)
662{ 662{
663 sheet->lockClicks(lock); 663 sheet->lockClicks(lock);
664} 664}
665 665
666void MainWindow::addToData(const QString &data) 666void MainWindow::addToData(const QString &data)
667{ 667{