QtPass
1.7.0
Multi-platform GUI for pass, the standard unix password manager.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
grepsearchcontroller.h
1
// SPDX-FileCopyrightText: 2014 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
#ifndef SRC_GREPSEARCHCONTROLLER_H_
4
#define SRC_GREPSEARCHCONTROLLER_H_
5
18
class
GrepSearchController
{
19
public
:
23
struct
FinishOutcome
{
24
bool
restoreCursor
;
25
bool
discard
;
26
};
27
32
auto
inGrepMode
() const ->
bool
{
return
m_mode; }
33
37
void
enterGrepMode
() { m_mode =
true
; }
38
46
auto
leaveGrepMode
() ->
bool
{
47
m_mode =
false
;
48
if
(m_busy) {
49
m_busy =
false
;
50
m_cancelled =
true
;
51
return
true
;
52
}
53
return
false
;
54
}
55
61
void
clearGrepMode
() { m_mode =
false
; }
62
67
auto
beginSearch
() ->
bool
{
68
m_cancelled =
false
;
69
if
(!m_busy) {
70
m_busy =
true
;
71
return
true
;
72
}
73
return
false
;
74
}
75
80
auto
cancelSearch
() ->
bool
{
81
m_cancelled =
true
;
82
if
(m_busy) {
83
m_busy =
false
;
84
return
true
;
85
}
86
return
false
;
87
}
88
94
auto
finishSearch
() ->
FinishOutcome
{
95
FinishOutcome
outcome{m_busy, m_cancelled};
96
m_busy =
false
;
97
m_cancelled =
false
;
98
return
outcome;
99
}
100
101
private
:
102
bool
m_mode =
false
;
103
bool
m_busy =
false
;
104
bool
m_cancelled =
false
;
105
};
106
107
#endif
// SRC_GREPSEARCHCONTROLLER_H_
GrepSearchController
State machine for MainWindow's content-search (grep) mode.
Definition
grepsearchcontroller.h:18
GrepSearchController::clearGrepMode
void clearGrepMode()
Drop the mode flag only, without touching busy/cancelled state.
Definition
grepsearchcontroller.h:61
GrepSearchController::beginSearch
auto beginSearch() -> bool
Begin a search for a non-empty query.
Definition
grepsearchcontroller.h:67
GrepSearchController::leaveGrepMode
auto leaveGrepMode() -> bool
Leave content-search mode (search button toggled off).
Definition
grepsearchcontroller.h:46
GrepSearchController::finishSearch
auto finishSearch() -> FinishOutcome
Record that a search finished and report required side effects.
Definition
grepsearchcontroller.h:94
GrepSearchController::enterGrepMode
void enterGrepMode()
Enter content-search mode (search button toggled on).
Definition
grepsearchcontroller.h:37
GrepSearchController::cancelSearch
auto cancelSearch() -> bool
Cancel the current search (e.g. query cleared).
Definition
grepsearchcontroller.h:80
GrepSearchController::inGrepMode
auto inGrepMode() const -> bool
Whether content-search mode is currently active.
Definition
grepsearchcontroller.h:32
GrepSearchController::FinishOutcome
Outcome of a search-completion transition.
Definition
grepsearchcontroller.h:23
GrepSearchController::FinishOutcome::discard
bool discard
The finished search was cancelled; ignore results.
Definition
grepsearchcontroller.h:25
GrepSearchController::FinishOutcome::restoreCursor
bool restoreCursor
A wait cursor was active and must be restored.
Definition
grepsearchcontroller.h:24
Generated by
1.17.0