mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge pull request #470 from shahit2/timeline2
changed timezone and times to UTC for display
This commit is contained in:
commit
66cb306c92
@ -148,6 +148,9 @@
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="GeneralPanel.useGMTTimeRB.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="useGMTTimeRBActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
|
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.corecomponents;
|
||||
|
||||
import java.util.prefs.Preferences;
|
||||
import org.openide.util.NbPreferences;
|
||||
import org.sleuthkit.autopsy.datamodel.ContentUtils;
|
||||
|
||||
final class GeneralPanel extends javax.swing.JPanel {
|
||||
|
||||
@ -33,6 +34,7 @@ final class GeneralPanel extends javax.swing.JPanel {
|
||||
GeneralPanel(GeneralOptionsPanelController controller) {
|
||||
this.controller = controller;
|
||||
initComponents();
|
||||
ContentUtils.setDisplayInLocalTime(useLocalTimeRB.isSelected());
|
||||
// TODO listen to changes in form fields and call controller.changed()
|
||||
}
|
||||
|
||||
@ -80,6 +82,11 @@ final class GeneralPanel extends javax.swing.JPanel {
|
||||
|
||||
buttonGroup3.add(useGMTTimeRB);
|
||||
org.openide.awt.Mnemonics.setLocalizedText(useGMTTimeRB, org.openide.util.NbBundle.getMessage(GeneralPanel.class, "GeneralPanel.useGMTTimeRB.text")); // NOI18N
|
||||
useGMTTimeRB.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
useGMTTimeRBActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(GeneralPanel.class, "GeneralPanel.jLabel3.text")); // NOI18N
|
||||
|
||||
@ -144,6 +151,10 @@ final class GeneralPanel extends javax.swing.JPanel {
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_useBestViewerRBActionPerformed
|
||||
|
||||
private void useGMTTimeRBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useGMTTimeRBActionPerformed
|
||||
ContentUtils.setDisplayInLocalTime(useLocalTimeRB.isSelected());
|
||||
}//GEN-LAST:event_useGMTTimeRBActionPerformed
|
||||
|
||||
void load() {
|
||||
boolean keepPreferredViewer = prefs.getBoolean(KEEP_PREFERRED_VIEWER, false);
|
||||
keepCurrentViewerRB.setSelected(keepPreferredViewer);
|
||||
|
@ -50,7 +50,7 @@ public final class ContentUtils {
|
||||
private final static Logger logger = Logger.getLogger(ContentUtils.class.getName());
|
||||
private static final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
|
||||
private static final SimpleDateFormat dateFormatterISO8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
|
||||
private static boolean displayInLocalTime;
|
||||
// don't instantiate
|
||||
private ContentUtils() {
|
||||
throw new AssertionError();
|
||||
@ -106,10 +106,9 @@ public final class ContentUtils {
|
||||
}
|
||||
|
||||
public static TimeZone getTimeZone(Content c) {
|
||||
Preferences generalPanelPrefs = NbPreferences.root().node("/org/sleuthkit/autopsy/core");
|
||||
boolean useLocalTime = generalPanelPrefs.getBoolean("useLocalTime", true);
|
||||
|
||||
try {
|
||||
if (!useLocalTime) {
|
||||
if (!getDisplayInLocalTime()) {
|
||||
return TimeZone.getTimeZone("GMT");
|
||||
}
|
||||
else {
|
||||
@ -360,4 +359,18 @@ public final class ContentUtils {
|
||||
+ cntnt.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
/**sets displayInlocalTime value based on button in GeneralPanel.java
|
||||
*
|
||||
* @param flag
|
||||
*/
|
||||
public static void setDisplayInLocalTime(boolean flag) {
|
||||
displayInLocalTime = flag;
|
||||
}
|
||||
/** get global timezone setting for displaying time values
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static boolean getDisplayInLocalTime(){
|
||||
return displayInLocalTime;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,9 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
import java.util.Stack;
|
||||
import java.util.TimeZone;
|
||||
import java.util.logging.Level;
|
||||
import java.util.prefs.Preferences;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@ -75,11 +77,11 @@ import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionReferences;
|
||||
import org.openide.awt.ActionRegistration;
|
||||
import org.openide.modules.InstalledFileLocator;
|
||||
import org.openide.modules.ModuleInstall;
|
||||
import org.openide.nodes.Children;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.NbPreferences;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.actions.Presenter;
|
||||
import org.openide.util.lookup.Lookups;
|
||||
@ -97,6 +99,7 @@ import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor;
|
||||
import org.sleuthkit.autopsy.datamodel.FileNode;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
import org.sleuthkit.autopsy.coreutils.ExecUtil;
|
||||
import org.sleuthkit.autopsy.datamodel.ContentUtils;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
@ -142,12 +145,11 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
|
||||
private EventHandler<MouseEvent> fxMouseExitedListener;
|
||||
private SleuthkitCase skCase;
|
||||
private boolean fxInited = false;
|
||||
|
||||
public Timeline() {
|
||||
super();
|
||||
|
||||
fxInited = Installer.isJavaFxInited();
|
||||
|
||||
// TimeZone.setDefault(TimeZone.getTimeZone("UTC")); //sets the default timezone to UTC unless otherwise stated
|
||||
}
|
||||
|
||||
//Swing components and JavafX components don't play super well together
|
||||
@ -914,17 +916,35 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
|
||||
|
||||
int prevYear = -1;
|
||||
YearEpoch ye = null;
|
||||
|
||||
while (scan.hasNextLine()) {
|
||||
String[] s = scan.nextLine().split(","); //1999-02-08T11:08:08Z, 78706, m..b, rrwxrwxrwx, 0, 0, 8355, /img...
|
||||
|
||||
// break the date into mon, day and year: Note that the ISO times are in GMT
|
||||
String[] datetime = s[0].split("T"); //{1999-02-08, 11:08:08Z}
|
||||
String[] date = datetime[0].split("-"); // {1999, 02, 08}
|
||||
// break the date into year,month,day,hour,minute, and second: Note that the ISO times are in GMT
|
||||
String delims = "[T:Z\\-]+"; //split by the delimiters
|
||||
String[] date = s[0].split(delims); //{1999,02,08,11,08,08,...}
|
||||
|
||||
int year = Integer.valueOf(date[0]);
|
||||
int month = Integer.valueOf(date[1]) - 1; //Months are zero indexed: 1 = February, 6 = July, 11 = December
|
||||
int day = Integer.valueOf(date[2]); //Days are 1 indexed
|
||||
int hour=Integer.valueOf(date[3]);
|
||||
int minute=Integer.valueOf(date[4]);
|
||||
int second=Integer.valueOf(date[5]);
|
||||
|
||||
// get the object id out of the modified outpu
|
||||
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); //set calendar to GMT due to ISO format
|
||||
calendar.set(year, month, day, hour, minute, second);
|
||||
day=calendar.get(Calendar.DAY_OF_MONTH); // this is needed or else timezone change wont work. probably incorrect optimization by compiler
|
||||
|
||||
//conversion to GMT
|
||||
|
||||
if (!ContentUtils.getDisplayInLocalTime()) {
|
||||
calendar.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
}
|
||||
else{
|
||||
calendar.setTimeZone(TimeZone.getDefault());// local timezone OF the user. should be what the user SETS at startup
|
||||
}
|
||||
|
||||
day=calendar.get(Calendar.DAY_OF_MONTH);//get the day which may be affected by timezone change
|
||||
long ObjId = Long.valueOf(s[4]);
|
||||
|
||||
// when the year changes, create and add a new YearEpoch object to the list
|
||||
@ -961,7 +981,6 @@ public class Timeline extends CallableSystemAction implements Presenter.Toolbar,
|
||||
// Get report path
|
||||
String bodyFilePath = moduleDir.getAbsolutePath()
|
||||
+ java.io.File.separator + currentCase.getName() + "-" + datenotime + ".txt";
|
||||
|
||||
// Run query to get all files
|
||||
final String filesAndDirs = "name != '.' "
|
||||
+ "AND name != '..'";
|
||||
|
Loading…
x
Reference in New Issue
Block a user