QtPass 1.6.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
simpletransaction.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2017 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
3#include "simpletransaction.h"
4#include <utility>
5
6#ifdef QT_DEBUG
7#include "debughelper.h"
8#endif
9
10using Enums::INVALID;
11using Enums::PROCESS;
12
18#ifdef QT_DEBUG
19 dbg() << "START" << transactionDepth;
20#endif
21 transactionDepth++;
22}
23
31#ifdef QT_DEBUG
32 dbg() << "ADD" << transactionDepth << id;
33#endif
34 if (transactionDepth > 0) {
35 lastInTransaction = id;
36 } else {
37 transactionQueue.emplace(id, id);
38 }
39}
40
46#ifdef QT_DEBUG
47 dbg() << "END" << transactionDepth;
48#endif
49 if (transactionDepth > 0) {
50 transactionDepth--;
51 if (transactionDepth == 0 && lastInTransaction != INVALID) {
52 transactionQueue.emplace(lastInTransaction, pid);
53 lastInTransaction = INVALID;
54 }
55 }
56}
57
66#ifdef QT_DEBUG
67 dbg() << "OVER" << transactionDepth << id;
68#endif
69 if (!transactionQueue.empty() && id == transactionQueue.front().first) {
70 PROCESS ret = transactionQueue.front().second;
71 transactionQueue.pop();
72 return ret;
73 }
74 return INVALID;
75}
auto transactionIsOver(Enums::PROCESS) -> Enums::PROCESS
transactionIsOver checks wheather currently finished process is last in current transaction
void transactionEnd(Enums::PROCESS)
transactionEnd marks end of transaction
void transactionAdd(Enums::PROCESS)
transactionAdd If called after call to transactionStart() and before transactionEnd(),...
void transactionStart()
transactionStart this function is used to mark start of the sequence of processes that shall be treat...
Debug utilities for QtPass.
#define dbg()
Simple debug macro that includes file and line number.
Definition debughelper.h:21
@ INVALID
Definition enums.h:43
PROCESS
Identifies different subprocess operations used in QtPass.
Definition enums.h:26
@ INVALID
Definition enums.h:43