From 3fc5f1e1db322baa04a3bb6b5093da9374e0cef5 Mon Sep 17 00:00:00 2001 From: anonymousMouse45 <32428831+anonymousMouse45@users.noreply.github.com> Date: Sun, 1 Oct 2017 01:02:08 -0700 Subject: [PATCH] Add option to sync the root folder. --- Classes/PutIOFolderPicker.h | 1 + Classes/PutIOFolderPicker.m | 7 ++++ Classes/SyncInstructionEditor.m | 9 +++++ Classes/en.lproj/PutIOFolderPicker.xib | 34 ++++++++++++++----- PutIOSync-Info.plist | 2 +- .../xcschemes/xcschememanagement.plist | 19 +++++++++++ 6 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 PutIOSync.xcodeproj/xcuserdata/server.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/Classes/PutIOFolderPicker.h b/Classes/PutIOFolderPicker.h index 0ad81f0..2145fb5 100644 --- a/Classes/PutIOFolderPicker.h +++ b/Classes/PutIOFolderPicker.h @@ -5,6 +5,7 @@ @class PutIOFolderPicker; @protocol PutIOFolderPickerDelegate -(void)folderPicker:(PutIOFolderPicker*)picker didPickFolder:(PutIOAPIFile*)folder; +-(void)folderPicker:(PutIOFolderPicker *)picker didPickFolderID:(int)folderID; -(void)folderPickerDidCancel:(PutIOFolderPicker*)picker; @end diff --git a/Classes/PutIOFolderPicker.m b/Classes/PutIOFolderPicker.m index 398414c..438977d 100644 --- a/Classes/PutIOFolderPicker.m +++ b/Classes/PutIOFolderPicker.m @@ -43,6 +43,13 @@ -(void)chooseSelectedFolder:(id)sender } } +- (IBAction)useRootFolder:(id)sender { + if ([_delegate respondsToSelector:@selector(folderPicker:didPickFolderID:)]) { + [_delegate folderPicker:self didPickFolderID:0]; + } + [self.window close]; +} + -(void)cancel:(id)sender { [self.window close]; diff --git a/Classes/SyncInstructionEditor.m b/Classes/SyncInstructionEditor.m index 9809815..4cb2eba 100644 --- a/Classes/SyncInstructionEditor.m +++ b/Classes/SyncInstructionEditor.m @@ -127,6 +127,15 @@ -(void)folderPicker:(PutIOFolderPicker *)picker didPickFolder:(PutIOAPIFile *)fo [self updateLabels]; } +-(void)folderPicker:(PutIOFolderPicker *)picker didPickFolderID:(int)folderID +{ + [NSApp endSheet:folderPicker.window]; + _editedSyncInstruction.originFolderID = @(folderID); + _editedSyncInstruction.originFolderName = @"Root"; + + [self updateLabels]; +} + -(void)folderPickerDidCancel:(PutIOFolderPicker *)picker { [NSApp endSheet:folderPicker.window]; diff --git a/Classes/en.lproj/PutIOFolderPicker.xib b/Classes/en.lproj/PutIOFolderPicker.xib index 08cd2e9..42c23aa 100644 --- a/Classes/en.lproj/PutIOFolderPicker.xib +++ b/Classes/en.lproj/PutIOFolderPicker.xib @@ -1,7 +1,9 @@ - - + + - + + + @@ -14,12 +16,12 @@ - + - + @@ -31,9 +33,10 @@ + - + @@ -94,7 +97,6 @@ - diff --git a/PutIOSync-Info.plist b/PutIOSync-Info.plist index 2d279f3..1667337 100644 --- a/PutIOSync-Info.plist +++ b/PutIOSync-Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 383 + 384 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/PutIOSync.xcodeproj/xcuserdata/server.xcuserdatad/xcschemes/xcschememanagement.plist b/PutIOSync.xcodeproj/xcuserdata/server.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..afcfbae --- /dev/null +++ b/PutIOSync.xcodeproj/xcuserdata/server.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,19 @@ + + + + + SchemeUserState + + PutIOSync.xcscheme + + orderHint + 0 + + Release.xcscheme + + orderHint + 1 + + + +