mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Fix ExpireDate issue for Database V3
This commit is contained in:
1 parent
4aff5e3a06
commit
ab98f03ebf
8 files changed
+16
-10
No files matched your search
@@ -263,7 +263,7 @@ public class EntryActivity extends LockingHideActivity {
|
||||
entryContentsView.assignModificationDate(mEntry.getLastModificationTime().getDate());
|
||||
entryContentsView.assignLastAccessDate(mEntry.getLastAccessTime().getDate());
|
||||
Date expires = mEntry.getExpiryTime().getDate();
|
||||
if ( mEntry.expires() ) {
|
||||
if ( mEntry.isExpires() ) {
|
||||
entryContentsView.assignExpiresDate(expires);
|
||||
} else {
|
||||
entryContentsView.assignExpiresDate(getString(R.string.never));
|
||||
|
||||
@@ -40,7 +40,7 @@ public class EntrySearchHandlerAll<T extends PwEntry> extends EntryHandler<T> {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sp.excludeExpired && entry.expires() && now.after(entry.getExpiryTime().getDate())) {
|
||||
if (sp.excludeExpired && entry.isExpires() && now.after(entry.getExpiryTime().getDate())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class EntrySearchHandlerV4 extends EntrySearchHandler<PwEntryV4> {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sp.excludeExpired && entry.expires() && now.after(entry.getExpiryTime().getDate())) {
|
||||
if (sp.excludeExpired && entry.isExpires() && now.after(entry.getExpiryTime().getDate())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,6 @@ public interface ISmallTimeLogger {
|
||||
PwDate getExpiryTime();
|
||||
void setExpiryTime(PwDate date);
|
||||
|
||||
boolean expires();
|
||||
boolean isExpires();
|
||||
void setExpires(boolean exp);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class PwDate implements Cloneable, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean IsSameDate(Date d1, Date d2) {
|
||||
private static boolean IsSameDate(Date d1, Date d2) {
|
||||
Calendar cal1 = Calendar.getInstance();
|
||||
cal1.setTime(d1);
|
||||
cal1.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
@@ -118,7 +118,7 @@ public class PwGroupV4 extends PwGroup<PwGroupV4, PwGroupV4, PwEntryV4> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean expires() {
|
||||
public boolean isExpires() {
|
||||
return expires;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,13 @@
|
||||
*/
|
||||
package com.keepassdroid.database;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import static com.keepassdroid.database.PwDate.NEVER_EXPIRE;
|
||||
import static com.keepassdroid.database.PwDate.PW_NEVER_EXPIRE;
|
||||
@@ -150,9 +156,9 @@ public abstract class PwNode<Parent extends PwGroup> implements ISmallTimeLogger
|
||||
}
|
||||
}
|
||||
|
||||
public boolean expires() {
|
||||
return expireDate.getDate().equals(NEVER_EXPIRE)
|
||||
|| expireDate.getDate().after(NEVER_EXPIRE);
|
||||
public boolean isExpires() {
|
||||
// If expireDate is before NEVER_EXPIRE date less 1 month (to be sure)
|
||||
return expireDate.getDate().before(LocalDate.fromDateFields(NEVER_EXPIRE).minusMonths(1).toDate());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -752,7 +752,7 @@ public class PwDbV4Output extends PwDbOutput {
|
||||
writeObject(ElemCreationTime, it.getCreationTime().getDate());
|
||||
writeObject(ElemLastAccessTime, it.getLastAccessTime().getDate());
|
||||
writeObject(ElemExpiryTime, it.getExpiryTime().getDate());
|
||||
writeObject(ElemExpires, it.expires());
|
||||
writeObject(ElemExpires, it.isExpires());
|
||||
writeObject(ElemUsageCount, it.getUsageCount());
|
||||
writeObject(ElemLocationChanged, it.getLocationChanged().getDate());
|
||||
|
||||
|
||||
Reference in new issue
Block a user