* @brief MainWindow::renamePassword rename an existing password */
| 1325 | * @brief MainWindow::renamePassword rename an existing password |
| 1326 | */ |
| 1327 | void MainWindow::renamePassword() { |
| 1328 | bool ok; |
| 1329 | QString file = getFile(ui->treeView->currentIndex(), false); |
| 1330 | QString filePath = QFileInfo(file).path(); |
| 1331 | QString fileName = QFileInfo(file).fileName(); |
| 1332 | if (fileName.endsWith(".gpg", Qt::CaseInsensitive)) { |
| 1333 | fileName.chop(4); |
| 1334 | } |
| 1335 | |
| 1336 | QString newName = |
| 1337 | QInputDialog::getText(this, tr("Rename file"), tr("Rename File To: "), |
| 1338 | QLineEdit::Normal, fileName, &ok); |
| 1339 | if (!ok || newName.isEmpty()) { |
| 1340 | return; |
| 1341 | } |
| 1342 | QString newFile = QDir(filePath).filePath(newName); |
| 1343 | QtPassSettings::getPass()->Move(file, newFile); |
| 1344 | } |
| 1345 | |
| 1346 | /** |
| 1347 | * @brief MainWindow::clearTemplateWidgets empty the template widget fields in |