4 #include <Wt/WTreeNode.h> 5 #include <Wt/WHBoxLayout.h> 6 #include <Wt/WVBoxLayout.h> 8 #include <Wtx/Util/Util.h> 10 #include "ManagerWidget.h" 15 :
public Wt::WContainerWidget
20 :
public Wt::WTreeNode
24 Node(
const std::string & label );
43 FolderView::Node::Node(
const std::string & lbl )
47 std::make_unique<Wt::WIconPair>
49 "resources/icons/yellow-folder-closed.png",
50 "resources/icons/yellow-folder-open.png",
54 setLabelIcon( std::move( folderIcon ) );
55 label()-> setTextFormat( Wt::TextFormat::Plain );
56 label()-> setWordWrap(
false);
57 label()-> setText( lbl );
58 setStyleClass(
"linkstyle");
59 setLoadPolicy( Wt::ContentLoading::NextLevel );
66 auto u_hlw = std::make_unique< Wt::WHBoxLayout >();
67 auto hlw = u_hlw.get();
68 setLayout( std::move( u_hlw ) );
69 hlw-> setContentsMargins( 0,0,0,0 );
71 auto u_tree = std::make_unique< Wt::WTree >();
72 m_tree = u_tree.get();
73 hlw-> addWidget( std::move( u_tree ), 1 );
75 auto u_rootNode = std::make_unique< FolderView::Node >( account()-> name() );
76 m_rootNode = u_rootNode.get();
77 m_tree-> setTreeRoot( std::move(u_rootNode) );
79 auto inbox = rootNode()-> addChildNode( std::make_unique< FolderView::Node >(
"Inbox" ) );
81 auto drafts = inbox-> addChildNode( std::make_unique< FolderView::Node > (
"Drafts" ) );
82 auto sent = inbox-> addChildNode( std::make_unique< FolderView::Node > (
"Sent" ) );
83 auto archives = inbox-> addChildNode( std::make_unique< FolderView::Node > (
"Archives" ) );
84 auto junk = inbox-> addChildNode( std::make_unique< FolderView::Node > (
"Junk" ) );
85 auto deleted = inbox-> addChildNode( std::make_unique< FolderView::Node > (
"Deleted" ) );
86 auto scam = inbox-> addChildNode( std::make_unique< FolderView::Node > (
"Scam" ) );
88 for(
int i=2005; i < 2020; i++ )
89 archives-> addChildNode( std::make_unique< FolderView::Node >(
Wtx::itos(i) ) );
91 rootNode()-> expand();
100 FolderView::Node * FolderView::rootNode()
110 :
public Wt::WContainerWidget
114 Widget( std::unique_ptr< Wtx::Eml::Service::Manager > sm );
118 std::unique_ptr< Wtx::Eml::Service::Manager > m_manager;
122 Widget::Widget( std::unique_ptr< Wtx::Eml::Service::Manager > sm )
123 :
Wt::WContainerWidget(),
124 m_manager( std::move(sm) )
126 auto u_lw = std::make_unique< Wt::WVBoxLayout >();
127 auto lw = u_lw.get();
128 setLayout( std::move( u_lw ) );
129 lw-> setContentsMargins( 0,0,0,0 );
131 for(
auto emlAccount : manager()-> accounts() )
133 std::cout << __FILE__ <<
":" << __LINE__
134 <<
" " << emlAccount-> name()
138 auto u_view = std::make_unique< FolderView >( emlAccount );
139 lw-> addWidget( std::move( u_view ) );
145 auto u_productView = std::make_unique< Mrp::Product::ManagerWidget >();
146 auto productView = u_productView.get();
147 hlw-> addWidget( std::move(u_productView) );
149 auto u_inventoryView = std::make_unique< Mrp::Inventory::ManagerWidget >();
150 auto inventoryView = u_inventoryView.get();
151 hlw-> addWidget( std::move(u_inventoryView) );
153 auto u_cw = std::make_unique<Wt::WContainerWidget>();
154 auto cw = u_cw.get();
155 hlw-> addWidget( std::move(u_cw) );
157 auto u_vlw = std::make_unique<Wt::WVBoxLayout>();
158 auto vlw = u_vlw.get();
159 cw-> setLayout( std::move(u_vlw) );
161 auto u_inboundView = std::make_unique< Mrp::Inbound::ManagerWidget >();
162 auto inboundView = u_inboundView.get();
163 vlw-> addWidget( std::move(u_inboundView) );
165 auto u_outboundView = std::make_unique< Mrp::Outbound::ManagerWidget >();
166 auto outboundView = u_outboundView.get();
167 vlw-> addWidget( std::move(u_outboundView) );
169 productView-> itemClicked().connect( [=]( Wt::Dbo::ptr<Mrp::Product::Item> item )
171 inventoryView-> setFor( item );
174 inventoryView-> itemClicked().connect( [=]( Wt::Dbo::ptr<Mrp::Inventory::Item> item )
176 inboundView-> setFor( item );
177 outboundView-> setFor( item );
186 return m_manager.get();
200 Wtx::Eml::ManagerWidget::ManagerWidget( std::unique_ptr< Wtx::Eml::Service::Manager > sm )
201 :
Wt::WContainerWidget()
203 auto layout = std::make_unique< Wt::WHBoxLayout >();
204 layout-> setContentsMargins( 0,0,0,0 );
206 layout-> addWidget( std::make_unique<Widget>( std::move(sm) ) );
208 setLayout( std::move( layout ) );
std::string itos(int value)
Convert an Integer to a String.