~igor-cali/bilancio/trunk-a18

« back to all changes in this revision

Viewing changes to src/ombtray/ombtaskbar.cpp

  • Committer: Igor Calì
  • Date: 2024-04-07 15:42:12 UTC
  • Revision ID: igor.cali0@gmail.com-20240407154212-za8iy8efo91nwmz9
[Desktop] Code security harneded based on Flawfinder checks; [Android] Code security hardening baseline based on Insider checks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Name:      ombtaskbar.cpp
3
3
 * Purpose:   Code for TaskBar Class
4
4
 * Author:    Igor Calì (igor.cali0@gmail.com)
5
 
 * Created:   2023-11-03
 
5
 * Created:   2024-04-06
6
6
 * Copyright: Igor Calì (igor.cali0@gmail.com)
7
7
 * License:   GNU
8
8
 **************************************************************/
16
16
        #include <wx/wxprec.h>
17
17
#endif
18
18
 
19
 
/*
20
 
#ifndef __WXMSW__
21
 
  #include <signal.h>
22
 
#else
23
 
    #include <wx/msw/registry.h> // For wxRegKey
24
 
#endif // __WXMSW__
25
 
 
26
 
#ifdef _OMB_USE_GSETTINGS
27
 
        #include <gio/gio.h>    // For GSettings
28
 
#else
29
 
        #include <wx/fileconf.h> // For wxFileConfig
30
 
#endif // _OMB_USE_GSETTINGS
31
 
*/
32
 
 
33
 
#include <wx/snglinst.h>        // for wxSingleInstanceChecker
34
 
#include <wx/filename.h>
35
 
#include <wx/stdpaths.h> // For wxStandardPathsBase
36
 
 
37
19
#ifdef __WXMAC__
38
20
        #include <wx/notifmsg.h>
39
21
#endif // __WXMAC__
52
34
        //#include "../../rsrc/icons/ombtray_attention.xpm"
53
35
#endif // __OPENSUSE__
54
36
 
55
 
/*
56
 
#ifdef __WXMSW__
57
 
        #include "../../rsrc/icons/logo_dark.xpm"
58
 
        #include "../../rsrc/icons/logo_disabled_dark.xpm"
59
 
#endif // __WXMSW__
60
 
*/
61
 
 
62
37
#ifdef _OMB_USEINDICATOR
63
38
        #include "mailbox.h"
64
39
#endif // _OMB_USEINDICATOR
65
40
 
66
 
//#include "../languages.cpp"   // Contains language definitions
67
 
 
68
41
        #ifdef _OMB_DEBUG
69
42
                const int MainTimerInt = 10000;
70
43
        #else
71
44
                const int MainTimerInt = 600000;                        // Data check timer
72
45
        #endif // _OMB_DEBUG
73
 
/*
74
 
        const int TermTimerInt = 3000;                          // Kill check timer
75
 
        #ifdef _OMB_USEINDICATOR
76
 
                const int CommandTimerInt = 1000;               // Command check timer (_OMB_USEINDICATOR)
77
 
        #endif // _OMB_USEINDICATOR
78
 
*/
79
46
 
80
47
// Code start
81
48
 
82
 
// the arrays must be in sync
83
 
//wxCOMPILE_TIME_ASSERT( WXSIZEOF(langNames)==WXSIZEOF(langIds),LangArraysMismatch);
84
 
 
85
 
/*
86
 
#ifndef __WXMSW__
87
 
  bool Killed = false;  // Set to true when SIGTERM is received
88
 
#endif // __WXMSW__
89
 
*/
90
 
 
91
49
#ifdef _OMB_USEINDICATOR
92
50
        extern omb_msgbuf command;
93
51
        extern wxTimer *CommandTimer;
94
52
#endif // _OMB_USEINDICATOR
95
53
 
96
54
extern bool HasAlarms;
97
 
/*
98
 
#ifndef __WXMSW__
99
 
        #ifndef _OMB_USE_GSETTINGS
100
 
        wxFileConfig *INI;
101
 
        #endif // _OMB_USE_GSETTINGS
102
 
#else
103
 
    // long LightTheme = 1;
104
 
#endif // __WXMSW__
105
 
*/
106
 
 
107
 
wxSingleInstanceChecker *m_checker_ombtray;     // checks if another instance is already running
108
55
wxTimer *MainTimer;
109
56
extern TData *Data;
110
57
 
183
130
}}
184
131
 
185
132
void ombTaskBarIcon::RunOmbClick(wxCommandEvent& event){
186
 
        /*
187
 
        wxString Proc = wxEmptyString;
188
 
        wxStandardPaths std = wxStandardPaths::Get();
189
 
  wxString exePath = std.GetExecutablePath();
190
 
  wxString path;
191
 
  wxFileName::SplitPath (exePath, &path, NULL, NULL, wxPATH_NATIVE);
192
 
 
193
 
  Proc = Proc + path;
194
 
 
195
 
  #ifdef __WXMSW__
196
 
    Proc = Proc + L"\\";
197
 
  #else
198
 
    Proc = Proc + L"/";
199
 
  #endif // __WXMSW__
200
 
 
201
 
  Proc = Proc + L"openmoneybox";
202
 
 
203
 
  #ifdef __WXMSW__
204
 
    Proc = Proc + L".exe";
205
 
  #endif // __WXMSW__
206
 
 
207
 
  #ifdef __WXMAC__
208
 
    Proc += L"-bin";
209
 
  #endif // __WXMSW__
210
 
 
211
 
        delete m_checker_ombtray;
212
 
        if(wxExecute(Proc, wxEXEC_ASYNC)){
213
 
                RemoveIcon();}
214
 
        */
215
 
 
216
133
        if(App->ShowFrame()) RemoveIcon();
217
134
}
218
135
 
219
136
void ombTaskBarIcon::OptionsClick(wxCommandEvent& event){
220
137
  if(ShowOptionsDialog()){
221
138
    wxString Document = GetDefaultDocument();
222
 
    if(Document == wxEmptyString){
 
139
    if(Document == wxEmptyString)
223
140
        RemoveIcon();
224
 
        delete m_checker_ombtray;}
225
141
    else
226
142
                Data->OpenDatabase(Document);}}
227
143
 
228
144
void ombTaskBarIcon::ExitClick(wxCommandEvent& event){
229
 
  #ifndef __WXMSW__
230
 
    delete m_checker_ombtray;
231
 
  #endif // __WXMSW__
232
145
  RemoveIcon();
233
146
 
234
147
  #ifdef __WXMSW__