Files correlati : ba8.exe ba8700a.msk bamenu.men Ricompilazione Demo : [ ] Commento : 0001335: Firma digitale Nei parametri della firma digitale i parametri relativi alla marcatura temporale non vengono salvati. La label utente la cambiere in "Utente windows". Inoltre la funzione per impostare la firma digitiale la porterei al di fuori del menù "query e report" git-svn-id: svn://10.65.10.50/trunk@18923 c028cbd2-c16b-5b4b-a496-9718f37d4682
121 lines
2.6 KiB
C++
Executable File
121 lines
2.6 KiB
C++
Executable File
#include "ba8.h"
|
|
#include "ba8700a.h"
|
|
|
|
#include <applicat.h>
|
|
#include <automask.h>
|
|
#include <config.h>
|
|
#include <dongle.h>
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TSignature_mask
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TSignature_mask : public TAutomask
|
|
{
|
|
TString _host, _user;
|
|
bool _admin;
|
|
|
|
protected:
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
public:
|
|
void load();
|
|
void save();
|
|
|
|
TSignature_mask();
|
|
};
|
|
|
|
bool TSignature_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
{
|
|
switch (o.dlg())
|
|
{
|
|
case F_LIST:
|
|
if (e == se_query_add || e == se_query_del)
|
|
return _admin;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void TSignature_mask::load()
|
|
{
|
|
TConfig ini(CONFIG_WST, "fd");
|
|
TAssoc_array& ass = ini.list_variables();
|
|
|
|
TSheet_field& sheet = sfield(F_LIST);
|
|
FOR_EACH_ASSOC_STRING(ass, h, key, val)
|
|
{
|
|
if (_admin || _user.compare(key, -1, true) == 0)
|
|
{
|
|
TToken_string& row = sheet.row(-1);
|
|
row = key; // "Cert_USER"
|
|
row.ltrim(5); // remove "Cert_"
|
|
row.add(val); // add "pkxxx.dll,certificate"
|
|
row.replace(',', row.separator());
|
|
}
|
|
}
|
|
sheet.sort();
|
|
}
|
|
|
|
void TSignature_mask::save()
|
|
{
|
|
TConfig ini(CONFIG_WST, "fd");
|
|
|
|
if (_admin)
|
|
ini.remove_all();
|
|
|
|
TSheet_field& sheet = sfield(F_LIST);
|
|
TString usr;
|
|
TToken_string data(255, ',');
|
|
FOR_EACH_SHEET_ROW(sheet, i, row)
|
|
{
|
|
row->get(0, usr);
|
|
if (usr.full())
|
|
{
|
|
usr.insert("Cert_");
|
|
data = (const char*)*row; // Copia la riga dello spreadsheet
|
|
data.replace(row->separator(), ','); // Cambia il separatore da | a ,
|
|
data.add(" ", 0); data.ltrim(2); // Elimina il nome dell'utente
|
|
ini.set(usr, data);
|
|
}
|
|
}
|
|
}
|
|
|
|
TSignature_mask::TSignature_mask() : TAutomask("ba8700a")
|
|
{
|
|
_admin = user() == dongle().administrator();
|
|
xvt_sys_get_host_name(_host.get_buffer(), _host.size());
|
|
xvt_sys_get_user_name(_user.get_buffer(), _user.size());
|
|
set(F_HOST, _host);
|
|
set(F_NAME, _user);
|
|
load();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TSignature_app
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TSignature_app : public TSkeleton_application
|
|
{
|
|
protected:
|
|
virtual const char* extra_modules() const { return "fd"; }
|
|
|
|
public:
|
|
virtual void main_loop();
|
|
};
|
|
|
|
void TSignature_app::main_loop()
|
|
{
|
|
TSignature_mask m;
|
|
while (m.run() == K_ENTER)
|
|
m.save();
|
|
}
|
|
|
|
int ba8700(int argc, char* argv[])
|
|
{
|
|
TSignature_app app;
|
|
app.run(argc, argv, TR("Firma digitale"));
|
|
return 0;
|
|
} |