Aggiunta funzione di cancellazione veloce basata su selezione multipla
git-svn-id: svn://10.65.10.50/trunk@4354 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9ba97cf041
commit
9c9da01eb4
@ -1,4 +1,5 @@
|
|||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
|
#include <progind.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <relapp.h>
|
#include <relapp.h>
|
||||||
@ -433,6 +434,68 @@ bool TRelation_application::search_mode()
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TRelation_application::delete_mode()
|
||||||
|
{
|
||||||
|
TEdit_field& fld = get_search_field();
|
||||||
|
TBrowse* brw = fld.browse();
|
||||||
|
TCursor* cur = brw ? brw->cursor() : NULL;
|
||||||
|
|
||||||
|
if (cur)
|
||||||
|
{
|
||||||
|
TToken_string head(brw->head());
|
||||||
|
head.insert("@1|", 0);
|
||||||
|
TToken_string items(brw->items());
|
||||||
|
items.insert(" |", 0);
|
||||||
|
TCursor_sheet sht(cur, items, "Eliminazione", head, 0, 1);
|
||||||
|
if (sht.run() == K_ENTER)
|
||||||
|
{
|
||||||
|
long deleting = sht.checked();
|
||||||
|
if (deleting == 0)
|
||||||
|
{
|
||||||
|
sht.check(sht.selected());
|
||||||
|
deleting++;
|
||||||
|
}
|
||||||
|
TString msg(80);
|
||||||
|
msg = "Confermate l'eliminazione de";
|
||||||
|
if (deleting == 1)
|
||||||
|
msg << "l documento selezionato?";
|
||||||
|
else
|
||||||
|
msg << "i " << deleting << " documenti selezionati?";
|
||||||
|
if (yesno_box(msg))
|
||||||
|
{
|
||||||
|
TWait_cursor hourglass;
|
||||||
|
cur->freeze(TRUE); // Congelo il cursore altrimenti si riaggiorna troppo
|
||||||
|
for (long pos = 0; deleting > 0; pos++)
|
||||||
|
{
|
||||||
|
if (sht.checked(pos))
|
||||||
|
{
|
||||||
|
*cur = pos;
|
||||||
|
brw->do_output();
|
||||||
|
if (find(1) && modify_mode())
|
||||||
|
{
|
||||||
|
_autodelete = TRUE;
|
||||||
|
if (protected_record(get_relation()->curr()))
|
||||||
|
warning_box("Documento non eliminabile");
|
||||||
|
else
|
||||||
|
remove();
|
||||||
|
_autodelete = FALSE;
|
||||||
|
query_mode();
|
||||||
|
}
|
||||||
|
deleting--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cur->freeze(FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (search_mode())
|
||||||
|
_autodelete = TRUE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// @doc INTERNAL
|
// @doc INTERNAL
|
||||||
|
|
||||||
// @mfunc Controlla se una chiave e' completa ed esiste su file
|
// @mfunc Controlla se una chiave e' completa ed esiste su file
|
||||||
@ -678,7 +741,7 @@ bool TRelation_application::relation_remove()
|
|||||||
r.restore_status();
|
r.restore_status();
|
||||||
|
|
||||||
if (protected_record(r.curr()))
|
if (protected_record(r.curr()))
|
||||||
return message_box("Registrazione non eliminabile");
|
return message_box("Documento non eliminabile");
|
||||||
|
|
||||||
if (_transaction == "DELETE" || yesno_box("Confermare l'eliminazione"))
|
if (_transaction == "DELETE" || yesno_box("Confermare l'eliminazione"))
|
||||||
{
|
{
|
||||||
@ -810,9 +873,8 @@ bool TRelation_application::main_loop()
|
|||||||
break;
|
break;
|
||||||
case K_DEL:
|
case K_DEL:
|
||||||
if (_mask->query_mode())
|
if (_mask->query_mode())
|
||||||
{
|
{
|
||||||
if (search_mode())
|
delete_mode();
|
||||||
_autodelete = TRUE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user