View Single Post
Old 03-09-2012, 11:48 AM   #3516
quisvir
Addict
quisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animalsquisvir is kind to children and small, furry animals
 
quisvir's Avatar
 
Posts: 238
Karma: 6875
Join Date: Feb 2009
Location: Netherlands
Device: Kindle PW2
Quote:
Originally Posted by Analogus View Post
Is there a command/function which saves not already saved data in system-cache?
Yes, there is:
Code:
kbook.model.commitCache();
To make the switch work, remove the {} from the case statement. So you get something like this:
Spoiler:
Code:
switch (type) {
	case 'BLABLA':
		// code
		break;
	case 'UNDOPRS':
		var dialog = kbook.model.getConfirmationDialog();
		dialog.onOk = function () {
			Core.shell.exec('cp -R -f /Data/database/system/PRSPlus/PRSave3/prsp /opt0');
		}
		dialog.openDialog(LA("MSG_QUESTION_RESTORE_PRS"), 0);
}

The break statement at the end of a case is optional. Without it, the next case(s) will be executed as well. Additionally: getConfirmationDialog resets the dialog, so you don't have to define a 'do nothing' onNo function.

Last edited by quisvir; 03-09-2012 at 11:51 AM.
quisvir is offline   Reply With Quote