Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

aqfinance / src / fox / lib / modules / accounts / fm_accounts.cpp @ 242027ca

History | View | Annotate | Download (2.83 KB)

1
/****************************************************************************
2
 * This file is part of the project AqFinance.
3
 * AqFinance (c) by 2009 Martin Preuss, all rights reserved.
4
 *
5
 * The license for this file can be found in the file COPYING which you
6
 * should have received along with this file.
7
 ****************************************************************************/
8

    
9
#ifdef HAVE_CONFIG_H
10
# include <config.h>
11
#endif
12

    
13

    
14
#include "fm_accounts.hpp"
15
#include "fm_accpage.hpp"
16
#include "ff_app.hpp"
17

    
18

    
19
#include <gwenhywfar/debug.h>
20
#include <gwenhywfar/i18n.h>
21

    
22

    
23
#define I18N(msg) GWEN_I18N_Translate(PACKAGE, msg)
24

    
25

    
26

    
27

    
28
FM_Accounts::FM_Accounts(FF_ModuleManager *mm)
29
  :FF_Module(mm, FF_Module::MODULE_ACCOUNTS, I18N("Module|Accounts"))
30
  , m_page(NULL)
31
  , m_config(NULL)
32
{
33
  m_icon=getApp()->getIcon("account");
34
  if (m_icon)
35
    m_icon->create();
36
}
37

    
38

    
39

    
40
FM_Accounts::~FM_Accounts()
41
{
42
}
43

    
44

    
45

    
46
void FM_Accounts::dump(int indent)
47
{
48
}
49

    
50

    
51

    
52
void FM_Accounts::init(FXComposite *parentForView)
53
{
54
  int rv;
55

    
56
  DBG_INFO(0, "Init");
57
  rv=GWEN_ConfigMgr_GetGroup(AE_GetConfigManager(),
58
                             "modules",
59
                             "accounts",
60
                             &m_config);
61
  if (rv<0) {
62
    DBG_ERROR(0, "Error getting main configuration group (%d)", rv);
63
    return;
64
  }
65

    
66

    
67
  m_page=new FM_AccountPage(this, parentForView, LAYOUT_FILL_X | LAYOUT_FILL_Y);
68
  m_page->create();
69
  m_page->init(m_config);
70
  m_page->show();
71
}
72

    
73

    
74

    
75
void FM_Accounts::fini()
76
{
77
  DBG_INFO(0, "Fini");
78
  if (m_config) {
79
    if (m_page) {
80
      int rv;
81

    
82
      rv=GWEN_ConfigMgr_LockGroup(AE_GetConfigManager(),
83
                                  "modules",
84
                                  "accounts");
85
      if (rv<0) {
86
        DBG_ERROR(0, "Unable to lock configuration group (%d)", rv);
87
      }
88
      else {
89
        m_page->fini(m_config);
90

    
91
        rv=GWEN_ConfigMgr_SetGroup(AE_GetConfigManager(),
92
                                   "modules",
93
                                   "accounts",
94
                                   m_config);
95
        if (rv<0) {
96
          DBG_ERROR(0, "Error setting configuration group (%d)", rv);
97
        }
98

    
99
        rv=GWEN_ConfigMgr_UnlockGroup(AE_GetConfigManager(),
100
                                      "modules",
101
                                      "accounts");
102
      }
103
    } /* if page */
104
    GWEN_DB_Group_free(m_config);
105
    m_config=NULL;
106
  }
107

    
108
  if (m_page) {
109
    delete m_page;
110
    m_page=NULL;
111
  }
112
}
113

    
114

    
115

    
116
void FM_Accounts::enter()
117
{
118
}
119

    
120

    
121

    
122
void FM_Accounts::leave()
123
{
124
}
125

    
126

    
127

    
128
void FM_Accounts::reset()
129
{
130
}
131

    
132

    
133

    
134
void FM_Accounts::dbOpened(AE_BOOK *bk)
135
{
136
  m_page->dbOpened(bk);
137
}
138

    
139

    
140

    
141
void FM_Accounts::dbClosing()
142
{
143
  m_page->dbClosing();
144
}
145

    
146

    
147

    
148
void FM_Accounts::dbClosed()
149
{
150
  m_page->dbClosed();
151
}
152

    
153

    
154

    
155
void FM_Accounts::dbReload(AE_BOOK_TABLE_TYPE tt)
156
{
157
  m_page->dbReload(tt);
158
}
159

    
160

    
161

    
162
void FM_Accounts::aboutToSendJobs()
163
{
164
  m_page->aboutToSendJobs();
165
}
166

    
167

    
168

    
169

    
170

    
171

    
172