diff --git a/Base.lproj/teleportPref.xib b/Base.lproj/teleportPref.xib index 4aa828f..0c454f5 100644 --- a/Base.lproj/teleportPref.xib +++ b/Base.lproj/teleportPref.xib @@ -297,6 +297,17 @@ + diff --git a/TPMainController.m b/TPMainController.m index a7ca62f..ccdf385 100644 --- a/TPMainController.m +++ b/TPMainController.m @@ -217,7 +217,7 @@ - (void)screensDidSleep:(NSNotification*)notification [self _invalidateTimer]; TPClientController * clientController = [TPClientController defaultController]; TPMessage *message = [TPMessage messageWithType:TPControlSleepType]; - if ([clientController currentConnection] != nil) { + if ([clientController currentConnection] != nil && [[TPPreferencesManager sharedPreferencesManager] boolForPref:SYNC_SLEEP_STATUS]) { [[clientController currentConnection] sendMessage:message]; } } diff --git a/TPPreferencesManager.h b/TPPreferencesManager.h index 6e4810f..76756f5 100644 --- a/TPPreferencesManager.h +++ b/TPPreferencesManager.h @@ -12,6 +12,7 @@ #define PREFS_VERSION @"prefsVersion" #define SHARE_PASTEBOARD @"sharePasteboard" #define SYNC_LOCK_STATUS @"syncLockStatus" +#define SYNC_SLEEP_STATUS @"syncSleepStatus" #define ALLOW_CONTROL @"allowControl" #define REQUIRE_KEY @"requireKey" #define DELAYED_SWITCH @"delayedSwitch" diff --git a/TPPreferencesManager.m b/TPPreferencesManager.m index bed72a0..bce609a 100644 --- a/TPPreferencesManager.m +++ b/TPPreferencesManager.m @@ -126,6 +126,7 @@ - (NSUserDefaultsController*)_defaultsController [_userDefaultsController setInitialValues:@{SHARE_PASTEBOARD: @YES, SYNC_LOCK_STATUS: @NO, + SYNC_SLEEP_STATUS: @NO, ALLOW_CONTROL: @NO, REQUIRE_KEY: @NO, DELAYED_SWITCH: @NO, diff --git a/TPServerController.m b/TPServerController.m index 578666e..da42672 100644 --- a/TPServerController.m +++ b/TPServerController.m @@ -338,7 +338,9 @@ - (void)connection:(TPNetworkConnection*)connection receivedMessage:(TPMessage*) switch(type) { case TPControlSleepType: DebugLog(@"received sleep msg"); + if ([[TPPreferencesManager sharedPreferencesManager] boolForPref:SYNC_SLEEP_STATUS]) { [[TPLocalHost localHost] sleepScreen]; + } break; case TPControlWakeType: DebugLog(@"received wake msg"); diff --git a/TPStatusItemController.m b/TPStatusItemController.m index 558e4a5..dac38b2 100644 --- a/TPStatusItemController.m +++ b/TPStatusItemController.m @@ -81,6 +81,12 @@ - (void)setShowStatusItem:(BOOL)showStatusItem [syncLockStatusMenuItem setRepresentedObject:SYNC_LOCK_STATUS]; [syncLockStatusMenuItem bind:@"state" toObject:[TPPreferencesManager sharedPreferencesManager] withKeyPath:SYNC_LOCK_STATUS options:nil]; [menu addItem:syncLockStatusMenuItem]; + + NSMenuItem * syncSleepStatusMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Sync sleep status", nil) action:@selector(switchMenuItem:) keyEquivalent:@""]; + [syncSleepStatusMenuItem setTarget:self]; + [syncSleepStatusMenuItem setRepresentedObject:SYNC_SLEEP_STATUS]; + [syncSleepStatusMenuItem bind:@"state" toObject:[TPPreferencesManager sharedPreferencesManager] withKeyPath:SYNC_SLEEP_STATUS options:nil]; + [menu addItem:syncSleepStatusMenuItem]; [menu addItem:[NSMenuItem separatorItem]]; diff --git a/teleport.xcodeproj/project.pbxproj b/teleport.xcodeproj/project.pbxproj index 09ebfa6..e75b64c 100644 --- a/teleport.xcodeproj/project.pbxproj +++ b/teleport.xcodeproj/project.pbxproj @@ -1139,7 +1139,7 @@ CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 1.3.4; + CURRENT_PROJECT_VERSION = 1.3.5; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; EXCLUDED_ARCHS = ""; @@ -1167,7 +1167,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1.3.4; + CURRENT_PROJECT_VERSION = 1.3.5; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; EXCLUDED_ARCHS = ""; @@ -1280,7 +1280,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1.3.4; + CURRENT_PROJECT_VERSION = 1.3.5; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; EXCLUDED_ARCHS = "";