Added export to XML action for Version2 Databases

Small updates to Database Settings window
This commit is contained in:
michael starke
2013-07-15 22:10:27 +02:00
parent f4c67ea603
commit c0051f852e
9 changed files with 532 additions and 374 deletions

View File

@@ -262,6 +262,15 @@
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="438377242">
<reference key="NSMenu" ref="720053764"/>
<string key="NSTitle">Export As XML…</string>
<string key="NSKeyEquiv">E</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="579971712">
<reference key="NSMenu" ref="720053764"/>
<string key="NSTitle">Revert to Saved</string>
@@ -811,6 +820,14 @@
</object>
<int key="connectionID">1255</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">exportDatabase:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="438377242"/>
</object>
<int key="connectionID">1260</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">showPreferences:</string>
@@ -914,6 +931,7 @@
<reference ref="915918141"/>
<reference ref="544639599"/>
<reference ref="663106531"/>
<reference ref="438377242"/>
</array>
<reference key="parent" ref="379814623"/>
</object>
@@ -1249,6 +1267,11 @@
<reference key="object" ref="663106531"/>
<reference key="parent" ref="720053764"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1259</int>
<reference key="object" ref="438377242"/>
<reference key="parent" ref="720053764"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -1266,6 +1289,7 @@
<string key="124.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="1243.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="125.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="1259.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="126.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="129.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="130.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1322,7 +1346,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">1258</int>
<int key="maxID">1260</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1382,6 +1406,7 @@
<string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="editPassword:">id</string>
<string key="exportDatabase:">id</string>
<string key="showDatabaseSettings:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
@@ -1389,6 +1414,10 @@
<string key="name">editPassword:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="exportDatabase:">
<string key="name">exportDatabase:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="showDatabaseSettings:">
<string key="name">showDatabaseSettings:</string>
<string key="candidateClassName">id</string>

File diff suppressed because it is too large Load Diff

View File

@@ -67,6 +67,8 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
- (void)useGroupAsTrash:(KdbGroup *)group;
#pragma mark Export
- (void)writeXMLToURL:(NSURL *)url;
#pragma mark Undo Data Manipulation
/* Undoable Intiialization of elements */

View File

@@ -17,6 +17,7 @@
#import "KdbLib.h"
#import "Kdb3Node.h"
#import "Kdb4Node.h"
#import "Kdb4Persist.h"
#import "KdbPassword.h"
#import "KdbGroup+Undo.h"
#import "KdbGroup+KVOAdditions.h"
@@ -27,6 +28,8 @@
#import "Kdb3Tree+NewTree.h"
#import "Kdb4Tree+NewTree.h"
#import "DataOutputStream.h"
NSString *const MPDocumentDidAddGroupNotification = @"com.hicknhack.macpass.MPDocumentDidAddGroupNotification";
NSString *const MPDocumentWillDelteGroupNotification = @"com.hicknhack.macpass.MPDocumentDidDelteGroupNotification";
NSString *const MPDocumentDidAddEntryNotification = @"com.hicknhack.macpass.MPDocumentDidAddEntryNotification";
@@ -160,6 +163,13 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
[super close];
}
- (void)writeXMLToURL:(NSURL *)url {
DataOutputStream *outputStream = [[DataOutputStream alloc] init];
Kdb4Persist *persist = [[Kdb4Persist alloc] initWithTree:self.treeV4 outputStream:outputStream randomStream:nil];
[persist persist];
[outputStream.data writeToURL:url atomically:YES];
}
#pragma mark Lock/Unlock/Decrypt
- (BOOL)unlockWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL {

View File

@@ -38,6 +38,7 @@ APPKIT_EXTERN NSString *const MPCurrentItemChangedNotification;
- (void)performFindPanelAction:(id)sender;
- (IBAction)editPassword:(id)sender;
- (IBAction)showDatabaseSettings:(id)sender;
- (IBAction)exportDatabase:(id)sender;
- (void)lock:(id)sender;

View File

@@ -162,13 +162,27 @@ NSString *const MPCurrentItemChangedNotification = @"com.hicknhack.macpass.MPCur
}
#pragma mark Actions
- (void)exportDatabase:(id)sender {
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setAllowsOtherFileTypes:YES];
[savePanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
if(result == NSFileHandlingPanelOKButton) {
[[self document] writeXMLToURL:savePanel.URL];
}
}];
}
- (void)performFindPanelAction:(id)sender {
[self.entryViewController showFilter:sender];
}
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
BOOL enabled = YES;
MPDocument *document = [self document];
return !( document.isLocked || document.isReadOnly );
if([menuItem action] == @selector(exportDatabase:)) {
enabled = (nil != document.treeV4);
}
enabled &= !( document.isLocked || document.isReadOnly );
return enabled;
}
- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem {

View File

@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<KeePassFile>
<Meta>
<Generator>KeePassX</Generator>
<DatabaseName/>
<DatabaseNameChanged>2013-07-15T19:35:54Z</DatabaseNameChanged>
<DatabaseDescription/>
<DatabaseDescriptionChanged>2013-07-15T19:35:54Z</DatabaseDescriptionChanged>
<DefaultUserName/>
<DefaultUserNameChanged>2013-07-15T19:35:54Z</DefaultUserNameChanged>
<MaintenanceHistoryDays>365</MaintenanceHistoryDays>
<Color/>
<MasterKeyChanged>2013-07-15T19:36:02Z</MasterKeyChanged>
<MasterKeyChangeRec>-1</MasterKeyChangeRec>
<MasterKeyChangeForce>-1</MasterKeyChangeForce>
<MemoryProtection>
<ProtectTitle>False</ProtectTitle>
<ProtectUserName>False</ProtectUserName>
<ProtectPassword>True</ProtectPassword>
<ProtectURL>False</ProtectURL>
<ProtectNotes>False</ProtectNotes>
</MemoryProtection>
<CustomIcons>
<Icon>
<UUID>RaP8u/B18ngIutqc2B5c9g==</UUID>
<Data>iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAsSAAALEgHS3X78AAACHUlEQVQokV2SzUtUYRTGn/Pe915HZyIwJ0FDEsqCXORGaBFYLWoR7foDglZt+xuCFu76G9q0iFBKMgQhhUhIhIRM7EuHq+N8ODN37uf7ntNCR249q7P4wfOccx4SEfRkwY4oEIyVNAoLJVdZTxxD0KeMQk4OKxCSKF5893KgJEkkcAyJzjOQnJiZRSp7P01rh4Ot+devjFjLeUT+cQCJyez3zRVH2sTd+/euB60O0T+IEjAACAAWIwfNg5lrZ5HWkNZxtL24NEcCgCEnVM+BACjlYG9jFU5HzCFnR+Duw1vjQdTpAUyAolyqSqU2PbGPqLrwYXf+/VdYH40vywtz1vZiCTR6s8mi0eK21Npg7NZ9sQWElLC+MymNuj9UHiFSICgc7wA0age8u0CpWLt/6VzxwlCfZK2+NHTT/eWltxADAGB9vEoUhmVnh6KqQb+WdPpKod6o0e+P1loNmSmO+od3R86PQZQGFEm2tbU+5c9K/Ed321BUGrx4Rg1mnZZrGZbKvPFpfW749iPxigowzSCbLG2nvzak6SPu2m61k4zFXHQ7KQIgDhAXJiovmkGsJaHM8I+11YmVm/CAzAOlrPHm21U/bD2ZqoIsGcWKlcHm5dnxB08pC41ee24/P3NsZPVJbYgoX8rjF7e5nDze0bFSCjoZvmGUUr2LAaAcnyrX4ywxxX6XiVkobTbR77H5r7yncjnp6tIA2z6v8BeUfknGrtTw7gAAAABJRU5ErkJggg==</Data>
</Icon>
</CustomIcons>
<RecycleBinEnabled>True</RecycleBinEnabled>
<RecycleBinUUID>AAAAAAAAAAAAAAAAAAAAAA==</RecycleBinUUID>
<RecycleBinChanged>2013-07-15T19:35:54Z</RecycleBinChanged>
<EntryTemplatesGroup>AAAAAAAAAAAAAAAAAAAAAA==</EntryTemplatesGroup>
<EntryTemplatesGroupChanged>2013-07-15T19:35:54Z</EntryTemplatesGroupChanged>
<HistoryMaxItems>10</HistoryMaxItems>
<HistoryMaxSize>6291456</HistoryMaxSize>
<LastSelectedGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastSelectedGroup>
<LastTopVisibleGroup>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleGroup>
<Binaries/>
<CustomData/>
</Meta>
<Root>
<Group>
<UUID>8XPXLHyIoM9KLqrjDHjsZQ==</UUID>
<Name>Root</Name>
<Notes/>
<IconID>48</IconID>
<Times>
<LastModificationTime>2013-07-15T19:35:54Z</LastModificationTime>
<CreationTime>2013-07-15T19:35:54Z</CreationTime>
<LastAccessTime>2013-07-15T19:35:54Z</LastAccessTime>
<ExpiryTime>2013-07-15T19:35:54Z</ExpiryTime>
<Expires>False</Expires>
<UsageCount>0</UsageCount>
<LocationChanged>2013-07-15T19:35:54Z</LocationChanged>
</Times>
<IsExpanded>True</IsExpanded>
<DefaultAutoTypeSequence/>
<EnableAutoType>null</EnableAutoType>
<EnableSearching>null</EnableSearching>
<LastTopVisibleEntry>AAAAAAAAAAAAAAAAAAAAAA==</LastTopVisibleEntry>
<Entry>
<UUID>XW1C9XAjxqVKt4bJsOpgRQ==</UUID>
<IconID>0</IconID>
<CustomIconUUID>RaP8u/B18ngIutqc2B5c9g==</CustomIconUUID>
<ForegroundColor/>
<BackgroundColor/>
<OverrideURL/>
<Tags/>
<Times>
<LastModificationTime>2013-07-15T19:37:38Z</LastModificationTime>
<CreationTime>2013-07-15T19:36:04Z</CreationTime>
<LastAccessTime>2013-07-15T19:37:38Z</LastAccessTime>
<ExpiryTime>2013-07-15T19:36:04Z</ExpiryTime>
<Expires>False</Expires>
<UsageCount>0</UsageCount>
<LocationChanged>2013-07-15T19:36:08Z</LocationChanged>
</Times>
<String>
<Key>Title</Key>
<Value>CustomIcon</Value>
</String>
<String>
<Key>UserName</Key>
<Value/>
</String>
<String>
<Key>Password</Key>
<Value Protected="True"/>
</String>
<String>
<Key>URL</Key>
<Value/>
</String>
<String>
<Key>Notes</Key>
<Value/>
</String>
<AutoType>
<Enabled>True</Enabled>
<DataTransferObfuscation>0</DataTransferObfuscation>
<DefaultSequence/>
</AutoType>
<History>
<Entry>
<UUID>XW1C9XAjxqVKt4bJsOpgRQ==</UUID>
<IconID>0</IconID>
<ForegroundColor/>
<BackgroundColor/>
<OverrideURL/>
<Tags/>
<Times>
<LastModificationTime>2013-07-15T19:36:08Z</LastModificationTime>
<CreationTime>2013-07-15T19:36:04Z</CreationTime>
<LastAccessTime>2013-07-15T19:36:08Z</LastAccessTime>
<ExpiryTime>2013-07-15T19:36:04Z</ExpiryTime>
<Expires>False</Expires>
<UsageCount>0</UsageCount>
<LocationChanged>2013-07-15T19:36:08Z</LocationChanged>
</Times>
<String>
<Key>Title</Key>
<Value>CustomIcon</Value>
</String>
<String>
<Key>UserName</Key>
<Value/>
</String>
<String>
<Key>Password</Key>
<Value Protected="True"/>
</String>
<String>
<Key>URL</Key>
<Value/>
</String>
<String>
<Key>Notes</Key>
<Value/>
</String>
<AutoType>
<Enabled>True</Enabled>
<DataTransferObfuscation>0</DataTransferObfuscation>
<DefaultSequence/>
</AutoType>
</Entry>
</History>
</Entry>
</Group>
</Root>
</KeePassFile>

Binary file not shown.