1 /*******************************************************
2 Copyright (C) 2014 Gabriele-V
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 ********************************************************/
18 
19 #ifndef MM_EX_WEBAPPDIALOG_H_
20 #define MM_EX_WEBAPPDIALOG_H_
21 
22 #include "defs.h"
23 #include "webapp.h"
24 #include <wx/dataview.h>
25 #include <wx/srchctrl.h>
26 #include <map>
27 
28 class mmWebAppDialog : public wxDialog
29 {
30     wxDECLARE_DYNAMIC_CLASS(mmWebAppDialog);
31     wxDECLARE_EVENT_TABLE();
32 
33 public:
34     mmWebAppDialog(wxWindow* parent);
35 
getRefreshRequested()36     bool getRefreshRequested() const { return refreshRequested_; }
37 
38 private:
39     enum cols
40     {
41         WEBTRAN_ID = 0,
42         WEBTRAN_DATE,
43         WEBTRAN_ACCOUNT,
44         WEBTRAN_STATUS,
45         WEBTRAN_TYPE,
46         WEBTRAN_PAYEE,
47         WEBTRAN_CATEGORY,
48         WEBTRAN_AMOUNT,
49         WEBTRAN_NOTES,
50         WEBTRAN_ATTACHMENTS
51     };
52 
53     enum menu_items
54     {
55         MENU_OPEN_ATTACHMENT = 1,
56         MENU_IMPORT_WEBTRAN,
57         MENU_DELETE_WEBTRAN
58     };
59 
60     wxDataViewListCtrl* webtranListBox_;
61     wxSearchCtrl* m_maskTextCtrl;
62 
63     int m_webtran_id;
64     mmWebApp::WebTranVector WebAppTransactions_;
65     bool refreshRequested_;
66 
mmWebAppDialog()67     mmWebAppDialog() : m_webtran_id(-1), refreshRequested_(false) {}
68 
69     void do_create(wxWindow* parent);
70     void CreateControls();
71     void fillControls();
72 
73     void OnCancel(wxCommandEvent& /*event*/);
74     void OnApply(wxCommandEvent& /*event*/);
75     void OnOk(wxCommandEvent& /*event*/);
76 
77     bool ImportWebTr(int WebTrID, bool open);
78     void ImportAllWebTr(const bool& open);
79 
80     void OnListItemActivated(wxDataViewEvent& event);
81     void OnMenuSelected(wxCommandEvent& event);
82     void OnItemRightClick(wxDataViewEvent& event);
83 
84     void ImportWebTrSelected();
85     void DeleteWebTr();
86     void OpenAttachment();
87 };
88 
89 #endif // MM_EX_PAYEEDIALOG_H_
90