FOSSredder 0.5.0
Loading...
Searching...
No Matches
ui::BookingViewModel Class Reference

Owns Booking view form state and delegates statement and transaction CRUD to workspace. More...

#include <BookingViewModel.h>

Inheritance diagram for ui::BookingViewModel:
Collaboration diagram for ui::BookingViewModel:

Signals

void changed ()

Public Member Functions

 BookingViewModel (WorkspaceStore *store, WorkspaceCommands *commands, WorkspaceSelection *selection, WorkspaceSelectors *selectors, QObject *parent=nullptr)
 Creates the booking view model backed by workspace roles.
bool isCreateMode () const
 Returns whether the form currently creates a new statement.
QString statementName () const
 Returns the statement name shown in the form.
void setStatementName (const QString &value)
 Updates the statement name shown in the form.
QString transactionName () const
 Returns the current transaction name field.
void setTransactionName (const QString &value)
 Updates the current transaction name field.
QString transactionBookingDate () const
 Returns the current transaction booking date field.
void setTransactionBookingDate (const QString &value)
 Updates the current transaction booking date field.
QString transactionValuta () const
 Returns the current transaction valuta field.
void setTransactionValuta (const QString &value)
 Updates the current transaction valuta field.
QString transactionAmountText () const
 Returns the current amount field as text.
void setTransactionAmountText (const QString &value)
 Updates the current amount field.
int transactionStatusIndex () const
 Returns the selected transaction status option index.
void setTransactionStatusIndex (int index)
 Updates the current transaction status from an option index.
bool transactionAllocatable () const
 Returns whether the current transaction is allocatable.
void setTransactionAllocatable (bool value)
 Updates the current transaction allocatable flag.
QVariantList propertyRows () const
 Returns property rows for the property checkbox list.
QVariantList selectedPropertyIds () const
 Returns property ids selected for the current transaction.
QVariantList transactionStatusOptions () const
 Returns selectable transaction status options.
QVariantList statementRows () const
 Returns statements shown in the booking sidebar.
QString selectedStatementId () const
 Returns the selected statement id.
QString selectedTransactionId () const
 Returns the selected transaction id.
QVariantList actorDisplayRows () const
 Returns actor rows prepared for the actor dropdown.
QVariantList contractDisplayRows () const
 Returns contract rows prepared for the contract dropdown.
int selectedActorIndex () const
 Returns the selected actor dropdown index.
int selectedContractIndex () const
 Returns the selected contract dropdown index.
QString transactionInfoText () const
 Returns the transaction position text shown in the form.
bool hasStatements () const
 Returns whether statement rows are available.
bool hasMultipleTransactions () const
 Returns whether the current statement has multiple transactions.
bool canCreate () const
 Returns whether the create form can be submitted.
bool canUpdate () const
 Returns whether the selected statement or transaction changed.
bool canAddTransaction () const
 Returns whether a transaction can be added to the current statement.
bool canDeleteTransaction () const
 Returns whether the current transaction can be deleted.
Q_INVOKABLE void resetCreateState ()
 Clears the create form and creates a single empty transaction state.
Q_INVOKABLE void previousStatement ()
 Selects the previous statement or the create form.
Q_INVOKABLE void nextStatement ()
 Selects the next statement or the create form.
Q_INVOKABLE void previousTransaction ()
 Selects the previous transaction in the current statement.
Q_INVOKABLE void nextTransaction ()
 Selects the next transaction in the current statement.
Q_INVOKABLE void addTransactionAfterCurrent ()
 Adds a transaction after the current transaction.
Q_INVOKABLE void deleteCurrentTransaction ()
 Deletes the current transaction when at least one remains.
Q_INVOKABLE void setPropertySelected (const QString &propertyId, bool selected)
 Updates whether a property is selected for the current transaction.
Q_INVOKABLE void selectActorIndex (int index)
 Selects an actor from the actor dropdown.
Q_INVOKABLE void selectContractIndex (int index)
 Selects a contract from the contract dropdown.
Q_INVOKABLE void selectStatement (const QString &statementId)
 Selects a statement from the sidebar.
Q_INVOKABLE void selectTransaction (const QString &statementId, const QString &transactionId)
 Selects a transaction from the sidebar.
Q_INVOKABLE QString submit ()
 Creates a statement and its transaction form states through workspace.
Q_INVOKABLE void updateCurrent ()
 Updates the selected statement and transaction through workspace.
Q_INVOKABLE void deleteCurrentStatement ()
 Deletes the selected statement through workspace.

Properties

bool isCreateMode
QString statementName
QString transactionName
QString transactionBookingDate
QString transactionValuta
QString transactionAmountText
int transactionStatusIndex
bool transactionAllocatable
QVariantList propertyRows
QVariantList selectedPropertyIds
QVariantList transactionStatusOptions
QVariantList statementRows
QString selectedStatementId
QString selectedTransactionId
QVariantList actorDisplayRows
QVariantList contractDisplayRows
int selectedActorIndex
int selectedContractIndex
QString transactionInfoText
bool hasStatements
bool hasMultipleTransactions
bool canCreate
bool canUpdate
bool canAddTransaction
bool canDeleteTransaction

Detailed Description

Owns Booking view form state and delegates statement and transaction CRUD to workspace.

Definition at line 24 of file BookingViewModel.h.

Constructor & Destructor Documentation

◆ BookingViewModel()

ui::BookingViewModel::BookingViewModel ( WorkspaceStore * store,
WorkspaceCommands * commands,
WorkspaceSelection * selection,
WorkspaceSelectors * selectors,
QObject * parent = nullptr )
explicit

Creates the booking view model backed by workspace roles.

Parameters
parentOptional Qt parent object.

Definition at line 459 of file BookingViewModel.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ actorDisplayRows()

QVariantList ui::BookingViewModel::actorDisplayRows ( ) const

Returns actor rows prepared for the actor dropdown.

Returns
Actor display rows including the empty option.

Definition at line 1165 of file BookingViewModel.cpp.

◆ addTransactionAfterCurrent()

void ui::BookingViewModel::addTransactionAfterCurrent ( )

Adds a transaction after the current transaction.

Definition at line 769 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ canAddTransaction()

bool ui::BookingViewModel::canAddTransaction ( ) const

Returns whether a transaction can be added to the current statement.

Returns
True in create mode or when a statement is selected.

Definition at line 597 of file BookingViewModel.cpp.

◆ canCreate()

bool ui::BookingViewModel::canCreate ( ) const

Returns whether the create form can be submitted.

Returns
True when the local form state passes the quick UI checks.

Definition at line 1032 of file BookingViewModel.cpp.

◆ canDeleteTransaction()

bool ui::BookingViewModel::canDeleteTransaction ( ) const

Returns whether the current transaction can be deleted.

Returns
True when deleting would leave at least one transaction.

Definition at line 601 of file BookingViewModel.cpp.

◆ canUpdate()

bool ui::BookingViewModel::canUpdate ( ) const

Returns whether the selected statement or transaction changed.

Returns
True when the edit form can be updated.

Definition at line 1036 of file BookingViewModel.cpp.

◆ changed

void ui::BookingViewModel::changed ( )
signal
Here is the call graph for this function:
Here is the caller graph for this function:

◆ contractDisplayRows()

QVariantList ui::BookingViewModel::contractDisplayRows ( ) const

Returns contract rows prepared for the contract dropdown.

Returns
Contract display rows including the empty option.

Definition at line 1169 of file BookingViewModel.cpp.

◆ deleteCurrentStatement()

void ui::BookingViewModel::deleteCurrentStatement ( )

Deletes the selected statement through workspace.

Definition at line 1111 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ deleteCurrentTransaction()

void ui::BookingViewModel::deleteCurrentTransaction ( )

Deletes the current transaction when at least one remains.

Definition at line 812 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ hasMultipleTransactions()

bool ui::BookingViewModel::hasMultipleTransactions ( ) const

Returns whether the current statement has multiple transactions.

Returns
True when previous/next transaction navigation is useful.

Definition at line 589 of file BookingViewModel.cpp.

◆ hasStatements()

bool ui::BookingViewModel::hasStatements ( ) const

Returns whether statement rows are available.

Returns
True when the sidebar has statement rows.

Definition at line 546 of file BookingViewModel.cpp.

◆ isCreateMode()

bool ui::BookingViewModel::isCreateMode ( ) const

Returns whether the form currently creates a new statement.

Returns
True when no existing statement is selected.

Definition at line 476 of file BookingViewModel.cpp.

◆ nextStatement()

void ui::BookingViewModel::nextStatement ( )

Selects the next statement or the create form.

Definition at line 941 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ nextTransaction()

void ui::BookingViewModel::nextTransaction ( )

Selects the next transaction in the current statement.

Definition at line 1001 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ previousStatement()

void ui::BookingViewModel::previousStatement ( )

Selects the previous statement or the create form.

Definition at line 913 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ previousTransaction()

void ui::BookingViewModel::previousTransaction ( )

Selects the previous transaction in the current statement.

Definition at line 969 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ propertyRows()

QVariantList ui::BookingViewModel::propertyRows ( ) const

Returns property rows for the property checkbox list.

Returns
Workspace property rows.

Definition at line 1147 of file BookingViewModel.cpp.

◆ resetCreateState()

void ui::BookingViewModel::resetCreateState ( )

Clears the create form and creates a single empty transaction state.

Definition at line 753 of file BookingViewModel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectActorIndex()

void ui::BookingViewModel::selectActorIndex ( int index)

Selects an actor from the actor dropdown.

Parameters
indexIndex into actorDisplayRows().

Definition at line 1210 of file BookingViewModel.cpp.

◆ selectContractIndex()

void ui::BookingViewModel::selectContractIndex ( int index)

Selects a contract from the contract dropdown.

Parameters
indexIndex into contractDisplayRows().

Definition at line 1217 of file BookingViewModel.cpp.

◆ selectedActorIndex()

int ui::BookingViewModel::selectedActorIndex ( ) const

Returns the selected actor dropdown index.

Returns
Index into actorDisplayRows().

Definition at line 1182 of file BookingViewModel.cpp.

◆ selectedContractIndex()

int ui::BookingViewModel::selectedContractIndex ( ) const

Returns the selected contract dropdown index.

Returns
Index into contractDisplayRows().

Definition at line 1188 of file BookingViewModel.cpp.

◆ selectedPropertyIds()

QVariantList ui::BookingViewModel::selectedPropertyIds ( ) const

Returns property ids selected for the current transaction.

Returns
Selected property id list.

Definition at line 1151 of file BookingViewModel.cpp.

◆ selectedStatementId()

QString ui::BookingViewModel::selectedStatementId ( ) const

Returns the selected statement id.

Returns
Workspace selected statement id or an empty string.

Definition at line 538 of file BookingViewModel.cpp.

◆ selectedTransactionId()

QString ui::BookingViewModel::selectedTransactionId ( ) const

Returns the selected transaction id.

Returns
Workspace selected transaction id or an empty string.

Definition at line 542 of file BookingViewModel.cpp.

◆ selectStatement()

void ui::BookingViewModel::selectStatement ( const QString & statementId)

Selects a statement from the sidebar.

Parameters
statementIdStatement id to select.

Definition at line 556 of file BookingViewModel.cpp.

◆ selectTransaction()

void ui::BookingViewModel::selectTransaction ( const QString & statementId,
const QString & transactionId )

Selects a transaction from the sidebar.

Parameters
statementIdParent statement id.
transactionIdTransaction id to select.

Definition at line 563 of file BookingViewModel.cpp.

◆ setPropertySelected()

void ui::BookingViewModel::setPropertySelected ( const QString & propertyId,
bool selected )

Updates whether a property is selected for the current transaction.

Parameters
propertyIdProperty id from the checkbox row.
selectedTrue to select the property, false to remove it.

Definition at line 1194 of file BookingViewModel.cpp.

◆ setStatementName()

void ui::BookingViewModel::setStatementName ( const QString & value)

Updates the statement name shown in the form.

Parameters
valueNew statement name.

Definition at line 484 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ setTransactionAllocatable()

void ui::BookingViewModel::setTransactionAllocatable ( bool value)

Updates the current transaction allocatable flag.

Parameters
valueNew allocatable flag.

Definition at line 730 of file BookingViewModel.cpp.

◆ setTransactionAmountText()

void ui::BookingViewModel::setTransactionAmountText ( const QString & value)

Updates the current amount field.

Parameters
valueNew amount text.

Definition at line 722 of file BookingViewModel.cpp.

◆ setTransactionBookingDate()

void ui::BookingViewModel::setTransactionBookingDate ( const QString & value)

Updates the current transaction booking date field.

Parameters
valueNew booking date text.

Definition at line 705 of file BookingViewModel.cpp.

◆ setTransactionName()

void ui::BookingViewModel::setTransactionName ( const QString & value)

Updates the current transaction name field.

Parameters
valueNew transaction name.

Definition at line 697 of file BookingViewModel.cpp.

◆ setTransactionStatusIndex()

void ui::BookingViewModel::setTransactionStatusIndex ( int index)

Updates the current transaction status from an option index.

Parameters
indexIndex into transactionStatusOptions().

Definition at line 1139 of file BookingViewModel.cpp.

◆ setTransactionValuta()

void ui::BookingViewModel::setTransactionValuta ( const QString & value)

Updates the current transaction valuta field.

Parameters
valueNew valuta text.

Definition at line 713 of file BookingViewModel.cpp.

◆ statementName()

QString ui::BookingViewModel::statementName ( ) const

Returns the statement name shown in the form.

Returns
Current create or edit statement name.

Definition at line 480 of file BookingViewModel.cpp.

◆ statementRows()

QVariantList ui::BookingViewModel::statementRows ( ) const

Returns statements shown in the booking sidebar.

Returns
Statement rows including transaction children.

Definition at line 533 of file BookingViewModel.cpp.

◆ submit()

QString ui::BookingViewModel::submit ( )

Creates a statement and its transaction form states through workspace.

Returns
Created statement id or an empty string when creation failed.

Definition at line 1045 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ transactionAllocatable()

bool ui::BookingViewModel::transactionAllocatable ( ) const

Returns whether the current transaction is allocatable.

Returns
True when the current transaction has the allocatable flag set.

Definition at line 726 of file BookingViewModel.cpp.

◆ transactionAmountText()

QString ui::BookingViewModel::transactionAmountText ( ) const

Returns the current amount field as text.

Returns
Amount text as entered or loaded for the current transaction.

Definition at line 717 of file BookingViewModel.cpp.

◆ transactionBookingDate()

QString ui::BookingViewModel::transactionBookingDate ( ) const

Returns the current transaction booking date field.

Returns
Current booking date text.

Definition at line 701 of file BookingViewModel.cpp.

◆ transactionInfoText()

QString ui::BookingViewModel::transactionInfoText ( ) const

Returns the transaction position text shown in the form.

Returns
Localized transaction counter text.

Definition at line 571 of file BookingViewModel.cpp.

◆ transactionName()

QString ui::BookingViewModel::transactionName ( ) const

Returns the current transaction name field.

Returns
Current transaction name.

Definition at line 693 of file BookingViewModel.cpp.

◆ transactionStatusIndex()

int ui::BookingViewModel::transactionStatusIndex ( ) const

Returns the selected transaction status option index.

Returns
Index into transactionStatusOptions().

Definition at line 1127 of file BookingViewModel.cpp.

◆ transactionStatusOptions()

QVariantList ui::BookingViewModel::transactionStatusOptions ( ) const

Returns selectable transaction status options.

Returns
Status option rows with display labels and values.

Definition at line 1157 of file BookingViewModel.cpp.

Here is the call graph for this function:

◆ transactionValuta()

QString ui::BookingViewModel::transactionValuta ( ) const

Returns the current transaction valuta field.

Returns
Current valuta text.

Definition at line 709 of file BookingViewModel.cpp.

◆ updateCurrent()

void ui::BookingViewModel::updateCurrent ( )

Updates the selected statement and transaction through workspace.

Definition at line 1073 of file BookingViewModel.cpp.

Here is the call graph for this function:

Property Documentation

◆ actorDisplayRows

QVariantList ui::BookingViewModel::actorDisplayRows
read

Definition at line 51 of file BookingViewModel.h.

◆ canAddTransaction

bool ui::BookingViewModel::canAddTransaction
read

Definition at line 64 of file BookingViewModel.h.

◆ canCreate

bool ui::BookingViewModel::canCreate
read

Definition at line 62 of file BookingViewModel.h.

◆ canDeleteTransaction

bool ui::BookingViewModel::canDeleteTransaction
read

Definition at line 65 of file BookingViewModel.h.

◆ canUpdate

bool ui::BookingViewModel::canUpdate
read

Definition at line 63 of file BookingViewModel.h.

◆ contractDisplayRows

QVariantList ui::BookingViewModel::contractDisplayRows
read

Definition at line 52 of file BookingViewModel.h.

◆ hasMultipleTransactions

bool ui::BookingViewModel::hasMultipleTransactions
read

Definition at line 60 of file BookingViewModel.h.

◆ hasStatements

bool ui::BookingViewModel::hasStatements
read

Definition at line 59 of file BookingViewModel.h.

◆ isCreateMode

bool ui::BookingViewModel::isCreateMode
read

Definition at line 26 of file BookingViewModel.h.

◆ propertyRows

QVariantList ui::BookingViewModel::propertyRows
read

Definition at line 41 of file BookingViewModel.h.

◆ selectedActorIndex

int ui::BookingViewModel::selectedActorIndex
read

Definition at line 54 of file BookingViewModel.h.

◆ selectedContractIndex

int ui::BookingViewModel::selectedContractIndex
read

Definition at line 55 of file BookingViewModel.h.

◆ selectedPropertyIds

QVariantList ui::BookingViewModel::selectedPropertyIds
read

Definition at line 42 of file BookingViewModel.h.

◆ selectedStatementId

QString ui::BookingViewModel::selectedStatementId
read

Definition at line 47 of file BookingViewModel.h.

◆ selectedTransactionId

QString ui::BookingViewModel::selectedTransactionId
read

Definition at line 49 of file BookingViewModel.h.

◆ statementName

QString ui::BookingViewModel::statementName
readwrite

Definition at line 27 of file BookingViewModel.h.

◆ statementRows

QVariantList ui::BookingViewModel::statementRows
read

Definition at line 46 of file BookingViewModel.h.

◆ transactionAllocatable

bool ui::BookingViewModel::transactionAllocatable
read

Definition at line 39 of file BookingViewModel.h.

◆ transactionAmountText

QString ui::BookingViewModel::transactionAmountText
read

Definition at line 35 of file BookingViewModel.h.

◆ transactionBookingDate

QString ui::BookingViewModel::transactionBookingDate
read

Definition at line 31 of file BookingViewModel.h.

◆ transactionInfoText

QString ui::BookingViewModel::transactionInfoText
read

Definition at line 57 of file BookingViewModel.h.

◆ transactionName

QString ui::BookingViewModel::transactionName
read

Definition at line 29 of file BookingViewModel.h.

◆ transactionStatusIndex

int ui::BookingViewModel::transactionStatusIndex
read

Definition at line 37 of file BookingViewModel.h.

◆ transactionStatusOptions

QVariantList ui::BookingViewModel::transactionStatusOptions
read

Definition at line 44 of file BookingViewModel.h.

◆ transactionValuta

QString ui::BookingViewModel::transactionValuta
read

Definition at line 33 of file BookingViewModel.h.


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