GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
YearSelector.cpp
Go to the documentation of this file.
1#line 2 "src/Gui/BillPay/YearSelector.cpp"
2
3#include "../../Glb/Core.h"
4#include "BillPay.h"
5
8: Wt::WComboBox()
9{
10 /*
11 ** preload some useful values
12 */
13 for( int i=2020; i< 2030; i++ )
15
16 /*
17 ** set the last used value
18 ** (note; the value is stored as an 'integer')
19 */
20 setValueText( GCW::Core::itos( configItem()-> getVarInt( "selectedYear" ) ) );
21
22 /*
23 ** if the user changes the value, record it
24 */
25 activated()
26 .connect( [this]( int _index )
27 {
28 Wt::Dbo::Transaction t( GCW::app()-> gnucashew_session() );
29
30 configItem().modify()-> setVar( "selectedYear", GCW::Core::stoi( valueText().toUTF8() ) );
31
32 });
33
34} // endYearSelector()
35
36
virtual WString valueText() const override
virtual void setValueText(const WString &value) override
Signal< int > & activated()
void addItem(const WString &text)
std::string itos(int value)
Convert an Integer to a String.
Definition Core.cpp:588
int stoi(const std::string &value)
Convert a String to an Integer.
Definition Core.cpp:569
auto configItem() -> GCW::Dbo::Vars::Item::Ptr
Config Item.
Definition BillPay.cpp:7
App * app()
Definition App.cpp:75