aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionController.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-06-12 13:56:11 +0000
committerstuconnolly <stuart02@gmail.com>2011-06-12 13:56:11 +0000
commitf3e65efba3f76cb2149fd8427af9463032d3c45d (patch)
tree0e8ebaadd24c8e206bca1f8b2a30ef6543976391 /Source/SPConnectionController.m
parentc1de88ac62381469ad01975c0f28e5847a65edb9 (diff)
downloadsequelpro-f3e65efba3f76cb2149fd8427af9463032d3c45d.tar.gz
sequelpro-f3e65efba3f76cb2149fd8427af9463032d3c45d.tar.bz2
sequelpro-f3e65efba3f76cb2149fd8427af9463032d3c45d.zip
Add the ability to export favorites.
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r--Source/SPConnectionController.m17
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 0f12303f..6ed6e392 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -38,6 +38,8 @@
#import "SPGeneralPreferencePane.h"
#import "SPDatabaseViewController.h"
#import "SPTreeNode.h"
+#import "SPFavoritesExporter.h"
+#import "SPFavoritesImporter.h"
// Constants
static NSString *SPRemoveNode = @"RemoveNode";
@@ -989,6 +991,8 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v
{
NSSavePanel *savePanel = [NSSavePanel savePanel];
+ [savePanel setAccessoryView:exportPanelAccessoryView];
+
[savePanel beginSheetForDirectory:nil
file:SPExportFavoritesFilename
modalForWindow:[dbDocument parentWindow]
@@ -1131,9 +1135,20 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v
/**
* Called when the user dismisses either the import of export favorites panels.
*/
-- (void)importExportFavoritesSheetDidEnd:(NSOpenPanel *)openPanel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
+- (void)importExportFavoritesSheetDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
+ NSError *error = nil;
+ if (contextInfo == SPExportFavorites) {
+ SPFavoritesExporter *exporter = [[[SPFavoritesExporter alloc] init] autorelease];
+
+ [exporter setDelegate:self];
+
+ [exporter writeFavorites:[self selectedFavoriteNodes] toFile:[panel filename] error:&error];
+ }
+ else if (contextInfo == SPImportFavorites) {
+ //SPFavoritesImporter *importer = [[SPFavoritesImporter alloc] init];
+ }
}
/**