Limitato al minimo accesso a file NDITTE sempre problematico
git-svn-id: svn://10.65.10.50/branches/R_10_00@23055 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d27ef67a40
commit
61fd44bec6
@ -367,7 +367,7 @@ const char* TApplication::get_module_name() const
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
error_box(FR("Il modulo '%s' non e' autorizzato per l'utente %s"), (const char*)module, ((const char*)user()));
|
||||
error_box(FR("Il modulo '%s' non è autorizzato per l'utente %s"), (const char*)module, ((const char*)user()));
|
||||
module.cut(0);
|
||||
}
|
||||
}
|
||||
@ -454,7 +454,7 @@ void TApplication::check_parameters(
|
||||
}
|
||||
}
|
||||
|
||||
bool TApplication::test_assistance_year() const
|
||||
bool TApplication::test_assistance_year(bool verbose) const
|
||||
{
|
||||
const int dongle_year = dongle().year_assist();
|
||||
int app_year, dum1, dum2, dum3;
|
||||
@ -462,11 +462,24 @@ bool TApplication::test_assistance_year() const
|
||||
if (ok)
|
||||
{
|
||||
ok = app_year <= dongle_year;
|
||||
if (ok && check_autorization())
|
||||
if (ok)
|
||||
{
|
||||
Tdninst dninst; //queste 2 righe sono quelle da mettere nei programmi
|
||||
ok = dninst.can_I_run();
|
||||
if (check_autorization())
|
||||
{
|
||||
Tdninst dninst; //queste 2 righe sono quelle da mettere nei programmi
|
||||
ok = dninst.can_I_run(false, verbose);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose)
|
||||
error_box(TR("E' necessario rinnovare l'assistenza per l'anno in corso"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose)
|
||||
error_box(TR("Impossibile determinare la versione dell'applicazione"));
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -501,11 +514,8 @@ void TApplication::run(
|
||||
_name = cmd2name(argv[0]);
|
||||
|
||||
const int sn = get_serial_number();
|
||||
if (sn > 0 && !test_assistance_year())
|
||||
{
|
||||
error_box(FR("E' necessario attivare il contratto di assistenza per la chiave %d"), sn);
|
||||
if (sn > 0 && !test_assistance_year(true))
|
||||
return;
|
||||
}
|
||||
|
||||
if (use_files())
|
||||
init_global_vars();
|
||||
@ -658,15 +668,10 @@ bool TApplication::set_firm(long newfirm)
|
||||
if (newfirm <= 0)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newfirm == oldfirm || newfirm <= 0)
|
||||
return newfirm > 0;
|
||||
}
|
||||
|
||||
if (prefix().test(newfirm))
|
||||
bool done = newfirm > 0 && prefix().set_codditta(newfirm);
|
||||
if (done)
|
||||
{
|
||||
prefix().set_codditta(newfirm);
|
||||
_savefirm = 0;
|
||||
|
||||
WINDOW w = cur_win();
|
||||
@ -680,7 +685,7 @@ bool TApplication::set_firm(long newfirm)
|
||||
on_config_change();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return done;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
@ -91,7 +91,7 @@ protected:
|
||||
// @cmember Chiamata ogni volta che l'utente cambia ditta
|
||||
virtual void on_firm_change();
|
||||
|
||||
virtual bool test_assistance_year() const;
|
||||
virtual bool test_assistance_year(bool verbose) const;
|
||||
|
||||
// @cmember Setta i permessi di utilizzo dei moduli
|
||||
void set_perms();
|
||||
|
@ -758,17 +758,24 @@ static void cfg2file(int which_config, TFilename& file)
|
||||
file = "./install.ini";
|
||||
break;
|
||||
case CONFIG_DITTA:
|
||||
file = firm2dir(prefix().get_codditta());
|
||||
file.add("ditta.ini");
|
||||
if (!file.exist())
|
||||
{
|
||||
TFilename oldfile = file;
|
||||
const int pos = oldfile.find("ditta.ini");
|
||||
oldfile.cut(pos);
|
||||
oldfile.add("prassid.ini"); // Old config file!
|
||||
if (oldfile.exist())
|
||||
fcopy(oldfile, file);
|
||||
}
|
||||
{
|
||||
long codditta = 0L;
|
||||
if (prefix_valid())
|
||||
codditta = prefix().get_codditta();
|
||||
else
|
||||
codditta = xvt_sys_get_profile_int(NULL, "Main", "Firm", 1);
|
||||
file = firm2dir(codditta);
|
||||
file.add("ditta.ini");
|
||||
if (!file.exist())
|
||||
{
|
||||
TFilename oldfile = file;
|
||||
const int pos = oldfile.find("ditta.ini");
|
||||
oldfile.cut(pos);
|
||||
oldfile.add("prassid.ini"); // Old config file!
|
||||
if (oldfile.exist())
|
||||
fcopy(oldfile, file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CONFIG_STUDIO:
|
||||
case CONFIG_STAMPE:
|
||||
|
@ -338,6 +338,16 @@ XVT_FNTID xvtil_load_default_font()
|
||||
|
||||
#define XI_INVALID_BITMAP ((XI_BITMAP*)-1)
|
||||
|
||||
struct RGB_struct { unsigned long r,g,b; };
|
||||
|
||||
HIDDEN void RGB_mean(short x, short y, unsigned char* rgba, void* jolly)
|
||||
{
|
||||
RGB_struct* s = (RGB_struct*)jolly;
|
||||
s->r += *(rgba+0);
|
||||
s->g += *(rgba+1);
|
||||
s->b += *(rgba+2);
|
||||
}
|
||||
|
||||
HIDDEN XI_BITMAP* get_background_bitmap(bool reload)
|
||||
{
|
||||
static XI_BITMAP* bmp = XI_INVALID_BITMAP;
|
||||
@ -356,25 +366,20 @@ HIDDEN XI_BITMAP* get_background_bitmap(bool reload)
|
||||
{
|
||||
XVT_IMAGE img = (XVT_IMAGE)bmp->xin_bitmap->x;
|
||||
short w, h; xvt_image_get_dimensions(img, &w, &h);
|
||||
|
||||
unsigned long r=0, g=0, b=0;
|
||||
const short k = min(w,h);
|
||||
for (short xy = 0; xy < k; xy++)
|
||||
{
|
||||
const COLOR col = xvt_image_get_pixel(img, xy, xy);
|
||||
r += XVT_COLOR_GET_RED(col);
|
||||
g += XVT_COLOR_GET_GREEN(col);
|
||||
b += XVT_COLOR_GET_BLUE(col);
|
||||
}
|
||||
r = (r+k/2)/k; g = (g+k/2)/k; b = (b+k/2)/k;
|
||||
// Calcola colore medio della tile
|
||||
RGB_struct rgb; rgb.r = rgb.g = rgb.b = 0;
|
||||
xvt_image_filter(img, RGB_mean, &rgb);
|
||||
int den = w; den *= h;
|
||||
const int r = rgb.r / den;
|
||||
const int g = rgb.g / den;
|
||||
const int b = rgb.b / den;
|
||||
|
||||
MASK_BACK_COLOR = XVT_MAKE_COLOR(r, g, b); // Mean texture color
|
||||
MASK_LIGHT_COLOR = modulate_color(MASK_BACK_COLOR, +0.2);
|
||||
MASK_DARK_COLOR = modulate_color(MASK_BACK_COLOR, -0.2);
|
||||
|
||||
MASK_DARK_COLOR = modulate_color(MASK_BACK_COLOR, -0.2);
|
||||
DISABLED_BACK_COLOR = MASK_BACK_COLOR;
|
||||
|
||||
if (w > 512 || h > 512)
|
||||
if (h > 640)
|
||||
{
|
||||
bmp->mode = XI_BITMAP_NORMAL;
|
||||
bmp->hcenter = bmp->vcenter = TRUE;
|
||||
|
@ -374,9 +374,7 @@ bool TDongle::eutron_login(bool test_all_keys)
|
||||
bool TDongle::ssa_login(const char* mod)
|
||||
{
|
||||
if (mod && *mod)
|
||||
{
|
||||
return is_power_station() || xvt_dongle_sa_login(mod) == 0;
|
||||
}
|
||||
|
||||
_max_users = 1;
|
||||
_last_update = TDate(TODAY);
|
||||
@ -1195,7 +1193,7 @@ int Tdninst::test_cmdline(const TString& cmdline, bool key_must_exist, TString&
|
||||
if (serno == 0)
|
||||
{
|
||||
if (is_power_station())
|
||||
return 0; // Solo chiavi per uso interno aga
|
||||
return 0; // Solo chiavi per uso interno Sirio
|
||||
msg = TR("Chiave di sviluppo non autorizzata");
|
||||
return 1;
|
||||
}
|
||||
@ -1231,13 +1229,12 @@ int Tdninst::test_cmdline(const TString& cmdline, bool key_must_exist, TString&
|
||||
|
||||
if (parse_date(dninst_line, key, datascad))
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
const bool scaduto = datascad < oggi;
|
||||
if (key == "*")
|
||||
{
|
||||
if (scaduto)
|
||||
{
|
||||
msg << TR("Chiave scaduta il ") << datascad;
|
||||
msg.format(FR("Chiave %ld scaduta il %s"), serno, datascad.string());
|
||||
return 7;
|
||||
}
|
||||
} else
|
||||
@ -1282,26 +1279,31 @@ int Tdninst::test_cmdline(const TString& cmdline, bool key_must_exist, TString&
|
||||
|
||||
if (!bFound && key_must_exist)
|
||||
{
|
||||
msg << TR("Impossibile trovare ") << cmdline;
|
||||
msg << TR("Impossibile trovare ") << cmdline << TR(" tra i programmi abilitati");
|
||||
return 6;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Tdninst::can_I_run(const bool is_personal_program) const
|
||||
bool Tdninst::can_I_run(const bool is_personal_program, const bool verbose) const
|
||||
{
|
||||
TFilename cmdline = main_app().argv(0);
|
||||
const TApplication& app = main_app();
|
||||
TFilename cmdline = app.argv(0);
|
||||
cmdline = cmdline.name_only();
|
||||
if (cmdline.starts_with("ba", true) || cmdline.ends_with("cnv", true))
|
||||
return true;
|
||||
|
||||
const char* option = main_app().argc() > 1 ? main_app().argv(1) : "";
|
||||
const char* option = app.argc() > 1 ? app.argv(1) : "";
|
||||
if (*option == '-' && isdigit(*(option+1)))
|
||||
cmdline << ' ' << option;
|
||||
cmdline.lower();
|
||||
|
||||
TString msg;
|
||||
return test_cmdline(cmdline, is_personal_program, msg) == 0;
|
||||
bool ok = test_cmdline(cmdline, is_personal_program, msg) == 0;
|
||||
if (!ok && verbose)
|
||||
error_box(msg);
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool Tdninst::find_serno() const
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
int assist_year() const { return _year_assist; }
|
||||
int solar_year() const { return assistance_year2solar(_year_assist); }
|
||||
int test_cmdline(const TString& cmdline, bool key_must_exist, TString& msg) const;
|
||||
bool can_I_run(const bool is_personal_program = false) const;
|
||||
bool can_I_run(const bool is_personal_program = false, const bool verbose = false) const;
|
||||
bool find_serno() const;
|
||||
bool find_killed(TToken_string& kill_list) const;
|
||||
bool find_expiring(int days, TString& module, TDate& expires) const;
|
||||
|
@ -99,9 +99,9 @@ protected:
|
||||
word _size; // Buffer size
|
||||
short _decimals; // Precision
|
||||
TString _prompt; // Prompt
|
||||
TString _flags; // Flags
|
||||
int _bmp_up; // Bitmap up
|
||||
int _bmp_dn; // Bitmap down
|
||||
TString16 _flags; // Flags
|
||||
int _bmp_up; // Bitmap up
|
||||
int _bmp_dn; // Bitmap down
|
||||
TToken_string _park; // Work string
|
||||
void reset();
|
||||
};
|
||||
|
@ -1236,9 +1236,14 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
case XIE_CHG_CELL:
|
||||
if (_edit_field && !_cell_dirty)
|
||||
{
|
||||
notify_change();
|
||||
_cell_dirty = true;
|
||||
_edit_field->set_dirty();
|
||||
if (active())
|
||||
{
|
||||
notify_change();
|
||||
_cell_dirty = true;
|
||||
_edit_field->set_dirty();
|
||||
}
|
||||
else
|
||||
refused = true;
|
||||
}
|
||||
break;
|
||||
case XIE_BUTTON:
|
||||
@ -1300,7 +1305,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
|
||||
if (xiev->v.select.column > 0)
|
||||
{
|
||||
if (!cell_disabled(record, cid2index(f->dlg())))
|
||||
if (!cell_disabled(record, cid2index(f->dlg())) && active())
|
||||
{
|
||||
notify_change();
|
||||
if (f->get().blank())
|
||||
@ -2598,7 +2603,6 @@ KEY TSpreadsheet::edit(int n)
|
||||
}
|
||||
|
||||
bool TSpreadsheet::add_row_auto()
|
||||
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
@ -2606,7 +2610,7 @@ bool TSpreadsheet::add_row_auto()
|
||||
{
|
||||
on_idle(); // Termina tutti gli eventuali update in corso
|
||||
|
||||
if (active() && xi_move_focus(get_interface()))
|
||||
if (owner().active() && xi_move_focus(get_interface()))
|
||||
{
|
||||
int rec = -1;
|
||||
|
||||
@ -2769,9 +2773,11 @@ bool TSheet_field::parse_item(TScanner& scanner)
|
||||
{
|
||||
switch(*f)
|
||||
{
|
||||
case 'A': _enable_autoload = true; break;
|
||||
case 'I': _append = false; break;
|
||||
case '|': _separator = SAFE_PIPE_CHR; break;
|
||||
case 'A': _enable_autoload = true; break;
|
||||
case 'I': _append = false; break;
|
||||
case '|': _separator = SAFE_PIPE_CHR; break;
|
||||
case 'L': _flags.read_only = true; break;
|
||||
case 'D': _flags.enable_default = false; break;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
@ -2849,13 +2855,22 @@ void TSheet_field::create(WINDOW parent)
|
||||
{
|
||||
_flags.enabled = true; // Lo sheet e' sempre operabile anche se non editabile
|
||||
disable();
|
||||
((TSpreadsheet*)_ctl)->activate(false);
|
||||
}
|
||||
if (_flags.read_only)
|
||||
{
|
||||
((TSpreadsheet*)_ctl)->activate(false);
|
||||
}
|
||||
const TMask & s = sheet_mask();
|
||||
short id;
|
||||
|
||||
for (id = FIRST_FIELD; ; id++)
|
||||
if (s.id2pos(id) < 0) break;
|
||||
_last_column_id = id - 1;
|
||||
const TMask& s = sheet_mask();
|
||||
for (short id = FIRST_FIELD; ; id++)
|
||||
{
|
||||
if (s.id2pos(id) < 0)
|
||||
{
|
||||
_last_column_id = id - 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
((TSpreadsheet*)_ctl)->load_columns_order();
|
||||
}
|
||||
|
@ -502,9 +502,8 @@ const TFilename& TFile_info::load_filedes()
|
||||
}
|
||||
|
||||
TFile_info::TFile_info(int logicnum, TFilename& name)
|
||||
: _ref_count(0), _num(logicnum), _handle(-1),
|
||||
_last_access(0),
|
||||
_last_change(0), _locked(false), _exclusive(false), _last_key(-1)
|
||||
: _ref_count(0), _num(logicnum), _handle(-1), _last_access(0),
|
||||
_last_change(0), _locked(false), _exclusive(false), _last_key(-1)
|
||||
{
|
||||
if (logicnum < LF_EXTERNAL)
|
||||
{
|
||||
@ -1174,7 +1173,7 @@ bool TPrefix::set_studio(const char* study, long ditta)
|
||||
__ptprf[len] = SLASH;
|
||||
__ptprf[len+1] = '\0';
|
||||
}
|
||||
if (!test(ditta))
|
||||
if (ditta > 0 && !test(ditta))
|
||||
ditta = 0L;
|
||||
|
||||
bool ok = set_codditta(ditta, TRUE);
|
||||
|
@ -326,7 +326,7 @@ TTimerind::~TTimerind()
|
||||
|
||||
bool TProgress_monitor::set_status(long n)
|
||||
{
|
||||
// Aggiunsto timer iniziale se necessario
|
||||
// Aggiusto timer iniziale se necessario
|
||||
if (_status <= 0L && n <= 0L)
|
||||
_start = clock();
|
||||
|
||||
@ -345,6 +345,8 @@ bool TProgress_monitor::set_status(long n)
|
||||
void TProgress_monitor::set_text(const char* msg)
|
||||
{
|
||||
_txt = msg;
|
||||
if (_pi == NULL && _total <= 1 && (clock() - _start) >= CLOCKS_PER_SEC)
|
||||
set_status(1);
|
||||
if (_pi != NULL)
|
||||
_pi->set_text(_txt);
|
||||
}
|
||||
@ -360,11 +362,14 @@ void TProgress_monitor::set_max(long tot)
|
||||
}
|
||||
}
|
||||
|
||||
bool TProgress_monitor::is_cancelled() const
|
||||
{
|
||||
return _cancellable && _pi != NULL && _pi->iscancelled();
|
||||
}
|
||||
|
||||
TProgress_monitor::TProgress_monitor(long items, const char* txt, bool cancancel)
|
||||
: _total(items), _txt(txt), _status(0), _cancellable(cancancel), _pi(NULL), _start(clock())
|
||||
{
|
||||
begin_wait();
|
||||
}
|
||||
{ begin_wait(); }
|
||||
|
||||
TProgress_monitor::~TProgress_monitor()
|
||||
{
|
||||
|
@ -178,6 +178,7 @@ public:
|
||||
// deprecated TProgind compatibility methods
|
||||
bool setstatus(long n) { return set_status(n); }
|
||||
bool addstatus(long n) { return add_status(n); }
|
||||
bool is_cancelled() const;
|
||||
|
||||
TProgress_monitor(long items, const char* txt, bool cancellable = true);
|
||||
~TProgress_monitor();
|
||||
|
@ -28,6 +28,7 @@
|
||||
#define SCAD_CODAG "CODAG"
|
||||
#define SCAD_DESCR "DESCR"
|
||||
#define SCAD_BLOCCATA "BLOCCATA"
|
||||
#define SCAD_MOTIVO "MOTIVO"
|
||||
#define SCAD_TNRIGA "TNRIGA"
|
||||
#define SCAD_TNRATA "TNRATA"
|
||||
|
||||
|
@ -137,7 +137,7 @@ bool TTable_application::user_create()
|
||||
TString title;
|
||||
_msk->get_caption(title);
|
||||
set_title(title);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TTable_application::user_destroy()
|
||||
@ -145,7 +145,7 @@ bool TTable_application::user_destroy()
|
||||
if (_msk) delete _msk;
|
||||
if (_rel) delete _rel;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
|
@ -638,17 +638,8 @@ void xvtil_statbar_set(
|
||||
{
|
||||
TToken_string t(80, '\t');
|
||||
t.add(text);
|
||||
t.add(ini_get_string(CONFIG_DITTA, "Main", "RAGSOC")); // NON aprire più LF_NDITTE
|
||||
TApplication& a = main_app();
|
||||
if (prefix_valid() && a.is_running() && a.get_firm() > 0)
|
||||
{
|
||||
t.add(prefix().firm().get(NDT_RAGSOC));
|
||||
}
|
||||
else
|
||||
{
|
||||
TString80 ragsoc;
|
||||
xvt_sys_get_profile_string(NULL, "Main", "Company", "", ragsoc.get_buffer(), ragsoc.size());
|
||||
t.add(ragsoc);
|
||||
}
|
||||
t.add(a.title());
|
||||
if (def)
|
||||
statbar_set_default_title(_statbar, t);
|
||||
|
Loading…
x
Reference in New Issue
Block a user