summaryrefslogtreecommitdiffstats
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2020-11-05 18:15:15 +0100
committerGitHub <noreply@github.com>2020-11-05 18:15:15 +0100
commit0d0f29657f2c9d2bc8e20a8806dc4cd7ee8d7121 (patch)
tree30fe6225be09eff07058b6b21e7866e069fc44a2 /src/mainwindow.cpp
parentda8aeb3678eed52deb37c22ef640b69b4c991e59 (diff)
parent0455ab57968daee85ba5703715972dc8feff702e (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.cpp5
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);
}