Fix up other entry fields.

This commit is contained in:
Brian Pellin
2010-06-05 17:10:41 -05:00
parent 8b739af8b7
commit d9c772ae64
6 changed files with 52 additions and 27 deletions

View File

@@ -198,7 +198,7 @@ public class EntryActivity extends LockCloseActivity {
private void fillData() {
populateText(R.id.entry_title, mEntry.getTitle());
populateText(R.id.entry_user_name, mEntry.getUsername());
populateText(R.id.entry_url, mEntry.url);
populateText(R.id.entry_url, mEntry.getUrl());
populateText(R.id.entry_password, mEntry.getPassword());
setPasswordStyle();
@@ -213,7 +213,7 @@ public class EntryActivity extends LockCloseActivity {
} else {
populateText(R.id.entry_expires, df.format(expires));
}
populateText(R.id.entry_comment, mEntry.additional);
populateText(R.id.entry_comment, mEntry.getNotes());
}
@@ -301,7 +301,7 @@ public class EntryActivity extends LockCloseActivity {
case MENU_GOTO_URL:
String url;
url = mEntry.url;
url = mEntry.getUrl();
// Default http:// if no protocol specified
if ( ! url.contains("://") ) {

View File

@@ -24,9 +24,7 @@ import java.util.UUID;
public abstract class PwEntry implements Cloneable {
// TODO none of these belong here. They aren't stored this way in PwEntryV4
public String url;
public String additional;
// TODO none of these belong here. They aren't stored this way in PwEntryV4
public int imageId;
@@ -44,17 +42,10 @@ public abstract class PwEntry implements Cloneable {
throw new RuntimeException("Clone should be supported");
}
newEntry.setUUID(getUUID());
newEntry.url = url;
newEntry.additional = additional;
return newEntry;
}
public void assign(PwEntry source) {
setUUID(source.getUUID());
url = source.url;
additional = source.additional;
}
public abstract void stampLastAccess();
@@ -64,10 +55,13 @@ public abstract class PwEntry implements Cloneable {
public abstract String getTitle();
public abstract String getUsername();
public abstract String getPassword();
public abstract String getUrl();
public abstract String getNotes();
public abstract Date getCreate();
public abstract Date getMod();
public abstract Date getAccess();
public abstract Date getExpire();
public abstract boolean expires();
public abstract PwGroup getParent();
public abstract String getDisplayTitle();

View File

@@ -76,6 +76,10 @@ public class PwEntryV3 extends PwEntry {
public String username;
private byte[] password;
private byte[] uuid;
public String title;
public String url;
public String additional;
public PwDate tCreation;
public PwDate tLastMod;
@@ -127,8 +131,6 @@ public class PwEntryV3 extends PwEntry {
public PwGroupV3 parent = null;
public String title;
public PwEntryV3() {
super();
}
@@ -260,9 +262,12 @@ public class PwEntryV3 extends PwEntry {
private void assign(PwEntryV3 source) {
title = source.title;
url = source.url;
groupId = source.groupId;
imageId = source.imageId;
username = source.username;
additional = source.additional;
uuid = source.uuid;
int passLen = source.password.length;
password = new byte[passLen];
@@ -364,4 +369,19 @@ public class PwEntryV3 extends PwEntry {
return title;
}
@Override
public String getNotes() {
return additional;
}
@Override
public String getUrl() {
return url;
}
@Override
public boolean expires() {
return ! IsNever(tExpire.getJDate());
}
}

View File

@@ -29,6 +29,9 @@ import java.util.UUID;
public class PwEntryV4 extends PwEntry implements ITimeLogger {
private static final String STR_TITLE = "Title";
private static final String STR_USERNAME = "UserName";
private static final String STR_PASSWORD = "Password";
private static final String STR_URL = "URL";
private static final String STR_NOTES = "Notes";
public PwGroupV4 parent;
public UUID uuid;
@@ -48,6 +51,8 @@ public class PwEntryV4 extends PwEntry implements ITimeLogger {
private Date expireDate;
private boolean expires = false;
private long usageCount = 0;
public String url;
public String additional;
public class AutoType {
public boolean enabled;
@@ -121,26 +126,22 @@ public class PwEntryV4 extends PwEntry implements ITimeLogger {
@Override
public String getPassword() {
// TODO
return null;
return getString(STR_PASSWORD);
}
@Override
public Date getAccess() {
// TODO
return null;
return lastAccess;
}
@Override
public Date getCreate() {
// TODO
return null;
return creation;
}
@Override
public Date getExpire() {
// TODO
return null;
return expireDate;
}
@Override
@@ -150,7 +151,7 @@ public class PwEntryV4 extends PwEntry implements ITimeLogger {
@Override
public String getDisplayTitle() {
// TODO: Add TAN supprot
// TODO: Add TAN support
return getTitle();
}
@@ -249,4 +250,14 @@ public class PwEntryV4 extends PwEntry implements ITimeLogger {
expires = exp;
}
@Override
public String getNotes() {
return getString(STR_NOTES);
}
@Override
public String getUrl() {
return getString(STR_URL);
}
}

View File

@@ -103,8 +103,8 @@ public class SearchDbHelper {
cv.put(KEY_UUID, uuidStr);
cv.put(KEY_TITLE, entry.getTitle());
cv.put(KEY_URL, entry.url);
cv.put(KEY_COMMENT, entry.additional);
cv.put(KEY_URL, entry.getUrl());
cv.put(KEY_COMMENT, entry.getNotes());
return cv;
}

View File

@@ -92,7 +92,7 @@ public class DeleteEntry extends AndroidTestCase {
Vector<PwEntry> entries = pm.entries;
for ( int i = 0; i < entries.size(); i++ ) {
PwEntry entry = entries.get(i);
if ( entry.title.equals(name) ) {
if ( entry.getTitle().equals(name) ) {
return entry;
}
}