1994-11-10 10:59:24 +00:00
|
|
|
|
#include <applicat.h>
|
2009-12-28 10:08:56 +00:00
|
|
|
|
#include <dongle.h>
|
1997-12-15 15:11:40 +00:00
|
|
|
|
#include <form.h>
|
1994-11-10 10:59:24 +00:00
|
|
|
|
#include <modaut.h>
|
1996-05-28 09:39:05 +00:00
|
|
|
|
#include <msksheet.h>
|
1997-12-15 15:11:40 +00:00
|
|
|
|
#include <printer.h>
|
2009-12-28 10:08:56 +00:00
|
|
|
|
#include <toolfld.h>
|
1994-11-10 10:59:24 +00:00
|
|
|
|
#include <utility.h>
|
|
|
|
|
#include <urldefid.h>
|
1995-02-21 15:10:12 +00:00
|
|
|
|
|
1994-11-10 10:59:24 +00:00
|
|
|
|
#include "ba1.h"
|
1996-05-28 09:39:05 +00:00
|
|
|
|
#include "ba1500.h"
|
1994-11-10 10:59:24 +00:00
|
|
|
|
#include "ba1500a.h"
|
1998-04-30 14:38:35 +00:00
|
|
|
|
#include "ba1500b.h"
|
1997-12-15 15:11:40 +00:00
|
|
|
|
#include "ba1600.h"
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
|
TInformazione_moduli::TInformazione_moduli()
|
1998-11-04 18:04:26 +00:00
|
|
|
|
: _unassigned_modules(0)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TDongle& d = dongle();
|
2013-03-15 10:55:26 +00:00
|
|
|
|
for (word mod = BAAUT+1; mod < ENDAUT; mod++)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TToken_string t = d.module_code2desc(mod);
|
|
|
|
|
if (t.len() > 2 && !t.starts_with("Modulo vario", true)) // Scarta moduli ignoti
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
if (d.shown(mod)) //controlla che sia veramente un modulo da mostrare!
|
|
|
|
|
{
|
|
|
|
|
t.add(d.module_code2name(mod));
|
|
|
|
|
t.add(mod);
|
|
|
|
|
_infos.add(t);
|
|
|
|
|
}
|
1996-05-28 09:39:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_infos.sort();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
for (int i = 0; i < _infos.items(); i++)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
|
|
|
|
TToken_string& riga = _infos.row(i);
|
1996-06-12 08:32:36 +00:00
|
|
|
|
const int mod = riga.get_int(2);
|
|
|
|
|
_index[mod] = i;
|
1996-05-28 09:39:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const char* TInformazione_moduli::get_description_by_order(int index)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (index >= 0 && index < _infos.items())
|
1996-05-28 09:39:05 +00:00
|
|
|
|
return _infos.row(index).get(0);
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const char* TInformazione_moduli::get_description_by_name(const char* code) const
|
|
|
|
|
{
|
|
|
|
|
FOR_EACH_ARRAY_ROW_BACK(_infos, i, info)
|
|
|
|
|
{
|
2008-04-04 16:03:36 +00:00
|
|
|
|
if (xvt_str_compare_ignoring_case(info->get(1), code) == 0)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
return info->get(0);
|
|
|
|
|
}
|
2008-04-04 16:03:36 +00:00
|
|
|
|
return TR("{MODULO SCONOSCIUTO}");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const char* TInformazione_moduli::get_name_by_order(int index)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (index >= 0 && index < _infos.items())
|
1996-05-28 09:39:05 +00:00
|
|
|
|
return _infos.row(index).get(1);
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int TInformazione_moduli::get_module_by_order(int index)
|
|
|
|
|
{
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (index >= 0 && index < _infos.items())
|
|
|
|
|
return _infos.row(index).get_int(2);
|
1996-05-28 09:39:05 +00:00
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const char* TInformazione_moduli::get_description(int module)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{ return get_description_by_order(_index[module]); }
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
const char* TInformazione_moduli::get_name(int module)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{ return get_name_by_order(_index[module]); }
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int TInformazione_moduli::get_index(int module) const
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{ return _index[module]; }
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int TInformazione_moduli::get_index_by_name(const char* code) const
|
|
|
|
|
{
|
|
|
|
|
FOR_EACH_ARRAY_ROW_BACK(_infos, i, info)
|
|
|
|
|
{
|
2008-04-04 16:03:36 +00:00
|
|
|
|
if (xvt_str_compare_ignoring_case(info->get(1), code) == 0)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return i >= 0 ? get_index(i) : i;
|
|
|
|
|
}
|
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
1997-12-15 15:11:40 +00:00
|
|
|
|
// TForm richiesta attivazione
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TRequest_form : public TForm
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
void update_serno(const TString& serno);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
void update_dongle();
|
2001-04-30 14:22:43 +00:00
|
|
|
|
void update_os();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
void print_footer();
|
|
|
|
|
|
|
|
|
|
TRequest_form(const char* name);
|
|
|
|
|
virtual ~TRequest_form() { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TRequest_form::TRequest_form(const char* name)
|
|
|
|
|
: TForm(name)
|
|
|
|
|
{
|
|
|
|
|
const TPrint_section& header = section('H', odd_page);
|
|
|
|
|
const TPrint_section& footer = section('F', odd_page);
|
|
|
|
|
|
|
|
|
|
int riga[66];
|
|
|
|
|
int y1 = header.height()-2;
|
|
|
|
|
int y2 = printer().formlen() - footer.height();
|
|
|
|
|
if ((y2-y1) & 0x1) y2--; // Forza un numero pari di righe
|
|
|
|
|
|
|
|
|
|
for (int i = 0; ; i++)
|
|
|
|
|
{
|
|
|
|
|
riga[i] = y1 + 2*(i+1);
|
|
|
|
|
if (riga[i] >= y2-1)
|
|
|
|
|
{
|
|
|
|
|
riga[i] = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
genera_intestazioni(odd_page, y1+1);
|
|
|
|
|
genera_fincatura(odd_page, y1, y2, riga);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRequest_form::update_serno(const TString& num)
|
|
|
|
|
{
|
|
|
|
|
const TDate today(TODAY);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
TForm_item& data = find_field('H', odd_page, FF_DATARICH);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
data.set(today.string());
|
2015-06-17 07:13:32 +00:00
|
|
|
|
find_field('H',odd_page,FF_DONGLE_HW).set("SSA");
|
1998-04-30 14:38:35 +00:00
|
|
|
|
TForm_item& serno = find_field('H', odd_page, FF_DONGLE_SN);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
serno.set(num);
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
void TRequest_form::update_dongle()
|
1997-12-15 15:11:40 +00:00
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TDongle& d = dongle();
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
TForm_item& year = find_field('H', odd_page, FF_YEAR);
|
2010-01-04 10:11:51 +00:00
|
|
|
|
TString16 str; str << d.year_assist();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
year.set(str);
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
TForm_item& user = find_field('H', odd_page, FF_NUTENTI);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
str.format("%d", d.max_users());
|
1997-12-15 15:11:40 +00:00
|
|
|
|
user.set(str);
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-30 14:22:43 +00:00
|
|
|
|
void TRequest_form::update_os()
|
|
|
|
|
{
|
2010-01-04 10:11:51 +00:00
|
|
|
|
char stros[256];
|
|
|
|
|
xvt_sys_get_version(stros, NULL, sizeof(stros));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
|
|
|
|
|
TForm_item& os = find_field('H', odd_page, FF_OS);
|
2001-04-30 14:22:43 +00:00
|
|
|
|
os.set(stros);
|
|
|
|
|
}
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
void TRequest_form::print_footer()
|
|
|
|
|
{
|
2006-12-13 16:22:33 +00:00
|
|
|
|
set_footer(odd_page, true);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
printer().formfeed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// TAttivazione_moduli
|
1997-09-30 09:34:49 +00:00
|
|
|
|
///////////////////////////////////////////////////////////
|
1996-05-16 10:44:00 +00:00
|
|
|
|
|
2001-05-07 13:28:51 +00:00
|
|
|
|
class TAttivazione_moduli : public TSkeleton_application
|
1994-11-10 10:59:24 +00:00
|
|
|
|
{
|
|
|
|
|
TMask* _msk;
|
1996-05-28 09:39:05 +00:00
|
|
|
|
TInformazione_moduli* _im;
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
|
|
|
|
word _serno;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
word _wanted_users, _wanted_assist;
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
private:
|
|
|
|
|
void garble_dongle(word k[4]) const;
|
|
|
|
|
const TString& garble_md5(const char* strin) const;
|
|
|
|
|
const TString& garble_md5(long numin) const;
|
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
protected:
|
1994-11-10 10:59:24 +00:00
|
|
|
|
virtual bool create() ;
|
|
|
|
|
virtual bool destroy() ;
|
2001-05-07 13:28:51 +00:00
|
|
|
|
virtual void main_loop();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
virtual bool use_files() const { return false; }
|
2001-06-25 10:41:20 +00:00
|
|
|
|
virtual bool test_assistance_year() const;
|
1994-12-07 11:07:54 +00:00
|
|
|
|
|
1997-09-30 09:34:49 +00:00
|
|
|
|
word& serno() { return _serno; }
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
void init_mask();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
int build_sheet(bool on = true);
|
2015-06-17 07:13:32 +00:00
|
|
|
|
|
1994-11-10 10:59:24 +00:00
|
|
|
|
static void keyext(const TString & s, word * v);
|
1996-05-28 09:39:05 +00:00
|
|
|
|
static void encode_second_key();
|
2015-06-17 07:13:32 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
static bool k_notify(TSheet_field& f, int r, KEY k);
|
|
|
|
|
static bool print_handler(TMask_field& fld, KEY key);
|
1998-08-25 17:46:29 +00:00
|
|
|
|
static bool printlist_handler(TMask_field& fld, KEY key);
|
1998-01-28 08:53:28 +00:00
|
|
|
|
static bool aga_handler(TMask_field& fld, KEY key);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
static bool sh_nposti_handler(TMask_field& fld, KEY key);
|
|
|
|
|
static bool sh_acquisto_handler(TMask_field& fld, KEY key);
|
|
|
|
|
static bool sh_aggiornamento_handler(TMask_field& fld, KEY key);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
2001-04-30 14:22:43 +00:00
|
|
|
|
bool new_module_requested();
|
2010-12-10 14:03:36 +00:00
|
|
|
|
bool dongle_update_needed() const;
|
2001-04-30 14:22:43 +00:00
|
|
|
|
|
|
|
|
|
void print_status();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual void print();
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
TAttivazione_moduli() : _msk(NULL), _wanted_users(0), _wanted_assist(0) { }
|
|
|
|
|
virtual ~TAttivazione_moduli() { }
|
1994-11-10 10:59:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
2010-01-04 10:11:51 +00:00
|
|
|
|
HIDDEN TAttivazione_moduli& app() { return (TAttivazione_moduli&)main_app(); }
|
1998-04-30 14:38:35 +00:00
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
|
int TAttivazione_moduli::build_sheet(bool on)
|
|
|
|
|
{
|
|
|
|
|
int nmod = 0;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
TSheet_field& sf = _msk->sfield(F_MODULI);
|
|
|
|
|
for (int i = 0; i < _im->items(); i++)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
|
|
|
|
TToken_string& riga = sf.row(i);
|
2006-12-13 16:22:33 +00:00
|
|
|
|
riga = _im->get_description_by_order(i);
|
1998-04-30 14:38:35 +00:00
|
|
|
|
riga.trim();
|
1996-05-28 09:39:05 +00:00
|
|
|
|
const int module = _im->get_module_by_order(i);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
|
1998-02-17 11:15:36 +00:00
|
|
|
|
const bool ics = module == 0 || (on && ::dongle().active(module));
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (ics)
|
1996-05-28 09:39:05 +00:00
|
|
|
|
{
|
|
|
|
|
riga.add("X");
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (module != 0)
|
1998-11-04 18:04:26 +00:00
|
|
|
|
nmod++;
|
|
|
|
|
else
|
|
|
|
|
sf.disable_cell(i, -1); // Disabilita la riga della base
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
riga.add(" ");
|
1996-05-28 09:39:05 +00:00
|
|
|
|
riga.add(module);
|
|
|
|
|
}
|
|
|
|
|
return nmod;
|
|
|
|
|
}
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
2008-03-19 15:31:53 +00:00
|
|
|
|
void TAttivazione_moduli::garble_dongle(word k[4]) const
|
1997-09-30 09:34:49 +00:00
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
::dongle().garble(k);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-11-04 14:09:21 +00:00
|
|
|
|
#define YEAR_MIN 2121
|
2008-03-19 15:31:53 +00:00
|
|
|
|
#define YEAR_MAX 2777
|
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
bool TAttivazione_moduli::print_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
app().print();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-01-28 08:53:28 +00:00
|
|
|
|
bool TAttivazione_moduli::aga_handler(TMask_field& fld, KEY key)
|
|
|
|
|
{
|
|
|
|
|
if (key == K_SPACE)
|
|
|
|
|
{
|
2010-05-07 08:53:49 +00:00
|
|
|
|
TMask mask(TR("Dati Release"), 1, 80, 13);
|
2009-01-15 17:02:20 +00:00
|
|
|
|
mask.add_string(101, 0, PR("Nome Breve "), 1, 1, 32);
|
|
|
|
|
mask.add_string(102, 0, PR("Prodotto "), 1, 2, 32);
|
|
|
|
|
mask.add_string(103, 0, PR("Distributore "), 1, 3, 60);
|
|
|
|
|
mask.add_string(104, 0, PR("Amministratore "), 1, 4, 16, "U");
|
|
|
|
|
mask.add_string(105, 0, PR("Password "), 1, 5, 16, "*");
|
2011-04-12 13:02:16 +00:00
|
|
|
|
mask.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
|
1998-01-28 08:53:28 +00:00
|
|
|
|
mask.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
|
|
|
|
|
|
2009-01-12 16:52:14 +00:00
|
|
|
|
//nuovo modo di gettare il producer da oem.ini
|
|
|
|
|
TConfig oemini(CONFIG_OEM, "MAIN");
|
|
|
|
|
const int oem = oemini.get_int("OEM", NULL, -1, -1);
|
|
|
|
|
if (oem >= 0)
|
|
|
|
|
{
|
|
|
|
|
TString8 para; para << "OEM_" << oem;
|
|
|
|
|
oemini.set_paragraph(para);
|
2009-01-15 17:02:20 +00:00
|
|
|
|
mask.set(101, ::decode(oemini.get("Name")));
|
|
|
|
|
mask.set(102, ::decode(oemini.get("Product")));
|
|
|
|
|
mask.set(103, ::decode(oemini.get("Reseller")));
|
|
|
|
|
mask.set(104, ::decode(oemini.get("Administrator")));
|
|
|
|
|
mask.set(105, ::decode(oemini.get("Password")));
|
2009-01-12 16:52:14 +00:00
|
|
|
|
}
|
|
|
|
|
else //vecchio modo; gi<67> che c'<27> elimina i vecchi valori dall'install.ini
|
|
|
|
|
{
|
|
|
|
|
TConfig ini("install.ini", "Main");
|
2009-01-15 17:02:20 +00:00
|
|
|
|
mask.set(103, ::decode(ini.get("Producer")));
|
|
|
|
|
mask.set(104, ::decode(ini.get("Administrator")));
|
|
|
|
|
mask.set(105, ::decode(ini.get("Password")));
|
2009-01-12 16:52:14 +00:00
|
|
|
|
ini.remove("Producer");
|
|
|
|
|
ini.remove("Administrator");
|
|
|
|
|
ini.remove("Password");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//setta comunque nel nuovo modo con producer = 0 se eventualmente ignoto
|
1998-01-28 08:53:28 +00:00
|
|
|
|
if (mask.run() == K_ENTER)
|
1999-05-24 13:34:11 +00:00
|
|
|
|
{
|
2009-01-15 17:02:20 +00:00
|
|
|
|
oemini.set("Name", ::encode(mask.get(101)));
|
|
|
|
|
oemini.set("Product", ::encode(mask.get(102)));
|
|
|
|
|
oemini.set("Reseller", ::encode(mask.get(103)));
|
|
|
|
|
oemini.set("Administrator", ::encode(mask.get(104)));
|
|
|
|
|
oemini.set("Password", ::encode(mask.get(105)));
|
2009-01-12 16:52:14 +00:00
|
|
|
|
if (oem < 0)
|
2009-01-15 15:16:42 +00:00
|
|
|
|
oemini.set("OEM", "0", "MAIN", true);
|
1999-05-24 13:34:11 +00:00
|
|
|
|
}
|
1998-01-28 08:53:28 +00:00
|
|
|
|
}
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1998-01-28 08:53:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-04-30 14:38:35 +00:00
|
|
|
|
void TAttivazione_moduli::init_mask()
|
1994-11-10 10:59:24 +00:00
|
|
|
|
{
|
1998-02-17 11:15:36 +00:00
|
|
|
|
const TDate oggi(TODAY);
|
|
|
|
|
const int nmod = build_sheet();
|
2006-12-13 16:22:33 +00:00
|
|
|
|
const TDongle& d = ::dongle();
|
|
|
|
|
_msk->set(F_SN, d.number());
|
|
|
|
|
_msk->set(F_USERS, d.max_users());
|
|
|
|
|
_msk->set(F_ASSIST, d.year_assist());
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
|
bool TAttivazione_moduli::k_notify(TSheet_field& f, int r, KEY k)
|
|
|
|
|
{
|
1997-11-20 08:18:05 +00:00
|
|
|
|
if (k == K_INS || k == K_DEL)
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return false;
|
|
|
|
|
return true;
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-04-30 14:22:43 +00:00
|
|
|
|
void TAttivazione_moduli::print_status()
|
|
|
|
|
{
|
|
|
|
|
TRequest_form form("ba1500a");
|
|
|
|
|
TForm_item& descr = form.find_field('B', odd_page, 102);
|
|
|
|
|
TForm_item& codice = form.find_field('B', odd_page, 103);
|
|
|
|
|
|
2006-12-13 16:22:33 +00:00
|
|
|
|
form.find_field('H',odd_page,1).set(dongle().reseller());
|
2001-04-30 14:22:43 +00:00
|
|
|
|
form.update_serno(_msk->get(F_SN));
|
2006-12-13 16:22:33 +00:00
|
|
|
|
form.update_dongle();
|
2001-04-30 14:22:43 +00:00
|
|
|
|
form.update_os();
|
|
|
|
|
|
|
|
|
|
TWait_cursor hourglass;
|
|
|
|
|
printer().open();
|
|
|
|
|
|
|
|
|
|
TSheet_field& sheet = _msk->sfield(F_MODULI);
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
|
|
|
|
{
|
|
|
|
|
const int module = row->get_int(2) ;
|
|
|
|
|
const bool active = ::dongle().active(module);
|
|
|
|
|
|
|
|
|
|
if (!active)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
descr.set(row->get(0));
|
2002-10-24 10:47:49 +00:00
|
|
|
|
codice.set(TR("*ATTIVO*"));
|
2001-04-30 14:22:43 +00:00
|
|
|
|
form.print(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printer().close();
|
|
|
|
|
}
|
|
|
|
|
|
1998-08-25 17:46:29 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
void TAttivazione_moduli::print()
|
|
|
|
|
{
|
2015-11-04 14:09:21 +00:00
|
|
|
|
print_status();
|
1997-12-15 15:11:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-25 10:41:20 +00:00
|
|
|
|
// Questo programma non deve bloccarsi per l'anno di assistenza!
|
|
|
|
|
bool TAttivazione_moduli::test_assistance_year() const
|
2010-12-10 14:03:36 +00:00
|
|
|
|
{ return true; }
|
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::dongle_update_needed() const
|
|
|
|
|
{
|
2015-03-31 05:59:47 +00:00
|
|
|
|
bool ok = TApplication::test_assistance_year(false);
|
2010-12-10 14:03:36 +00:00
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
|
Tdninst dninst;
|
|
|
|
|
const int dninst_year = dninst.assist_year();
|
|
|
|
|
const int dongle_year = dongle().year_assist();
|
|
|
|
|
ok = dninst_year <= dongle_year;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return !ok;
|
2001-06-25 10:41:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
1994-11-10 10:59:24 +00:00
|
|
|
|
bool TAttivazione_moduli::create()
|
|
|
|
|
{
|
2010-03-29 14:36:06 +00:00
|
|
|
|
TDongle& d = dongle();
|
|
|
|
|
bool ok = d.login(true);
|
1997-09-30 09:34:49 +00:00
|
|
|
|
if (!ok)
|
2006-04-13 17:56:02 +00:00
|
|
|
|
return false;
|
2001-06-25 10:41:20 +00:00
|
|
|
|
|
2010-12-10 14:03:36 +00:00
|
|
|
|
ok = !dongle_update_needed();
|
2001-06-25 10:41:20 +00:00
|
|
|
|
if (!ok)
|
|
|
|
|
{
|
|
|
|
|
ok = update_assistance_year();
|
2015-03-31 05:59:47 +00:00
|
|
|
|
if (ok && TApplication::test_assistance_year(false))
|
2008-10-22 08:18:26 +00:00
|
|
|
|
return false; // Aggiornamento automatico riuscito!
|
2001-06-25 10:41:20 +00:00
|
|
|
|
}
|
1997-09-30 09:34:49 +00:00
|
|
|
|
|
2010-12-23 11:42:43 +00:00
|
|
|
|
|
1996-05-28 09:39:05 +00:00
|
|
|
|
_im = new TInformazione_moduli;
|
|
|
|
|
|
1994-12-07 11:07:54 +00:00
|
|
|
|
disable_menu_item(M_FILE_NEW);
|
|
|
|
|
disable_menu_item(M_FILE_PG_SETUP);
|
1994-11-10 10:59:24 +00:00
|
|
|
|
|
|
|
|
|
_msk = new TMask("ba1500a") ;
|
1997-11-20 08:18:05 +00:00
|
|
|
|
|
2009-12-28 10:08:56 +00:00
|
|
|
|
_msk->set_handler(DLG_PRINT, print_handler);
|
1997-12-15 15:11:40 +00:00
|
|
|
|
|
1997-11-20 08:18:05 +00:00
|
|
|
|
TSheet_field& sf = _msk->sfield(F_MODULI);
|
|
|
|
|
sf.set_notify(k_notify);
|
2015-06-17 07:13:32 +00:00
|
|
|
|
|
1997-12-15 15:11:40 +00:00
|
|
|
|
enable_menu_item(M_FILE_PG_SETUP);
|
|
|
|
|
enable_menu_item(M_FILE_PRINT);
|
2001-05-07 13:28:51 +00:00
|
|
|
|
return TSkeleton_application::create();
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TAttivazione_moduli::destroy()
|
|
|
|
|
{
|
1995-03-22 09:07:04 +00:00
|
|
|
|
if (_msk != NULL) delete _msk;
|
1996-05-28 09:39:05 +00:00
|
|
|
|
if (_im != NULL) delete _im;
|
2006-12-13 16:22:33 +00:00
|
|
|
|
return true;
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-07 13:28:51 +00:00
|
|
|
|
void TAttivazione_moduli::main_loop()
|
1994-11-10 10:59:24 +00:00
|
|
|
|
{
|
2015-11-04 14:09:21 +00:00
|
|
|
|
init_mask();
|
2015-06-17 07:13:32 +00:00
|
|
|
|
_msk->run();
|
1994-11-10 10:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ba1500(int argc, char** argv)
|
|
|
|
|
{
|
2015-06-17 07:13:32 +00:00
|
|
|
|
TAttivazione_moduli a ;
|
|
|
|
|
a.run(argc, argv, TR("Stato attivazione moduli"));
|
1994-11-10 10:59:24 +00:00
|
|
|
|
return 0;
|
2008-03-19 15:31:53 +00:00
|
|
|
|
}
|