! * disables cell data relevant actions in the spreadsheet menu if there're no cells available */
| 1504 | * disables cell data relevant actions in the spreadsheet menu if there're no cells available |
| 1505 | */ |
| 1506 | void SpreadsheetView::checkSpreadsheetMenu() { |
| 1507 | if (!m_plotDataMenu) |
| 1508 | initMenus(); |
| 1509 | |
| 1510 | const auto& columns = m_spreadsheet->children<Column>(); |
| 1511 | |
| 1512 | const bool cellsAvail = m_spreadsheet->columnCount() > 0 && m_spreadsheet->rowCount() > 0; |
| 1513 | bool hasValues = this->hasValues(columns); |
| 1514 | m_plotDataMenu->setEnabled(hasValues); |
| 1515 | m_analyzePlotMenu->setEnabled(hasValues); |
| 1516 | m_selectionMenu->setEnabled(hasValues); |
| 1517 | action_select_all->setEnabled(hasValues); |
| 1518 | action_clear_spreadsheet->setEnabled(hasValues); |
| 1519 | action_statistics_all_columns->setEnabled(hasValues); |
| 1520 | action_go_to_cell->setEnabled(cellsAvail); |
| 1521 | |
| 1522 | // deactivate the "Clear masks" action if there are no masked cells |
| 1523 | bool hasMasked = false; |
| 1524 | for (auto* column : columns) { |
| 1525 | if (column->maskedIntervals().size() > 0) { |
| 1526 | hasMasked = true; |
| 1527 | break; |
| 1528 | } |
| 1529 | } |
| 1530 | |
| 1531 | action_clear_masks->setVisible(hasMasked); |
| 1532 | |
| 1533 | // deactivate the "Remove format" action if no columns are formatted |
| 1534 | bool hasFormat = false; |
| 1535 | for (auto* column : columns) { |
| 1536 | if (column->hasHeatmapFormat()) { |
| 1537 | hasFormat = true; |
| 1538 | break; |
| 1539 | } |
| 1540 | } |
| 1541 | |
| 1542 | action_formatting_remove->setVisible(hasFormat); |
| 1543 | |
| 1544 | bool hasStatisticsSpreadsheet = (m_spreadsheet->children<StatisticsSpreadsheet>().size() == 1); |
| 1545 | action_statistics_spreadsheet->setChecked(hasStatisticsSpreadsheet); |
| 1546 | |
| 1547 | if (m_spreadsheet->showComments()) |
| 1548 | action_toggle_comments->setText(i18n("Hide Comments")); |
| 1549 | else |
| 1550 | action_toggle_comments->setText(i18n("Show Comments")); |
| 1551 | |
| 1552 | if (m_spreadsheet->showSparklines()) |
| 1553 | action_toggle_sparklines->setText(i18n("Hide Sparklines")); |
| 1554 | else |
| 1555 | action_toggle_sparklines->setText(i18n("Show Sparklines")); |
| 1556 | } |
| 1557 | |
| 1558 | void SpreadsheetView::checkSpreadsheetSelectionMenu() { |
| 1559 | // deactivate mask/unmask actions for the selection |
nothing calls this directly
no test coverage detected