QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
keygendialog.cpp File Reference

Implements KeygenDialog: form validation, splicing the passphrase into the GPG batch the way gpg itself reads it, and the one-attempt connections to the Pass backend. More...

#include "keygendialog.h"
#include "configdialog.h"
#include "pass.h"
#include "qprogressindicator.h"
#include "qtpasssettings.h"
#include "ui_keygendialog.h"
#include "windowstatestore.h"
#include <QCheckBox>
#include <QMessageBox>
#include <QRegularExpression>
#include <algorithm>
#include "qtpasslogging.h"
Include dependency graph for keygendialog.cpp:

Go to the source code of this file.

Functions

static QStringList batchLines (QString batch)
 Cut a batch template into its non-empty lines at CR and LF.
static bool isControlStatement (const QString &line, const QString &control)
 Whether a batch line is the control statement control.

Detailed Description

Implements KeygenDialog: form validation, splicing the passphrase into the GPG batch the way gpg itself reads it, and the one-attempt connections to the Pass backend.

Definition in file keygendialog.cpp.

Function Documentation

◆ batchLines()

QStringList batchLines ( QString batch)
static

Cut a batch template into its non-empty lines at CR and LF.

Plain character splitting, no regex: QRegularExpression matches nothing in text that is not valid UTF-16, so a lone surrogate anywhere left the whole batch one "line" and no-protection was never found.

Parameters
batchThe template text.
Returns
Its lines, without the line breaks and without empty ones.

Definition at line 99 of file keygendialog.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isControlStatement()

bool isControlStatement ( const QString & line,
const QString & control )
static

Whether a batch line is the control statement control.

Matches the way gpg's read_parameter_file does: leading whitespace skipped, keyword ends at the first whitespace, case-insensitive.

Parameters
lineOne line of the batch template.
controlThe statement to look for, e.g. no-protection.
Returns
true when the line is that statement, alone or followed by whitespace.

Definition at line 130 of file keygendialog.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: