- Timestamp:
- 01/30/19 13:03:55 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/FrameIO.java
r1200 r1219 37 37 import java.util.HashMap; 38 38 import java.util.LinkedList; 39 import java.util.List; 39 40 40 41 import org.expeditee.actions.Actions; 41 42 import org.expeditee.agents.ExistingFramesetException; 42 import org.expeditee.auth.io.EncryptedExpReader; 43 import org.expeditee.auth.io.EncryptedExpWriter; 43 import org.expeditee.auth.Authenticator; 44 import org.expeditee.auth.EncryptedExpReader; 45 import org.expeditee.auth.EncryptedProfileExpWriter; 46 import org.expeditee.auth.gui.MailBay; 44 47 import org.expeditee.io.Conversion; 45 48 import org.expeditee.io.ExpReader; … … 193 196 } 194 197 195 public static String FRAMESET_CONSULT_PATH = null;196 197 198 public static Frame LoadFrame(String frameName) { 198 return LoadFrame(frameName, FRAMESET_CONSULT_PATH, false);199 return LoadFrame(frameName, null, false); 199 200 } 200 201 … … 203 204 } 204 205 205 public static Frame LoadFrame(String frameName, String path, boolean ignoreAnnotations) 206 { 206 public static Frame LoadFrame(String frameName, String path, boolean ignoreAnnotations) { 207 207 if (!isValidFrameName(frameName)) { 208 208 return null; … … 261 261 Logger.Log(Logger.SYSTEM, Logger.LOAD, "Clearing " + frameName 262 262 + " from cache."); 263 Frame frame = _Cache.get(frameNameLower);264 263 _Cache.remove(frameNameLower); 265 264 } … … 293 292 loaded = LoadKnowPath(knownPath, framename); 294 293 } else { 295 296 for (String path : FolderSettings.FrameDirs.get()) { 294 List<String> directoriesToSearch = FolderSettings.FrameDirs.get(); 295 296 if (UserSettings.Authenticated.get()) { 297 // if we are running Expeditee Authenticated, consult user profile as location for framesets first 298 String profilePath = FrameIO.PROFILE_PATH + UserSettings.UserName.get() + File.separator; 299 directoriesToSearch.add(0, profilePath); 300 } 301 302 for (String path : directoriesToSearch) { 297 303 loaded = LoadKnowPath(path, framename); 298 304 if (loaded != null) { … … 448 454 } 449 455 } 456 reader.close(); 450 457 } catch (FileNotFoundException e) { 451 458 e.printStackTrace(); … … 468 475 if (fullPath.endsWith(ExpReader.EXTENTION)) { 469 476 if (EncryptedExpReader.isEncryptedExpediteeFile(fullPath)) { 470 reader = new EncryptedExpReader(frameName); 477 final boolean isProfile = frameName.startsWith(UserSettings.UserName.get()); 478 reader = new EncryptedExpReader(frameName, isProfile); 471 479 } else { 472 480 reader = new ExpReader(frameName); … … 941 949 public static String SaveFrame(Frame toSave, boolean inc, 942 950 boolean checkBackup) { 951 952 if (toSave.getName().startsWith("ExpediteeMail")) { 953 System.err.println(); 954 } 943 955 944 956 // TODO When loading a frame maybe append onto the event history too- … … 994 1006 // if its a new frame or an existing Exp frame... 995 1007 if (fullPath == null || fullPath.endsWith(ExpReader.EXTENTION)) { 996 //writer = new ExpWriter(); 997 writer = new ExpWriter();//new EncryptedExpWriter(); 998 savedVersion = ExpReader.getVersion(fullPath); 1008 //Frame currentFrame = DisplayController.getCurrentFrame(); 1009 if (UserSettings.Authenticated.get() && 1010 toSave.getName().startsWith(UserSettings.UserName.get()) && 1011 toSave.getNumber() != Authenticator.PUBLIC_KEY_FRAME) { 1012 writer = new EncryptedProfileExpWriter(); 1013 savedVersion = EncryptedExpReader.getVersion(fullPath); 1014 } else { 1015 writer = new ExpWriter(); 1016 savedVersion = ExpReader.getVersion(fullPath); 1017 } 999 1018 } else { 1000 1019 writer = new KMSWriter(); … … 1016 1035 1017 1036 // Check if we are trying to save an out of date version 1018 if (savedVersion > toSave.getVersion() 1019 && !toSave.getFramesetName().equalsIgnoreCase( 1020 MessageBay.MESSAGES_FRAMESET_NAME)) { 1037 String framesetName = toSave.getFramesetName(); 1038 boolean isBayFrameset = 1039 framesetName.equalsIgnoreCase(MessageBay.MESSAGES_FRAMESET_NAME) || 1040 framesetName.equalsIgnoreCase(MailBay.EXPEDITEE_MAIL_FRAMESET_NAME); 1041 if (savedVersion > toSave.getVersion() && !isBayFrameset) { 1021 1042 // remove this frame from the cache if it is there 1022 1043 // This will make sure links to the original are set correctly … … 1146 1167 1147 1168 String sf = SaveFrame(toSave, inc, checkBackup); 1148 String originalFrameName = toSave.getFramesetName();1149 //System.out.println(originalFrameName + " : " + toSave.getPath());1150 1169 String fullPath = getFrameFullPathName(toSave.getPath(), toSave 1151 1170 .getName());
Note:
See TracChangeset
for help on using the changeset viewer.