quisvir:
Question:
Is there a command/function which saves not already saved data in system-cache?
Reason:
I work on my auto-restart-code. For the 350 your code (formatting non existend cards) works better. Sometimes my dirty-reader-crashing code prevents to save reading-progress. After a restart the 'old' progress is used. Very unconvenient.
Idea:
When first saving properly the system-cache and then let restart reader it could solve the problem.
Another question:
Is it possible to use a CONFIRM DIALOGUE inbetween a SWITCH-block?
I have a ACTION, which functions well:
Code:
{
name: "RestoreLastPRS",
title: LA("ACTION_PRS_RESTORE_LAST"),
group: "SAVE_RESTORE",
icon: "BACK",
action: function ()
{
var dialog = kbook.model.getConfirmationDialog();
dialog.onOk = function ()
{
Core.shell.exec('cp -R -f /Data/database/system/PRSPlus/PRSave3/prsp /opt0');
}
dialog.onNo = function ()
{
break;
}
dialog.openDialog(LA("MSG_QUESTION_RESTORE_PRS"), 0);
}
},
I try to convert it in an option. Following works well as an 'Action'-Option:
Code:
restoreData = function (type)
{
switch (type)
{
...
case 'UNDOPRS':
Core.shell.exec('cp -R -f /Data/database/system/PRSPlus/PRSave3/prsp /opt0');
break;
}
But when adding the confirm dialogue, nothing will happen:
Code:
restoreData = function (type)
{
switch (type)
{
...
case 'UNDOPRS':
{
var dialog = kbook.model.getConfirmationDialog();
dialog.onOk = function ()
{
Core.shell.exec('cp -R -f /Data/database/system/PRSPlus/PRSave3/prsp /opt0');
}
dialog.onNo = function ()
{
break;
}
dialog.openDialog(LA("MSG_QUESTION_RESTORE_PRS"), 0);
}
}
Where is my mistake? Tried lot of tweaking: using or not using {}, [], ';', 'break', 'return', ...
I tried it with much simpler code, no chance.
Thank you