-rw-r--r-- | noncore/apps/opie-sheet/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index 9d69b8a..efbcc20 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp | |||
@@ -444,193 +444,193 @@ void MainWindow::initMenu() | |||
444 | addFlyAction(tr("Arc Sine"), tr("A&rc Sine"), "ASIN(", submenuFuncMath); | 444 | addFlyAction(tr("Arc Sine"), tr("A&rc Sine"), "ASIN(", submenuFuncMath); |
445 | addFlyAction(tr("Cosine"), tr("&Cosine"), "COS(", submenuFuncMath); | 445 | addFlyAction(tr("Cosine"), tr("&Cosine"), "COS(", submenuFuncMath); |
446 | addFlyAction(tr("ArcCosine"), tr("Arc Cos&ine"), "COS(", submenuFuncMath); | 446 | addFlyAction(tr("ArcCosine"), tr("Arc Cos&ine"), "COS(", submenuFuncMath); |
447 | addFlyAction(tr("Tangent"), tr("&Tangent"), "TAN(", submenuFuncMath); | 447 | addFlyAction(tr("Tangent"), tr("&Tangent"), "TAN(", submenuFuncMath); |
448 | addFlyAction(tr("Arc Tangent"), tr("Arc Tan&gent"), "ATAN(", submenuFuncMath); | 448 | addFlyAction(tr("Arc Tangent"), tr("Arc Tan&gent"), "ATAN(", submenuFuncMath); |
449 | addFlyAction(tr("Arc Tangent of Coordinates"), tr("C&oor. Arc Tangent"), "ATAN2(", submenuFuncMath); | 449 | addFlyAction(tr("Arc Tangent of Coordinates"), tr("C&oor. Arc Tangent"), "ATAN2(", submenuFuncMath); |
450 | submenuFuncMath->insertSeparator(); | 450 | submenuFuncMath->insertSeparator(); |
451 | addFlyAction(tr("Exponential"), tr("&Exponential"), "EXP(", submenuFuncMath); | 451 | addFlyAction(tr("Exponential"), tr("&Exponential"), "EXP(", submenuFuncMath); |
452 | addFlyAction(tr("Logarithm"), tr("&Logarithm"), "LOG(", submenuFuncMath); | 452 | addFlyAction(tr("Logarithm"), tr("&Logarithm"), "LOG(", submenuFuncMath); |
453 | addFlyAction(tr("Power"), tr("&Power"), "POW(", submenuFuncMath); | 453 | addFlyAction(tr("Power"), tr("&Power"), "POW(", submenuFuncMath); |
454 | submenuFunc->insertItem(tr("&Mathematical"), submenuFuncMath); | 454 | submenuFunc->insertItem(tr("&Mathematical"), submenuFuncMath); |
455 | 455 | ||
456 | submenuFuncStat=new QPopupMenu; | 456 | submenuFuncStat=new QPopupMenu; |
457 | addFlyAction(tr("Average"), tr("&Average"), "AVG(", submenuFuncStat); | 457 | addFlyAction(tr("Average"), tr("&Average"), "AVG(", submenuFuncStat); |
458 | addFlyAction(tr("Maximum"), tr("Ma&ximum"), "MAX(", submenuFuncStat); | 458 | addFlyAction(tr("Maximum"), tr("Ma&ximum"), "MAX(", submenuFuncStat); |
459 | addFlyAction(tr("Minimum"), tr("&Minimum"), "MIN(", submenuFuncStat); | 459 | addFlyAction(tr("Minimum"), tr("&Minimum"), "MIN(", submenuFuncStat); |
460 | addFlyAction(tr("Count"), tr("&Count"), "COUNT(", submenuFuncStat); | 460 | addFlyAction(tr("Count"), tr("&Count"), "COUNT(", submenuFuncStat); |
461 | submenuFunc->insertItem(tr("&Statistical"), submenuFuncStat); | 461 | submenuFunc->insertItem(tr("&Statistical"), submenuFuncStat); |
462 | 462 | ||
463 | menuInsert->insertSeparator(); | 463 | menuInsert->insertSeparator(); |
464 | insertCells->addTo(menuInsert); | 464 | insertCells->addTo(menuInsert); |
465 | insertRows->addTo(menuInsert); | 465 | insertRows->addTo(menuInsert); |
466 | insertCols->addTo(menuInsert); | 466 | insertCols->addTo(menuInsert); |
467 | insertSheets->addTo(menuInsert); | 467 | insertSheets->addTo(menuInsert); |
468 | } | 468 | } |
469 | 469 | ||
470 | void MainWindow::initStandardToolbar() | 470 | void MainWindow::initStandardToolbar() |
471 | { | 471 | { |
472 | toolbarStandard=new QPEToolBar(this); | 472 | toolbarStandard=new QPEToolBar(this); |
473 | toolbarStandard->setHorizontalStretchable(TRUE); | 473 | toolbarStandard->setHorizontalStretchable(TRUE); |
474 | moveToolBar(toolbarStandard, Top); | 474 | moveToolBar(toolbarStandard, Top); |
475 | 475 | ||
476 | fileNew->addTo(toolbarStandard); | 476 | fileNew->addTo(toolbarStandard); |
477 | fileOpen->addTo(toolbarStandard); | 477 | fileOpen->addTo(toolbarStandard); |
478 | fileSave->addTo(toolbarStandard); | 478 | fileSave->addTo(toolbarStandard); |
479 | 479 | ||
480 | comboSheets=new QComboBox(toolbarStandard); | 480 | comboSheets=new QComboBox(toolbarStandard); |
481 | toolbarStandard->setStretchableWidget(comboSheets); | 481 | toolbarStandard->setStretchableWidget(comboSheets); |
482 | connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &))); | 482 | connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &))); |
483 | } | 483 | } |
484 | 484 | ||
485 | void MainWindow::initFunctionsToolbar() | 485 | void MainWindow::initFunctionsToolbar() |
486 | { | 486 | { |
487 | toolbarFunctions=new QPEToolBar(this); | 487 | toolbarFunctions=new QPEToolBar(this); |
488 | toolbarFunctions->setHorizontalStretchable(TRUE); | 488 | toolbarFunctions->setHorizontalStretchable(TRUE); |
489 | moveToolBar(toolbarFunctions, Bottom); | 489 | moveToolBar(toolbarFunctions, Bottom); |
490 | 490 | ||
491 | funcEqual->addTo(toolbarFunctions); | 491 | funcEqual->addTo(toolbarFunctions); |
492 | funcPlus->addTo(toolbarFunctions); | 492 | funcPlus->addTo(toolbarFunctions); |
493 | funcMinus->addTo(toolbarFunctions); | 493 | funcMinus->addTo(toolbarFunctions); |
494 | funcCross->addTo(toolbarFunctions); | 494 | funcCross->addTo(toolbarFunctions); |
495 | funcDivide->addTo(toolbarFunctions); | 495 | funcDivide->addTo(toolbarFunctions); |
496 | funcParanOpen->addTo(toolbarFunctions); | 496 | funcParanOpen->addTo(toolbarFunctions); |
497 | funcParanClose->addTo(toolbarFunctions); | 497 | funcParanClose->addTo(toolbarFunctions); |
498 | funcComma->addTo(toolbarFunctions); | 498 | funcComma->addTo(toolbarFunctions); |
499 | 499 | ||
500 | toolFunction=new QToolButton(toolbarFunctions); | 500 | toolFunction=new QToolButton(toolbarFunctions); |
501 | toolFunction->setPixmap(func_func_xpm); | 501 | toolFunction->setPixmap(func_func_xpm); |
502 | toolFunction->setTextLabel(tr("Functions")); | 502 | toolFunction->setTextLabel(tr("Functions")); |
503 | toolFunction->setPopup(submenuFunc); | 503 | toolFunction->setPopup(submenuFunc); |
504 | toolFunction->setPopupDelay(0); | 504 | toolFunction->setPopupDelay(0); |
505 | } | 505 | } |
506 | 506 | ||
507 | void MainWindow::initEditToolbar() | 507 | void MainWindow::initEditToolbar() |
508 | { | 508 | { |
509 | toolbarEdit=new QPEToolBar(this); | 509 | toolbarEdit=new QPEToolBar(this); |
510 | toolbarEdit->setHorizontalStretchable(TRUE); | 510 | toolbarEdit->setHorizontalStretchable(TRUE); |
511 | moveToolBar(toolbarEdit, Bottom); | 511 | moveToolBar(toolbarEdit, Bottom); |
512 | 512 | ||
513 | editAccept->addTo(toolbarEdit); | 513 | editAccept->addTo(toolbarEdit); |
514 | editCancel->addTo(toolbarEdit); | 514 | editCancel->addTo(toolbarEdit); |
515 | 515 | ||
516 | editData=new QLineEdit(toolbarEdit); | 516 | editData=new QLineEdit(toolbarEdit); |
517 | toolbarEdit->setStretchableWidget(editData); | 517 | toolbarEdit->setStretchableWidget(editData); |
518 | connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); | 518 | connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept())); |
519 | 519 | ||
520 | editCellSelect->addTo(toolbarEdit); | 520 | editCellSelect->addTo(toolbarEdit); |
521 | } | 521 | } |
522 | 522 | ||
523 | void MainWindow::slotHelpGeneral() | 523 | void MainWindow::slotHelpGeneral() |
524 | { | 524 | { |
525 | if (QFile::exists(helpFile)) | 525 | if (QFile::exists(helpFile)) |
526 | { | 526 | { |
527 | QCopEnvelope e("QPE/Application/helpbrowser", "showFile(QString)"); | 527 | QCopEnvelope e("QPE/Application/helpbrowser", "showFile(QString)"); |
528 | e << helpFile; | 528 | e << helpFile; |
529 | } | 529 | } |
530 | else | 530 | else |
531 | QMessageBox::critical(this, tr("Error"), tr("Help file not found!")); | 531 | QMessageBox::critical(this, tr("Error"), tr("Help file not found!")); |
532 | } | 532 | } |
533 | 533 | ||
534 | void MainWindow::slotHelpAbout() | 534 | void MainWindow::slotHelpAbout() |
535 | { | 535 | { |
536 | QDialog dialogAbout(this, 0, TRUE); | 536 | QDialog dialogAbout(this, 0, TRUE); |
537 | dialogAbout.resize(width()-40, height()-80); | 537 | dialogAbout.resize(width()-40, height()-80); |
538 | dialogAbout.setCaption(tr("About Opie Sheet")); | 538 | dialogAbout.setCaption(tr("About Opie Sheet")); |
539 | 539 | ||
540 | QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nVersion: 1.0.1 (Final)\nRelease Date: July 4, 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); | 540 | QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.1\nRelease Date: July 04, 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); |
541 | label.setGeometry(dialogAbout.rect()); | 541 | label.setGeometry(dialogAbout.rect()); |
542 | label.setAlignment(Qt::AlignCenter | Qt::WordBreak); | 542 | label.setAlignment(Qt::AlignCenter | Qt::WordBreak); |
543 | 543 | ||
544 | dialogAbout.exec(); | 544 | dialogAbout.exec(); |
545 | } | 545 | } |
546 | 546 | ||
547 | void MainWindow::initSheet() | 547 | void MainWindow::initSheet() |
548 | { | 548 | { |
549 | sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); | 549 | sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this); |
550 | setCentralWidget(sheet); | 550 | setCentralWidget(sheet); |
551 | 551 | ||
552 | connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &))); | 552 | connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &))); |
553 | connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &))); | 553 | connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &))); |
554 | connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); | 554 | connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified())); |
555 | 555 | ||
556 | connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); | 556 | connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut())); |
557 | connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); | 557 | connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy())); |
558 | connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); | 558 | connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear())); |
559 | } | 559 | } |
560 | 560 | ||
561 | void MainWindow::slotEditAccept() | 561 | void MainWindow::slotEditAccept() |
562 | { | 562 | { |
563 | sheet->setData(editData->text()); | 563 | sheet->setData(editData->text()); |
564 | } | 564 | } |
565 | 565 | ||
566 | void MainWindow::slotEditCancel() | 566 | void MainWindow::slotEditCancel() |
567 | { | 567 | { |
568 | editData->setText(sheet->getData()); | 568 | editData->setText(sheet->getData()); |
569 | } | 569 | } |
570 | 570 | ||
571 | void MainWindow::slotCellSelect(bool lock) | 571 | void MainWindow::slotCellSelect(bool lock) |
572 | { | 572 | { |
573 | sheet->lockClicks(lock); | 573 | sheet->lockClicks(lock); |
574 | } | 574 | } |
575 | 575 | ||
576 | void MainWindow::addToData(const QString &data) | 576 | void MainWindow::addToData(const QString &data) |
577 | { | 577 | { |
578 | editData->setText(editData->text().insert(editData->cursorPosition(), data)); | 578 | editData->setText(editData->text().insert(editData->cursorPosition(), data)); |
579 | } | 579 | } |
580 | 580 | ||
581 | void MainWindow::slotFuncOutput() | 581 | void MainWindow::slotFuncOutput() |
582 | { | 582 | { |
583 | if (sender()->isA("QAction")) | 583 | if (sender()->isA("QAction")) |
584 | addToData(((QAction *)sender())->toolTip()); | 584 | addToData(((QAction *)sender())->toolTip()); |
585 | } | 585 | } |
586 | 586 | ||
587 | void MainWindow::slotInsertRows() | 587 | void MainWindow::slotInsertRows() |
588 | { | 588 | { |
589 | NumberDialog dialogNumber(this); | 589 | NumberDialog dialogNumber(this); |
590 | if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) | 590 | if (dialogNumber.exec(tr("Insert Rows"), tr("&Number of rows:"))==QDialog::Accepted) |
591 | sheet->insertRows(dialogNumber.getValue()); | 591 | sheet->insertRows(dialogNumber.getValue()); |
592 | } | 592 | } |
593 | 593 | ||
594 | void MainWindow::slotInsertCols() | 594 | void MainWindow::slotInsertCols() |
595 | { | 595 | { |
596 | NumberDialog dialogNumber(this); | 596 | NumberDialog dialogNumber(this); |
597 | if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) | 597 | if (dialogNumber.exec(tr("Insert Columns"), tr("&Number of columns:"))==QDialog::Accepted) |
598 | sheet->insertColumns(dialogNumber.getValue()); | 598 | sheet->insertColumns(dialogNumber.getValue()); |
599 | } | 599 | } |
600 | 600 | ||
601 | void MainWindow::slotInsertSheets() | 601 | void MainWindow::slotInsertSheets() |
602 | { | 602 | { |
603 | NumberDialog dialogNumber(this); | 603 | NumberDialog dialogNumber(this); |
604 | if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted) | 604 | if (dialogNumber.exec(tr("Add Sheets"), tr("&Number of sheets:"))==QDialog::Accepted) |
605 | for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet(); | 605 | for (int i=dialogNumber.getValue(); i>0; --i) createNewSheet(); |
606 | } | 606 | } |
607 | 607 | ||
608 | void MainWindow::slotCellClicked(const QString &cell) | 608 | void MainWindow::slotCellClicked(const QString &cell) |
609 | { | 609 | { |
610 | editCellSelect->setOn(FALSE); | 610 | editCellSelect->setOn(FALSE); |
611 | addToData(cell); | 611 | addToData(cell); |
612 | } | 612 | } |
613 | 613 | ||
614 | typeSheet *MainWindow::createNewSheet() | 614 | typeSheet *MainWindow::createNewSheet() |
615 | { | 615 | { |
616 | typeSheet *newSheet=new typeSheet; | 616 | typeSheet *newSheet=new typeSheet; |
617 | int currentNo=1, tempNo; | 617 | int currentNo=1, tempNo; |
618 | bool ok; | 618 | bool ok; |
619 | 619 | ||
620 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 620 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
621 | if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok) | 621 | if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok) |
622 | currentNo=tempNo+1; | 622 | currentNo=tempNo+1; |
623 | 623 | ||
624 | newSheet->name=tr("Sheet")+QString::number(currentNo); | 624 | newSheet->name=tr("Sheet")+QString::number(currentNo); |
625 | newSheet->data.setAutoDelete(TRUE); | 625 | newSheet->data.setAutoDelete(TRUE); |
626 | 626 | ||
627 | comboSheets->insertItem(newSheet->name); | 627 | comboSheets->insertItem(newSheet->name); |
628 | listSheets.append(newSheet); | 628 | listSheets.append(newSheet); |
629 | return newSheet; | 629 | return newSheet; |
630 | } | 630 | } |
631 | 631 | ||
632 | typeSheet *MainWindow::findSheet(const QString &name) | 632 | typeSheet *MainWindow::findSheet(const QString &name) |
633 | { | 633 | { |
634 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) | 634 | for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) |
635 | if (tempSheet->name==name) | 635 | if (tempSheet->name==name) |
636 | return tempSheet; | 636 | return tempSheet; |