public void secureDelete() { int rw = tblItems.getSelectedRow(); if (rw == -1) { JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE); return; } int idx = tblItems.convertRowIndexToModel(rw); if (JOptionPane.showConfirmDialog( frm, "Delete " + store.plainName(idx) + "?", "Confirm Delete", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) return; File del = store.delete(idx); store.fireTableDataChanged(); if (del != null) { if (del.delete()) { // successful needsSave = true; } else { System.err.println("Delete " + del.getAbsolutePath() + " failed"); } } updateStatus(); }
public void secureExport(int i) { File expf = getExportTempFile(store.plainName(i)); // check if its already been exported if (expf.exists()) secureUse(expf); else { // otherwise add to work queue File cipf = store.locate(i); if (cipf != null) { synchronized (jobs) { if (priorityExport) jobs.addFirst(expJob(cipf, expf)); else jobs.addLast(expJob(cipf, expf)); } } else System.err.println("Cannot export, missing encrypted file"); } updateStatus(); }
public void secureMove() { int rw = tblItems.getSelectedRow(); if (rw == -1) { JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE); return; } int idx = tblItems.convertRowIndexToModel(rw); String[] opts = new String[storeLocs.size()]; for (int i = 0; i < opts.length; i++) opts[i] = storeLocs.get(i).getAbsolutePath(); JComboBox cmbMove = new JComboBox(opts); cmbMove.setSelectedIndex(store.curStore(idx)); if (JOptionPane.showConfirmDialog(frm, cmbMove, "Move item", JOptionPane.OK_CANCEL_OPTION) != JOptionPane.OK_OPTION) return; File newLoc = store.move(idx, cmbMove.getSelectedIndex()); if (newLoc == null) System.err.println("move " + store.plainName(idx) + " unsuccessful"); else needsSave = true; }