diff --git a/JUninstaller.java b/JUninstaller.java index 52c402a..9e865ed 100644 --- a/JUninstaller.java +++ b/JUninstaller.java @@ -225,16 +225,33 @@ public class JUninstaller extends Frame implements ActionListener { } else if (ae.getSource().equals(btDelFile)) { // Delete file (log-details) String selItem = ltView.getSelectedItem(); String selFile = ltApps.getSelectedItem(); + char status = selItem.charAt(0); // for addition question later if (selItem != null && selFile != null) { selItem = selItem.substring(selItem.indexOf(" ")+1); - if (MQ.yesnoBox("Are you sure?", "Do you really want to delete this file?\n\n"+selItem+"\n\nDeleting the wrong file may render your phone unusable!") == MQ.YES) { - File flDelMe = new File(selItem); - if (flDelMe.delete()) { - MIP.infoPrint("Deleted."); - } else { - MIP.infoPrint("Error!"); + File flDelMe = new File(selItem); + if (flDelMe.exists()) { + if (MQ.yesnoBox("Are you sure?", "Do you really want to delete this file?\n\n"+selItem+"\n\nDeleting the wrong file may render your phone unusable!") == MQ.YES) { + + boolean doIt = false; + if (status == '*') { + doIt = (MQ.yesnoBox("Are you really sure?", "This file has already been there before the logged installation occurred.\nDeleting it may harm your phone.\n\nDo you still want to delete it?") == MQ.YES); + } else { + doIt = true; + } + + if (doIt) { + if (flDelMe.delete()) { + MIP.infoPrint("Deleted."); + } else { + MIP.infoPrint("Error!"); + } + updateDetList(selFile+DATAEXT, selItem); + } else { + MIP.infoPrint("Deletion aborted."); + } } - updateDetList(selFile+DATAEXT, selItem); + } else { + MIP.infoPrint("File does not exist!"); } } else { MIP.infoPrint("Select one entry!"); diff --git a/MyQuestions.java b/MyQuestions.java index d9349fa..80cfc3c 100644 --- a/MyQuestions.java +++ b/MyQuestions.java @@ -83,9 +83,21 @@ public class MyQuestions implements ActionListener { // make each line below maxWidth as long as there is a whitespace in it int idx; FontMetrics fm = di.getFontMetrics(ftDialog); + boolean addedLine; for (int i=0;i<txts.length;i++) { txts[i] = txts[i].trim(); + addedLine = false; while (fm.stringWidth(txts[i]) > maxWidth && txts[i].indexOf(" ") != -1) { + if (!addedLine) { + tmps = new String[txts.length+1]; + for (int j=0;j<txts.length;j++) { + if (j<=i) tmps[j] = txts[j]; + else tmps[j+1] = txts[j]; + } + tmps[i+1] = ""; + txts = tmps; + addedLine = true; + } // auto-lengthen txts, if there is more space needed if (i+1>=txts.length) { tmps = new String[txts.length+1]; @@ -97,7 +109,7 @@ public class MyQuestions implements ActionListener { } // wrap word to next line idx = txts[i].lastIndexOf(" "); - txts[i+1] = txts[i].substring(idx) + txts[i+1]; + txts[i+1] = txts[i].substring(idx+1) + " " + txts[i+1]; txts[i] = txts[i].substring(0, idx); } }