9#ifndef SRC_MAINWINDOW_H_
10#define SRC_MAINWINDOW_H_
31void qt_set_sequence_auto_mnemonic(
bool b);
68 explicit MainWindow(
const QString &searchText = QString(),
69 QWidget *parent =
nullptr);
104 void flashText(
const QString &text,
const bool isError,
105 const bool isHtml =
false);
189 void critical(
const QString &title,
const QString &msg);
212 void passShowHandler(
const QString &output,
const QString &file = QString());
260 void onGrepFinished(
const QList<QPair<QString, QStringList>> &results);
481 QScopedPointer<Ui::MainWindow>
ui;
588 auto firstFile(QModelIndex parentIndex) -> QModelIndex;
596 auto getFile(
const QModelIndex &index,
bool forPass) -> QString;
604 void setPassword(
const QString &file,
bool isNew =
true);
AppSettings, the value object holding every flat QtPass setting.
State machine for MainWindow's content-search (grep) mode.
GrepSearchController m_grep
Mode/busy/cancelled state of the content search.
void dropStaleToolsAreaPalettes()
Drop a style-imposed menu bar or toolbar palette that belongs to the other theme (Breeze header palet...
void startReencryptPath()
Begin a re-encryption pass on the current path.
void addPassword()
Toolbar/context-menu "Add password": open PasswordDialog for a new entry in the current folder.
void closeEvent(QCloseEvent *event) override
Save window state and geometry on close.
void cancelOtpRequest()
Forget the pending OTP and copy requests.
void renameFolder()
Context menu "Rename folder": ask for a new name and Move the current folder, refusing a target outsi...
void initTextBrowser()
Font, wrapping and link handling of the text browser, per the settings.
void enableGitButtons(const bool &state)
Enable or disable the Push and Pull actions together.
void onConfig()
Toolbar "Config": config(), ignoring its result.
void initToolBarButtons()
void endReencryptPath()
Finish a re-encryption pass on the current path.
void onGrepFinished(const QList< QPair< QString, QStringList > > &results)
Handle results from a completed grep search.
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 folder...
void executeWrapperStarted()
Slot called when an external process wrapper has started.
PasswordDisplayPanel * m_displayPanel
Renders decrypted fields into the grid; created in initDisplayPanel(), parented to this window.
void updateGitButtonVisibility(bool uiEnabled=true)
Show Push and Pull only when Git is in use; enable them only while the interface is.
void onDelete()
Toolbar "Delete" or the Delete key: confirm, then remove the current entry or folder....
void showEvent(QShowEvent *event) override
First-show hook used to focus the search input once the window is actually mapped (avoids races with ...
void editPassword(const QString &file)
Open PasswordDialog on an existing entry, after a blocking pull when auto-pull is on....
void changeEvent(QEvent *event) override
React to language or window state changes.
QPointer< QProgressDialog > m_reencryptProgress
void on_profileBox_currentTextChanged(const QString &name)
The user picked another profile: save its store, key and Git flags as the active settings,...
void addFolder()
Toolbar/context-menu "Add folder": ask for a name, create the folder under the current one (refusing ...
void updateGrepButtonVisibility()
ProcessOutputPanel * m_processOutput
void messageAvailable(const QString &message)
Handle an incoming inter-process message (single-instance mode).
MainWindow(const QString &searchText=QString(), QWidget *parent=nullptr)
Construct the main window.
void copyPasswordFromTreeview()
Ctrl+C on the tree: decrypt the current entry and let passwordFromFileToClipboard() copy its first li...
void connectPassSignals(Pass *pass)
Connect the signals of one backend that the window answers itself: errors, critical messages,...
StoreTree * m_tree
The store as shown in the tree: models, view setup, path mapping.
void reencryptProgress(int current, int total)
Update the re-encryption progress dialog.
void keyPressEvent(QKeyEvent *event) override
Handle keyboard shortcuts.
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...
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 showShareHelp()
Share menu "What is this?": the explanation of sharing with GPG.
void onTimeoutSearch()
searchTimer fired: filter the tree on the typed words (matched literally, in order,...
void onPush()
Trigger a git push operation.
void showStatusMessage(const QString &msg, int timeout=2000)
Show a message in the status bar for the given duration.
void focusInput()
Select-all and focus the search box once the window is visible; sets m_firstShowCompleted only on suc...
void on_lineEdit_returnPressed()
Enter in the search box: in content-search mode start (or, for an empty query, cancel) the grep; othe...
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 po...
QString m_copyRequestFile
void on_grepButton_toggled(bool checked)
The content-search toggle changed: switch the search box between name filtering and regex content sea...
void selectFirstFile()
Make the first entry (depth first) under the store root current.
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...
void onOperationError()
An operation ended in an error before or instead of a result: forget the pending requests and what th...
void updateProcessOutputVisibility()
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 (...
void reencryptPath(const QString &dir)
Share menu "Re-encrypt all passwords": confirm, lock the UI via startReencryptPath() and have Imitate...
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 copyPas...
auto confirmPathInStore(const QString &candidate) -> bool
Guard the input dialogs (create, move, rename) against names like ../../etc/passwd or absolute paths ...
void showContextMenu(const QPoint &pos)
Build and show the tree's context menu for the item under the cursor: folder actions (open,...
void updateProfileBoxEnabled()
Enable the profile box only when there is more than one profile, the interface is enabled and the bac...
void critical(const QString &title, const QString &msg)
Display a critical error dialog.
void applyWindowFlagsSettings()
void updateProfileBox()
Fill the profile box from the settings, the active profile selected, without switching profiles while...
void updateOtpButtonVisibility(bool uiEnabled=true)
Refresh the OTP toolbar action from settings.
void addRecipient(const QString &dir)
Share menu "Add recipient": open UsersDialog for dir (keys already in the keyring only).
bool m_firstShowCompleted
Set once focusInput() has actually focused the search box, so later show events leave the focus alone...
void onEdit()
Toolbar "Edit" or a double-click: editPassword() on the current entry.
void restoreWindow()
Restore window geometry and state from saved settings.
void onOtp()
Toolbar "OTP": copy the current entry's one-time code. Uses the code the panel already shows for this...
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 d...
QScopedPointer< Ui::MainWindow > ui
The widgets generated from mainwindow.ui.
auto eventFilter(QObject *obj, QEvent *event) -> bool override
Filter events from watched objects.
void showAbout()
Show the About box: version, project link, licence.
static constexpr int UiWatchdogMs
Interval of m_uiWatchdog in milliseconds.
void openFolder()
Context menu "Open folder with file manager" on the current folder.
void exportPublicKey()
Share menu "Export my public key": run gpg --armor --export for the configured signing key and show t...
void initTrayIcon()
Create m_tray and add the menu bar toggle to its menu; gives up (m_tray stays null) when no system tr...
void flashText(const QString &text, const bool isError, const bool isHtml=false)
Display a transient message in the text panel.
void initStatusBar()
Welcome message and the permanent logo in the status bar.
void initDisplayPanel()
The grid of decrypted fields and what its buttons ask for.
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...
void clearPanel(bool notify=true)
Empty the display panel and the text browser, and leave content search if its results were showing....
void setUiElementsEnabled(bool state)
Enable or disable the main UI elements.
auto event(QEvent *event) -> bool override
Notice an application palette change, the theme switch that makes a style-imposed bar palette suspect...
auto initSucceeded() const -> bool
Return whether startup configuration succeeded.
void applyTextBrowserSettings()
auto config() -> bool
Open the configuration dialog.
auto getCurrentTreeViewIndex() -> QModelIndex
Return the currently selected index in the tree view.
void onUpdate(bool block=false)
Toolbar "Update": git pull.
void deselect()
Clear the current tree view selection.
auto getFile(const QModelIndex &index, bool forPass) -> QString
StoreTree::fileFor() on the tree.
void onProcessOutput(const QString &output, bool isError, Enums::PROCESS pid=Enums::INVALID)
Handle generic process output for display in output panel.
void passShowHandler(const QString &output, const QString &file=QString())
Render a decrypted entry: fields into the display panel, the rest into the text browser,...
void on_treeView_clicked(const QModelIndex &index)
Handle a click on an item in the tree view.
void onUsers()
Toolbar/context-menu "Users": open UsersDialog for the current folder, unless it lies behind a link.
void destroyTrayIcon()
Delete m_tray and reset it to null.
QtPass * m_qtPass
The UI-neutral glue to the backends (output, status, clipboard, QR codes); created in the constructor...
auto firstFile(QModelIndex parentIndex) -> QModelIndex
Depth-first search for the first entry under a folder.
void renamePassword()
Context menu "Rename password": ask for a new name and Move the current entry within its folder,...
void on_lineEdit_textChanged(const QString &arg1)
The search box changed (name filtering only): drop the pending decrypt and the panel,...
Abstract base class for password store operations.
Renders decrypted password-file fields into MainWindow's grid.
The dockable "Process output" console: numbered, colour-coded lines of git/pass/gpg output with a lin...
Application-level glue between the pass backends and whatever shows their results: turns the backends...
The password store as shown in the tree: the QFileSystemModel, the StoreModel proxy on top of it and ...
Handles the system tray icon and menu.
The Enums namespace: clipboard behaviour and the identifiers of the subprocess kinds QtPass queues.
GrepSearchController: the mode/busy/cancelled state machine behind MainWindow's content search.
PROCESS
Identifies different subprocess operations used in QtPass.
StoreTree: owns the QFileSystemModel and StoreModel behind the password tree view and maps view index...
Plain value-object holding all flat QtPass configuration.