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

Main application window orchestrating UI, user interactions, and external process handlers. More...

#include <mainwindow.h>

Inheritance diagram for MainWindow:
Collaboration diagram for MainWindow:

Public Slots

void deselect ()
 Clear the current tree view selection.
void messageAvailable (const QString &message)
 Handle an incoming inter-process message (single-instance mode).
void critical (const QString &title, const QString &msg)
 Display a critical error dialog.
void executeWrapperStarted ()
 Slot called when an external process wrapper has started.
void showStatusMessage (const QString &msg, int timeout=2000)
 Show a message in the status bar for the given duration.
void passShowHandler (const QString &output)
 Handle output from the pass show command.
void passOtpHandler (const QString &output)
 Handle output from the pass OTP command.
void onGrepFinished (const QList< QPair< QString, QStringList > > &results)
 Handle results from a completed grep search.
void onPush ()
 Trigger a git push operation.
void on_treeView_clicked (const QModelIndex &index)
 Handle a click on an item in the tree view.
void startReencryptPath ()
 Begin a re-encryption pass on the current path.
void endReencryptPath ()
 Finish a re-encryption pass on the current path.

Signals

void passShowHandlerFinished (const QString &output)
 Emitted when the pass show handler has finished decrypting.
void passGitInitNeeded ()
 Emitted when a Git init is required for the current store.
void generateGPGKeyPair (const QString &batch)
 Emitted to trigger GPG key pair generation.

Public Member Functions

 MainWindow (const QString &searchText=QString(), QWidget *parent=nullptr)
 Construct the main window.
void restoreWindow ()
 Restore window geometry and state from saved settings.
void generateKeyPair (const QString &batch, QDialog *dialog)
 Open the GPG key generation dialog.
void userDialog (const QString &dir="")
 Open the user/recipient management dialog.
void config ()
 Open the configuration dialog.
void setUiElementsEnabled (bool state)
 Enable or disable the main UI elements.
void flashText (const QString &text, const bool isError, const bool isHtml=false)
 Display a transient message in the text panel.
auto getCurrentTreeViewIndex () -> QModelIndex
 Return the currently selected index in the tree view.
auto getKeygenDialog () -> QDialog *
 Return the active key generation dialog, if any.
void cleanKeygenDialog ()
 Destroy and clear the key generation dialog.

Protected Member Functions

void closeEvent (QCloseEvent *event) override
 Save window state and geometry on close.
void keyPressEvent (QKeyEvent *event) override
 Handle keyboard shortcuts.
void changeEvent (QEvent *event) override
 React to language or window state changes.
auto eventFilter (QObject *obj, QEvent *event) -> bool override
 Filter events from watched objects.

Detailed Description

Main application window orchestrating UI, user interactions, and external process handlers.

Provides the central interface for managing items, folders, passwords, and OTPs; coordinates UI components (toolbars, panels, dialogs, status/tray), selection and navigation in the underlying file/store models, and lifecycle interactions with external handlers (e.g., pass, Git, GPG key generation, OTP).

Definition at line 45 of file mainwindow.h.

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( const QString & searchText = QString(),
QWidget * parent = nullptr )
explicit

Construct the main window.

Parameters
searchTextInitial search text to populate the search field.
parentOptional parent widget.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ changeEvent()

void MainWindow::changeEvent ( QEvent * event)
overrideprotected

React to language or window state changes.

Parameters
eventThe change event.

◆ closeEvent()

void MainWindow::closeEvent ( QCloseEvent * event)
overrideprotected

Save window state and geometry on close.

Parameters
eventThe close event.

◆ critical

void MainWindow::critical ( const QString & title,
const QString & msg )
slot

Display a critical error dialog.

Parameters
titleDialog title.
msgError message body.

◆ eventFilter()

auto MainWindow::eventFilter ( QObject * obj,
QEvent * event ) -> bool
overrideprotected

Filter events from watched objects.

Parameters
objThe object that received the event.
eventThe event to filter.
Returns
true if the event was consumed.

◆ flashText()

void MainWindow::flashText ( const QString & text,
const bool isError,
const bool isHtml = false )

Display a transient message in the text panel.

Parameters
textMessage text to display.
isErrortrue to style the message as an error.
isHtmltrue if text contains HTML markup.

◆ generateGPGKeyPair

void MainWindow::generateGPGKeyPair ( const QString & batch)
signal

Emitted to trigger GPG key pair generation.

Parameters
batchGPG batch parameter string.

◆ generateKeyPair()

void MainWindow::generateKeyPair ( const QString & batch,
QDialog * dialog )

Open the GPG key generation dialog.

Parameters
batchGPG batch parameter string.
dialogDialog to store as the active keygen dialog; it is kept as activeKeygenDialog and represents the UI used during generation.

◆ getCurrentTreeViewIndex()

auto MainWindow::getCurrentTreeViewIndex ( ) -> QModelIndex

Return the currently selected index in the tree view.

Returns
Current QModelIndex.

◆ getKeygenDialog()

auto MainWindow::getKeygenDialog ( ) -> QDialog *
inline

Return the active key generation dialog, if any.

Returns
Pointer to the keygen QDialog, or nullptr.

Definition at line 107 of file mainwindow.h.

◆ keyPressEvent()

void MainWindow::keyPressEvent ( QKeyEvent * event)
overrideprotected

Handle keyboard shortcuts.

Parameters
eventThe key press event.

◆ messageAvailable

void MainWindow::messageAvailable ( const QString & message)
slot

Handle an incoming inter-process message (single-instance mode).

Parameters
messageMessage string received from another instance.

◆ on_treeView_clicked

void MainWindow::on_treeView_clicked ( const QModelIndex & index)
slot

Handle a click on an item in the tree view.

Parameters
indexThe model index that was clicked.

◆ onGrepFinished

void MainWindow::onGrepFinished ( const QList< QPair< QString, QStringList > > & results)
slot

Handle results from a completed grep search.

Parameters
resultsList of file/match pairs from the grep operation.

◆ passOtpHandler

void MainWindow::passOtpHandler ( const QString & output)
slot

Handle output from the pass OTP command.

Parameters
outputOTP output string.

◆ passShowHandler

void MainWindow::passShowHandler ( const QString & output)
slot

Handle output from the pass show command.

Parameters
outputDecrypted password file content.

◆ passShowHandlerFinished

void MainWindow::passShowHandlerFinished ( const QString & output)
signal

Emitted when the pass show handler has finished decrypting.

Parameters
outputDecrypted password file content.

◆ setUiElementsEnabled()

void MainWindow::setUiElementsEnabled ( bool state)

Enable or disable the main UI elements.

Parameters
statetrue to enable, false to disable.

◆ showStatusMessage

void MainWindow::showStatusMessage ( const QString & msg,
int timeout = 2000 )
slot

Show a message in the status bar for the given duration.

Parameters
msgMessage to display.
timeoutDuration in milliseconds (default 2000).

◆ userDialog()

void MainWindow::userDialog ( const QString & dir = "")

Open the user/recipient management dialog.

Parameters
dirDirectory for which to manage recipients.

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