Search in sources :

Example 1 with PwIconStandard

use of com.keepassdroid.database.PwIconStandard in project KeePassDX by Kunzisoft.

the class PwEntryTestV4 method testAssign.

public void testAssign() {
    PwEntryV4 entry = new PwEntryV4();
    entry.setAdditional("test223");
    entry.setAutoType(new AutoType());
    entry.getAutoType().defaultSequence = "1324";
    entry.getAutoType().enabled = true;
    entry.getAutoType().obfuscationOptions = 123412432109L;
    entry.getAutoType().put("key", "value");
    entry.setBackgroupColor("blue");
    entry.putProtectedBinary("key1", new ProtectedBinary(false, new byte[] { 0, 1 }));
    entry.setCustomIcon(new PwIconCustom(UUID.randomUUID(), new byte[0]));
    entry.setForegroundColor("red");
    entry.addToHistory(new PwEntryV4());
    entry.setIcon(new PwIconStandard(5));
    entry.setOverrideURL("override");
    entry.setParent(new PwGroupV4());
    entry.addField("key2", new ProtectedString(false, "value2"));
    entry.setUrl("http://localhost");
    entry.setUUID(UUID.randomUUID());
    PwEntryV4 target = new PwEntryV4();
    target.assign(entry);
/* This test is not so useful now that I am not implementing value equality for Entries
		assertTrue("Entries do not match.", entry.equals(target));
		*/
}
Also used : PwEntryV4(com.keepassdroid.database.PwEntryV4) AutoType(com.keepassdroid.database.AutoType) PwGroupV4(com.keepassdroid.database.PwGroupV4) ProtectedBinary(com.keepassdroid.database.security.ProtectedBinary) PwIconCustom(com.keepassdroid.database.PwIconCustom) ProtectedString(com.keepassdroid.database.security.ProtectedString) PwIconStandard(com.keepassdroid.database.PwIconStandard)

Example 2 with PwIconStandard

use of com.keepassdroid.database.PwIconStandard in project KeePassDX by Kunzisoft.

the class EntryEditActivity method populateNewEntry.

protected PwEntry populateNewEntry() {
    PwDatabase db = App.getDB().pm;
    PwEntry newEntry = mEntry.clone();
    newEntry.startToDecodeReference(db);
    newEntry.createBackup(db);
    newEntry.setLastAccessTime(new PwDate());
    newEntry.setLastModificationTime(new PwDate());
    newEntry.setTitle(entryTitleView.getText().toString());
    if (mSelectedIconID != -1)
        // or TODO icon factory newEntry.setIcon(App.getDB().pm.iconFactory.getIcon(mSelectedIconID));
        newEntry.setIcon(new PwIconStandard(mSelectedIconID));
    else {
        if (mIsNew) {
            newEntry.setIcon(App.getDB().pm.iconFactory.getIcon(0));
        } else {
            //  Keep previous icon, if no new one was selected
            newEntry.setIcon(mEntry.getIconStandard());
        }
    }
    newEntry.setUrl(entryUrlView.getText().toString());
    newEntry.setUsername(entryUserNameView.getText().toString());
    newEntry.setNotes(entryCommentView.getText().toString());
    newEntry.setPassword(entryPasswordView.getText().toString());
    if (newEntry.allowExtraFields()) {
        // Delete all new standard strings
        newEntry.removeExtraFields();
        // Add extra fields from views
        for (int i = 0; i < entryExtraFieldsContainer.getChildCount(); i++) {
            EntryEditNewField view = (EntryEditNewField) entryExtraFieldsContainer.getChildAt(i);
            String key = view.getLabel();
            String value = view.getValue();
            boolean protect = view.isProtected();
            newEntry.addField(key, new ProtectedString(protect, value));
        }
    }
    newEntry.endToDecodeReference(db);
    return newEntry;
}
Also used : PwDatabase(com.keepassdroid.database.PwDatabase) PwDate(com.keepassdroid.database.PwDate) PwEntry(com.keepassdroid.database.PwEntry) ProtectedString(com.keepassdroid.database.security.ProtectedString) PwIconStandard(com.keepassdroid.database.PwIconStandard) ProtectedString(com.keepassdroid.database.security.ProtectedString) EntryEditNewField(com.keepassdroid.view.EntryEditNewField)

Aggregations

PwIconStandard (com.keepassdroid.database.PwIconStandard)2 ProtectedString (com.keepassdroid.database.security.ProtectedString)2 AutoType (com.keepassdroid.database.AutoType)1 PwDatabase (com.keepassdroid.database.PwDatabase)1 PwDate (com.keepassdroid.database.PwDate)1 PwEntry (com.keepassdroid.database.PwEntry)1 PwEntryV4 (com.keepassdroid.database.PwEntryV4)1 PwGroupV4 (com.keepassdroid.database.PwGroupV4)1 PwIconCustom (com.keepassdroid.database.PwIconCustom)1 ProtectedBinary (com.keepassdroid.database.security.ProtectedBinary)1 EntryEditNewField (com.keepassdroid.view.EntryEditNewField)1