* @brief MainWindow::getFile get the selected file path * @param index * @param forPass returns relative path without '.gpg' extension * @return path * @return */
| 363 | * @return |
| 364 | */ |
| 365 | auto MainWindow::getFile(const QModelIndex &index, bool forPass) -> QString { |
| 366 | if (!index.isValid() || |
| 367 | !model.fileInfo(proxyModel.mapToSource(index)).isFile()) { |
| 368 | return {}; |
| 369 | } |
| 370 | QString filePath = model.filePath(proxyModel.mapToSource(index)); |
| 371 | if (forPass) { |
| 372 | filePath = QDir(QtPassSettings::getPassStore()).relativeFilePath(filePath); |
| 373 | filePath.replace(Util::endsWithGpg(), ""); |
| 374 | } |
| 375 | return filePath; |
| 376 | } |
| 377 | |
| 378 | /** |
| 379 | * @brief MainWindow::on_treeView_clicked read the selected password file |