diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2020-11-05 18:15:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-05 18:15:15 +0100 |
commit | 0d0f29657f2c9d2bc8e20a8806dc4cd7ee8d7121 (patch) | |
tree | 30fe6225be09eff07058b6b21e7866e069fc44a2 /src/mainwindow.cpp | |
parent | da8aeb3678eed52deb37c22ef640b69b4c991e59 (diff) | |
parent | 0455ab57968daee85ba5703715972dc8feff702e (diff) |
Merge pull request #532 from ChaoticEnigma/master
Fix issues with renaming passwords and moving folders
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9134d3c6..036fba12 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1016,15 +1016,14 @@ void MainWindow::editPassword(const QString &file) { void MainWindow::renamePassword() { bool ok; QString file = getFile(ui->treeView->currentIndex(), false); + QString filePath = QFileInfo(file).path(); QString fileName = QFileInfo(file).baseName(); QString newName = QInputDialog::getText(this, tr("Rename file"), tr("Rename File To: "), QLineEdit::Normal, fileName, &ok); if (!ok || newName.isEmpty()) return; - QString newFile = file; - newFile.replace(file.lastIndexOf(fileName), fileName.length(), newName); - newFile.replace(QRegExp("\\.gpg$"), ""); + QString newFile = QDir(filePath).filePath(newName); QtPassSettings::getPass()->Move(file, newFile); } |