Reso oopzionale l'ordine dei bottoni si/no (no/si) nelle richieste di cancellazione

git-svn-id: svn://10.65.10.50/branches/R_10_00@22624 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-04-10 07:44:40 +00:00
parent 992b4beb15
commit ea6ed43b96
10 changed files with 62 additions and 13 deletions

View File

@ -1,3 +1,5 @@
#define _CRT_SECURE_NO_WARNINGS 1
#include <agasys.h>
#include <archives.h>
#include <config.h>

View File

@ -1,7 +1,7 @@
#include <xvt.h>
#include <checks.h>
#include <config.h>
#include <diction.h>
#include <dongle.h>
#include <keys.h>
#define buildmsg() char msg[1024];va_list argptr;va_start(argptr,fmt);vsnprintf_s(msg,sizeof(msg),_TRUNCATE,fmt,argptr);va_end(argptr);
@ -191,6 +191,19 @@ bool cantaccess_box(const char* filename)
return error_box(FR("L'utente %s non può accedere a %s"), (const char*)user(), filename);
}
bool delete_box(const char* fmt, ...)
{
ASK_RESPONSE r = RESP_DEFAULT;
buildmsg();
const bool no_def = ini_get_bool(CONFIG_GUI, "Colors", "NoOnDelete", dongle().active(LVAUT));
if (no_def)
r = xvt_dm_post_ask("No", "Si", NULL, msg);
else
r = xvt_dm_post_ask("Si", "No", NULL, msg);
return r == RESP_DEFAULT;
}
// @doc EXTERNAL
// @msg __trace | Permette di mandare dei messaggi nel file trace.log
bool __trace(

View File

@ -1,10 +1,6 @@
#ifndef __CHECKS_H
#define __CHECKS_H
#ifndef __STDTYPES_H
#include <stdtypes.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -19,6 +15,7 @@ extern "C" {
int yesnoall_box(const char* fmt, ...);
int yesnocancel_box(const char* fmt, ...);
bool yesnofatal_box(const char* fmt, ...);
bool delete_box(const char* fmt, ...);
bool cantread_box(const char* filename);
bool cantwrite_box(const char* filename);
bool cantaccess_box(const char* filename);

View File

@ -850,6 +850,8 @@ const TString& ini_get_string(const char* file, const char* paragraph, const cha
tmp.rtrim(1);
tmp.ltrim(1);
}
else
tmp.trim();
return tmp;
}

View File

@ -733,7 +733,7 @@ const TString& TDongle::server_name() const
if (network() && !xvt_sys_dongle_server_is_running())
return ini_get_string(CONFIG_INSTALL, "Server", "Dongle");
TString& tmp = get_tmp_string(32);
TString& tmp = get_tmp_string(50);
xvt_sys_get_host_name(tmp.get_buffer(), tmp.size());
return tmp;
}

View File

@ -9,6 +9,10 @@
#include <date.h>
#endif
#ifndef __MODAUT_H
#include <modaut.h>
#endif
#ifndef __STRINGS_H
#include <strings.h>
#endif

View File

@ -187,6 +187,7 @@
#define LF_LVRCONSPLAN 167
#define LF_LVCONDV 168
#define LF_LVRCONDV 169
#define LF_CONTACT 170
#define LF_EXTERNAL 1000 // Files with id >= are considered to be externals

View File

@ -851,11 +851,11 @@ int TRelation_application::delete_mode()
long deleting = sht.checked();
TString msg;
msg.format(FR("Confermare l'eliminazione di %d elementi"), deleting);
bool can_delete = noyes_box(msg);
bool can_delete = delete_box(msg);
if (can_delete && deleting > 100)
{
msg.insert(TR("ATTENZIONE: "), 0);
can_delete = noyes_box(msg);
can_delete = delete_box(msg);
}
if (can_delete)
{
@ -1257,7 +1257,7 @@ bool TRelation_application::relation_remove()
return message_box(TR("Elemento non eliminabile"));
if (_curr_transaction == TRANSACTION_DELETE ||
noyes_box(FR("Confermare l'eliminazione del record %s"), r.file().description()))
delete_box(FR("Confermare l'eliminazione del record %s"), r.file().description()))
{
r.restore_status();
const bool ok = remove();

View File

@ -271,7 +271,7 @@ public:
virtual bool goto_selected();
virtual void set_header(const char* head);
virtual void set_row_height(int rh);
virtual int get_selection(TString_array& sel) const;
TTree_window(int x, int y, int dx, int dy, WINDOW parent, TTree_field* owner);
virtual ~TTree_window() { }
};
@ -569,6 +569,18 @@ void TTree_window::set_row_height(int rh)
// TBI
}
int TTree_window::get_selection(TString_array& sel) const
{
SLIST list = xvt_treeview_get_selected_list(_ctrl);
for (SLIST_ELT e = xvt_slist_get_first(list); e; e = xvt_slist_get_next(list, e))
{
const char* id = xvt_slist_get(list, e, NULL);
sel.add(id);
}
xvt_slist_destroy(list);
return sel.items();
}
TTree_window::TTree_window(int x, int y, int dx, int dy, WINDOW parent, TTree_field* owner)
: TControl_host_window(x, y, dx, dy, parent, owner), _tree(NULL), _hide_leaves(false)
{
@ -633,6 +645,9 @@ void TTree_field::set_row_height(int rh)
TField_window* TTree_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{ return new TTree_window(x, y, dx, dy, parent, this); }
int TTree_field::selection(TString_array& ids) const
{ return tree_win().get_selection(ids); }
///////////////////////////////////////////////////////////
// TOutlook_field
///////////////////////////////////////////////////////////
@ -1268,6 +1283,7 @@ public:
virtual void set_header(const char* head);
virtual void set_fields(const char* flds);
virtual void force_update();
virtual int get_selection(TString_array& sel) const;
TTreelist_window(int x, int y, int dx, int dy, WINDOW parent, TTreelist_field* owner);
virtual ~TTreelist_window() { }
@ -1312,7 +1328,7 @@ bool TTreelist_window::add_child(XVT_TREEVIEW_NODE parent)
ii = im_nor->xvt_image();
}
TToken_string csv(80, '\t'); get_fields(csv);
TString256 id; tree()->curr_id(id);
TString256 id; tree()->curr_id(id);
XVT_TREEVIEW_NODE child = xvt_treelist_add_child_node(_ctrl, parent, type, ii, ic, ie, csv, NULL, id);
if (child != NULL)
{
@ -1587,6 +1603,18 @@ void TTreelist_window::force_update()
xvt_dwin_invalidate_rect(_ctrl, NULL);
}
int TTreelist_window::get_selection(TString_array& sel) const
{
SLIST list = xvt_treelist_get_selected_list(_ctrl);
for (SLIST_ELT e = xvt_slist_get_first(list); e; e = xvt_slist_get_next(list, e))
{
const char* id = xvt_slist_get(list, e, NULL);
sel.add(id);
}
xvt_slist_destroy(list);
return sel.items();
}
///////////////////////////////////////////////////////////
// TTreelist_field
///////////////////////////////////////////////////////////

View File

@ -68,6 +68,8 @@ public:
virtual void set_header(const char* head);
virtual void set_row_height(int rh);
virtual int selection(TString_array& ids) const;
TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { }
};