Merging KDB files with different options to prevent group duplication

This commit is contained in:
Michael Starke
2018-08-25 08:48:35 +02:00
parent 2276a2b954
commit 6555cc04e5
4 changed files with 15 additions and 6 deletions

View File

@@ -1,3 +1,3 @@
github "sparkle-project/Sparkle" ~> 1.18.1
github "MacPass/KeePassKit" ~> 1.13.5
github "MacPass/KeePassKit" ~> 1.13.6
github "mstarke/HNHUi" ~> 1.5

View File

@@ -1,4 +1,4 @@
github "MacPass/KeePassKit" "1.13.5"
github "MacPass/KeePassKit" "1.13.6"
github "mstarke/HNHUi" "1.5"
github "robbiehanson/KissXML" "5.2.3"
github "sparkle-project/Sparkle" "1.19.0"

View File

@@ -52,7 +52,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="500" height="360"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" id="2">
<rect key="frame" x="0.0" y="0.0" width="553" height="484"/>
<autoresizingMask key="autoresizingMask"/>
@@ -498,8 +498,8 @@ Gw
<stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="1295"/>
</stepper>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1268">
<rect key="frame" x="52" y="330" width="128" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Maxium history size:" id="1269">
<rect key="frame" x="41" y="330" width="139" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Maximum history size:" id="1269">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>

View File

@@ -359,14 +359,23 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
NSError *error;
KPKTree *otherTree;
BOOL mergeKDB;
/* TODO determine KDB file format to set GroupByTitle options */
KPKFileVersion version = [KPKFormat.sharedFormat fileVersionForData:[NSData dataWithContentsOfURL:url]];
mergeKDB = (version.format == KPKDatabaseFormatKdb);
if(key) {
otherTree = [[KPKTree alloc] initWithContentsOfUrl:url key:key error:&error];
}
if(otherTree) {
[self.tree synchronizeWithTree:otherTree mode:KPKSynchronizationModeSynchronize options:0];
KPKSynchronizationOptions options = 0;
if(mergeKDB) {
options |= KPKSynchronizationOptionMatchGroupsByTitleOnly;
}
[self.tree synchronizeWithTree:otherTree mode:KPKSynchronizationModeSynchronize options:options];
/* the key might have changed so update ours! */
//self.compositeKey = key;
[self updateChangeCount:NSChangeDone];