-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 | |||
@@ -348,385 +348,385 @@ void MainWindow::initActions() | |||
348 | funcMinus=new QAction(tr("Subtraction"), QPixmap(func_minus_xpm), tr("&Subtraction"), 0, this); | 348 | funcMinus=new QAction(tr("Subtraction"), QPixmap(func_minus_xpm), tr("&Subtraction"), 0, this); |
349 | funcMinus->setToolTip("-"); | 349 | funcMinus->setToolTip("-"); |
350 | connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 350 | connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
351 | funcCross=new QAction(tr("Multiplication"), QPixmap(func_cross_xpm), tr("&Multiplication"), 0, this); | 351 | funcCross=new QAction(tr("Multiplication"), QPixmap(func_cross_xpm), tr("&Multiplication"), 0, this); |
352 | funcCross->setToolTip("*"); | 352 | funcCross->setToolTip("*"); |
353 | connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 353 | connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
354 | funcDivide=new QAction(tr("Division"), QPixmap(func_divide_xpm), tr("&Division"), 0, this); | 354 | funcDivide=new QAction(tr("Division"), QPixmap(func_divide_xpm), tr("&Division"), 0, this); |
355 | funcDivide->setToolTip("/"); | 355 | funcDivide->setToolTip("/"); |
356 | connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 356 | connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
357 | funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), QPixmap(func_paran_open_xpm), tr("&Open Paranthesis"), 0, this); | 357 | funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), QPixmap(func_paran_open_xpm), tr("&Open Paranthesis"), 0, this); |
358 | funcParanOpen->setToolTip("("); | 358 | funcParanOpen->setToolTip("("); |
359 | connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 359 | connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
360 | funcParanClose=new QAction(tr("Close Paranthesis"), QPixmap(func_paran_close_xpm), tr("&Close Paranthesis"), 0, this); | 360 | funcParanClose=new QAction(tr("Close Paranthesis"), QPixmap(func_paran_close_xpm), tr("&Close Paranthesis"), 0, this); |
361 | funcParanClose->setToolTip(")"); | 361 | funcParanClose->setToolTip(")"); |
362 | connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 362 | connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
363 | funcComma=new QAction(tr("Comma"), QPixmap(func_comma_xpm), tr("&Comma"), 0, this); | 363 | funcComma=new QAction(tr("Comma"), QPixmap(func_comma_xpm), tr("&Comma"), 0, this); |
364 | funcComma->setToolTip(","); | 364 | funcComma->setToolTip(","); |
365 | connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 365 | connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
366 | } | 366 | } |
367 | 367 | ||
368 | void MainWindow::initMenu() | 368 | void MainWindow::initMenu() |
369 | { | 369 | { |
370 | menu=new QPEMenuBar(this); | 370 | menu=new QPEMenuBar(this); |
371 | 371 | ||
372 | menuFile=new QPopupMenu; | 372 | menuFile=new QPopupMenu; |
373 | fileNew->addTo(menuFile); | 373 | fileNew->addTo(menuFile); |
374 | fileOpen->addTo(menuFile); | 374 | fileOpen->addTo(menuFile); |
375 | fileSave->addTo(menuFile); | 375 | fileSave->addTo(menuFile); |
376 | fileSaveAs->addTo(menuFile); | 376 | fileSaveAs->addTo(menuFile); |
377 | menuFile->insertSeparator(); | 377 | menuFile->insertSeparator(); |
378 | fileQuit->addTo(menuFile); | 378 | fileQuit->addTo(menuFile); |
379 | menu->insertItem(tr("&File"), menuFile); | 379 | menu->insertItem(tr("&File"), menuFile); |
380 | 380 | ||
381 | menuEdit=new QPopupMenu; | 381 | menuEdit=new QPopupMenu; |
382 | editAccept->addTo(menuEdit); | 382 | editAccept->addTo(menuEdit); |
383 | editCancel->addTo(menuEdit); | 383 | editCancel->addTo(menuEdit); |
384 | editCellSelect->addTo(menuEdit); | 384 | editCellSelect->addTo(menuEdit); |
385 | menuEdit->insertSeparator(); | 385 | menuEdit->insertSeparator(); |
386 | editCut->addTo(menuEdit); | 386 | editCut->addTo(menuEdit); |
387 | editCopy->addTo(menuEdit); | 387 | editCopy->addTo(menuEdit); |
388 | editPaste->addTo(menuEdit); | 388 | editPaste->addTo(menuEdit); |
389 | editPasteContents->addTo(menuEdit); | 389 | editPasteContents->addTo(menuEdit); |
390 | editClear->addTo(menuEdit); | 390 | editClear->addTo(menuEdit); |
391 | menu->insertItem(tr("&Edit"), menuEdit); | 391 | menu->insertItem(tr("&Edit"), menuEdit); |
392 | 392 | ||
393 | menuInsert=new QPopupMenu; | 393 | menuInsert=new QPopupMenu; |
394 | menu->insertItem(tr("&Insert"), menuInsert); | 394 | menu->insertItem(tr("&Insert"), menuInsert); |
395 | 395 | ||
396 | menuFormat=new QPopupMenu; | 396 | menuFormat=new QPopupMenu; |
397 | formatCells->addTo(menuFormat); | 397 | formatCells->addTo(menuFormat); |
398 | menu->insertItem(tr("&Format"), menuFormat); | 398 | menu->insertItem(tr("&Format"), menuFormat); |
399 | 399 | ||
400 | menuData=new QPopupMenu; | 400 | menuData=new QPopupMenu; |
401 | dataSort->addTo(menuData); | 401 | dataSort->addTo(menuData); |
402 | dataFindReplace->addTo(menuData); | 402 | dataFindReplace->addTo(menuData); |
403 | menu->insertItem(tr("&Data"), menuData); | 403 | menu->insertItem(tr("&Data"), menuData); |
404 | 404 | ||
405 | menuHelp=new QPopupMenu; | 405 | menuHelp=new QPopupMenu; |
406 | helpGeneral->addTo(menuHelp); | 406 | helpGeneral->addTo(menuHelp); |
407 | helpAbout->addTo(menuHelp); | 407 | helpAbout->addTo(menuHelp); |
408 | menu->insertItem(tr("&Help"), menuHelp); | 408 | menu->insertItem(tr("&Help"), menuHelp); |
409 | 409 | ||
410 | submenuRow=new QPopupMenu; | 410 | submenuRow=new QPopupMenu; |
411 | rowHeight->addTo(submenuRow); | 411 | rowHeight->addTo(submenuRow); |
412 | rowAdjust->addTo(submenuRow); | 412 | rowAdjust->addTo(submenuRow); |
413 | rowShow->addTo(submenuRow); | 413 | rowShow->addTo(submenuRow); |
414 | rowHide->addTo(submenuRow); | 414 | rowHide->addTo(submenuRow); |
415 | menuFormat->insertItem(tr("&Row"), submenuRow); | 415 | menuFormat->insertItem(tr("&Row"), submenuRow); |
416 | 416 | ||
417 | submenuCol=new QPopupMenu; | 417 | submenuCol=new QPopupMenu; |
418 | colWidth->addTo(submenuCol); | 418 | colWidth->addTo(submenuCol); |
419 | colAdjust->addTo(submenuCol); | 419 | colAdjust->addTo(submenuCol); |
420 | colShow->addTo(submenuCol); | 420 | colShow->addTo(submenuCol); |
421 | colHide->addTo(submenuCol); | 421 | colHide->addTo(submenuCol); |
422 | menuFormat->insertItem(tr("Colum&n"), submenuCol); | 422 | menuFormat->insertItem(tr("Colum&n"), submenuCol); |
423 | 423 | ||
424 | submenuSheet=new QPopupMenu; | 424 | submenuSheet=new QPopupMenu; |
425 | sheetRename->addTo(submenuSheet); | 425 | sheetRename->addTo(submenuSheet); |
426 | sheetRemove->addTo(submenuSheet); | 426 | sheetRemove->addTo(submenuSheet); |
427 | menuFormat->insertItem(tr("&Sheet"), submenuSheet); | 427 | menuFormat->insertItem(tr("&Sheet"), submenuSheet); |
428 | 428 | ||
429 | submenuFunc=new QPopupMenu; | 429 | submenuFunc=new QPopupMenu; |
430 | menuInsert->insertItem(tr("&Function"), submenuFunc); | 430 | menuInsert->insertItem(tr("&Function"), submenuFunc); |
431 | 431 | ||
432 | submenuFuncStd=new QPopupMenu; | 432 | submenuFuncStd=new QPopupMenu; |
433 | funcPlus->addTo(submenuFuncStd); | 433 | funcPlus->addTo(submenuFuncStd); |
434 | funcMinus->addTo(submenuFuncStd); | 434 | funcMinus->addTo(submenuFuncStd); |
435 | funcCross->addTo(submenuFuncStd); | 435 | funcCross->addTo(submenuFuncStd); |
436 | funcDivide->addTo(submenuFuncStd); | 436 | funcDivide->addTo(submenuFuncStd); |
437 | submenuFunc->insertItem(tr("&Standard"), submenuFuncStd); | 437 | submenuFunc->insertItem(tr("&Standard"), submenuFuncStd); |
438 | 438 | ||
439 | submenuFuncMath=new QPopupMenu; | 439 | submenuFuncMath=new QPopupMenu; |
440 | addFlyAction(tr("Summation"), tr("&Summation"), "SUM(", submenuFuncMath); | 440 | addFlyAction(tr("Summation"), tr("&Summation"), "SUM(", submenuFuncMath); |
441 | addFlyAction(tr("Absolute Value"), tr("&Absolute"), "ABS(", submenuFuncMath); | 441 | addFlyAction(tr("Absolute Value"), tr("&Absolute"), "ABS(", submenuFuncMath); |
442 | submenuFuncMath->insertSeparator(); | 442 | submenuFuncMath->insertSeparator(); |
443 | addFlyAction(tr("Sine"), tr("Si&ne"), "SIN(", submenuFuncMath); | 443 | addFlyAction(tr("Sine"), tr("Si&ne"), "SIN(", submenuFuncMath); |
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; |
637 | return NULL; | 637 | return NULL; |
638 | } | 638 | } |
639 | 639 | ||
640 | void MainWindow::slotSheetChanged(const QString &name) | 640 | void MainWindow::slotSheetChanged(const QString &name) |
641 | { | 641 | { |
642 | sheet->copySheetData(&findSheet(sheet->getName())->data); | 642 | sheet->copySheetData(&findSheet(sheet->getName())->data); |
643 | sheet->setName(name); | 643 | sheet->setName(name); |
644 | sheet->setSheetData(&findSheet(name)->data); | 644 | sheet->setSheetData(&findSheet(name)->data); |
645 | } | 645 | } |
646 | 646 | ||
647 | void MainWindow::addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w) | 647 | void MainWindow::addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w) |
648 | { | 648 | { |
649 | QAction *action=new QAction(text, menuText, 0, this); | 649 | QAction *action=new QAction(text, menuText, 0, this); |
650 | action->setToolTip(tip); | 650 | action->setToolTip(tip); |
651 | connect(action, SIGNAL(activated()), this, SLOT(slotFuncOutput())); | 651 | connect(action, SIGNAL(activated()), this, SLOT(slotFuncOutput())); |
652 | action->addTo(w); | 652 | action->addTo(w); |
653 | } | 653 | } |
654 | 654 | ||
655 | void MainWindow::slotFormatCells() | 655 | void MainWindow::slotFormatCells() |
656 | { | 656 | { |
657 | CellFormat dialogCellFormat(this); | 657 | CellFormat dialogCellFormat(this); |
658 | dialogCellFormat.showMaximized(); | 658 | dialogCellFormat.showMaximized(); |
659 | dialogCellFormat.exec(sheet); | 659 | dialogCellFormat.exec(sheet); |
660 | } | 660 | } |
661 | 661 | ||
662 | void MainWindow::slotEditPaste() | 662 | void MainWindow::slotEditPaste() |
663 | { | 663 | { |
664 | sheet->editPaste(); | 664 | sheet->editPaste(); |
665 | } | 665 | } |
666 | 666 | ||
667 | void MainWindow::slotEditPasteContents() | 667 | void MainWindow::slotEditPasteContents() |
668 | { | 668 | { |
669 | sheet->editPaste(TRUE); | 669 | sheet->editPaste(TRUE); |
670 | } | 670 | } |
671 | 671 | ||
672 | void MainWindow::slotRowHeight() | 672 | void MainWindow::slotRowHeight() |
673 | { | 673 | { |
674 | int row1, row2, col1, col2; | 674 | int row1, row2, col1, col2; |
675 | sheet->getSelection(&row1, &col1, &row2, &col2); | 675 | sheet->getSelection(&row1, &col1, &row2, &col2); |
676 | 676 | ||
677 | NumberDialog dialogNumber(this); | 677 | NumberDialog dialogNumber(this); |
678 | if (dialogNumber.exec(tr("Row Height"), tr("&Height of each row:"), sheet->rowHeight(row1))==QDialog::Accepted) | 678 | if (dialogNumber.exec(tr("Row Height"), tr("&Height of each row:"), sheet->rowHeight(row1))==QDialog::Accepted) |
679 | { | 679 | { |
680 | int newHeight=dialogNumber.getValue(), row; | 680 | int newHeight=dialogNumber.getValue(), row; |
681 | for (row=row1; row<=row2; ++row) | 681 | for (row=row1; row<=row2; ++row) |
682 | sheet->setRowHeight(row, newHeight); | 682 | sheet->setRowHeight(row, newHeight); |
683 | } | 683 | } |
684 | } | 684 | } |
685 | 685 | ||
686 | void MainWindow::slotRowAdjust() | 686 | void MainWindow::slotRowAdjust() |
687 | { | 687 | { |
688 | int row1, row2, col1, col2; | 688 | int row1, row2, col1, col2; |
689 | sheet->getSelection(&row1, &col1, &row2, &col2); | 689 | sheet->getSelection(&row1, &col1, &row2, &col2); |
690 | 690 | ||
691 | for (int row=row1; row<=row2; ++row) | 691 | for (int row=row1; row<=row2; ++row) |
692 | sheet->adjustRow(row); | 692 | sheet->adjustRow(row); |
693 | } | 693 | } |
694 | 694 | ||
695 | void MainWindow::slotRowShow() | 695 | void MainWindow::slotRowShow() |
696 | { | 696 | { |
697 | int row1, row2, col1, col2; | 697 | int row1, row2, col1, col2; |
698 | sheet->getSelection(&row1, &col1, &row2, &col2); | 698 | sheet->getSelection(&row1, &col1, &row2, &col2); |
699 | 699 | ||
700 | for (int row=row1; row<=row2; ++row) | 700 | for (int row=row1; row<=row2; ++row) |
701 | sheet->showRow(row); | 701 | sheet->showRow(row); |
702 | } | 702 | } |
703 | 703 | ||
704 | void MainWindow::slotRowHide() | 704 | void MainWindow::slotRowHide() |
705 | { | 705 | { |
706 | int row1, row2, col1, col2; | 706 | int row1, row2, col1, col2; |
707 | sheet->getSelection(&row1, &col1, &row2, &col2); | 707 | sheet->getSelection(&row1, &col1, &row2, &col2); |
708 | 708 | ||
709 | for (int row=row1; row<=row2; ++row) | 709 | for (int row=row1; row<=row2; ++row) |
710 | sheet->hideRow(row); | 710 | sheet->hideRow(row); |
711 | } | 711 | } |
712 | 712 | ||
713 | void MainWindow::slotColumnWidth() | 713 | void MainWindow::slotColumnWidth() |
714 | { | 714 | { |
715 | int row1, row2, col1, col2; | 715 | int row1, row2, col1, col2; |
716 | sheet->getSelection(&row1, &col1, &row2, &col2); | 716 | sheet->getSelection(&row1, &col1, &row2, &col2); |
717 | 717 | ||
718 | NumberDialog dialogNumber(this); | 718 | NumberDialog dialogNumber(this); |
719 | if (dialogNumber.exec(tr("Column Width"), tr("&Width of each column:"), sheet->columnWidth(col1))==QDialog::Accepted) | 719 | if (dialogNumber.exec(tr("Column Width"), tr("&Width of each column:"), sheet->columnWidth(col1))==QDialog::Accepted) |
720 | { | 720 | { |
721 | int newWidth=dialogNumber.getValue(), col; | 721 | int newWidth=dialogNumber.getValue(), col; |
722 | for (col=col1; col<=col2; ++col) | 722 | for (col=col1; col<=col2; ++col) |
723 | sheet->setColumnWidth(col, newWidth); | 723 | sheet->setColumnWidth(col, newWidth); |
724 | } | 724 | } |
725 | } | 725 | } |
726 | 726 | ||
727 | void MainWindow::slotColumnAdjust() | 727 | void MainWindow::slotColumnAdjust() |
728 | { | 728 | { |
729 | int row1, row2, col1, col2; | 729 | int row1, row2, col1, col2; |
730 | sheet->getSelection(&row1, &col1, &row2, &col2); | 730 | sheet->getSelection(&row1, &col1, &row2, &col2); |
731 | 731 | ||
732 | for (int col=col1; col<=col2; ++col) | 732 | for (int col=col1; col<=col2; ++col) |