* @brief Walk the store, decrypt every .gpg file, collect matches. */
| 1068 | * @brief Walk the store, decrypt every .gpg file, collect matches. |
| 1069 | */ |
| 1070 | auto ImitatePass::grepScanStore(const QStringList &env, const QString &gpgExe, |
| 1071 | const QString &storeDir, |
| 1072 | const QRegularExpression &rx) |
| 1073 | -> QList<QPair<QString, QStringList>> { |
| 1074 | QList<QPair<QString, QStringList>> results; |
| 1075 | QDirIterator it(storeDir, QStringList() << "*.gpg", QDir::Files, |
| 1076 | QDirIterator::Subdirectories); |
| 1077 | while (it.hasNext()) { |
| 1078 | if (QThread::currentThread()->isInterruptionRequested()) |
| 1079 | return {}; |
| 1080 | const QString filePath = it.next(); |
| 1081 | const QStringList matches = grepMatchFile(env, gpgExe, filePath, rx); |
| 1082 | if (!matches.isEmpty()) { |
| 1083 | QString entry = QDir(storeDir).relativeFilePath(filePath); |
| 1084 | if (entry.endsWith(QLatin1String(".gpg"))) |
| 1085 | entry.chop(4); |
| 1086 | results.append({entry, matches}); |
| 1087 | } |
| 1088 | } |
| 1089 | return results; |
| 1090 | } |
| 1091 | |
| 1092 | /** |
| 1093 | * @brief Search all password content by GPG-decrypting each .gpg file. |
nothing calls this directly
no outgoing calls
no test coverage detected