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

State machine for MainWindow's content-search (grep) mode. More...

#include <grepsearchcontroller.h>

Classes

struct  FinishOutcome
 Outcome of a search-completion transition. More...

Public Member Functions

auto inGrepMode () const -> bool
 Whether content-search mode is currently active.
void enterGrepMode ()
 Enter content-search mode (search button toggled on).
auto leaveGrepMode () -> bool
 Leave content-search mode (search button toggled off).
void clearGrepMode ()
 Drop the mode flag only, without touching busy/cancelled state.
auto beginSearch () -> bool
 Begin a search for a non-empty query.
auto cancelSearch () -> bool
 Cancel the current search (e.g. query cleared).
auto finishSearch () -> FinishOutcome
 Record that a search finished and report required side effects.

Detailed Description

State machine for MainWindow's content-search (grep) mode.

Extracted from MainWindow, where the search state lived in three loose booleans (mode / busy / cancelled) poked from six different slots. This owns those flags behind intent-named transitions so the slots no longer introspect raw booleans; each transition returns what UI side effect the caller still has to perform (wait-cursor handling, discarding stale results). It holds no widgets — MainWindow keeps those and reacts to the returned outcomes.

Definition at line 18 of file grepsearchcontroller.h.

Member Function Documentation

◆ beginSearch()

auto GrepSearchController::beginSearch ( ) -> bool
inline

Begin a search for a non-empty query.

Returns
true if a wait cursor should now be shown (search newly busy).

Definition at line 67 of file grepsearchcontroller.h.

◆ cancelSearch()

auto GrepSearchController::cancelSearch ( ) -> bool
inline

Cancel the current search (e.g. query cleared).

Returns
true if a wait cursor should be restored (a search was busy).

Definition at line 80 of file grepsearchcontroller.h.

◆ clearGrepMode()

void GrepSearchController::clearGrepMode ( )
inline

Drop the mode flag only, without touching busy/cancelled state.

Used when the panel is cleared and the search UI is reset in place.

Definition at line 61 of file grepsearchcontroller.h.

◆ enterGrepMode()

void GrepSearchController::enterGrepMode ( )
inline

Enter content-search mode (search button toggled on).

Definition at line 37 of file grepsearchcontroller.h.

◆ finishSearch()

auto GrepSearchController::finishSearch ( ) -> FinishOutcome
inline

Record that a search finished and report required side effects.

Returns
Whether to restore the wait cursor and whether to discard the results (because the search was cancelled).

Definition at line 94 of file grepsearchcontroller.h.

◆ inGrepMode()

auto GrepSearchController::inGrepMode ( ) const -> bool
inline

Whether content-search mode is currently active.

Returns
true if in grep mode.

Definition at line 32 of file grepsearchcontroller.h.

◆ leaveGrepMode()

auto GrepSearchController::leaveGrepMode ( ) -> bool
inline

Leave content-search mode (search button toggled off).

If a search was in flight it is marked cancelled so its pending results are discarded when they arrive.

Returns
true if a busy search was interrupted (restore the wait cursor).

Definition at line 46 of file grepsearchcontroller.h.


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