| 1471 | } |
| 1472 | |
| 1473 | void MainWindow::renameFile() |
| 1474 | { |
| 1475 | ScintillaNext *editor = currentEditor(); |
| 1476 | |
| 1477 | if (editor->isFile()) { |
| 1478 | const QString filter = app->getFileDialogFilter(); |
| 1479 | QString selectedFilter = app->getFileDialogFilterForLanguage(editor->languageName); |
| 1480 | QString fileName = FileDialogHelpers::getSaveFileName(this, tr("Rename"), defaultDirectoryManager->getDefaultDirectory(), filter, &selectedFilter); |
| 1481 | |
| 1482 | if (fileName.isEmpty()) { |
| 1483 | return; |
| 1484 | } |
| 1485 | |
| 1486 | emit fileDialogAccepted(fileName); |
| 1487 | |
| 1488 | // TODO |
| 1489 | // The new fileName might be to one of the existing editors. |
| 1490 | //auto otherEditor = app->getEditorByFilePath(fileName); |
| 1491 | |
| 1492 | bool renameSuccessful = editor->rename(fileName); |
| 1493 | Q_UNUSED(renameSuccessful) |
| 1494 | } |
| 1495 | else { |
| 1496 | bool ok; |
| 1497 | QString text = QInputDialog::getText(this, tr("Rename"), tr("Name:"), QLineEdit::Normal, editor->getName(), &ok); |
| 1498 | |
| 1499 | if (ok && !text.isEmpty()) { |
| 1500 | editor->setName(text); |
| 1501 | } |
| 1502 | } |
| 1503 | } |
| 1504 | |
| 1505 | void MainWindow::moveCurrentFileToTrash() |
| 1506 | { |
nothing calls this directly
no test coverage detected