QtPass 1.7.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
Util Class Reference

Some static utilities to be used elsewhere. More...

#include <util.h>

Static Public Member Functions

static auto findBinaryInPath (const QString &binary) -> QString
 Locate an executable by searching the process PATH and (on Windows) falling back to WSL.
static auto findPasswordStore () -> QString
 Locate the password store directory.
static auto normalizeFolderPath (const QString &path) -> QString
 Ensure a folder path always ends with the native directory separator.
static auto configIsValid () -> bool
 Verify that the required configuration is complete.
static auto getDir (const QModelIndex &index, bool forPass, const QFileSystemModel &model, const StoreModel &storeModel) -> QString
 Get the selected folder path, either relative to the configured pass store or absolute.
static auto endsWithGpg () -> const QRegularExpression &
 Returns a regex to match .gpg file extensions.
static auto protocolRegex () -> const QRegularExpression &
 Returns a regex to match URL protocols.
static auto newLinesRegex () -> const QRegularExpression &
 Returns a regex to match newline characters.
static auto isValidKeyId (const QString &keyId) -> bool
 Check if a string looks like a valid GPG key ID. Accepts:

Detailed Description

Some static utilities to be used elsewhere.

Definition at line 20 of file util.h.

Member Function Documentation

◆ configIsValid()

auto Util::configIsValid ( ) -> bool
static

Verify that the required configuration is complete.

Returns
bool true if the password store's .gpg-id exists AND the configured executable (pass or gpg, depending on settings) exists or is a WSL wrapper; false otherwise.

◆ endsWithGpg()

auto Util::endsWithGpg ( ) -> const QRegularExpression &
static

Returns a regex to match .gpg file extensions.

Returns
Reference to static regex

◆ findBinaryInPath()

auto Util::findBinaryInPath ( const QString & binary) -> QString
static

Locate an executable by searching the process PATH and (on Windows) falling back to WSL.

Parameters
binaryExecutable name or relative path to locate (e.g., "gpg" or "pass").
Returns
QString Absolute path to the executable if found, empty QString otherwise.

◆ findPasswordStore()

auto Util::findPasswordStore ( ) -> QString
static

Locate the password store directory.

Returns
QString Path to the password store, always ends with native directory separator.

◆ getDir()

auto Util::getDir ( const QModelIndex & index,
bool forPass,
const QFileSystemModel & model,
const StoreModel & storeModel ) -> QString
static

Get the selected folder path, either relative to the configured pass store or absolute.

Parameters
indexModel index selecting the file or folder.
forPassIf true, return the path relative to the pass store; otherwise return an absolute path.
modelFilesystem model used to resolve the index.
storeModelStoreModel used to map view indexes to the filesystem model.
Returns
QString Folder path that always ends with the native directory separator. Returns an empty string when index is invalid and forPass is true; otherwise returns the pass store root.

◆ isValidKeyId()

auto Util::isValidKeyId ( const QString & keyId) -> bool
static

Check if a string looks like a valid GPG key ID. Accepts:

◆ newLinesRegex()

auto Util::newLinesRegex ( ) -> const QRegularExpression &
static

Returns a regex to match newline characters.

Returns
Reference to static regex

◆ normalizeFolderPath()

auto Util::normalizeFolderPath ( const QString & path) -> QString
static

Ensure a folder path always ends with the native directory separator.

Parameters
pathThe folder path to normalize.
Returns
QString Path with trailing separator added if missing.

◆ protocolRegex()

auto Util::protocolRegex ( ) -> const QRegularExpression &
static

Returns a regex to match URL protocols.

Returns
Reference to static regex

The documentation for this class was generated from the following file: