MCPcopy Create free account
hub / github.com/IJHack/QtPass / renamePassword

Method renamePassword

src/mainwindow.cpp:1327–1344  ·  view source on GitHub ↗

* @brief MainWindow::renamePassword rename an existing password */

Source from the content-addressed store, hash-verified

1325 * @brief MainWindow::renamePassword rename an existing password
1326 */
1327void 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

Callers

nothing calls this directly

Calls 1

MoveMethod · 0.45

Tested by

no test coverage detected