GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
Widget.cpp
Go to the documentation of this file.
1#line 2 "src/Gui/AccountRegister/Widget.cpp"
2
3#include <Wt/WDateEdit.h>
4#include <Wt/WPushButton.h>
5#include <Wt/WSuggestionPopup.h>
6#include <Wt/WText.h>
7#include <Wt/WTableView.h>
8#include <Wt/WTheme.h>
9#include <Wt/WVBoxLayout.h>
10#include <Wt/WHBoxLayout.h>
11
12#include "../define.h"
13#include "../App.h"
14#include "../Dbo/Accounts/Accounts.h"
15#include "../Dbo/Prefrences.h"
16#include "../Dbo/Splits/Splits.h"
17#include "../Eng/TransactionManager.h"
18#include "SuggestionPopup.h"
19#include "Widget.h"
20
21/* * * * * * * * * * * * * * * * * * * * * * * * * * */
22/* * * * * * * * * * * * * * * * * * * * * * * * * * */
23
24auto
26init()-> void
27{
28 /*
29 ** see; gcw.css for styling.
30 */
31 addStyleClass( "AccountRegister" );
32
33 /*
34 ** use a layout manager to install the table view into, so
35 ** that the widget will fit and scroll properly.
36 */
37 auto lw = setLayout( std::make_unique< Wt::WVBoxLayout >() );
38
39 /*
40 ** Poke a tool bar up at the top of the area.
41 */
42 m_toolBar = lw-> addWidget( std::make_unique< ToolBar >() );
43
44
45
46 m_tableView = lw-> addWidget( std::make_unique< GCW::Gui::TableView >(), 1 );
47// tableView()-> setRowHeight( "20px" );
48
49 /*
50 ** Poke a status bar down at the bottom of the area.
51 */
52 m_statusBar = lw-> addWidget( std::make_unique< StatusBar >() );
53
54 /*
55 ** Configure the table view.
56 */
57 tableView()-> setSortingEnabled ( false );
58// tableView()-> setAlternatingRowColors ( true ); /// \todo need to redo this
59 tableView()-> setSelectionBehavior ( Wt::SelectionBehavior::Rows );
60 tableView()-> setSelectionMode ( Wt::SelectionMode::Single );
61// tableView()-> setEditTriggers ( Wt::EditTrigger::None );
62 tableView()-> setEditTriggers ( Wt::EditTrigger::SingleClicked );
63// tableView()-> setEditOptions ( Wt::EditOption::SingleEditor | Wt::EditOption::SaveWhenClosed );
64 tableView()-> setEditOptions ( Wt::EditOption::MultipleEditors | Wt::EditOption::LeaveEditorsOpen );
65
66 /*
67 ** in order to allow right-click in the browser this oncontextmenu
68 ** attribute must be set in the table which allows Wt to pick up the
69 ** right-click event.
70 */
71 tableView()-> setAttributeValue ( "oncontextmenu","event.cancelBubble=true;event.returnValue=false;return false;" );
72 tableView()-> mouseWentUp().connect( this, &Widget::on_showPopup_triggered );
73
74 /*
75 ** set the column delegates/editors
76 */
77 Editor::applyDelegates( tableView() );
78
79 tableView()-> headerClicked().connect( [=]( int col, Wt::WMouseEvent event )
80 {
81#ifdef NEVER
82 if( tableView()-> selectedIndexes().size() == 0 )
83 tableView()-> select( baseModel()-> index( 893, 0 ) );
84 else
85 tableView()-> clearSelection();
86#endif
87
88 std::cout << __FILE__ << ":" << __LINE__ << " headerClicked:" << col << std::endl;
89
90 });
91
92#ifdef NEVER
93 /*
94 ** This 'selectionChanged' procedure is 'clunky'.
95 **
96 ** This procedure is designed to respond to a row-selection
97 ** change event. When a different row is selected, we want
98 ** any open editors to be closed, and the row selection to
99 ** move to the newly selected row.
100 **
101 ** Right now the problem is with the 'select' command, where
102 ** it calling 'select' cause this 'selectionChanged' event
103 ** to fire again. So, there is a little 'selecting' interlock
104 ** built around it to try to prevent this weirdness.
105 **
106 ** The other problem with this routine is when 'selecting'
107 ** a cell that is editable, the editor is immediately engaged
108 ** but this 'selectionChanged' signal never fires... so we have
109 ** to sort that out.
110 */
111 tableView()->
112 selectionChanged().connect( [=]()
113 {
114 std::cout << __FILE__ << ":" << __LINE__
115 << " selectionChanged"
116 << std::endl;
117 });
118#endif
119
120#ifdef KEYPRESSED_ONLY_FIRES_WHEN_EDITORS_ARE_NOT_OPEN_NOT_USEFUL_HERE
121 tableView()->
122 keyPressed().connect( [=]( Wt::WKeyEvent _event )
123 {
124 std::cout << __FILE__ << ":" << __LINE__ << " " << _event.charCode() << std::endl;
125 });
126#endif
127
128 tableView()-> clicked().connect( this, &Widget::on_tableView_clicked );
129
130 m_baseModel = std::make_shared< BaseModel >();
131 m_sortFilterModel = std::make_shared< Wt::WSortFilterProxyModel >();
132 m_batchEditModel = std::make_shared< Wt::WBatchEditProxyModel >();
133//
134// m_sortFilterModel-> setSourceModel( m_baseModel );
135// m_sortFilterModel-> sort(0);
136// m_batchEditModel -> setSourceModel( m_sortFilterModel );
137// m_batchEditModel -> setSourceModel( m_baseModel );
138
139 baseModel()->
140 goneDirty().connect( [&]( Wt::WModelIndex _index )
141 {
142// std::cout << __FILE__ << ":" << __LINE__ << " " << _index.row() << std::endl;
143// baseModel()-> refreshFromDisk();
144// m_batchEditModel -> setSourceModel( m_baseModel );
145// std::cout << __FILE__ << ":" << __LINE__ << " " << _index.row() << std::endl;
146 });
147
148} // endinit()-> void
149
150
152Widget()
153{
154 init();
155
156
157} // endGCW::AccountRegister::AccountRegister( const std::string & _accountGuid )
158
159
160auto
163{
164#ifdef NEVER
165 std::cout << __FILE__ << ":" << __LINE__ << " " << __FUNCTION__
166 << " index(" << _index.row() << "," << _index.column() << ")"
167 << " m_clicked(" << m_clickedIndex.row() << "," << m_clickedIndex.column() << ")"
168 << std::endl
169 ;
170#endif
171
172 /*
173 ** do the select-row business. this may seem somewhat redundant to call
174 ** selectRow again here, since clicking on the row causes it to be selected,
175 ** but we have additional logic we want to employ.
176 */
177 do_selectRow( _index );
178
179} // endtableView()->clicked().connect( [=]( Wt::WModelIndex _index, Wt::WMouseEvent _event )
180
181
182auto
184setReadOnly( bool _state )-> void
185{
186 baseModel()-> setReadOnly( _state );
187
188} // endsetReadOnly( bool _state = true )
189
190auto
192deleteRow( int _row )-> void
193{
194 // BUGBUG working on the register, fix this!
195
196 auto splitGuid = baseModel()-> getSplitGuid( _row );
197// auto transMan = GCW::Eng::Transaction::Manager();
198// transMan.loadSplit( splitGuid );
199// transMan.deleteTransaction();
200
201 baseModel()-> refreshFromDisk();
202
203} // enddeleteRow( int _row )-> void
204
205auto
207on_sortBy_triggered()-> void
208{
209 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
210
211} // endon_sortBy_triggered()-> void
212
213auto
216{
217 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
218
219} // endon_filterBy_triggered()-> void
220
221auto
224{
225 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
226
227} // endon_renamePage_triggered()-> void
228
229auto
232{
233 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
234
235} // endon_duplicate_triggered()-> void
236
237auto
239on_delete_triggered()-> void
240{
241 /*!
242 ** by default, the user will be asked to delete
243 ** an item from the register, unless they
244 ** have chosen to never be asked.
245 **
246 ** \bug the logic here is not correct
247 */
248 static bool askThisSession = true;
249 bool askForever = GCW::Dbo::Prefrences::get().askOnDelete();
250
251 /*
252 ** ask sometimes
253 */
254 if( askThisSession || askForever )
255 {
256 /*
257 ** build out a dialog box to prompt the user to delete or not
258 */
259 auto msgBox = addChild( std::make_unique< Wt::WDialog >( TR("gcw.AccountRegister.delete.title") ) );
260 auto templt = msgBox-> contents()-> addNew< Wt::WTemplate >( TR("gcw.AccountRegister.delete.contents") );
261 msgBox-> setClosable( true );
262 msgBox-> setMovable ( true );
263 msgBox-> show(); // exec() blocks other users, show() doesn't
264
265 auto rememberAlways = templt-> bindNew< Wt::WCheckBox >( "rememberAlways" , TR("gcw.AccountRegister.delete.rem1" ) );
266 auto rememberSession = templt-> bindNew< Wt::WCheckBox >( "rememberSession", TR("gcw.AccountRegister.delete.rem2" ) );
267 auto pbCancel = templt-> bindNew< Wt::WPushButton >( "cancel" , TR("gcw.AccountRegister.delete.cancel") );
268 auto pbDelete = templt-> bindNew< Wt::WPushButton >( "delete" , TR("gcw.AccountRegister.delete.delete") );
269
270 auto splitGuid = baseModel()-> getSplitGuid( m_rightClickIndex.row() );
271// auto transMan = GCW::Eng::Transaction::Manager();
272// transMan.loadSplit( splitGuid );
273
274// templt-> bindString( "date" , transMan.getDateAsString () );
275// templt-> bindString( "desc" , transMan.getDescription () );
276// templt-> bindString( "amount", transMan.getValueAsString() );
277
278 pbCancel-> clicked().connect( msgBox, &Wt::WDialog::reject );
279 pbDelete-> clicked().connect( msgBox, &Wt::WDialog::accept );
280
281 /*
282 ** when this option is selected, disable the other one
283 */
284 rememberAlways->
285 clicked().connect( [rememberSession,rememberAlways]()
286 {
287 rememberSession-> setDisabled( rememberAlways-> checkState() == Wt::CheckState::Checked );
288 });
289
290 /*
291 ** When the dialog finishes, it is either accepted or rejected.
292 ** In either case, the dialog will be removed from the addChild
293 ** from earlier so we don't got no memory leaks.
294 */
295 msgBox->
296 finished().connect( [this,rememberSession,msgBox]( Wt::DialogCode _code )
297 {
298 if( _code == Wt::DialogCode::Accepted )
299 {
300 askThisSession = rememberSession-> checkState() == Wt::CheckState::Checked;
301
302 deleteRow( m_rightClickIndex.row() );
303
304 }
305 removeChild( msgBox );
306 });
307
308 } // endif( ..askFirst.. )
309
310 /*
311 ** don't ask, just delete
312 */
313 else
314 {
315 deleteRow( m_rightClickIndex.row() );
316 }
317
318} // endon_delete_triggered()-> void
319
320auto
323{
324 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
325
326} // endon_removeSplits_triggered()-> void
327
328auto
330on_enter_triggered()-> void
331{
332 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
333
334} // endon_enter_triggered()-> void;
335
336auto
338on_cancel_triggered()-> void
339{
340 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
341
342} // endon_cancel_triggered()-> void;
343
344auto
347{
348 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
349
350
351} // endon_manageDocument_triggered()-> void
352
353auto
356{
357 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
358
359} // endon_openDocument_triggered()-> void
360
361auto
364{
365 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
366
367} // endon_blankTransaction_triggered()-> void
368
369auto
371on_goDate_triggered()-> void
372{
373 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
374
375} // endon_goDate_triggered()-> void
376
377auto
380{
381 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
382
383} // endon_splitTransaction_triggered()-> void
384
385auto
388{
389 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
390
391} // endon_editExchangeRate_triggered()-> void
392
393auto
396{
397 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
398
399} // endon_schedule_triggered()-> void
400
401auto
403on_jump_triggered()-> void
404{
405 /*
406 ** use a transaction manager so we can find the other split guid
407 */
408// auto transMan = GCW::Eng::Transaction::Manager();
409// transMan.loadSplit( baseModel()-> getSplitGuid( m_rightClickIndex.row() ) );
410
411 /*!
412 ** \todo should deal with multiple splits
413 **
414 ** This function will emit the guid of the account of the 'other'
415 ** split used in this transaction. But, a transaction may contain
416 ** multiple splits. In that instance, this jump routine should
417 ** make some different decisions about where to jump. In gnucash,
418 ** it indicates that the jump will jump to the 'highest value'
419 ** split... that could work.
420 */
421// jumpToAccount().emit( transMan.thatSplit()-> account_guid() );
422
423} // endon_jump_triggered()-> void
424
425auto
427on_edit_triggered()-> void
428{
429
430
431} // endon_edit_triggered()-> void
432
433auto
436{
437 std::cout << __FILE__ << ":" << __LINE__ << " " << std::endl;
438
439} // endon_assignPayment_triggered()-> void
440
441auto
443on_showPopup_triggered( const Wt::WModelIndex & _index, const Wt::WMouseEvent & _event )-> void
444{
445 /*
446 ** pop-up is only on right-click
447 */
448 if( _event.button() != Wt::MouseButton::Right )
449 return;
450
451 /*
452 ** remember
453 */
454 m_rightClickIndex = _index;
455
456 /*
457 ** Set up the items in the pop-up menu
458 ** (some of the items are dependent on which row was clicked on
459 ** so we dump everything from the popup and reload)
460 **
461 ** NOTE: we're doing this because m_popupMenu is local (ie; not
462 ** a pointer!) so it is persistent within this object. So,
463 ** anything we do in it needs to be reset before we do anything
464 ** else.
465 */
466 while( m_popupMenu.count() )
467 m_popupMenu.removeItem( m_popupMenu.itemAt(0) );
468
469#ifdef NEVER
470 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.SortBy" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
471 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.FilterBy" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
472 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.RenamePage" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
473 m_popupMenu.addSeparator();
474 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.Duplicate" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
475#endif
476
477 // delete
478 {
479 auto item = m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.Delete"), this, &Widget::on_delete_triggered );
480
481 /*
482 ** delete doesn't work on the 'new' line (need a split guid)
483 */
484 if( !(baseModel()-> isDeletable( _index )) )
485 item-> setDisabled( true );
486 }
487
488#ifdef NEVER
489 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.RemoveSplits" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
490 m_popupMenu.addSeparator();
491 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.Enter" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
492 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.Cancel" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
493 m_popupMenu.addSeparator();
494 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.ManageDocument" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
495 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.OpenDocument" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
496#endif
497
498 m_popupMenu.addSeparator();
499
500 // jump
501 {
502 /*
503 ** create the menu item
504 */
505 auto item =
506 m_popupMenu
507 .addItem
508 (
509 TR( "gcw.AccountRegister.Popup.Jump" ),
510 this,
512 );
513
514 if( !(baseModel()-> isJumpable( _index )) )
515 item-> setDisabled( true );
516 }
517
518 // edit
519 {
520 auto item =
521 m_popupMenu
522 .addItem
523 (
524 TR( "gcw.AccountRegister.Popup.edit" ),
525 this,
527 );
528 }
529
530
531
532#ifdef NEVER
533 m_popupMenu.addSeparator();
534 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.BlankTransaction" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
535 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.GoDate" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
536 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.SplitTransaction" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
537 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.EditExchangeRate" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
538 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.Schedule" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
539 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.Jump" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
540 m_popupMenu.addSeparator();
541 m_popupMenu.addItem( TR( "gcw.AccountRegister.Popup.AssignPayment" ), std::make_unique< Wt::WText >() )-> setDisabled( true );
542#endif
543
544 // Select the item, if it was not yet selected.
545 if( !tableView()-> isSelected( _index ) )
546 {
547 editRow( _index );
548 }
549
550 if( m_popupMenu.isHidden() )
551 {
552 m_popupMenu.popup( _event );
553 }
554 else
555 {
556 m_popupMenu.hide();
557 }
558
559} // endon_showPopup_triggered( const Wt::WModelIndex & _index, const Wt::WMouseEvent & _event )-> void
560
561
562auto
564setAccountGuid( const std::string & _accountGuid )-> void
565{
566 m_accountGuid = _accountGuid;
567
568 baseModel()-> setAccountGuid( _accountGuid );
569
570 loadData();
571
572 /*
573 ** Scroll to the bottom of the view, and select the last row.
574 */
575 do_selectRow( lastIndex() );
576
577} // endsetAccountGuid( const std::string & _accountGuid )-> void
578
579auto
581setDoubleLine( bool _state )-> void
582{
583
584 baseModel()-> setDoubleLine( _state );
585
586 setAccountGuid( m_accountGuid );
587
588} // endsetDoubleLine( bool _state )-> void
589
590auto
593{
594 return baseModel()-> index( baseModel()-> rowCount() -1, 0 );
595
596} // endlastIndex()-> Wt::WModelIndex
597
598auto
600loadData()-> void
601{
602 tableView()-> setModel( m_baseModel );
603
604 // 0 = Date
605 tableView()-> setColumnWidth ( asInt( Col::DATE ), "125px" );
606 tableView()-> setHeaderAlignment( asInt( Col::DATE ), Wt::AlignmentFlag::Right );
607 tableView()-> setColumnAlignment( asInt( Col::DATE ), Wt::AlignmentFlag::Right );
608
609 // 1 = Action/Num
610 tableView()-> setColumnWidth ( asInt( Col::ACTION ), "50px" );
611 tableView()-> setHeaderAlignment( asInt( Col::ACTION ), Wt::AlignmentFlag::Center );
612 tableView()-> setColumnAlignment( asInt( Col::ACTION ), Wt::AlignmentFlag::Center );
613
614 // 2 = Memo/Description
615 tableView()-> setColumnWidth ( asInt( Col::DESCRIPTION ), "99%" );
616 tableView()-> setHeaderAlignment( asInt( Col::DESCRIPTION ), Wt::AlignmentFlag::Left );
617 tableView()-> setColumnAlignment( asInt( Col::DESCRIPTION ), Wt::AlignmentFlag::Left );
618
619 // 3 = Account/Transfer
620 tableView()-> setColumnWidth ( asInt( Col::TRANSFER ), "150px" );
621 tableView()-> setHeaderAlignment( asInt( Col::TRANSFER ), Wt::AlignmentFlag::Right );
622 tableView()-> setColumnAlignment( asInt( Col::TRANSFER ), Wt::AlignmentFlag::Right );
623
624 // 4 = Reconciliation
625 tableView()-> setColumnWidth ( asInt( Col::RECONCILE ), "25px" );
626 tableView()-> setHeaderAlignment( asInt( Col::RECONCILE ), Wt::AlignmentFlag::Center );
627 tableView()-> setColumnAlignment( asInt( Col::RECONCILE ), Wt::AlignmentFlag::Center );
628
629 // 5 = Debit
630 tableView()-> setColumnWidth ( asInt( Col::DEBIT ), "85px" );
631 tableView()-> setHeaderAlignment( asInt( Col::DEBIT ), Wt::AlignmentFlag::Right );
632 tableView()-> setColumnAlignment( asInt( Col::DEBIT ), Wt::AlignmentFlag::Right );
633
634 // 6 = Credit
635 tableView()-> setColumnWidth ( asInt( Col::CREDIT ), "85px" );
636 tableView()-> setHeaderAlignment( asInt( Col::CREDIT ), Wt::AlignmentFlag::Right );
637 tableView()-> setColumnAlignment( asInt( Col::CREDIT ), Wt::AlignmentFlag::Right );
638
639 // 7 = Balance
640 tableView()-> setColumnWidth ( asInt( Col::BALANCE ), "85px" );
641 tableView()-> setHeaderAlignment( asInt( Col::BALANCE ), Wt::AlignmentFlag::Right );
642 tableView()-> setColumnAlignment( asInt( Col::BALANCE ), Wt::AlignmentFlag::Right );
643
644 statusBar()-> setPresent ( baseModel()-> present () );
645 statusBar()-> setProjected ( baseModel()-> projected () );
646 statusBar()-> setReconciled ( baseModel()-> reconciled () );
647 statusBar()-> setFuture ( baseModel()-> future () );
648 statusBar()-> setCleared ( baseModel()-> cleared () );
649 statusBar()-> setRowCount ( baseModel()-> splitCount () );
650
651} // endloadData()-> void
652
653//auto
654//GCW::Gui::AccountRegister::
655//editRow( Wt::WModelIndex _index )-> void
656//{
657// tableView()-> closeEditors( true );
658// ( _index.row() );
659//
660//} // endeditRow( Wt::WModelIndex _index )-> void
661
662auto
664do_selectRow( Wt::WModelIndex _index )-> void
665{
666 /*
667 ** if the row hasn't changed, do nothing
668 */
669 if( m_selectIndex.isValid() )
670 if( m_selectIndex.row() == _index.row() )
671 return;
672
673 m_selectIndex = _index;
674
675#ifndef NEVER
676 std::cout << __FILE__ << ":" << __LINE__
677 << " " << __FUNCTION__ << "(" << _index.row() << ")"
678 << " isR/O:" << baseModel()-> isReadOnly( _index.row() )
679 << " i(" << _index.row() << "," << _index.column() << ")"
680 << " si(" << m_selectIndex.row() << "," << m_selectIndex.column() << ")"
681 << std::endl;
682#endif
683
684 tableView()-> clearSelection();
685 tableView()-> closeEditors( true );
686 tableView()-> scrollTo( _index );
687 tableView()-> select( _index, Wt::SelectionFlag::ClearAndSelect );
688
689 if( !baseModel()-> isReadOnly( _index.row() ) )
690 editRow( _index );
691
692} // enddo_selectRow( Wt::WModelIndex _index )-> void
693
694auto
696editRow( Wt::WModelIndex _index )-> void
697{
698#ifdef NEVER
699 std::cout << __FILE__ << ":" << __LINE__
700 << " " << __FUNCTION__ << "(" << _index.row() << "," << _index.column() << ")"
701 << " ro:" << baseModel()-> isReadOnly( _index.row() )
702 << " sel:" << tableView()-> selectedIndexes().size()
703 << " selrow:" << tableView()-> selectedIndexes().begin()-> row()
704 << std::endl;
705#endif
706
707 Editor editor( tableView() );
708 editor.editRow( _index );
709
710} // endeditRow( Wt::WModelIndex _index )-> void
711
712auto
714toJson() const-> Wt::Json::Object
715{
716 Wt::Json::Object jobj;
717
718 return jobj;
719}
720
721auto
723fromJson( const Wt::Json::Object & _jobj )-> bool
724{
725 return true;
726}
727
728
729
730void
732test()
733{
734 std::cout << __FILE__ << ":" << __LINE__ << " ::test::" << std::endl;
735
736 std::cout << __FILE__ << ":" << __LINE__ << " " << tableView()-> selectedIndexes().size() << std::endl;
737
738 auto selectedIndex = *tableView()-> selectedIndexes().begin();
739
740 if( selectedIndex.isValid() )
741 {
742
743 std::cout << __FILE__ << ":" << __LINE__ << " " << tableView()-> selectedIndexes().size() << std::endl;
744
745 }
746
747
748} // endvoid GCW::Gui::AccountRegister::test()
749
750
Account Register Editor.
Definition Editor.h:43
auto editRow(Wt::WModelIndex _index) -> void
Edit Row.
Definition Editor.cpp:172
auto on_showPopup_triggered(const Wt::WModelIndex &_index, const Wt::WMouseEvent &_event) -> void
Show Popup.
Definition Widget.cpp:443
auto fromJson(const Wt::Json::Object &_jobj) -> bool
Set View Properties from JSON Object.
Definition Widget.cpp:723
auto on_cancel_triggered() -> void
Cancel Transaction.
Definition Widget.cpp:338
auto lastIndex() -> Wt::WModelIndex
Last Index.
Definition Widget.cpp:592
auto on_removeSplits_triggered() -> void
Remove Splits.
Definition Widget.cpp:322
auto on_editExchangeRate_triggered() -> void
Edit Exchange Rate.
Definition Widget.cpp:387
auto on_renamePage_triggered() -> void
Definition Widget.cpp:223
auto setReadOnly(bool _state=true) -> void
Set Read Only.
Definition Widget.cpp:184
auto on_splitTransaction_triggered() -> void
Split Transaction.
Definition Widget.cpp:379
auto on_filterBy_triggered() -> void
Definition Widget.cpp:215
auto deleteRow(int _row) -> void
Delete Row.
Definition Widget.cpp:192
auto on_assignPayment_triggered() -> void
Assign Payment.
Definition Widget.cpp:435
auto do_selectRow(Wt::WModelIndex _index) -> void
Select Row.
Definition Widget.cpp:664
auto on_jump_triggered() -> void
Jump to Transaction.
Definition Widget.cpp:403
auto editRow(Wt::WModelIndex _index) -> void
Edit Row.
Definition Widget.cpp:696
auto setAccountGuid(const std::string &_accountGuid) -> void
Set Account.
Definition Widget.cpp:564
auto on_duplicate_triggered() -> void
Definition Widget.cpp:231
auto on_delete_triggered() -> void
Delete a Row.
Definition Widget.cpp:239
auto on_schedule_triggered() -> void
Schedule a Transaction.
Definition Widget.cpp:395
auto init() -> void
Internal Initializer.
Definition Widget.cpp:26
auto loadData() -> void
Editor Helper.
Definition Widget.cpp:600
auto on_blankTransaction_triggered() -> void
Blank Transaction.
Definition Widget.cpp:363
auto on_manageDocument_triggered() -> void
Manage Document.
Definition Widget.cpp:346
auto setDoubleLine(bool _state) -> void
Definition Widget.cpp:581
auto on_openDocument_triggered() -> void
Open Document.
Definition Widget.cpp:355
auto on_goDate_triggered() -> void
Go to Date.
Definition Widget.cpp:371
auto on_enter_triggered() -> void
Enter Transaction.
Definition Widget.cpp:330
auto on_edit_triggered() -> void
Edit to Transaction.
Definition Widget.cpp:427
auto toJson() const -> Wt::Json::Object
Create View Properties JSON Object.
Definition Widget.cpp:714
auto on_tableView_clicked(Wt::WModelIndex _index, Wt::WMouseEvent _event) -> void
Clicked Handler.
Definition Widget.cpp:162
virtual void accept()
virtual void reject()
int charCode() const
#define TR(X)
Definition define.h:17
auto get() -> GCW::Dbo::Prefrences::Item
constexpr int asInt(Col col) noexcept
Definition ViewMode.h:67
DialogCode