mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-26 11:56:43 -08:00
Fill out more functionality.
This commit is contained in:
1 parent
2380579654
commit
a300edbce0
6 files changed
+51
-39
No files matched your search
@@ -78,7 +78,23 @@ public class PwEntryV4 extends PwEntry implements ITimeLogger {
|
||||
}
|
||||
|
||||
private void assign(PwEntryV4 source) {
|
||||
// TODO: Implement me
|
||||
parent = source.parent;
|
||||
uuid = source.uuid;
|
||||
strings = source.strings;
|
||||
customIconUuid = source.customIconUuid;
|
||||
foregroundColor = source.foregroundColor;
|
||||
backgroupColor = source.backgroupColor;
|
||||
overrideURL = source.overrideURL;
|
||||
autoType = source.autoType;
|
||||
history = source.history;
|
||||
parentGroupLastMod = source.parentGroupLastMod;
|
||||
creation = source.creation;
|
||||
lastMod = source.lastMod;
|
||||
lastAccess = source.lastAccess;
|
||||
expireDate = source.expireDate;
|
||||
expires = source.expires;
|
||||
usageCount = source.usageCount;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +106,7 @@ public class PwEntryV4 extends PwEntry implements ITimeLogger {
|
||||
|
||||
@Override
|
||||
public void stampLastAccess() {
|
||||
// TODO Implement me
|
||||
lastAccess = new Date(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
*/
|
||||
package com.keepassdroid.database;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -34,4 +36,30 @@ public abstract class PwGroup {
|
||||
|
||||
public abstract Date getLastMod();
|
||||
|
||||
public void sortGroupsByName() {
|
||||
Collections.sort(childGroups, new GroupNameComparator());
|
||||
}
|
||||
|
||||
private class GroupNameComparator implements Comparator<PwGroup> {
|
||||
|
||||
@Override
|
||||
public int compare(PwGroup object1, PwGroup object2) {
|
||||
return object1.getName().compareToIgnoreCase(object2.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sortEntriesByName() {
|
||||
Collections.sort(childEntries, new EntryNameComparator());
|
||||
}
|
||||
|
||||
private class EntryNameComparator implements Comparator<PwEntry> {
|
||||
|
||||
@Override
|
||||
public int compare(PwEntry object1, PwEntry object2) {
|
||||
return object1.title.compareToIgnoreCase(object2.title);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,8 +30,6 @@ Copyright 2006 Bill Zwicky <[email protected]>
|
||||
|
||||
package com.keepassdroid.database;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -77,37 +75,11 @@ public class PwGroupV3 extends PwGroup {
|
||||
childGroups = groups;
|
||||
}
|
||||
|
||||
public void sortGroupsByName() {
|
||||
Collections.sort(childGroups, new GroupNameComparator());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PwGroup getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void sortEntriesByName() {
|
||||
Collections.sort(childEntries, new EntryNameComparator());
|
||||
}
|
||||
|
||||
private class GroupNameComparator implements Comparator<PwGroup> {
|
||||
|
||||
@Override
|
||||
public int compare(PwGroup object1, PwGroup object2) {
|
||||
return object1.getName().compareToIgnoreCase(object2.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class EntryNameComparator implements Comparator<PwEntry> {
|
||||
|
||||
@Override
|
||||
public int compare(PwEntry object1, PwEntry object2) {
|
||||
return object1.title.compareToIgnoreCase(object2.title);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PwGroupId getId() {
|
||||
return new PwGroupIdV3(groupId);
|
||||
|
||||
@@ -195,6 +195,5 @@ public class PwGroupV4 extends PwGroup implements ITimeLogger {
|
||||
public void setExpires(boolean exp) {
|
||||
expires = exp;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import com.keepassdroid.database.PwEntry;
|
||||
import com.keepassdroid.database.PwEntryV3;
|
||||
import com.keepassdroid.database.PwGroup;
|
||||
import com.keepassdroid.search.SearchDbHelper;
|
||||
import com.keepassdroid.utils.Types;
|
||||
|
||||
public abstract class AddEntry extends RunnableOnFinish {
|
||||
protected Database mDb;
|
||||
|
||||
@@ -23,9 +23,7 @@ import java.lang.ref.WeakReference;
|
||||
|
||||
import com.keepassdroid.Database;
|
||||
import com.keepassdroid.database.PwEntry;
|
||||
import com.keepassdroid.database.PwEntryV3;
|
||||
import com.keepassdroid.database.PwGroup;
|
||||
import com.keepassdroid.database.PwGroupV3;
|
||||
import com.keepassdroid.search.SearchDbHelper;
|
||||
|
||||
public class UpdateEntry extends RunnableOnFinish {
|
||||
@@ -41,8 +39,8 @@ public class UpdateEntry extends RunnableOnFinish {
|
||||
mNewE = newE;
|
||||
|
||||
// Keep backup of original values in case save fails
|
||||
PwEntryV3 backup;
|
||||
backup = (PwEntryV3) mOldE.clone();
|
||||
PwEntry backup;
|
||||
backup = (PwEntry) mOldE.clone();
|
||||
|
||||
mFinish = new AfterUpdate(backup, finish);
|
||||
}
|
||||
@@ -58,9 +56,9 @@ public class UpdateEntry extends RunnableOnFinish {
|
||||
}
|
||||
|
||||
private class AfterUpdate extends OnFinish {
|
||||
private PwEntryV3 mBackup;
|
||||
private PwEntry mBackup;
|
||||
|
||||
public AfterUpdate(PwEntryV3 backup, OnFinish finish) {
|
||||
public AfterUpdate(PwEntry backup, OnFinish finish) {
|
||||
super(finish);
|
||||
|
||||
mBackup = backup;
|
||||
@@ -71,7 +69,7 @@ public class UpdateEntry extends RunnableOnFinish {
|
||||
if ( mSuccess ) {
|
||||
// Mark group dirty if title changes
|
||||
if ( ! mBackup.title.equals(mNewE.title) ) {
|
||||
PwGroupV3 parent = mBackup.parent;
|
||||
PwGroup parent = mBackup.getParent();
|
||||
if ( parent != null ) {
|
||||
// Resort entries
|
||||
parent.sortEntriesByName();
|
||||
|
||||
Reference in new issue
Block a user