QtPass 2.0.0
Developer documentation
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 onProcessOutput (const QString &output, bool isError, Enums::PROCESS pid=Enums::INVALID)
 Handle generic process output for display in output panel.
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, const QString &file=QString())
 Render a decrypted entry: fields into the display panel, the rest into the text browser, and the password onto the clipboard when "Always copy" is set. Decrypts of any entry but the one the panel last asked to show (m_shownFile) are dropped.
void otpFromFileToClipboard (const QString &output, const QString &file)
 Generate a one-time password from decrypted content and copy it. Ignores decrypts of anything but the entry onOtp() asked for.
void passwordFromFileToClipboard (const QString &text, const QString &file)
 Copy the first line of a decrypted entry (Ctrl+C). Ignores decrypts of anything but the entry copyPasswordFromTreeview() asked for; an otpauth:// first line is refused.
void cancelOtpRequest ()
 Forget the pending OTP and copy requests.
void onOperationError ()
 An operation ended in an error before or instead of a result: forget the pending requests and what the panel was about to show.
void dropStaleToolsAreaPalettes ()
 Drop a style-imposed menu bar or toolbar palette that belongs to the other theme (Breeze header palette after a light/dark switch).
void refreshMarkedSecrets (const AppSettings &s)
 Hand the display panel what a template marks secret, in the settings or the store's .templates, when "Hide password" is on. Read each time, so an edit there counts at once.
void onGrepFinished (const QList< QPair< QString, QStringList > > &results)
 Handle results from a completed grep search.
void onPush ()
 Trigger a git push operation.
void onAutoPush ()
 Trigger the automatic git push after a change (QtPass::pushRequested()); see Pass::GitPushAutomatic().
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 reencryptProgress (int current, int total)
 Update the re-encryption progress dialog.
void endReencryptPath ()
 Finish a re-encryption pass on the current path.
void askReencryptUnexpected (const QString &dir, const QStringList &files, const QStringList &details)
 Ask whether entries a re-encryption left alone, being encrypted to other keys than their folder had, are to be re-encrypted after all (ImitatePass::unexpectedRecipients()). They may have been copied in from a folder this folder's recipients cannot read.

Public Member Functions

 MainWindow (const QString &searchText=QString(), QWidget *parent=nullptr)
 Construct the main window.
 ~MainWindow () override
 Save the window state (a quit from the tray menu or a SIGTERM never delivers closeEvent()) and delete the QtPass glue.
void restoreWindow ()
 Restore window geometry and state from saved settings.
auto config () -> bool
 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 initSucceeded () const -> bool
 Return whether startup configuration succeeded.

Static Public Attributes

static constexpr int kMaxFlashCharacters = 64 * 1024
 Most characters the text panel keeps of appended output.

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 event (QEvent *event) -> bool override
 Notice an application palette change, the theme switch that makes a style-imposed bar palette suspect; see dropStaleToolsAreaPalettes().
void showEvent (QShowEvent *event) override
 First-show hook used to focus the search input once the window is actually mapped (avoids races with timers fired before show).
auto eventFilter (QObject *obj, QEvent *event) -> bool override
 Filter events from watched objects.

Private Slots

void updateProfileBox ()
 Fill the profile box from the settings, the active profile selected, without switching profiles while doing so.
void updateProfileBoxEnabled ()
 Enable the profile box only when there is more than one profile, the interface is enabled and the backend is idle.
void on_grepButton_toggled (bool checked)
 The content-search toggle changed: switch the search box between name filtering and regex content search, clearing the query, the tree filter and any results; leaving while a search runs cancels it.
void on_grepResultsList_itemClicked (QTreeWidgetItem *item, int column)
 A content-search result was clicked: select the entry in the tree, show it, and go back to the tree (clearing the results when content is hidden or the panel autoclears).
void addPassword ()
 Toolbar/context-menu "Add password": open PasswordDialog for a new entry in the current folder.
void addFolder ()
 Toolbar/context-menu "Add folder": ask for a name, create the folder under the current one (refusing paths that escape the store) and seed its .gpg-id from the parent when configured.
void onEdit ()
 Toolbar "Edit" or a double-click: editPassword() on the current entry.
void onDelete ()
 Toolbar "Delete" or the Delete key: confirm, then remove the current entry or folder. Nothing selected is a no-op (#556); a linked folder only loses its link, a folder behind a link is refused.
void onOtp ()
 Toolbar "OTP": copy the current entry's one-time code. Uses the code the panel already shows for this entry; otherwise decrypts once and lets otpFromFileToClipboard() finish.
void onUpdate (bool block=false)
 Toolbar "Update": git pull.
void onUsers ()
 Toolbar/context-menu "Users": open UsersDialog for the current folder, unless it lies behind a link.
void onConfig ()
 Toolbar "Config": config(), ignoring its result; refused while a backend still runs or waits, as a profile switch is.
void showAbout ()
 Show the About box: version, project link, licence.
void on_treeView_doubleClicked (const QModelIndex &index)
 A double-click on a tree entry opens it for editing; folders are left to the view.
void clearPanel (bool notify=true)
 Empty the display panel and the text browser, and leave content search if its results were showing.
void clearShownEntry (bool notify)
 Empty the display panel and the text browser and close the QR code: the shown entry only. Runs on clearPanelTimer.
void clearContentResults ()
 Empty the content search results and, if they were showing, put the tree back and leave content search. Runs on clearResultsTimer.
void on_lineEdit_textChanged (const QString &arg1)
 The search box changed (name filtering only): drop the pending decrypt and the panel, expand the tree and restart searchTimer.
void on_lineEdit_returnPressed ()
 Enter in the search box: in content-search mode start (or, for an empty query, cancel) the grep; otherwise select and show the first matching entry.
void on_profileBox_currentTextChanged (const QString &name)
 The user picked another profile: save its store, key and Git flags as the active settings, re-root the tree and clear the selection. Ignored during the fresh start and reverted while an operation runs.
void showContextMenu (const QPoint &pos)
 Build and show the tree's context menu for the item under the cursor: folder actions (open, add, users, rename, Share) or entry actions (edit, rename), plus Delete.
auto backOnMenuEntry (const QString &openedOn) -> bool
 Make the entry a tree menu was opened on current again, for the action picked from it: the current index may have moved on while the menu was open.
void addShareMenu (QMenu &contextMenu, const AppSettings &s)
 Add the Share submenu for the folder under the cursor: the entries are enabled only where a recipient list and a usable gpg or pass make them work.
auto confirmDeletion (const QString &file, bool isDir) -> bool
 Ask before deleting an entry or a folder, naming what goes and warning when the folder holds anything but entries.
auto confirmLinkRemoval (const QString &file) -> bool
 Ask before removing a folder that is a link, which takes the link and leaves what it points to.
void showBrowserContextMenu (const QPoint &pos)
 Show the text browser's standard context menu, reparented to the window so the browser's stylesheet does not bleed into it.
auto browserContextMenu (const QPoint &pos) -> QMenu *
 The text browser's standard context menu, with "Copy Link Location" copying through ClipboardManager.
void openFolder ()
 Context menu "Open folder with file manager" on the current folder.
void renameFolder ()
 Context menu "Rename folder": ask for a new name and Move the current folder, refusing a target outside the store.
void editPassword (const QString &file)
 Open PasswordDialog on an existing entry, after a blocking pull when auto-pull is on. Releases the panel's claim on the next decrypt so the dialog's own Show does not repaint or copy.
void renamePassword ()
 Context menu "Rename password": ask for a new name and Move the current entry within its folder, refusing a target outside the store.
void focusInput ()
 Select-all and focus the search box once the window is visible; sets m_firstShowCompleted only on success so showEvent() retries. Looks the widget up by name because setWindowFlags() can rebuild it under ui->lineEdit (Qt 6.11).
void copyPasswordFromTreeview ()
 Ctrl+C on the tree: decrypt the current entry and let passwordFromFileToClipboard() copy its first line. The newest request wins (m_copyRequestFile). Does nothing while content search results hide the tree.
void copySelectionOrPassword ()
 Ctrl+C anywhere in the window: the selected text when the focus is in a text view or a selectable label with a selection (the shown entry, its field values, the OTP code, the process output), otherwise the password (copyPasswordFromTreeview()).
void onTimeoutSearch ()
 searchTimer fired: filter the tree on the typed words (matched literally, in order, case-insensitively) and select the first match; an empty query collapses the tree and deselects.

Private Member Functions

auto grepLineForDisplay (const QString &line, const AppSettings &s) const -> QString
 A content search match as the results list shows it, by the display panel's rules: a one-time password secret never, the password and a hidden field (PasswordDisplayPanel::hides()) without their value.
void initToolBarButtons ()
void initStatusBar ()
 Welcome message and the permanent logo in the status bar.
void connectBackends ()
void initTextBrowser ()
 Font, wrapping and link handling of the text browser, per the settings.
void initDisplayPanel ()
 The grid of decrypted fields and what its buttons ask for.
void initTimers ()
void initProcessOutput ()
void connectPassSignals (Pass *pass)
 Connect the signals of one backend that the window answers itself: errors, critical messages, wrapper start, idle, status, finishedShow (panel, OTP and Ctrl+C handlers) and finishedGrep.
void selectFirstFile ()
void showContentResults (bool shown)
 Show the content search results in place of the tree, or the tree again.
void cancelContentSearch ()
auto exactMatch () -> QModelIndex
 The entry whose name is exactly the search text, if the filtered tree shows it: team/bank for "team/bank", not a folder of that name.
auto exactMatchPath () -> QString
 The entry file named exactly as the search text, spaces around the text included; failing that, named as the text without them.
void applySearchText (const QString &text)
 Searches for text as qtpass(1) promises for the command line and for text handed over by another qtpass: the tree is filtered to it at once, and an entry named exactly so is opened.
void openExactMatch (const QModelIndex &index)
 Makes index current and opens it, as a click on it would.
auto firstFile (QModelIndex parentIndex) -> QModelIndex
 Depth-first search for the first entry under a folder.
auto getFile (const QModelIndex &index, bool forPass) -> QString
 StoreTree::fileFor() on the tree.
void setPassword (const QString &file, bool isNew=true)
 Run PasswordDialog for a new or existing entry. For a new one the dialog gets the store's real folders (current one preselected) and the .templates, if any.
auto confirmPathInStore (const QString &candidate) -> bool
 Guard the input dialogs (create, move, rename) against names like ../../etc/passwd or absolute paths escaping the store root; warns the user when refusing.
void initTrayIcon ()
 Create m_tray and add the menu bar toggle to its menu; gives up (m_tray stays null) when no system tray is available.
void destroyTrayIcon ()
 Delete m_tray and reset it to null.
void reencryptPath (const QString &dir)
 Share menu "Re-encrypt all passwords": confirm, lock the UI via startReencryptPath() and have ImitatePass rewrite every entry under dir for the recipients in its .gpg-id.
void exportPublicKey ()
 Share menu "Export my public key": run gpg --armor --export for the configured signing key and show the result in ExportPublicKeyDialog; explains what to do when no key is set.
void addRecipient (const QString &dir)
 Share menu "Add recipient": open UsersDialog for dir (keys already in the keyring only).
auto refuseLinkedFolder (const QString &dir) -> bool
 Refuse, with a message, a tree-picked folder that is or lies behind a symlink or junction: what it points to is not part of the store. The store root itself may be a link.
void showShareHelp ()
 Share menu "What is this?": the explanation of sharing with GPG.
void applyTextBrowserSettings ()
void applyWindowFlagsSettings ()
void saveWindowState ()
void updateGitButtonVisibility (bool uiEnabled=true)
 Show Push and Pull only when Git is in use; enable them only while the interface is.
void updateOtpButtonVisibility (bool uiEnabled=true)
 Refresh the OTP toolbar action from settings.
void updateGrepButtonVisibility ()
void enableGitButtons (const bool &state)
 Enable or disable the Push and Pull actions together.
void updateProcessOutputVisibility ()

Private Attributes

QtPass * m_qtPass
 The UI-neutral glue to the backends (output, status, clipboard, QR codes); created in the constructor, deleted in the destructor.
QScopedPointer< Ui::MainWindow > ui
 The widgets generated from mainwindow.ui.
GrepSearchController m_grep
 Mode/busy/cancelled state of the content search.
PasswordDisplayPanel * m_displayPanel = nullptr
 Renders decrypted fields into the grid; created in initDisplayPanel(), parented to this window.
bool m_firstShowCompleted = false
 Set once focusInput() has actually focused the search box, so later show events leave the focus alone.
bool m_themeSwitched = false
QString m_shownFile
QString m_panelEntry
QString m_refreshAfterPush
QPointer< Pass > m_refreshAfterPushOwner
QString m_otpRequestFile
QString m_copyRequestFile
ProcessOutputPanel * m_processOutput = nullptr
StoreTree * m_tree = nullptr
 The store as shown in the tree: models, view setup, path mapping.
QTimer clearPanelTimer
QTimer searchTimer
QTimer clearResultsTimer
QTimer m_uiWatchdog
QPushButton * m_stopButton = nullptr
QPointer< QProgressDialog > m_reencryptProgress
bool m_inProgressUpdate = false
QPointer< QProgressDialog > m_progressToDelete
QPointer< QObject > m_pendingOpen
bool m_reencryptRunning = false
bool m_uiEnabled = true
TrayIcon * m_tray {}
bool m_initSucceeded = false
bool m_freshStart = true

Static Private Attributes

static constexpr int UiWatchdogMs = 30000
 Interval of m_uiWatchdog in milliseconds.

Friends

class tst_mainwindow
 Drives exportPublicKey(), which only a context menu reaches.

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 59 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.

Definition at line 87 of file mainwindow.cpp.

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

◆ ~MainWindow()

MainWindow::~MainWindow ( )
override

Save the window state (a quit from the tray menu or a SIGTERM never delivers closeEvent()) and delete the QtPass glue.

Definition at line 343 of file mainwindow.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addFolder

void MainWindow::addFolder ( )
privateslot

Toolbar/context-menu "Add folder": ask for a name, create the folder under the current one (refusing paths that escape the store) and seed its .gpg-id from the parent when configured.

Definition at line 2109 of file mainwindow.cpp.

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

◆ addPassword

void MainWindow::addPassword ( )
privateslot

Toolbar/context-menu "Add password": open PasswordDialog for a new entry in the current folder.

Definition at line 1551 of file mainwindow.cpp.

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

◆ addRecipient()

void MainWindow::addRecipient ( const QString & dir)
private

Share menu "Add recipient": open UsersDialog for dir (keys already in the keyring only).

Parameters
dirAbsolute folder; refused when behind a link.

Definition at line 2492 of file mainwindow.cpp.

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

◆ addShareMenu

void MainWindow::addShareMenu ( QMenu & contextMenu,
const AppSettings & s )
privateslot

Add the Share submenu for the folder under the cursor: the entries are enabled only where a recipient list and a usable gpg or pass make them work.

Parameters
contextMenuThe menu being built, which owns the submenu.
sThe settings the executables and the store come from.

Definition at line 1951 of file mainwindow.cpp.

Here is the call graph for this function:

◆ applySearchText()

void MainWindow::applySearchText ( const QString & text)
private

Searches for text as qtpass(1) promises for the command line and for text handed over by another qtpass: the tree is filtered to it at once, and an entry named exactly so is opened.

Parameters
textThe search text.

Definition at line 1420 of file mainwindow.cpp.

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

◆ applyTextBrowserSettings()

void MainWindow::applyTextBrowserSettings ( )
private

Re-apply the monospace and line-wrapping settings to the text browser after the configuration dialog.

Definition at line 638 of file mainwindow.cpp.

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

◆ applyWindowFlagsSettings()

void MainWindow::applyWindowFlagsSettings ( )
private

Toggle Qt::WindowStaysOnTopHint to match the "always on top" setting, skipping the native-window rebuild when nothing changes.

Definition at line 655 of file mainwindow.cpp.

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

◆ askReencryptUnexpected

void MainWindow::askReencryptUnexpected ( const QString & dir,
const QStringList & files,
const QStringList & details )
slot

Ask whether entries a re-encryption left alone, being encrypted to other keys than their folder had, are to be re-encrypted after all (ImitatePass::unexpectedRecipients()). They may have been copied in from a folder this folder's recipients cannot read.

Parameters
dirThe folder of the run.
filesThe entries, absolute.
detailsFor each, who would gain it.

Definition at line 2393 of file mainwindow.cpp.

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

◆ backOnMenuEntry

auto MainWindow::backOnMenuEntry ( const QString & openedOn) -> bool
privateslot

Make the entry a tree menu was opened on current again, for the action picked from it: the current index may have moved on while the menu was open.

Parameters
openedOnAbsolute path of that entry; empty for a menu opened beside the entries.
Returns
false when the entry is gone or no longer listed: the action must not run, and the status bar says why.

Definition at line 1981 of file mainwindow.cpp.

Here is the call graph for this function:

◆ browserContextMenu

auto MainWindow::browserContextMenu ( const QPoint & pos) -> QMenu *
privateslot

The text browser's standard context menu, with "Copy Link Location" copying through ClipboardManager.

Qt's own action puts the link on the clipboard as bare text, without the secret hint, the autoclear, or a copied() report; the link can be the entry's URL with a token in it.

Parameters
posViewport position of the right-click.
Returns
A new menu, parented to the window; the caller deletes it.

Definition at line 2068 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ cancelContentSearch()

void MainWindow::cancelContentSearch ( )
private

Stop a running content search on both backends (the active one may have changed since it started). It runs outside the process queue, so only this ends its walk and the gpg it is running; the result it still delivers is discarded by onGrepFinished().

Definition at line 1329 of file mainwindow.cpp.

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

◆ cancelOtpRequest

void MainWindow::cancelOtpRequest ( )
slot

Forget the pending OTP and copy requests.

A failed decrypt never emits Pass::finishedShow; without this a later decrypt of the same entry (the user retrying) would be taken as the answer to a request the user has long given up on.

Definition at line 1650 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ changeEvent()

void MainWindow::changeEvent ( QEvent * event)
overrideprotected

React to language or window state changes.

Parameters
eventThe change event.

Definition at line 437 of file mainwindow.cpp.

Here is the call graph for this function:

◆ clearContentResults

void MainWindow::clearContentResults ( )
privateslot

Empty the content search results and, if they were showing, put the tree back and leave content search. Runs on clearResultsTimer.

Definition at line 954 of file mainwindow.cpp.

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

◆ clearPanel

void MainWindow::clearPanel ( bool notify = true)
privateslot

Empty the display panel and the text browser, and leave content search if its results were showing.

Parameters
notifytrue to show "Password and content hidden" in the browser, false to leave it blank.

Definition at line 935 of file mainwindow.cpp.

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

◆ clearShownEntry

void MainWindow::clearShownEntry ( bool notify)
privateslot

Empty the display panel and the text browser and close the QR code: the shown entry only. Runs on clearPanelTimer.

Parameters
notifytrue to show "Password and content hidden" in the browser, false to leave it blank.

Definition at line 940 of file mainwindow.cpp.

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

◆ closeEvent()

void MainWindow::closeEvent ( QCloseEvent * event)
overrideprotected

Save window state and geometry on close.

Parameters
eventThe close event.

Definition at line 1837 of file mainwindow.cpp.

Here is the call graph for this function:

◆ config()

auto MainWindow::config ( ) -> bool

Open the configuration dialog.

On a fresh start the first-run wizard runs before the dialog is shown. Accepting the dialog does not guarantee a usable configuration: the OK button is not gated on Util::configIsValid(), so QtPass::init() uses the return value to decide whether to ask again or to give up.

Returns
true when the dialog was accepted, false when it was cancelled.

Definition at line 674 of file mainwindow.cpp.

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

◆ confirmDeletion

auto MainWindow::confirmDeletion ( const QString & file,
bool isDir ) -> bool
privateslot

Ask before deleting an entry or a folder, naming what goes and warning when the folder holds anything but entries.

Parameters
fileStore-relative path being deleted.
isDirWhether it is a folder.
Returns
Whether the user said yes.

Definition at line 1553 of file mainwindow.cpp.

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

◆ confirmLinkRemoval

auto MainWindow::confirmLinkRemoval ( const QString & file) -> bool
privateslot

Ask before removing a folder that is a link, which takes the link and leaves what it points to.

Parameters
fileStore-relative path of the link.
Returns
Whether the user said yes.

Definition at line 1612 of file mainwindow.cpp.

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

◆ confirmPathInStore()

auto MainWindow::confirmPathInStore ( const QString & candidate) -> bool
private

Guard the input dialogs (create, move, rename) against names like ../../etc/passwd or absolute paths escaping the store root; warns the user when refusing.

Parameters
candidatePath the user asked for.
Returns
true when it resolves inside the store.

Definition at line 1493 of file mainwindow.cpp.

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

◆ connectBackends()

void MainWindow::connectBackends ( )
private

Connect QtPass's and both backends' signals (the active backend can change through the configuration dialog without a restart).

Definition at line 176 of file mainwindow.cpp.

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

◆ connectPassSignals()

void MainWindow::connectPassSignals ( Pass * pass)
private

Connect the signals of one backend that the window answers itself: errors, critical messages, wrapper start, idle, status, finishedShow (panel, OTP and Ctrl+C handlers) and finishedGrep.

Parameters
passThe backend; both are connected, see connectBackends().

Definition at line 351 of file mainwindow.cpp.

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

◆ copyPasswordFromTreeview

void MainWindow::copyPasswordFromTreeview ( )
privateslot

Ctrl+C on the tree: decrypt the current entry and let passwordFromFileToClipboard() copy its first line. The newest request wins (m_copyRequestFile). Does nothing while content search results hide the tree.

Definition at line 2255 of file mainwindow.cpp.

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

◆ copySelectionOrPassword

void MainWindow::copySelectionOrPassword ( )
privateslot

Ctrl+C anywhere in the window: the selected text when the focus is in a text view or a selectable label with a selection (the shown entry, its field values, the OTP code, the process output), otherwise the password (copyPasswordFromTreeview()).

The shortcut is window-wide, and read-only text views and labels do not take Ctrl+C for themselves (line edits, the hidden password included, do), so a selected login or note was answered with the password.

Definition at line 2227 of file mainwindow.cpp.

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

◆ critical

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

Display a critical error dialog.

Parameters
titleDialog title.
msgError message body.

Definition at line 2572 of file mainwindow.cpp.

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

◆ deselect

void MainWindow::deselect ( )
slot

Clear the current tree view selection.

Definition at line 793 of file mainwindow.cpp.

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

◆ destroyTrayIcon()

void MainWindow::destroyTrayIcon ( )
private

Delete m_tray and reset it to null.

Definition at line 1832 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ dropStaleToolsAreaPalettes

void MainWindow::dropStaleToolsAreaPalettes ( )
slot

Drop a style-imposed menu bar or toolbar palette that belongs to the other theme (Breeze header palette after a light/dark switch).

Definition at line 1893 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ editPassword

void MainWindow::editPassword ( const QString & file)
privateslot

Open PasswordDialog on an existing entry, after a blocking pull when auto-pull is on. Releases the panel's claim on the next decrypt so the dialog's own Show does not repaint or copy.

Parameters
fileStore-relative entry name; empty is a no-op.

Definition at line 2182 of file mainwindow.cpp.

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

◆ enableGitButtons()

void MainWindow::enableGitButtons ( const bool & state)
private

Enable or disable the Push and Pull actions together.

Parameters
statetrue to enable.

Definition at line 2567 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ endReencryptPath

void MainWindow::endReencryptPath ( )
slot

Finish a re-encryption pass on the current path.

Definition at line 2379 of file mainwindow.cpp.

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

◆ event()

auto MainWindow::event ( QEvent * event) -> bool
overrideprotected

Notice an application palette change, the theme switch that makes a style-imposed bar palette suspect; see dropStaleToolsAreaPalettes().

Parameters
eventThe event.
Returns
true if the event was consumed.

Definition at line 427 of file mainwindow.cpp.

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

◆ 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.

Definition at line 1856 of file mainwindow.cpp.

Here is the call graph for this function:

◆ exactMatch()

auto MainWindow::exactMatch ( ) -> QModelIndex
private

The entry whose name is exactly the search text, if the filtered tree shows it: team/bank for "team/bank", not a folder of that name.

Returns
Its proxy index, or invalid when no entry is named so.

Definition at line 1407 of file mainwindow.cpp.

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

◆ exactMatchPath()

auto MainWindow::exactMatchPath ( ) -> QString
private

The entry file named exactly as the search text, spaces around the text included; failing that, named as the text without them.

Returns
Its path, or empty when no such file is in the store.

Definition at line 1389 of file mainwindow.cpp.

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

◆ executeWrapperStarted

void MainWindow::executeWrapperStarted ( )
slot

Slot called when an external process wrapper has started.

Definition at line 808 of file mainwindow.cpp.

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

◆ exportPublicKey()

void MainWindow::exportPublicKey ( )
private

Share menu "Export my public key": run gpg --armor --export for the configured signing key and show the result in ExportPublicKeyDialog; explains what to do when no key is set.

Definition at line 2434 of file mainwindow.cpp.

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

◆ firstFile()

auto MainWindow::firstFile ( QModelIndex parentIndex) -> QModelIndex
private

Depth-first search for the first entry under a folder.

Parameters
parentIndexProxy index of the folder to search.
Returns
Proxy index of the first file, or invalid when there is none.

Definition at line 1474 of file mainwindow.cpp.

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

◆ flashText()

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

Display a transient message in the text panel.

HTML is appended to what the panel shows (command output, one message after another). What was shown before is then trimmed from the front, at a paragraph, until the panel holds at most kMaxFlashCharacters, so a long session of Git and gpg output cannot grow it, and the re-parse each message costs, without bound (scan ANT-2026-VQGRD45V). The new message is never cut: an entry shown this way stays whole.

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

Definition at line 582 of file mainwindow.cpp.

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

◆ focusInput

void MainWindow::focusInput ( )
privateslot

Select-all and focus the search box once the window is visible; sets m_firstShowCompleted only on success so showEvent() retries. Looks the widget up by name because setWindowFlags() can rebuild it under ui->lineEdit (Qt 6.11).

Definition at line 408 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ getCurrentTreeViewIndex()

auto MainWindow::getCurrentTreeViewIndex ( ) -> QModelIndex

Return the currently selected index in the tree view.

Returns
Current QModelIndex.

Definition at line 578 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ getFile()

auto MainWindow::getFile ( const QModelIndex & index,
bool forPass ) -> QString
private

StoreTree::fileFor() on the tree.

Parameters
indexProxy index.
forPasstrue for the store-relative entry name, false for the absolute .gpg path.
Returns
Entry name or path; empty for a folder or invalid index.

Definition at line 764 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ grepLineForDisplay()

auto MainWindow::grepLineForDisplay ( const QString & line,
const AppSettings & s ) const -> QString
nodiscardprivate

A content search match as the results list shows it, by the display panel's rules: a one-time password secret never, the password and a hidden field (PasswordDisplayPanel::hides()) without their value.

Parameters
lineA match from NativeGrep::matchFile().
sThe settings in use.
Returns
The text to show.

Definition at line 1188 of file mainwindow.cpp.

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

◆ initDisplayPanel()

void MainWindow::initDisplayPanel ( )
private

The grid of decrypted fields and what its buttons ask for.

Definition at line 247 of file mainwindow.cpp.

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

◆ initProcessOutput()

void MainWindow::initProcessOutput ( )
private

The Process Output dock, its Settings-menu toggle, and the feed of non-secret process output into it.

Definition at line 303 of file mainwindow.cpp.

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

◆ initStatusBar()

void MainWindow::initStatusBar ( )
private

Welcome message and the permanent logo in the status bar.

Definition at line 525 of file mainwindow.cpp.

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

◆ initSucceeded()

auto MainWindow::initSucceeded ( ) const -> bool
inline

Return whether startup configuration succeeded.

Reflects the result of the initial configuration check performed in the constructor (QtPass::init()). When it is false the application cannot be used (e.g. the user cancelled the first-run wizard), and main() should exit before ever showing the window.

Returns
true when QtPass::init() reported a working configuration.

Definition at line 133 of file mainwindow.h.

Here is the caller graph for this function:

◆ initTextBrowser()

void MainWindow::initTextBrowser ( )
private

Font, wrapping and link handling of the text browser, per the settings.

Definition at line 227 of file mainwindow.cpp.

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

◆ initTimers()

void MainWindow::initTimers ( )
private

The panel-clear and search timers, and the watchdog that re-enables the UI when an operation never signals its end.

Definition at line 268 of file mainwindow.cpp.

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

◆ initToolBarButtons()

void MainWindow::initToolBarButtons ( )
private

Wire the toolbar and menu actions to their slots, set their icons, and set up the "Show menu bar" toggle with its MenuBarPeek (not on macOS).

Definition at line 466 of file mainwindow.cpp.

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

◆ initTrayIcon()

void MainWindow::initTrayIcon ( )
private

Create m_tray and add the menu bar toggle to its menu; gives up (m_tray stays null) when no system tray is available.

Definition at line 1821 of file mainwindow.cpp.

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

◆ keyPressEvent()

void MainWindow::keyPressEvent ( QKeyEvent * event)
overrideprotected

Handle keyboard shortcuts.

Parameters
eventThe key press event.

Definition at line 1923 of file mainwindow.cpp.

Here is the call graph for this function:

◆ messageAvailable

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

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

Parameters
messageMessage string received from another instance.

Definition at line 1726 of file mainwindow.cpp.

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

◆ on_grepButton_toggled

void MainWindow::on_grepButton_toggled ( bool checked)
privateslot

The content-search toggle changed: switch the search box between name filtering and regex content search, clearing the query, the tree filter and any results; leaving while a search runs cancels it.

Parameters
checkedtrue when content search was switched on.

Definition at line 1149 of file mainwindow.cpp.

Here is the call graph for this function:

◆ on_grepResultsList_itemClicked

void MainWindow::on_grepResultsList_itemClicked ( QTreeWidgetItem * item,
int column )
privateslot

A content-search result was clicked: select the entry in the tree, show it, and go back to the tree (clearing the results when content is hidden or the panel autoclears).

Parameters
itemThe clicked entry or match line; its UserRole holds the entry name.
columnUnused.

Definition at line 1289 of file mainwindow.cpp.

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

◆ on_lineEdit_returnPressed

void MainWindow::on_lineEdit_returnPressed ( )
privateslot

Enter in the search box: in content-search mode start (or, for an empty query, cancel) the grep; otherwise select and show the first matching entry.

Definition at line 1113 of file mainwindow.cpp.

Here is the call graph for this function:

◆ on_lineEdit_textChanged

void MainWindow::on_lineEdit_textChanged ( const QString & arg1)
privateslot

The search box changed (name filtering only): drop the pending decrypt and the panel, expand the tree and restart searchTimer.

Parameters
arg1The new text.

Definition at line 1074 of file mainwindow.cpp.

Here is the call graph for this function:

◆ on_profileBox_currentTextChanged

void MainWindow::on_profileBox_currentTextChanged ( const QString & name)
privateslot

The user picked another profile: save its store, key and Git flags as the active settings, re-root the tree and clear the selection. Ignored during the fresh start and reverted while an operation runs.

Parameters
nameThe chosen profile name.

Definition at line 1784 of file mainwindow.cpp.

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

◆ 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.

Definition at line 768 of file mainwindow.cpp.

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

◆ on_treeView_doubleClicked

void MainWindow::on_treeView_doubleClicked ( const QModelIndex & index)
privateslot

A double-click on a tree entry opens it for editing; folders are left to the view.

Parameters
indexThe double-clicked proxy index.

Definition at line 785 of file mainwindow.cpp.

Here is the call graph for this function:

◆ onAutoPush

void MainWindow::onAutoPush ( )
slot

Trigger the automatic git push after a change (QtPass::pushRequested()); see Pass::GitPushAutomatic().

Definition at line 757 of file mainwindow.cpp.

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

◆ onConfig

void MainWindow::onConfig ( )
privateslot

Toolbar "Config": config(), ignoring its result; refused while a backend still runs or waits, as a profile switch is.

Definition at line 1036 of file mainwindow.cpp.

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

◆ onDelete

void MainWindow::onDelete ( )
privateslot

Toolbar "Delete" or the Delete key: confirm, then remove the current entry or folder. Nothing selected is a no-op (#556); a linked folder only loses its link, a folder behind a link is refused.

Definition at line 1622 of file mainwindow.cpp.

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

◆ onEdit

void MainWindow::onEdit ( )
privateslot

Toolbar "Edit" or a double-click: editPassword() on the current entry.

Definition at line 1706 of file mainwindow.cpp.

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

◆ 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.

Definition at line 1210 of file mainwindow.cpp.

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

◆ onOperationError

void MainWindow::onOperationError ( )
slot

An operation ended in an error before or instead of a result: forget the pending requests and what the panel was about to show.

Connected to Pass::processErrorExit. A Show that never ran (a linked entry refused at the store boundary) leaves the previous entry's fields on the panel under the new name otherwise, and onOtp()'s fast path would take that entry's code for the refused one.

Definition at line 1655 of file mainwindow.cpp.

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

◆ onOtp

void MainWindow::onOtp ( )
privateslot

Toolbar "OTP": copy the current entry's one-time code. Uses the code the panel already shows for this entry; otherwise decrypts once and lets otpFromFileToClipboard() finish.

Definition at line 1669 of file mainwindow.cpp.

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

◆ onProcessOutput

void MainWindow::onProcessOutput ( const QString & output,
bool isError,
Enums::PROCESS pid = Enums::INVALID )
slot

Handle generic process output for display in output panel.

Parameters
outputProcess output text.
isErrortrue if output should be styled as error (red).
pidIdentifier of the originating subprocess (for the label prefix); defaults to Enums::INVALID for unlabelled output.

Definition at line 2577 of file mainwindow.cpp.

Here is the call graph for this function:

◆ onPush

void MainWindow::onPush ( )
slot

Trigger a git push operation.

Definition at line 750 of file mainwindow.cpp.

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

◆ onTimeoutSearch

void MainWindow::onTimeoutSearch ( )
privateslot

searchTimer fired: filter the tree on the typed words (matched literally, in order, case-insensitively) and select the first match; an empty query collapses the tree and deselects.

Definition at line 1091 of file mainwindow.cpp.

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

◆ onUpdate

void MainWindow::onUpdate ( bool block = false)
privateslot

Toolbar "Update": git pull.

Parameters
blocktrue to pull synchronously (before opening an edit dialog with auto-pull on).

Definition at line 741 of file mainwindow.cpp.

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

◆ onUsers

void MainWindow::onUsers ( )
privateslot

Toolbar/context-menu "Users": open UsersDialog for the current folder, unless it lies behind a link.

Definition at line 1714 of file mainwindow.cpp.

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

◆ openExactMatch()

void MainWindow::openExactMatch ( const QModelIndex & index)
private

Makes index current and opens it, as a click on it would.

Parameters
indexProxy index of the entry exactMatch() found.

Definition at line 1466 of file mainwindow.cpp.

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

◆ openFolder

void MainWindow::openFolder ( )
privateslot

Context menu "Open folder with file manager" on the current folder.

Definition at line 2102 of file mainwindow.cpp.

Here is the call graph for this function:

◆ otpFromFileToClipboard

void MainWindow::otpFromFileToClipboard ( const QString & output,
const QString & file )
slot

Generate a one-time password from decrypted content and copy it. Ignores decrypts of anything but the entry onOtp() asked for.

Parameters
outputDecrypted entry content.
fileEntry the content belongs to.

Definition at line 883 of file mainwindow.cpp.

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

◆ passShowHandler

void MainWindow::passShowHandler ( const QString & output,
const QString & file = QString() )
slot

Render a decrypted entry: fields into the display panel, the rest into the text browser, and the password onto the clipboard when "Always copy" is set. Decrypts of any entry but the one the panel last asked to show (m_shownFile) are dropped.

Parameters
outputDecrypted password file content.
fileEntry the content belongs to; empty for legacy callers that do not name it, which always repaints.

Definition at line 819 of file mainwindow.cpp.

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

◆ passwordFromFileToClipboard

void MainWindow::passwordFromFileToClipboard ( const QString & text,
const QString & file )
slot

Copy the first line of a decrypted entry (Ctrl+C). Ignores decrypts of anything but the entry copyPasswordFromTreeview() asked for; an otpauth:// first line is refused.

Parameters
textDecrypted entry content.
fileEntry the content belongs to.

Definition at line 2274 of file mainwindow.cpp.

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

◆ reencryptPath()

void MainWindow::reencryptPath ( const QString & dir)
private

Share menu "Re-encrypt all passwords": confirm, lock the UI via startReencryptPath() and have ImitatePass rewrite every entry under dir for the recipients in its .gpg-id.

Parameters
dirAbsolute folder; refused when missing or behind a link.

Definition at line 2299 of file mainwindow.cpp.

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

◆ reencryptProgress

void MainWindow::reencryptProgress ( int current,
int total )
slot

Update the re-encryption progress dialog.

Parameters
currentFiles checked so far.
totalFiles found under the re-encrypted folder.

Definition at line 2359 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ refreshMarkedSecrets

void MainWindow::refreshMarkedSecrets ( const AppSettings & s)
slot

Hand the display panel what a template marks secret, in the settings or the store's .templates, when "Hide password" is on. Read each time, so an edit there counts at once.

Parameters
sThe settings in use.

Definition at line 1180 of file mainwindow.cpp.

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

◆ refuseLinkedFolder()

auto MainWindow::refuseLinkedFolder ( const QString & dir) -> bool
private

Refuse, with a message, a tree-picked folder that is or lies behind a symlink or junction: what it points to is not part of the store. The store root itself may be a link.

Parameters
dirAbsolute folder path.
Returns
true when the folder was refused and the caller must stop.

Definition at line 2503 of file mainwindow.cpp.

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

◆ renameFolder

void MainWindow::renameFolder ( )
privateslot

Context menu "Rename folder": ask for a new name and Move the current folder, refusing a target outside the store.

Definition at line 2157 of file mainwindow.cpp.

Here is the call graph for this function:

◆ renamePassword

void MainWindow::renamePassword ( )
privateslot

Context menu "Rename password": ask for a new name and Move the current entry within its folder, refusing a target outside the store.

Definition at line 2198 of file mainwindow.cpp.

Here is the call graph for this function:

◆ restoreWindow()

void MainWindow::restoreWindow ( )

Restore window geometry and state from saved settings.

Definition at line 1011 of file mainwindow.cpp.

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

◆ saveWindowState()

void MainWindow::saveWindowState ( )
private

Store geometry and dock/toolbar state in the settings; idempotent, called from closeEvent() and the destructor.

Definition at line 403 of file mainwindow.cpp.

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

◆ selectFirstFile()

void MainWindow::selectFirstFile ( )
private

Make the entry named exactly as searched current, or else the first entry (depth first) under the store root.

Definition at line 1334 of file mainwindow.cpp.

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

◆ setPassword()

void MainWindow::setPassword ( const QString & file,
bool isNew = true )
private

Run PasswordDialog for a new or existing entry. For a new one the dialog gets the store's real folders (current one preselected) and the .templates, if any.

Parameters
fileStore-relative entry name; empty when creating.
isNewtrue to create, false to edit file.

Definition at line 1503 of file mainwindow.cpp.

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

◆ setUiElementsEnabled()

void MainWindow::setUiElementsEnabled ( bool state)

Enable or disable the main UI elements.

Parameters
statetrue to enable, false to disable.

Definition at line 978 of file mainwindow.cpp.

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

◆ showAbout

void MainWindow::showAbout ( )
privateslot

Show the About box: version, project link, licence.

Definition at line 1057 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ showBrowserContextMenu

void MainWindow::showBrowserContextMenu ( const QPoint & pos)
privateslot

Show the text browser's standard context menu, reparented to the window so the browser's stylesheet does not bleed into it.

Parameters
posViewport position of the right-click.

Definition at line 2096 of file mainwindow.cpp.

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

◆ showContentResults()

void MainWindow::showContentResults ( bool shown)
private

Show the content search results in place of the tree, or the tree again.

Parameters
shownTrue to show the results. Delete, Edit and OTP are off while they hide the tree; showing the tree enables them again only for a selected entry.

Definition at line 1313 of file mainwindow.cpp.

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

◆ showContextMenu

void MainWindow::showContextMenu ( const QPoint & pos)
privateslot

Build and show the tree's context menu for the item under the cursor: folder actions (open, add, users, rename, Share) or entry actions (edit, rename), plus Delete.

Parameters
posViewport position of the right-click.

Definition at line 2010 of file mainwindow.cpp.

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

◆ showEvent()

void MainWindow::showEvent ( QShowEvent * event)
overrideprotected

First-show hook used to focus the search input once the window is actually mapped (avoids races with timers fired before show).

Parameters
eventThe show event.

Definition at line 454 of file mainwindow.cpp.

Here is the call graph for this function:

◆ showShareHelp()

void MainWindow::showShareHelp ( )
private

Share menu "What is this?": the explanation of sharing with GPG.

Definition at line 2515 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ 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).

Definition at line 2295 of file mainwindow.cpp.

Here is the caller graph for this function:

◆ startReencryptPath

void MainWindow::startReencryptPath ( )
slot

Begin a re-encryption pass on the current path.

Disables the UI, shows a cancellable progress dialog and keeps both in place until endReencryptPath(): while the worker runs, unrelated completions must not re-enable the interface (see setUiElementsEnabled).

Definition at line 2335 of file mainwindow.cpp.

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

◆ updateGitButtonVisibility()

void MainWindow::updateGitButtonVisibility ( bool uiEnabled = true)
private

Show Push and Pull only when Git is in use; enable them only while the interface is.

Parameters
uiEnabledfalse while an operation runs

Definition at line 2532 of file mainwindow.cpp.

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

◆ updateGrepButtonVisibility()

void MainWindow::updateGrepButtonVisibility ( )
private

Show the content-search buttons only when the setting is on; turning it off while in content-search mode leaves that mode.

Definition at line 2558 of file mainwindow.cpp.

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

◆ updateOtpButtonVisibility()

void MainWindow::updateOtpButtonVisibility ( bool uiEnabled = true)
private

Refresh the OTP toolbar action from settings.

Parameters
uiEnabledfalse while a backend operation is in flight, so the action is disabled along with the rest of the UI.

Definition at line 2549 of file mainwindow.cpp.

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

◆ updateProcessOutputVisibility()

void MainWindow::updateProcessOutputVisibility ( )
private

Sync the Process Output dock and its menu toggle with the setting after the configuration dialog.

Definition at line 2586 of file mainwindow.cpp.

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

◆ updateProfileBox

void MainWindow::updateProfileBox ( )
privateslot

Fill the profile box from the settings, the active profile selected, without switching profiles while doing so.

Definition at line 1737 of file mainwindow.cpp.

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

◆ updateProfileBoxEnabled

void MainWindow::updateProfileBoxEnabled ( )
privateslot

Enable the profile box only when there is more than one profile, the interface is enabled and the backend is idle.

Definition at line 1772 of file mainwindow.cpp.

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

◆ tst_mainwindow

friend class tst_mainwindow
friend

Drives exportPublicKey(), which only a context menu reaches.

Definition at line 62 of file mainwindow.h.

Member Data Documentation

◆ clearPanelTimer

QTimer MainWindow::clearPanelTimer
private

Single-shot timer that runs clearShownEntry() "Autoclear panel" seconds after an entry was shown.

Definition at line 629 of file mainwindow.h.

◆ clearResultsTimer

QTimer MainWindow::clearResultsTimer
private

Single-shot timer that runs clearContentResults() "Autoclear panel" seconds after content search results were listed. Their own deadline: an operation that starts or an entry shown meanwhile does not move it.

Definition at line 635 of file mainwindow.h.

◆ kMaxFlashCharacters

int MainWindow::kMaxFlashCharacters = 64 * 1024
staticconstexpr

Most characters the text panel keeps of appended output.

Definition at line 116 of file mainwindow.h.

◆ m_copyRequestFile

QString MainWindow::m_copyRequestFile
private

Entry the in-flight Ctrl+C request asked for; empty when none. Each finishedShow is matched to it by file, so a second Ctrl+C on another entry just replaces the request instead of racing it.

Definition at line 617 of file mainwindow.h.

◆ m_displayPanel

PasswordDisplayPanel* MainWindow::m_displayPanel = nullptr
private

Renders decrypted fields into the grid; created in initDisplayPanel(), parented to this window.

Definition at line 583 of file mainwindow.h.

◆ m_firstShowCompleted

bool MainWindow::m_firstShowCompleted = false
private

Set once focusInput() has actually focused the search box, so later show events leave the focus alone.

Definition at line 588 of file mainwindow.h.

◆ m_freshStart

bool MainWindow::m_freshStart = true
private

No usable configuration has been accepted yet: config() runs the first-run wizard and defaults to pass when it is installed.

Definition at line 678 of file mainwindow.h.

◆ m_grep

GrepSearchController MainWindow::m_grep
private

Mode/busy/cancelled state of the content search.

Definition at line 578 of file mainwindow.h.

◆ m_initSucceeded

bool MainWindow::m_initSucceeded = false
private

Whether the constructor ended with a usable configuration; main() consults it via initSucceeded() to decide whether the application should start at all.

Definition at line 675 of file mainwindow.h.

◆ m_inProgressUpdate

bool MainWindow::m_inProgressUpdate = false
private

True while reencryptProgress() is inside the dialog's setValue(), which runs processEvents() on a modal dialog: endReencryptPath() then only hides the dialog and leaves the delete to reencryptProgress(). A nested event loop (the worker's error box) would otherwise delete it with setValue() still on the stack.

Definition at line 653 of file mainwindow.h.

◆ m_otpRequestFile

QString MainWindow::m_otpRequestFile
private

Entry the in-flight OTP request asked for; empty when none. finishedShow names its file, so otpFromFileToClipboard() simply ignores everything else and passShowHandler() skips the password copy for this one.

Definition at line 613 of file mainwindow.h.

◆ m_panelEntry

QString MainWindow::m_panelEntry
private

Entry whose fields the display panel's rows show; empty while the panel is empty. Unlike m_shownFile it is not dropped when Edit opens, and only a rendered entry sets it, so a double-click on a row edits that entry.

Definition at line 602 of file mainwindow.h.

◆ m_pendingOpen

QPointer<QObject> MainWindow::m_pendingOpen
private

The open applySearchText() waits to make until the tree has loaded the entry; QPointer so an ended or cancelled wait reads back as null.

Definition at line 659 of file mainwindow.h.

◆ m_processOutput

ProcessOutputPanel* MainWindow::m_processOutput = nullptr
private

The process output console, a QDockWidget at the bottom dock area created in initProcessOutput(). It isn't part of the .ui because uic places its QMainWindow children in centralWidget / statusBar / menuBar / toolBars / dock-widget slots only — a sibling widget at the QMainWindow level isn't laid out and ends up obscuring the centralWidget. See #1192 for the symptom.

Definition at line 624 of file mainwindow.h.

◆ m_progressToDelete

QPointer<QProgressDialog> MainWindow::m_progressToDelete
private

Set by endReencryptPath() during m_inProgressUpdate: the dialog to delete once setValue() has returned.

Definition at line 656 of file mainwindow.h.

◆ m_qtPass

QtPass* MainWindow::m_qtPass
private

The UI-neutral glue to the backends (output, status, clipboard, QR codes); created in the constructor, deleted in the destructor.

Definition at line 574 of file mainwindow.h.

◆ m_reencryptProgress

QPointer<QProgressDialog> MainWindow::m_reencryptProgress
private

Progress/cancel dialog shown between startReencryptPath() and endReencryptPath(); QPointer so a closed dialog reads back as null.

Definition at line 647 of file mainwindow.h.

◆ m_reencryptRunning

bool MainWindow::m_reencryptRunning = false
private

True between startReencryptPath() and endReencryptPath(). While set, setUiElementsEnabled(true) is ignored so the git completions queued by Init/Move/Copy (or the UI watchdog) cannot re-enable the interface while the re-encryption worker is still rewriting files.

Definition at line 664 of file mainwindow.h.

◆ m_refreshAfterPush

QString MainWindow::m_refreshAfterPush
private

Entry a save's refresh will show once the push queued with it is done; empty when none waits. Started behind the push, the refresh would empty the browser before a failed push's error was painted.

Definition at line 606 of file mainwindow.h.

◆ m_refreshAfterPushOwner

QPointer<Pass> MainWindow::m_refreshAfterPushOwner
private

The backend whose push m_refreshAfterPush waits for: only its pushes end the wait, and the refresh runs on it.

Definition at line 609 of file mainwindow.h.

◆ m_shownFile

QString MainWindow::m_shownFile
private

Entry the display panel is currently rendering. The tree's currentIndex can move without a repaint (arrow keys and right-click do not emit QTreeView::clicked), so onOtp() must not assume the visible code belongs to the selected entry.

Definition at line 598 of file mainwindow.h.

◆ m_stopButton

QPushButton* MainWindow::m_stopButton = nullptr
private

Shown in the status bar once the watchdog fired while a run still goes: stops it (Pass::stopRunning()).

Definition at line 642 of file mainwindow.h.

◆ m_themeSwitched

bool MainWindow::m_themeSwitched = false
private

Whether the application palette changed in this window's lifetime. A header palette a style stamps on the bars is only suspect after that: at startup the style's colours are fresh, however far from the window colour a scheme puts its header.

Definition at line 593 of file mainwindow.h.

◆ m_tray

TrayIcon* MainWindow::m_tray {}
private

The system tray icon; null until initTrayIcon() creates it when the setting is on, deleted again by destroyTrayIcon() when it is turned off or no tray is available.

Definition at line 671 of file mainwindow.h.

◆ m_tree

StoreTree* MainWindow::m_tree = nullptr
private

The store as shown in the tree: models, view setup, path mapping.

Definition at line 626 of file mainwindow.h.

◆ m_uiEnabled

bool MainWindow::m_uiEnabled = true
private

What setUiElementsEnabled() last set: updateProfileBox() keeps the profile box disabled while an operation runs.

Definition at line 667 of file mainwindow.h.

◆ m_uiWatchdog

QTimer MainWindow::m_uiWatchdog
private

Re-enables the UI if a backend operation disables it but never reports completion (see setUiElementsEnabled); armed whenever the UI is disabled, stopped when it is enabled again.

Definition at line 639 of file mainwindow.h.

◆ searchTimer

QTimer MainWindow::searchTimer
private

searchTimer: single-shot 350 ms debounce between typing in the search box and onTimeoutSearch().

Definition at line 629 of file mainwindow.h.

◆ ui

QScopedPointer<Ui::MainWindow> MainWindow::ui
private

The widgets generated from mainwindow.ui.

Definition at line 576 of file mainwindow.h.

◆ UiWatchdogMs

int MainWindow::UiWatchdogMs = 30000
staticconstexprprivate

Interval of m_uiWatchdog in milliseconds.

Definition at line 644 of file mainwindow.h.


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