|
QtPass 2.0.0
Developer documentation
|
Main application window orchestrating UI, user interactions, and external process handlers. More...
#include <mainwindow.h>
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. | |
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.
|
explicit |
Construct the main window.
| searchText | Initial search text to populate the search field. |
| parent | Optional parent widget. |
Definition at line 87 of file mainwindow.cpp.
|
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.
|
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.
|
privateslot |
Toolbar/context-menu "Add password": open PasswordDialog for a new entry in the current folder.
Definition at line 1551 of file mainwindow.cpp.
|
private |
Share menu "Add recipient": open UsersDialog for dir (keys already in the keyring only).
| dir | Absolute folder; refused when behind a link. |
Definition at line 2492 of file mainwindow.cpp.
|
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.
| contextMenu | The menu being built, which owns the submenu. |
| s | The settings the executables and the store come from. |
Definition at line 1951 of file mainwindow.cpp.
|
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.
| text | The search text. |
Definition at line 1420 of file mainwindow.cpp.
|
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.
|
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.
|
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.
| dir | The folder of the run. |
| files | The entries, absolute. |
| details | For each, who would gain it. |
Definition at line 2393 of file mainwindow.cpp.
|
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.
| openedOn | Absolute path of that entry; empty for a menu opened beside the entries. |
Definition at line 1981 of file mainwindow.cpp.
|
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.
| pos | Viewport position of the right-click. |
Definition at line 2068 of file mainwindow.cpp.
|
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.
|
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.
|
overrideprotected |
React to language or window state changes.
| event | The change event. |
Definition at line 437 of file mainwindow.cpp.
|
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.
|
privateslot |
Empty the display panel and the text browser, and leave content search if its results were showing.
| notify | true to show "Password and content hidden" in the browser, false to leave it blank. |
Definition at line 935 of file mainwindow.cpp.
|
privateslot |
Empty the display panel and the text browser and close the QR code: the shown entry only. Runs on clearPanelTimer.
| notify | true to show "Password and content hidden" in the browser, false to leave it blank. |
Definition at line 940 of file mainwindow.cpp.
|
overrideprotected |
Save window state and geometry on close.
| event | The close event. |
Definition at line 1837 of file mainwindow.cpp.
| 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.
Definition at line 674 of file mainwindow.cpp.
|
privateslot |
Ask before deleting an entry or a folder, naming what goes and warning when the folder holds anything but entries.
| file | Store-relative path being deleted. |
| isDir | Whether it is a folder. |
Definition at line 1553 of file mainwindow.cpp.
|
privateslot |
Ask before removing a folder that is a link, which takes the link and leaves what it points to.
| file | Store-relative path of the link. |
Definition at line 1612 of file mainwindow.cpp.
|
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.
| candidate | Path the user asked for. |
Definition at line 1493 of file mainwindow.cpp.
|
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.
|
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.
| pass | The backend; both are connected, see connectBackends(). |
Definition at line 351 of file mainwindow.cpp.
|
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.
|
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.
|
slot |
Display a critical error dialog.
| title | Dialog title. |
| msg | Error message body. |
Definition at line 2572 of file mainwindow.cpp.
|
slot |
Clear the current tree view selection.
Definition at line 793 of file mainwindow.cpp.
|
private |
Delete m_tray and reset it to null.
Definition at line 1832 of file mainwindow.cpp.
|
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.
|
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.
| file | Store-relative entry name; empty is a no-op. |
Definition at line 2182 of file mainwindow.cpp.
|
private |
Enable or disable the Push and Pull actions together.
| state | true to enable. |
Definition at line 2567 of file mainwindow.cpp.
|
slot |
Finish a re-encryption pass on the current path.
Definition at line 2379 of file mainwindow.cpp.
|
overrideprotected |
Notice an application palette change, the theme switch that makes a style-imposed bar palette suspect; see dropStaleToolsAreaPalettes().
| event | The event. |
Definition at line 427 of file mainwindow.cpp.
|
overrideprotected |
Filter events from watched objects.
| obj | The object that received the event. |
| event | The event to filter. |
Definition at line 1856 of file mainwindow.cpp.
|
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.
Definition at line 1407 of file mainwindow.cpp.
|
private |
The entry file named exactly as the search text, spaces around the text included; failing that, named as the text without them.
Definition at line 1389 of file mainwindow.cpp.
|
slot |
Slot called when an external process wrapper has started.
Definition at line 808 of file mainwindow.cpp.
|
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.
|
private |
Depth-first search for the first entry under a folder.
| parentIndex | Proxy index of the folder to search. |
Definition at line 1474 of file mainwindow.cpp.
| 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.
| text | Message text to display. |
| isError | true to style the message as an error. |
| isHtml | true if text contains HTML markup. |
Definition at line 582 of file mainwindow.cpp.
|
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.
| auto MainWindow::getCurrentTreeViewIndex | ( | ) | -> QModelIndex |
Return the currently selected index in the tree view.
Definition at line 578 of file mainwindow.cpp.
|
private |
StoreTree::fileFor() on the tree.
| index | Proxy index. |
| forPass | true for the store-relative entry name, false for the absolute .gpg path. |
Definition at line 764 of file mainwindow.cpp.
|
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.
| line | A match from NativeGrep::matchFile(). |
| s | The settings in use. |
Definition at line 1188 of file mainwindow.cpp.
|
private |
The grid of decrypted fields and what its buttons ask for.
Definition at line 247 of file mainwindow.cpp.
|
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.
|
private |
Welcome message and the permanent logo in the status bar.
Definition at line 525 of file mainwindow.cpp.
|
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.
Definition at line 133 of file mainwindow.h.
|
private |
Font, wrapping and link handling of the text browser, per the settings.
Definition at line 227 of file mainwindow.cpp.
|
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.
|
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.
|
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.
|
overrideprotected |
Handle keyboard shortcuts.
| event | The key press event. |
Definition at line 1923 of file mainwindow.cpp.
|
slot |
Handle an incoming inter-process message (single-instance mode).
| message | Message string received from another instance. |
Definition at line 1726 of file mainwindow.cpp.
|
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.
| checked | true when content search was switched on. |
Definition at line 1149 of file mainwindow.cpp.
|
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).
| item | The clicked entry or match line; its UserRole holds the entry name. |
| column | Unused. |
Definition at line 1289 of file mainwindow.cpp.
|
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.
|
privateslot |
The search box changed (name filtering only): drop the pending decrypt and the panel, expand the tree and restart searchTimer.
| arg1 | The new text. |
Definition at line 1074 of file mainwindow.cpp.
|
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.
| name | The chosen profile name. |
Definition at line 1784 of file mainwindow.cpp.
|
slot |
Handle a click on an item in the tree view.
| index | The model index that was clicked. |
Definition at line 768 of file mainwindow.cpp.
|
privateslot |
A double-click on a tree entry opens it for editing; folders are left to the view.
| index | The double-clicked proxy index. |
Definition at line 785 of file mainwindow.cpp.
|
slot |
Trigger the automatic git push after a change (QtPass::pushRequested()); see Pass::GitPushAutomatic().
Definition at line 757 of file mainwindow.cpp.
|
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.
|
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.
|
privateslot |
Toolbar "Edit" or a double-click: editPassword() on the current entry.
Definition at line 1706 of file mainwindow.cpp.
|
slot |
Handle results from a completed grep search.
| results | List of file/match pairs from the grep operation. |
Definition at line 1210 of file mainwindow.cpp.
|
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.
|
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.
|
slot |
Handle generic process output for display in output panel.
| output | Process output text. |
| isError | true if output should be styled as error (red). |
| pid | Identifier of the originating subprocess (for the label prefix); defaults to Enums::INVALID for unlabelled output. |
Definition at line 2577 of file mainwindow.cpp.
|
slot |
Trigger a git push operation.
Definition at line 750 of file mainwindow.cpp.
|
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.
|
privateslot |
Toolbar "Update": git pull.
| block | true to pull synchronously (before opening an edit dialog with auto-pull on). |
Definition at line 741 of file mainwindow.cpp.
|
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.
|
private |
Makes index current and opens it, as a click on it would.
| index | Proxy index of the entry exactMatch() found. |
Definition at line 1466 of file mainwindow.cpp.
|
privateslot |
Context menu "Open folder with file manager" on the current folder.
Definition at line 2102 of file mainwindow.cpp.
|
slot |
Generate a one-time password from decrypted content and copy it. Ignores decrypts of anything but the entry onOtp() asked for.
| output | Decrypted entry content. |
| file | Entry the content belongs to. |
Definition at line 883 of file mainwindow.cpp.
|
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.
| output | Decrypted password file content. |
| file | Entry the content belongs to; empty for legacy callers that do not name it, which always repaints. |
Definition at line 819 of file mainwindow.cpp.
|
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.
| text | Decrypted entry content. |
| file | Entry the content belongs to. |
Definition at line 2274 of file mainwindow.cpp.
|
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.
| dir | Absolute folder; refused when missing or behind a link. |
Definition at line 2299 of file mainwindow.cpp.
|
slot |
Update the re-encryption progress dialog.
| current | Files checked so far. |
| total | Files found under the re-encrypted folder. |
Definition at line 2359 of file mainwindow.cpp.
|
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.
| s | The settings in use. |
Definition at line 1180 of file mainwindow.cpp.
|
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.
| dir | Absolute folder path. |
Definition at line 2503 of file mainwindow.cpp.
|
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.
|
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.
| void MainWindow::restoreWindow | ( | ) |
Restore window geometry and state from saved settings.
Definition at line 1011 of file mainwindow.cpp.
|
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.
|
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.
|
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.
| file | Store-relative entry name; empty when creating. |
| isNew | true to create, false to edit file. |
Definition at line 1503 of file mainwindow.cpp.
| void MainWindow::setUiElementsEnabled | ( | bool | state | ) |
Enable or disable the main UI elements.
| state | true to enable, false to disable. |
Definition at line 978 of file mainwindow.cpp.
|
privateslot |
Show the About box: version, project link, licence.
Definition at line 1057 of file mainwindow.cpp.
|
privateslot |
Show the text browser's standard context menu, reparented to the window so the browser's stylesheet does not bleed into it.
| pos | Viewport position of the right-click. |
Definition at line 2096 of file mainwindow.cpp.
|
private |
Show the content search results in place of the tree, or the tree again.
| shown | True 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.
|
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.
| pos | Viewport position of the right-click. |
Definition at line 2010 of file mainwindow.cpp.
|
overrideprotected |
First-show hook used to focus the search input once the window is actually mapped (avoids races with timers fired before show).
| event | The show event. |
Definition at line 454 of file mainwindow.cpp.
|
private |
Share menu "What is this?": the explanation of sharing with GPG.
Definition at line 2515 of file mainwindow.cpp.
|
slot |
Show a message in the status bar for the given duration.
| msg | Message to display. |
| timeout | Duration in milliseconds (default 2000). |
Definition at line 2295 of file mainwindow.cpp.
|
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.
|
private |
Show Push and Pull only when Git is in use; enable them only while the interface is.
| uiEnabled | false while an operation runs |
Definition at line 2532 of file mainwindow.cpp.
|
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.
|
private |
Refresh the OTP toolbar action from settings.
| uiEnabled | false 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.
|
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.
|
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.
|
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.
|
friend |
Drives exportPublicKey(), which only a context menu reaches.
Definition at line 62 of file mainwindow.h.
|
private |
Single-shot timer that runs clearShownEntry() "Autoclear panel" seconds after an entry was shown.
Definition at line 629 of file mainwindow.h.
|
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.
|
staticconstexpr |
Most characters the text panel keeps of appended output.
Definition at line 116 of file mainwindow.h.
|
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.
|
private |
Renders decrypted fields into the grid; created in initDisplayPanel(), parented to this window.
Definition at line 583 of file mainwindow.h.
|
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.
|
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.
|
private |
Mode/busy/cancelled state of the content search.
Definition at line 578 of file mainwindow.h.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
private |
Set by endReencryptPath() during m_inProgressUpdate: the dialog to delete once setValue() has returned.
Definition at line 656 of file mainwindow.h.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
private |
The store as shown in the tree: models, view setup, path mapping.
Definition at line 626 of file mainwindow.h.
|
private |
What setUiElementsEnabled() last set: updateProfileBox() keeps the profile box disabled while an operation runs.
Definition at line 667 of file mainwindow.h.
|
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.
|
private |
searchTimer: single-shot 350 ms debounce between typing in the search box and onTimeoutSearch().
Definition at line 629 of file mainwindow.h.
|
private |
The widgets generated from mainwindow.ui.
Definition at line 576 of file mainwindow.h.
|
staticconstexprprivate |
Interval of m_uiWatchdog in milliseconds.
Definition at line 644 of file mainwindow.h.