QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
FirstRunWizard Class Reference

The first start of QtPass: find GnuPG (and pass and Git), make sure there is a secret key, pick or create the password store. Replaces the chain of message boxes ConfigDialog::wizard() used to run before showing the whole configuration dialog. More...

#include <firstrunwizard.h>

Inheritance diagram for FirstRunWizard:
Collaboration diagram for FirstRunWizard:

Public Types

enum  Page {
  IntroPage , ProgramsPage , KeyPage , StorePage ,
  DonePage
}
 Page ids, in order. More...

Public Member Functions

 FirstRunWizard (QWidget *parent=nullptr)
 Build the wizard from the current settings.
auto settings () const -> AppSettings
 The settings as the pages have edited them so far.
void accept () override
 Write the settings and, when the chosen store has no .gpg-id yet, create and initialise it for the chosen keys first.

Static Public Member Functions

static auto secretKeys (const QString &gpgExecutable) -> QList< UserInfo >
 The secret keys gpg lists for gpgExecutable.
static auto isStore (const QString &path) -> bool
 Whether path points at an initialised store.

Private Member Functions

auto initialiseStore (const QString &store) -> bool
 Make store a password store for the ticked keys: create the folder when it is missing, write and sign its .gpg-id, and set up Git when chosen. On failure what was written is taken back, so a second Finish runs the whole initialisation again.
auto initialiseGit (const QString &store) -> bool
 Give an existing store the Git repository it was chosen to have.

Private Attributes

AppSettings m_settings
QList< UserInfo > m_keys

Friends

class ProgramsWizardPage
class KeyWizardPage
class StoreWizardPage
class DoneWizardPage

Detailed Description

The first start of QtPass: find GnuPG (and pass and Git), make sure there is a secret key, pick or create the password store. Replaces the chain of message boxes ConfigDialog::wizard() used to run before showing the whole configuration dialog.

The wizard works on a copy of the settings and writes it back on Finish, after it has created and initialised the store when that was needed (ProfileInit). Cancel leaves the settings as they were; the caller keeps asking until the configuration is usable or the user gives up.

Definition at line 37 of file firstrunwizard.h.

Member Enumeration Documentation

◆ Page

Page ids, in order.

Enumerator
IntroPage 

What QtPass is and what the wizard will do.

ProgramsPage 

ProgramsWizardPage: where gpg, pass and git are.

KeyPage 

KeyWizardPage: the secret keys, with generation.

StorePage 

StoreWizardPage: the store folder and the Git choice.

DonePage 

DoneWizardPage: summary and two preferences.

Definition at line 68 of file firstrunwizard.h.

Constructor & Destructor Documentation

◆ FirstRunWizard()

FirstRunWizard::FirstRunWizard ( QWidget * parent = nullptr)
explicit

Build the wizard from the current settings.

Parameters
parentThe main window.

Definition at line 70 of file firstrunwizard.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ accept()

void FirstRunWizard::accept ( )
override

Write the settings and, when the chosen store has no .gpg-id yet, create and initialise it for the chosen keys first.

Definition at line 180 of file firstrunwizard.cpp.

Here is the call graph for this function:

◆ initialiseGit()

auto FirstRunWizard::initialiseGit ( const QString & store) -> bool
private

Give an existing store the Git repository it was chosen to have.

Parameters
storeThe folder, cleaned.
Returns
Whether the repository is ready (the user was told otherwise).

Definition at line 168 of file firstrunwizard.cpp.

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

◆ initialiseStore()

auto FirstRunWizard::initialiseStore ( const QString & store) -> bool
private

Make store a password store for the ticked keys: create the folder when it is missing, write and sign its .gpg-id, and set up Git when chosen. On failure what was written is taken back, so a second Finish runs the whole initialisation again.

Parameters
storeThe folder, cleaned.
Returns
Whether the store is ready (the user was told otherwise).

Definition at line 123 of file firstrunwizard.cpp.

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

◆ isStore()

auto FirstRunWizard::isStore ( const QString & path) -> bool
static

Whether path points at an initialised store.

Parameters
pathA directory.
Returns
true when it holds a .gpg-id.

Definition at line 118 of file firstrunwizard.cpp.

Here is the caller graph for this function:

◆ secretKeys()

auto FirstRunWizard::secretKeys ( const QString & gpgExecutable) -> QList< UserInfo >
static

The secret keys gpg lists for gpgExecutable.

Parameters
gpgExecutableThe gpg binary.
Returns
The keys, or an empty list when gpg cannot run.

Definition at line 100 of file firstrunwizard.cpp.

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

◆ settings()

auto FirstRunWizard::settings ( ) const -> AppSettings
inline

The settings as the pages have edited them so far.

Returns
A copy.

Definition at line 51 of file firstrunwizard.h.

◆ DoneWizardPage

friend class DoneWizardPage
friend

Definition at line 102 of file firstrunwizard.h.

◆ KeyWizardPage

friend class KeyWizardPage
friend

Definition at line 100 of file firstrunwizard.h.

◆ ProgramsWizardPage

friend class ProgramsWizardPage
friend

Definition at line 99 of file firstrunwizard.h.

◆ StoreWizardPage

friend class StoreWizardPage
friend

Definition at line 101 of file firstrunwizard.h.

Member Data Documentation

◆ m_keys

QList<UserInfo> FirstRunWizard::m_keys
private

The secret keys as listed on the key page; the enabled ones become the recipients of a new store.

Definition at line 109 of file firstrunwizard.h.

◆ m_settings

AppSettings FirstRunWizard::m_settings
private

The pages' working copy of the settings, loaded in the constructor and saved by accept(); the pages edit it through their friend access.

Definition at line 106 of file firstrunwizard.h.


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