Diffstat (limited to 'noncore/apps/opie-sheet/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-sheet/mainwindow.cpp | 12 |
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 | |||
@@ -1,94 +1,94 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Opie Sheet (formerly Sheet/Qt) | 11 | * Opie Sheet (formerly Sheet/Qt) |
12 | * by Serdar Ozler <sozler@sitebest.com> | 12 | * by Serdar Ozler <sozler@sitebest.com> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "mainwindow.h" | 15 | #include "mainwindow.h" |
16 | 16 | ||
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
19 | 19 | ||
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 | ||
33 | MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) | 33 | MainWindow::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 | ||
66 | MainWindow::~MainWindow() | 66 | MainWindow::~MainWindow() |
67 | { | 67 | { |
68 | if (currentDoc) delete currentDoc; | 68 | if (currentDoc) delete currentDoc; |
69 | } | 69 | } |
70 | 70 | ||
71 | void MainWindow::documentSave(DocLnk *lnkDoc) | 71 | void MainWindow::documentSave(DocLnk *lnkDoc) |
72 | { | 72 | { |
73 | FileManager fm; | 73 | FileManager fm; |
74 | QByteArray streamBuffer; | 74 | QByteArray streamBuffer; |
75 | QDataStream stream(streamBuffer, IO_WriteOnly); | 75 | QDataStream stream(streamBuffer, IO_WriteOnly); |
76 | 76 | ||
77 | typeSheet *currentSheet=findSheet(sheet->getName()); | 77 | typeSheet *currentSheet=findSheet(sheet->getName()); |
78 | if (!currentSheet) | 78 | if (!currentSheet) |
79 | { | 79 | { |
80 | QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); | 80 | QMessageBox::critical(this, tr("Error"), tr("Inconsistency error!")); |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | sheet->copySheetData(¤tSheet->data); | 83 | sheet->copySheetData(¤tSheet->data); |
84 | stream.writeRawBytes("SQT100", 6); | 84 | stream.writeRawBytes("SQT100", 6); |
85 | stream << (Q_UINT32)listSheets.count(); | 85 | stream << (Q_UINT32)listSheets.count(); |
86 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 86 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
87 | { | 87 | { |
88 | stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); | 88 | stream << tempSheet->name << (Q_UINT32)tempSheet->data.count(); |
89 | for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) | 89 | for (typeCellData *tempCell=tempSheet->data.first(); tempCell; tempCell=tempSheet->data.next()) |
90 | stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; | 90 | stream << (Q_UINT32)tempCell->col << (Q_UINT32)tempCell->row << tempCell->borders.right << tempCell->borders.bottom << tempCell->background << (Q_UINT32)tempCell->alignment << tempCell->fontColor << tempCell->font << tempCell->data; |
91 | } | 91 | } |
92 | 92 | ||
93 | lnkDoc->setType("application/sheet-qt"); | 93 | lnkDoc->setType("application/sheet-qt"); |
94 | if (!fm.saveFile(*lnkDoc, streamBuffer)) | 94 | if (!fm.saveFile(*lnkDoc, streamBuffer)) |
@@ -535,157 +535,157 @@ void MainWindow::initMenu() | |||
535 | submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat); | 535 | submenuFunc->insertItem(tr("Sta&tistical"), submenuFuncStat); |
536 | 536 | ||
537 | submenuFuncScientific=new QPopupMenu; | 537 | submenuFuncScientific=new QPopupMenu; |
538 | addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific); | 538 | addFlyAction(tr("BESSELI(x,n)"), tr("BESSELI(x,n)"), "BESSELI(",submenuFuncScientific); |
539 | addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific); | 539 | addFlyAction(tr("BESSELJ(x,n)"), tr("BESSELJ(x,n)"), "BESSELJ(",submenuFuncScientific); |
540 | addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific); | 540 | addFlyAction(tr("BESSELK(x,n)"), tr("BESSELK(x,n)"), "BESSELK(",submenuFuncScientific); |
541 | addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific); | 541 | addFlyAction(tr("BESSELY(x,n)"), tr("BESSELY(x,n)"), "BESSELY(",submenuFuncScientific); |
542 | submenuFuncScientific->insertSeparator(); | 542 | submenuFuncScientific->insertSeparator(); |
543 | addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific); | 543 | addFlyAction(tr("BETAI(x,a,b)"), tr("BETAI(x,a,b)"), "BETAI(",submenuFuncScientific); |
544 | addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific); | 544 | addFlyAction(tr("ERF(a,b)"), tr("ERF(a,b)"), "ERF(",submenuFuncScientific); |
545 | addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific); | 545 | addFlyAction(tr("ERFC(a,b)"), tr("ERFC(a,b)"), "ERFC(",submenuFuncScientific); |
546 | addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific); | 546 | addFlyAction(tr("GAMMALN(x)"), tr("GAMMALN(x)"), "GAMMALN(",submenuFuncScientific); |
547 | addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific); | 547 | addFlyAction(tr("GAMMAP(x,a)"), tr("GAMMAP(x,a)"), "GAMMAP(",submenuFuncScientific); |
548 | addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific); | 548 | addFlyAction(tr("GAMMAQ(x,a)"), tr("GAMMAQ(x,a)"), "GAMMAQ(",submenuFuncScientific); |
549 | submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific); | 549 | submenuFunc->insertItem(tr("Scienti&fic"), submenuFuncScientific); |
550 | 550 | ||
551 | submenuFuncDistr=new QPopupMenu; | 551 | submenuFuncDistr=new QPopupMenu; |
552 | addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr); | 552 | addFlyAction(tr("BETADIST(z,a,b,Q?)"), tr("BETADIST(z,a,b,Q?)"), "BETADIST(",submenuFuncDistr); |
553 | addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr); | 553 | addFlyAction(tr("CHI2DIST(x,n,Q?)"), tr("CHI2DIST(x,n,Q?)"), "CHI2DIST(",submenuFuncDistr); |
554 | addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr); | 554 | addFlyAction(tr("CHIDIST(x,n,Q?)"), tr("CHIDIST(x,n,Q?)"), "CHIDIST(",submenuFuncDistr); |
555 | addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr); | 555 | addFlyAction(tr("FDIST(z,deg1,deg2,Q?)"), tr("FDIST(z,deg1,deg2,Q?)"), "FDIST(",submenuFuncDistr); |
556 | addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr); | 556 | addFlyAction(tr("GAMMADIST(x,a,b,Q?)"), tr("GAMMADIST(x,a,b,Q?)"), "GAMMADIST(",submenuFuncDistr); |
557 | addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr); | 557 | addFlyAction(tr("NORMALDIST(x,m,s,Q?)"), tr("NORMALDIST(x,m,s,Q?)"), "NORMALDIST(",submenuFuncDistr); |
558 | addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr); | 558 | addFlyAction(tr("PHI(x,Q?)"), tr("PHI(x,Q?)"), "PHI(",submenuFuncDistr); |
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 | ||
571 | void MainWindow::initStandardToolbar() | 571 | void 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 | ||
586 | void MainWindow::initFunctionsToolbar() | 586 | void 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 | ||
608 | void MainWindow::initEditToolbar() | 608 | void MainWindow::initEditToolbar() |
609 | { | 609 | { |
610 | toolbarEdit=new QToolBar(this); | 610 | toolbarEdit=new QToolBar(this); |
611 | toolbarEdit->setHorizontalStretchable(TRUE); | 611 | toolbarEdit->setHorizontalStretchable(TRUE); |
612 | moveToolBar(toolbarEdit, Bottom); | 612 | moveToolBar(toolbarEdit, Bottom); |
613 | 613 | ||
614 | editAccept->addTo(toolbarEdit); | 614 | editAccept->addTo(toolbarEdit); |
615 | editCancel->addTo(toolbarEdit); | 615 | editCancel->addTo(toolbarEdit); |
616 | 616 | ||
617 | editData=new QLineEdit(toolbarEdit); | 617 | editData=new QLineEdit(toolbarEdit); |
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 | ||
624 | void MainWindow::slotHelpAbout() | 624 | void 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 | ||
637 | void MainWindow::initSheet() | 637 | void 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 | ||
651 | void MainWindow::slotEditAccept() | 651 | void MainWindow::slotEditAccept() |
652 | { | 652 | { |
653 | sheet->setData(editData->text()); | 653 | sheet->setData(editData->text()); |
654 | } | 654 | } |
655 | 655 | ||
656 | void MainWindow::slotEditCancel() | 656 | void MainWindow::slotEditCancel() |
657 | { | 657 | { |
658 | editData->setText(sheet->getData()); | 658 | editData->setText(sheet->getData()); |
659 | } | 659 | } |
660 | 660 | ||
661 | void MainWindow::slotCellSelect(bool lock) | 661 | void MainWindow::slotCellSelect(bool lock) |
662 | { | 662 | { |
663 | sheet->lockClicks(lock); | 663 | sheet->lockClicks(lock); |
664 | } | 664 | } |
665 | 665 | ||
666 | void MainWindow::addToData(const QString &data) | 666 | void MainWindow::addToData(const QString &data) |
667 | { | 667 | { |
668 | editData->setText(editData->text().insert(editData->cursorPosition(), data)); | 668 | editData->setText(editData->text().insert(editData->cursorPosition(), data)); |
669 | } | 669 | } |
670 | 670 | ||
671 | void MainWindow::slotFuncOutput() | 671 | void MainWindow::slotFuncOutput() |
672 | { | 672 | { |
673 | if (sender()->isA("QAction")) | 673 | if (sender()->isA("QAction")) |
674 | addToData(((QAction *)sender())->toolTip()); | 674 | addToData(((QAction *)sender())->toolTip()); |
675 | } | 675 | } |
676 | 676 | ||
677 | void MainWindow::slotInsertRows() | 677 | void MainWindow::slotInsertRows() |
678 | { | 678 | { |
679 | NumberDialog dialogNumber(this); | 679 | NumberDialog dialogNumber(this); |
680 | if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) | 680 | if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) |
681 | sheet->insertRows(dialogNumber.getValue()); | 681 | sheet->insertRows(dialogNumber.getValue()); |
682 | } | 682 | } |
683 | 683 | ||
684 | void MainWindow::slotInsertCols() | 684 | void MainWindow::slotInsertCols() |
685 | { | 685 | { |
686 | NumberDialog dialogNumber(this); | 686 | NumberDialog dialogNumber(this); |
687 | if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) | 687 | if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) |
688 | sheet->insertColumns(dialogNumber.getValue()); | 688 | sheet->insertColumns(dialogNumber.getValue()); |
689 | } | 689 | } |
690 | 690 | ||
691 | void MainWindow::slotInsertSheets() | 691 | void MainWindow::slotInsertSheets() |