diff --git a/Sparkle.framework/Versions/A/Headers/SUAppcast.h b/Sparkle.framework/Versions/A/Headers/SUAppcast.h index 8f3efc8..a035f18 100644 --- a/Sparkle.framework/Versions/A/Headers/SUAppcast.h +++ b/Sparkle.framework/Versions/A/Headers/SUAppcast.h @@ -19,6 +19,7 @@ SU_EXPORT @interface SUAppcast : NSObject @property (copy) NSDictionary *httpHeaders; - (void)fetchAppcastFromURL:(NSURL *)url completionBlock:(void (^)(NSError *))err; +- (SUAppcast *)copyWithoutDeltaUpdates; @property (readonly, copy) NSArray *items; @end diff --git a/Sparkle.framework/Versions/A/Headers/SUUpdater.h b/Sparkle.framework/Versions/A/Headers/SUUpdater.h index ed0072a..8602485 100644 --- a/Sparkle.framework/Versions/A/Headers/SUUpdater.h +++ b/Sparkle.framework/Versions/A/Headers/SUUpdater.h @@ -14,7 +14,7 @@ #import "SUVersionComparisonProtocol.h" #import "SUVersionDisplayProtocol.h" -@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast; +@class SUAppcastItem, SUAppcast; @protocol SUUpdaterDelegate; @@ -54,6 +54,8 @@ SU_EXPORT @interface SUUpdater : NSObject @property BOOL automaticallyDownloadsUpdates; +@property (nonatomic, copy) NSString *decryptionPassword; + /*! Explicitly checks for updates and displays a progress dialog while doing so. diff --git a/Sparkle.framework/Versions/A/PrivateHeaders/SUUnarchiver.h b/Sparkle.framework/Versions/A/PrivateHeaders/SUUnarchiver.h index 6397fe7..ccd5611 100644 --- a/Sparkle.framework/Versions/A/PrivateHeaders/SUUnarchiver.h +++ b/Sparkle.framework/Versions/A/PrivateHeaders/SUUnarchiver.h @@ -18,9 +18,10 @@ @property (copy, readonly) NSString *archivePath; @property (copy, readonly) NSString *updateHostBundlePath; +@property (copy, readonly) NSString *decryptionPassword; @property (weak) id delegate; -+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHostBundlePath:(NSString *)host; ++ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHostBundlePath:(NSString *)host withPassword:(NSString *)decryptionPassword; - (void)start; @end diff --git a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Info.plist b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Info.plist index 26a0212..5cb9c8d 100644 --- a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Info.plist +++ b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15E27e + 15E49a CFBundleDevelopmentRegion English CFBundleExecutable @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.13.1 git-2afc553 + 1.14.0 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -25,11 +25,11 @@ MacOSX CFBundleVersion - 1.13.1 + 1.14.0 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 7C68 + 7C1002 DTPlatformVersion GM DTSDKBuild @@ -37,9 +37,9 @@ DTSDKName macosx10.11 DTXcode - 0720 + 0721 DTXcodeBuild - 7C68 + 7C1002 LSBackgroundOnly 1 LSMinimumSystemVersion diff --git a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/Autoupdate b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/Autoupdate index 7caea3d..0e70736 100755 Binary files a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/Autoupdate and b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/Autoupdate differ diff --git a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/AppIcon.icns b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/AppIcon.icns index 75c7c37..93fb79e 100644 Binary files a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/AppIcon.icns and b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/AppIcon.icns differ diff --git a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/cs.lproj/Sparkle.strings b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/cs.lproj/Sparkle.strings index 6ca360d..da59028 100644 Binary files a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/cs.lproj/Sparkle.strings and b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/cs.lproj/Sparkle.strings differ diff --git a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ja.lproj/Sparkle.strings b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ja.lproj/Sparkle.strings index 1925ba4..08cb296 100644 Binary files a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ja.lproj/Sparkle.strings and b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/ja.lproj/Sparkle.strings differ diff --git a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_BR.lproj/Sparkle.strings b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_BR.lproj/Sparkle.strings index 300fc86..19cb11f 100644 Binary files a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_BR.lproj/Sparkle.strings and b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/pt_BR.lproj/Sparkle.strings differ diff --git a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_CN.lproj/Sparkle.strings b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_CN.lproj/Sparkle.strings index 0e91210..cbd1ba6 100644 Binary files a/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_CN.lproj/Sparkle.strings and b/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/Resources/zh_CN.lproj/Sparkle.strings differ diff --git a/Sparkle.framework/Versions/A/Resources/Info.plist b/Sparkle.framework/Versions/A/Resources/Info.plist index aba6f81..64d696e 100644 --- a/Sparkle.framework/Versions/A/Resources/Info.plist +++ b/Sparkle.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15E27e + 15E49a CFBundleDevelopmentRegion en CFBundleExecutable @@ -17,7 +17,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.13.1 git-2afc553 + 1.14.0 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -25,11 +25,11 @@ MacOSX CFBundleVersion - 1.13.1 + 1.14.0 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 7C68 + 7C1002 DTPlatformVersion GM DTSDKBuild @@ -37,8 +37,8 @@ DTSDKName macosx10.11 DTXcode - 0720 + 0721 DTXcodeBuild - 7C68 + 7C1002 diff --git a/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib b/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib index 4b32c51..86c7ace 100644 Binary files a/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib and b/Sparkle.framework/Versions/A/Resources/cs.lproj/SUAutomaticUpdateAlert.nib differ diff --git a/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib b/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib index 122c0e0..87d4eb2 100644 Binary files a/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib and b/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdateAlert.nib differ diff --git a/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib b/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib index 26ec025..c39c065 100644 Binary files a/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib and b/Sparkle.framework/Versions/A/Resources/cs.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings b/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings index 6ca360d..da59028 100644 Binary files a/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings and b/Sparkle.framework/Versions/A/Resources/cs.lproj/Sparkle.strings differ diff --git a/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib b/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib index 21fca7b..d04d0cd 100644 Binary files a/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib and b/Sparkle.framework/Versions/A/Resources/da.lproj/SUUpdatePermissionPrompt.nib differ diff --git a/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings b/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings index 1925ba4..08cb296 100644 Binary files a/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings and b/Sparkle.framework/Versions/A/Resources/ja.lproj/Sparkle.strings differ diff --git a/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings b/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings index 300fc86..19cb11f 100644 Binary files a/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings and b/Sparkle.framework/Versions/A/Resources/pt_BR.lproj/Sparkle.strings differ diff --git a/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib b/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib index 0bf6286..0602af8 100644 Binary files a/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib and b/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/SUUpdateAlert.nib differ diff --git a/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings b/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings index 0e91210..cbd1ba6 100644 Binary files a/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings and b/Sparkle.framework/Versions/A/Resources/zh_CN.lproj/Sparkle.strings differ diff --git a/Sparkle.framework/Versions/A/Sparkle b/Sparkle.framework/Versions/A/Sparkle index 158a259..5b7ce17 100755 Binary files a/Sparkle.framework/Versions/A/Sparkle and b/Sparkle.framework/Versions/A/Sparkle differ diff --git a/TodoTxtMac.xcodeproj/project.pbxproj b/TodoTxtMac.xcodeproj/project.pbxproj index f909ee5..5bd8ba5 100644 --- a/TodoTxtMac.xcodeproj/project.pbxproj +++ b/TodoTxtMac.xcodeproj/project.pbxproj @@ -45,6 +45,7 @@ 003F95B61AA40FB400A1FF47 /* TTMTask_DecrementDueDate_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 003F95B51AA40FB400A1FF47 /* TTMTask_DecrementDueDate_UnitTests.m */; }; 0050D6841996AA38008F349B /* TTMTasklistMetadata_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0050D6831996AA38008F349B /* TTMTasklistMetadata_UnitTests.m */; }; 006062D818EC6B0800D147F2 /* NSUserDefaults+myColorSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 006062D718EC6B0800D147F2 /* NSUserDefaults+myColorSupport.m */; }; + 0064E6441C9CEE6600B9A6C0 /* NSDate+RelativeDates.m in Sources */ = {isa = PBXBuildFile; fileRef = 0064E6431C9CEE6600B9A6C0 /* NSDate+RelativeDates.m */; }; 006B26461A81C82D00B0E47A /* TTMFindReplace.xib in Resources */ = {isa = PBXBuildFile; fileRef = 006B26451A81C82D00B0E47A /* TTMFindReplace.xib */; }; 006BA79E19DB9CFD00C8F408 /* TTMTasklistMetadata.xib in Resources */ = {isa = PBXBuildFile; fileRef = 006BA79D19DB9CFD00C8F408 /* TTMTasklistMetadata.xib */; }; 007B835F1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 007B835E1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m */; }; @@ -67,6 +68,8 @@ 00B4CBC918B43E8500313DAA /* TTMTask_ReplaceText_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00B4CBC818B43E8500313DAA /* TTMTask_ReplaceText_UnitTests.m */; }; 00B8C82518E48FFF008D9E48 /* TTMFieldEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 00B8C82418E48FFF008D9E48 /* TTMFieldEditor.m */; }; 00D102B61991ABBE00D30237 /* TTMTasklistMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D102B51991ABBE00D30237 /* TTMTasklistMetadata.m */; }; + 00D531271CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */; }; + 00D5312A1CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */; }; 00EAAB9718E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9618E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m */; }; 00EAAB9A18E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9918E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m */; }; 00EAAB9D18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9C18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m */; }; @@ -145,6 +148,8 @@ 0050D6831996AA38008F349B /* TTMTasklistMetadata_UnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMTasklistMetadata_UnitTests.m; sourceTree = ""; }; 006062D618EC6B0800D147F2 /* NSUserDefaults+myColorSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSUserDefaults+myColorSupport.h"; sourceTree = ""; }; 006062D718EC6B0800D147F2 /* NSUserDefaults+myColorSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSUserDefaults+myColorSupport.m"; sourceTree = ""; }; + 0064E6421C9CEE6600B9A6C0 /* NSDate+RelativeDates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+RelativeDates.h"; sourceTree = ""; }; + 0064E6431C9CEE6600B9A6C0 /* NSDate+RelativeDates.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+RelativeDates.m"; sourceTree = ""; }; 006B26451A81C82D00B0E47A /* TTMFindReplace.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TTMFindReplace.xib; sourceTree = ""; }; 006BA79D19DB9CFD00C8F408 /* TTMTasklistMetadata.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TTMTasklistMetadata.xib; sourceTree = ""; }; 007B835D1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorThresholdRowTemplate.h; sourceTree = ""; }; @@ -183,6 +188,9 @@ 00B8C82418E48FFF008D9E48 /* TTMFieldEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMFieldEditor.m; sourceTree = ""; }; 00D102B41991ABBE00D30237 /* TTMTasklistMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMTasklistMetadata.h; sourceTree = ""; }; 00D102B51991ABBE00D30237 /* TTMTasklistMetadata.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMTasklistMetadata.m; sourceTree = ""; }; + 00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMTask_IsHidden_UnitTests.m; sourceTree = ""; }; + 00D531281CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorHiddenRowTemplate.h; sourceTree = ""; }; + 00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorHiddenRowTemplate.m; sourceTree = ""; }; 00EAAB9518E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorDateRowTemplate.h; sourceTree = ""; }; 00EAAB9618E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorDateRowTemplate.m; sourceTree = ""; }; 00EAAB9818E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorDueRowTemplate.h; sourceTree = ""; }; @@ -251,6 +259,8 @@ 00EAAB9918E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m */, 007B835D1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.h */, 007B835E1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m */, + 00D531281CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.h */, + 00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */, ); name = Filters; sourceTree = ""; @@ -276,6 +286,8 @@ 006062D718EC6B0800D147F2 /* NSUserDefaults+myColorSupport.m */, 003F959C1AA2C42700A1FF47 /* NSMutableAttributableString+ColorRegExMatches.h */, 003F959D1AA2C42700A1FF47 /* NSMutableAttributableString+ColorRegExMatches.m */, + 0064E6421C9CEE6600B9A6C0 /* NSDate+RelativeDates.h */, + 0064E6431C9CEE6600B9A6C0 /* NSDate+RelativeDates.m */, ); name = Libraries; sourceTree = ""; @@ -386,6 +398,7 @@ 003F95AF1AA3FE4400A1FF47 /* TTMTask_AppendText_UnitTests.m */, 003F95B11AA4016200A1FF47 /* TTMTask_PrependText_UnitTests.m */, 00B4CBC818B43E8500313DAA /* TTMTask_ReplaceText_UnitTests.m */, + 00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */, ); path = TodoTxtMacTests; sourceTree = ""; @@ -563,6 +576,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 0064E6441C9CEE6600B9A6C0 /* NSDate+RelativeDates.m in Sources */, 002EAE5918DBD24C008E7517 /* TTMAppController.m in Sources */, 00EAAB9A18E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m in Sources */, 002EAE5E18DCAE5C008E7517 /* TTMFilterPredicates.m in Sources */, @@ -583,6 +597,7 @@ 00F811EF18D53F7300379B99 /* TTMPreferencesController.m in Sources */, 00165B2618DBD1EC00E137B8 /* TTMFiltersController.m in Sources */, 00FB47861A733E6100F8D2B3 /* TTMDocumentStatusBarText.m in Sources */, + 00D5312A1CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m in Sources */, 00B8C82518E48FFF008D9E48 /* TTMFieldEditor.m in Sources */, 00EAAB9D18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m in Sources */, ); @@ -616,6 +631,7 @@ 003F95B21AA4016200A1FF47 /* TTMTask_PrependText_UnitTests.m in Sources */, 003F959B1AA2B7A600A1FF47 /* TTMTask_RemoveDueDate_UnitTests.m in Sources */, 002218D81AA0D80800D6F3A0 /* TTMTask_Init_UnitTests.m in Sources */, + 00D531271CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m in Sources */, 003F95AA1AA3F9C700A1FF47 /* TTMTask_IncrementThresholdDate_UnitTests.m in Sources */, 002218E01AA1387900D6F3A0 /* TTMTask_ThresholdDate_UnitTests.m in Sources */, 003F95B01AA3FE4400A1FF47 /* TTMTask_AppendText_UnitTests.m in Sources */, diff --git a/TodoTxtMac/Base.lproj/MainMenu.xib b/TodoTxtMac/Base.lproj/MainMenu.xib index 299a0f1..9fe53c2 100644 --- a/TodoTxtMac/Base.lproj/MainMenu.xib +++ b/TodoTxtMac/Base.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - + @@ -182,6 +182,11 @@ + + + + + diff --git a/TodoTxtMac/NSDate+RelativeDates.h b/TodoTxtMac/NSDate+RelativeDates.h new file mode 100644 index 0000000..29db7c8 --- /dev/null +++ b/TodoTxtMac/NSDate+RelativeDates.h @@ -0,0 +1,57 @@ +/** + * @author Michael Descy + * @copyright 2014-2016 Michael Descy + * @discussion Dual-licensed under the GNU General Public License and the MIT License + * + * + * + * @license GNU General Public License http://www.gnu.org/licenses/gpl.html + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * + * + * @license The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#import + +@interface NSDate (RelativeDates) + +- (NSDate*)advanceDateByWeekdays:(NSInteger)numberOfWeekdays; +- (NSDate*)advanceDateByNumberOfCalendarUnits:(NSInteger)numberOfCalendarUnits + calendarUnit:(NSCalendarUnit)calendarUnit; +- (BOOL)isWeekendDay; +- (BOOL)isWeekday; + +@end diff --git a/TodoTxtMac/NSDate+RelativeDates.m b/TodoTxtMac/NSDate+RelativeDates.m new file mode 100644 index 0000000..832504c --- /dev/null +++ b/TodoTxtMac/NSDate+RelativeDates.m @@ -0,0 +1,89 @@ +/** + * @author Michael Descy + * @copyright 2014-2015 Michael Descy + * @discussion Dual-licensed under the GNU General Public License and the MIT License + * + * + * + * @license GNU General Public License http://www.gnu.org/licenses/gpl.html + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * + * + * @license The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#import "NSDate+RelativeDates.h" + +@implementation NSDate (RelativeDates) + +- (NSCalendar*)currentCalendar { + return [NSCalendar currentCalendar]; +} + +- (NSDate*)advanceDateByWeekdays:(NSInteger)numberOfWeekdays { + NSDate *relativeDate = self; + NSInteger weekdaysLeft = numberOfWeekdays; + + while (weekdaysLeft > 0) { + NSDate *newDate = [relativeDate advanceDateByNumberOfCalendarUnits:1 calendarUnit:NSCalendarUnitDay]; + if (newDate == nil) { + return relativeDate; + } + relativeDate = newDate; + if ([relativeDate isWeekday]) { + weekdaysLeft -= 1; + } + } + return relativeDate; +} + +- (NSDate*)advanceDateByNumberOfCalendarUnits:(NSInteger)numberOfCalendarUnits + calendarUnit:(NSCalendarUnit)calendarUnit { + return [[self currentCalendar] dateByAddingUnit:calendarUnit + value:numberOfCalendarUnits + toDate:self + options:NSCalendarMatchFirst]; +} + +- (BOOL)isWeekendDay { + long weekday = [[self currentCalendar] component:NSCalendarUnitWeekday fromDate:self]; + return (weekday == 1 || weekday == 7); +} + +- (BOOL)isWeekday { + return ![self isWeekendDay]; +} + +@end diff --git a/TodoTxtMac/TTMAppController.m b/TodoTxtMac/TTMAppController.m index d2cb4af..b79ceea 100644 --- a/TodoTxtMac/TTMAppController.m +++ b/TodoTxtMac/TTMAppController.m @@ -104,6 +104,8 @@ @0, @"levelsOfUndo", @YES, @"allowUndoOfArchiveCommand", @NO, @"hideFutureTasks", + @NO, @"closingLastWindowClosesApplication", + @NO, @"hideHiddenTasks", nil]; } return dict; diff --git a/TodoTxtMac/TTMAppDelegate.m b/TodoTxtMac/TTMAppDelegate.m index b938c36..e799c2e 100644 --- a/TodoTxtMac/TTMAppDelegate.m +++ b/TodoTxtMac/TTMAppDelegate.m @@ -70,4 +70,8 @@ - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender { ![[NSUserDefaults standardUserDefaults] boolForKey:@"openDefaultTodoFileOnStartup"]); } +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"closingLastWindowClosesApplication"]; +} + @end diff --git a/TodoTxtMac/TTMDateUtility.h b/TodoTxtMac/TTMDateUtility.h index c10adea..b4f4d15 100644 --- a/TodoTxtMac/TTMDateUtility.h +++ b/TodoTxtMac/TTMDateUtility.h @@ -130,4 +130,6 @@ */ + (NSString*)dateStringFromNaturalLanguageString:(NSString*)string; ++ (NSInteger)daysBetweenDate:(NSDate*)startDate andEndDate:(NSDate*)endDate; + @end diff --git a/TodoTxtMac/TTMDateUtility.m b/TodoTxtMac/TTMDateUtility.m index e66309f..43bb015 100644 --- a/TodoTxtMac/TTMDateUtility.m +++ b/TodoTxtMac/TTMDateUtility.m @@ -45,6 +45,7 @@ */ #import "TTMDateUtility.h" +#import "NSDate+RelativeDates.h" @implementation TTMDateUtility @@ -200,4 +201,11 @@ + (NSString*)dateStringFromNaturalLanguageString:(NSString*)naturalLanguageStrin } } ++ (NSInteger)daysBetweenDate:(NSDate*)startDate andEndDate:(NSDate*)endDate { + NSCalendar *currentCalendar = [NSCalendar currentCalendar]; + NSDateComponents *components = [currentCalendar components:NSCalendarUnitDay fromDate:startDate toDate:endDate options:NSCalendarMatchFirst]; + + return components.day; +} + @end \ No newline at end of file diff --git a/TodoTxtMac/TTMDocument.h b/TodoTxtMac/TTMDocument.h index 57ddc3b..c17a01f 100644 --- a/TodoTxtMac/TTMDocument.h +++ b/TodoTxtMac/TTMDocument.h @@ -55,6 +55,7 @@ #define SORTMENUTAG 4000 #define FILTERMENUTAG 5000 #define STATUSBARMENUITEMTAG 6000 +#define COPYTASKTONEWTASKMENUTAG 7000 typedef enum : NSUInteger { TTMSortOrderInFile, @@ -248,6 +249,12 @@ typedef enum : NSUInteger { */ - (void)addNewTasksFromPasteBoard:(NSPasteboard*)pasteboard; +/*! + * @method copyTaskToNewTask: + * @abstract Copies selected task to new tast text edit box. + */ +- (IBAction)copyTaskToNewTask:(id)sender; + #pragma mark - Update Task Methods /*! diff --git a/TodoTxtMac/TTMDocument.m b/TodoTxtMac/TTMDocument.m index df3ecdb..152710f 100644 --- a/TodoTxtMac/TTMDocument.m +++ b/TodoTxtMac/TTMDocument.m @@ -134,8 +134,6 @@ - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client { return self.customFieldEditor; } - - #pragma mark - File Loading and Saving Methods + (BOOL)autosavesInPlace { @@ -202,27 +200,20 @@ - (IBAction)reloadFile:(id)sender { // retain selected items, because selection is lost when the file/arrayController is reloaded NSArray *taskListSelectedItemsList = [self getTaskListSelections]; - // Save the current filter number. - NSUInteger filterNumber = self.activeFilterPredicateNumber; - - // Remove the current filter. - NSPredicate *tempPredicate = self.searchFieldPredicate; - self.searchFieldPredicate = nil; - [self removeTaskListFilter]; - // Reload the file. NSError *error; [self readFromURL:[self fileURL] ofType:@"TTMDocument" error:&error]; - // Refresh the task list. - [self refreshTaskListWithSave:NO]; - - // Re-apply the filter active before the file was reloaded. - self.searchFieldPredicate = tempPredicate; - [self changeActiveFilterPredicateToPreset:filterNumber]; - // re-set selected items [self setTaskListSelections:taskListSelectedItemsList]; + + [self updateTaskListMetadata]; + + // this section helps suppress messages about the file being modified outside the application + [self updateChangeCount:NSChangeDone]; + [self autosaveWithImplicitCancellability:NO completionHandler:^(NSError *errorOrNil){ + [self updateChangeCount:NSChangeCleared]; + }]; } - (NSArray*)getTaskListSelections { @@ -338,10 +329,8 @@ - (IBAction)moveFocusToNewTaskTextField:(id)sender { } - (void)removeAllTasks { - if ([[self.arrayController arrangedObjects] count] > 0) { - NSRange range = NSMakeRange(0, [[self.arrayController arrangedObjects] count]); - [self.arrayController - removeObjectsAtArrangedObjectIndexes:[NSIndexSet indexSetWithIndexesInRange:range]]; + for (TTMTask *task in self.taskList) { + [self.arrayController removeObject:task]; } } @@ -357,7 +346,7 @@ - (void)addTasksFromArray:(NSArray*)rawTextStrings [self.taskList count] : [[self.arrayController arrangedObjects] count]; for (NSString *rawTextString in rawTextStrings) { - if ([rawTextString length] > 0) { + if (rawTextString.length > 0) { TTMTask *newTask; if (removeAllTasksFirst) { newTask = [[TTMTask alloc] @@ -409,7 +398,10 @@ - (IBAction)addNewTask:(id)sender { // Optionally move focus to the task list depending on the user setting. if ([[NSUserDefaults standardUserDefaults] boolForKey:@"moveToTaskListAfterTaskCreation"]) { - [self tabFromTextFieldToTaskList]; + if ([self.arrayController.selectedObjects containsObject:newTask]) { + [self tabFromTextFieldToTaskList]; + [self.tableView scrollRowToVisible:self.tableView.selectedRow]; + } } } @@ -456,6 +448,17 @@ - (void)addNewTasksFromPasteBoard:(NSPasteboard*)pasteboard { [self refreshTaskListWithSave:YES]; } +- (IBAction)copyTaskToNewTask:(id)sender { + // cancel if multiple rows are selected + if ([[self.arrayController selectedObjects] count] != 1) { + return; + } + + TTMTask *task = [[self.arrayController selectedObjects] objectAtIndex:0]; + [self.textField setStringValue:task.rawText]; + [self moveFocusToNewTaskTextField:self]; +} + #pragma mark - Update Task Methods - (void)refreshTaskListWithSave:(BOOL)saveToFile { @@ -513,31 +516,86 @@ - (void)finalizeUpdateSelectedTask:(NSString*)rawText { NSArray *newTasks = [[NSArray alloc] initWithArray:[self.arrayController selectedObjects] copyItems:YES]; + NSMutableArray *newTaskStrings = [[NSMutableArray alloc] init]; + BOOL taskWasCompleted = NO; + BOOL recurringTasksWereCreated = NO; + BOOL prependDate = [[NSUserDefaults standardUserDefaults] boolForKey:@"prependDateOnNewTasks"]; + + for (TTMTask *task in newTasks) { + // if task is being marked complete... + if (task.isCompleted) { + taskWasCompleted = YES; + } + if (task.isCompleted && task.isRecurring) { + TTMTask *newTaskBase = [task copy]; + [newTaskBase markIncomplete]; + TTMTask *newTask = [newTaskBase newRecurringTask]; + if (newTask != nil) { + recurringTasksWereCreated = YES; + if (prependDate) { + [newTask removeCreationDate]; + } + [newTaskStrings addObject:newTask.rawText]; + } + } + } + [[self.undoManager prepareWithInvocationTarget:self] replaceTasks:newTasks withTasks:self.originalTasks]; [self.undoManager setActionName:NSLocalizedString(@"Edit Task", @"Undo Edit Task")]; self.originalTasks = nil; - [self refreshTaskListWithSave:YES]; + + if (taskWasCompleted && [[NSUserDefaults standardUserDefaults] integerForKey:@"archiveTasksUponCompletion"]) { + [self archiveCompletedTasks:self]; + } else { + [self refreshTaskListWithSave:YES]; + } + + if (recurringTasksWereCreated) { + [self addTasksFromArray:newTaskStrings removeAllTasksFirst:NO undoActionName:NSLocalizedString(@"Add Recurring Task", @"")]; + } } - (IBAction)toggleTaskCompletion:(id)sender { NSArray *oldTasks = [[NSArray alloc] initWithArray:[self.arrayController selectedObjects] copyItems:YES]; NSMutableArray *newTasks = [[NSMutableArray alloc] init]; - + NSMutableArray *newTaskStrings = [[NSMutableArray alloc] init]; + + BOOL recurringTasksWereCreated = NO; + BOOL prependDate = [[NSUserDefaults standardUserDefaults] boolForKey:@"prependDateOnNewTasks"]; + for (TTMTask *task in [self.arrayController selectedObjects]) { + // if task is being marked complete... + if (!task.isCompleted) { + if (task.isRecurring) { + TTMTask *newTask = [task newRecurringTask]; + if (newTask != nil) { + if (prependDate) { + [newTask removeCreationDate]; + } + [newTaskStrings addObject:newTask.rawText]; + recurringTasksWereCreated = YES; + } + } + } + [task toggleCompletionStatus]; [newTasks addObject:[task copy]]; } [[self.undoManager prepareWithInvocationTarget:self] replaceTasks:newTasks withTasks:oldTasks]; [self.undoManager setActionName:NSLocalizedString(@"Toggle Completion", @"Undo Toggle Completion")]; - + if ([[NSUserDefaults standardUserDefaults] integerForKey:@"archiveTasksUponCompletion"]) { [self archiveCompletedTasks:self]; } else { [self refreshTaskListWithSave:YES]; } + + if (recurringTasksWereCreated) { + [self addTasksFromArray:newTaskStrings removeAllTasksFirst:NO undoActionName:NSLocalizedString(@"Add Recurring Tasks", @"")]; + } } - (IBAction)deleteSelectedTasks:(id)sender { @@ -1256,6 +1314,14 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { [menuItem setTitle:@"Show Status Bar"]; } } + // Toggle copy task to new task menu item. + if (menuItem.tag == COPYTASKTONEWTASKMENUTAG) { + NSInteger selectedCount = [[self.arrayController selectedObjects] count]; + BOOL enabled = (selectedCount == 1); + [menuItem setEnabled:enabled]; + return enabled; + } + return [super validateMenuItem:menuItem]; } diff --git a/TodoTxtMac/TTMDocumentStatusBarText.h b/TodoTxtMac/TTMDocumentStatusBarText.h index d50776f..946a259 100644 --- a/TodoTxtMac/TTMDocumentStatusBarText.h +++ b/TodoTxtMac/TTMDocumentStatusBarText.h @@ -56,6 +56,7 @@ extern NSString* const TTMAllIncompleteTaskCount; extern NSString* const TTMAllDueTodayTaskCount; extern NSString* const TTMAllOverdueTaskCount; extern NSString* const TTMAllNotDueTaskCount; +extern NSString* const TTMAllNoDueDateTaskCount; extern NSString* const TTMAllProjectsCount; extern NSString* const TTMAllContextsCount; extern NSString* const TTMAllPrioritiesCount; @@ -67,6 +68,7 @@ extern NSString* const TTMShownIncompleteTaskCount; extern NSString* const TTMShownDueTodayTaskCount; extern NSString* const TTMShownOverdueTaskCount; extern NSString* const TTMShownNotDueTaskCount; +extern NSString* const TTMShownNoDueDateTaskCount; extern NSString* const TTMShownProjectsCount; extern NSString* const TTMShownContextsCount; extern NSString* const TTMShownPrioritiesCount; @@ -75,6 +77,7 @@ extern NSString* const TTMActiveSortNumber; extern NSString* const TTMActiveSortName; extern NSString* const TTMSelectedTaskCount; extern NSString* const TTMHideFutureTasks; +extern NSString* const TTMHideHiddenTasks; @property (nonatomic, retain) TTMDocument *document; @property (nonatomic) NSString *format; diff --git a/TodoTxtMac/TTMDocumentStatusBarText.m b/TodoTxtMac/TTMDocumentStatusBarText.m index 03680cb..584ce7a 100644 --- a/TodoTxtMac/TTMDocumentStatusBarText.m +++ b/TodoTxtMac/TTMDocumentStatusBarText.m @@ -57,6 +57,7 @@ @implementation TTMDocumentStatusBarText NSString* const TTMAllDueTodayTaskCount = @"{All Due Today}"; NSString* const TTMAllOverdueTaskCount = @"{All Overdue}"; NSString* const TTMAllNotDueTaskCount = @"{All Not Due}"; +NSString* const TTMAllNoDueDateTaskCount = @"{All No Due Date}"; NSString* const TTMAllProjectsCount = @"{All Projects}"; NSString* const TTMAllContextsCount = @"{All Contexts}"; NSString* const TTMAllPrioritiesCount = @"{All Priorities}"; @@ -66,6 +67,7 @@ @implementation TTMDocumentStatusBarText NSString* const TTMShownDueTodayTaskCount = @"{Shown Due Today}"; NSString* const TTMShownOverdueTaskCount = @"{Shown Overdue}"; NSString* const TTMShownNotDueTaskCount = @"{Shown Not Due}"; +NSString* const TTMShownNoDueDateTaskCount = @"{Shown No Due Date}"; NSString* const TTMShownProjectsCount = @"{Shown Projects}"; NSString* const TTMShownContextsCount = @"{Shown Contexts}"; NSString* const TTMShownPrioritiesCount = @"{Shown Priorities}"; @@ -74,6 +76,7 @@ @implementation TTMDocumentStatusBarText NSString* const TTMActiveSortName = @"{Sort Name}"; NSString* const TTMSelectedTaskCount = @"{Selected}"; NSString* const TTMHideFutureTasks = @"{Hide Future Tasks}"; +NSString* const TTMHideHiddenTasks = @"{Hide Hidden Tasks}"; #pragma mark - Init Method @@ -106,6 +109,7 @@ - (NSDictionary*)documentMetadata { TTMAllDueTodayTaskCount : @(self.document.tasklistMetadata.dueTodayTaskCount), TTMAllOverdueTaskCount : @(self.document.tasklistMetadata.overdueTaskCount), TTMAllNotDueTaskCount : @(self.document.tasklistMetadata.notDueTaskCount), + TTMAllNoDueDateTaskCount : @(self.document.tasklistMetadata.noDueDateTaskCount), TTMAllPrioritiesCount : @(self.document.tasklistMetadata.projectsCount), TTMAllProjectsCount : @(self.document.tasklistMetadata.projectsCount), TTMAllContextsCount : @(self.document.tasklistMetadata.contextsCount), @@ -115,6 +119,7 @@ - (NSDictionary*)documentMetadata { TTMShownDueTodayTaskCount : @(self.document.filteredTasklistMetadata.dueTodayTaskCount), TTMShownOverdueTaskCount : @(self.document.filteredTasklistMetadata.overdueTaskCount), TTMShownNotDueTaskCount : @(self.document.filteredTasklistMetadata.notDueTaskCount), + TTMShownNoDueDateTaskCount : @(self.document.filteredTasklistMetadata.noDueDateTaskCount), TTMShownPrioritiesCount : @(self.document.filteredTasklistMetadata.projectsCount), TTMShownProjectsCount : @(self.document.filteredTasklistMetadata.projectsCount), TTMShownContextsCount : @(self.document.filteredTasklistMetadata.contextsCount), @@ -122,7 +127,8 @@ - (NSDictionary*)documentMetadata { TTMActiveSortNumber : @(self.document.activeSortType), TTMActiveSortName : [sortNames objectForKey:@(self.document.activeSortType)], TTMSelectedTaskCount : @(self.document.arrayController.selectionIndexes.count), - TTMHideFutureTasks : [self hideFutureTasks] + TTMHideFutureTasks : [self hideFutureTasks], + TTMHideHiddenTasks : [self hideHiddenTasks] }; } @@ -134,6 +140,14 @@ - (NSString*)hideFutureTasks { } } +- (NSString*)hideHiddenTasks { + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"hideHiddenTasks"]) { + return NSLocalizedString(@"Yes", ""); + } else { + return NSLocalizedString(@"No", ""); + } +} + #pragma mark - Output/Property Methods - (NSString*)statusBarText { @@ -156,6 +170,7 @@ + (NSArray*)availableTags { TTMAllDueTodayTaskCount, TTMAllOverdueTaskCount, TTMAllNotDueTaskCount, + TTMAllNoDueDateTaskCount, TTMAllPrioritiesCount, TTMAllProjectsCount, TTMAllContextsCount, @@ -165,6 +180,7 @@ + (NSArray*)availableTags { TTMShownDueTodayTaskCount, TTMShownOverdueTaskCount, TTMShownNotDueTaskCount, + TTMShownNoDueDateTaskCount, TTMShownPrioritiesCount, TTMShownProjectsCount, TTMShownContextsCount, @@ -172,7 +188,8 @@ + (NSArray*)availableTags { TTMActiveSortNumber, TTMActiveSortName, TTMSelectedTaskCount, - TTMHideFutureTasks + TTMHideFutureTasks, + TTMHideHiddenTasks ]; } diff --git a/TodoTxtMac/TTMFilterPredicates.h b/TodoTxtMac/TTMFilterPredicates.h index 64849e1..810a8b8 100644 --- a/TodoTxtMac/TTMFilterPredicates.h +++ b/TodoTxtMac/TTMFilterPredicates.h @@ -63,18 +63,17 @@ */ + (NSData*)defaultFilterPredicateData; -/*! - * @method hideFutureTasksFilterPredicate: - * @abstract This method returns a filter predicate for use with the "hide future tasks" option. - */ -+ (NSPredicate*)hideFutureTasksFilterPredicate; - /*! * @method hideFutureTasksFilterSubPredicate: * @abstract This method returns a filter predicate for use with the "hide future tasks" option. */ + (NSPredicate*)hideFutureTasksFilterSubPredicate; +/*! + * @method hideHiddenTasksFilterSubPredicate: + * @abstract This method returns a filter predicate for use with the "hide hidden tasks" option. + */ ++ (NSPredicate*)hideHiddenTasksFilterSubPredicate; /*! * @method noFilterPredicate: diff --git a/TodoTxtMac/TTMFilterPredicates.m b/TodoTxtMac/TTMFilterPredicates.m index ddf23ae..c19712c 100644 --- a/TodoTxtMac/TTMFilterPredicates.m +++ b/TodoTxtMac/TTMFilterPredicates.m @@ -81,29 +81,38 @@ + (NSData*)defaultFilterPredicateData { } + (NSPredicate*)noFilterPredicate { - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"hideFutureTasks"]) { - return [self hideFutureTasksFilterPredicate]; - } else { - return nil; - } + return [self filterPredicateWithHideOptions]; } -+ (NSPredicate*)hideFutureTasksFilterPredicate { - static NSPredicate *defaultPredicate = nil; - if (defaultPredicate == nil) { - NSPredicate *defaultSubPredicate = [self hideFutureTasksFilterSubPredicate]; - - NSArray *subPredicates = @[defaultSubPredicate]; - defaultPredicate = [NSCompoundPredicate - andPredicateWithSubpredicates:subPredicates]; ++ (BOOL)hideFutureTasks { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideFutureTasks"]; +} + ++ (BOOL)hideHiddenTasks { + return [[NSUserDefaults standardUserDefaults] boolForKey:@"hideHiddenTasks"]; +} + + ++ (NSPredicate*)filterPredicateWithHideOptions { + NSMutableArray *subPredicates = [[NSMutableArray alloc] init]; + if ([self hideFutureTasks]) { + [subPredicates addObject:[self hideFutureTasksFilterSubPredicate]]; } - return defaultPredicate; + if ([self hideHiddenTasks]) { + [subPredicates addObject:[self hideHiddenTasksFilterSubPredicate]]; + } + + return [NSCompoundPredicate andPredicateWithSubpredicates:subPredicates]; } + (NSPredicate*)hideFutureTasksFilterSubPredicate { return [NSPredicate predicateWithFormat:@"thresholdState != %d", (int)ThresholdAfterToday]; } ++ (NSPredicate*)hideHiddenTasksFilterSubPredicate { + return [NSPredicate predicateWithFormat:@"isHidden == 0"]; +} + #pragma mark - Set Filter Predicate Methods + (void)setFilterPredicate:(NSPredicate*)predicate toUserDefaultsKey:(NSString*)key { @@ -127,20 +136,19 @@ + (NSPredicate*)getFilterPredicateFromUserDefaultsKey:(NSString*)key { } + (NSPredicate*)getFilterPredicateFromPresetNumber:(NSUInteger)presetNumber { - if (presetNumber == 0) { - return [self noFilterPredicate]; - } - if (presetNumber > 9) { + if (presetNumber < 1 || presetNumber > 9) { return [self noFilterPredicate]; } - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"hideFutureTasks"]) { - NSPredicate *filterPresetSubPredicate = [self getFilterPredicateFromUserDefaultsKey:[self keyFromPresetNumber:presetNumber]]; - NSPredicate *hideFutureTasksSubPredicate = [self hideFutureTasksFilterSubPredicate]; - NSArray *subPredicates = @[filterPresetSubPredicate, hideFutureTasksSubPredicate]; + NSPredicate *defaultPredicate = [self filterPredicateWithHideOptions]; + + NSPredicate *filterPresetSubPredicate = [self getFilterPredicateFromUserDefaultsKey:[self keyFromPresetNumber:presetNumber]]; + + if ([self hideFutureTasks] || [self hideHiddenTasks]) { + NSArray *subPredicates = @[defaultPredicate, filterPresetSubPredicate]; return [NSCompoundPredicate andPredicateWithSubpredicates:subPredicates]; } else { - return [self getFilterPredicateFromUserDefaultsKey:[self keyFromPresetNumber:presetNumber]]; + return filterPresetSubPredicate; } } @@ -152,14 +160,7 @@ + (NSString*)keyFromPresetNumber:(NSUInteger)presetNumber { } + (NSPredicate*)activeFilterPredicate { - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"hideFutureTasks"]) { - NSPredicate *filterPresetSubPredicate = [self getFilterPredicateFromUserDefaultsKey:@"activeFilterPredicate"]; - NSPredicate *hideFutureTasksSubPredicate = [self hideFutureTasksFilterSubPredicate]; - NSArray *subPredicates = @[filterPresetSubPredicate, hideFutureTasksSubPredicate]; - return [NSCompoundPredicate andPredicateWithSubpredicates:subPredicates]; - } else { - return [self getFilterPredicateFromUserDefaultsKey:@"activeFilterPredicate"]; - } + return [self getFilterPredicateFromPresetNumber:[self activeFilterPredicatePresetNumber]]; } + (void)setActiveFilterPredicatePresetNumber:(NSUInteger)presetNumber { diff --git a/TodoTxtMac/TTMFilters.xib b/TodoTxtMac/TTMFilters.xib index 0c68415..0f72473 100644 --- a/TodoTxtMac/TTMFilters.xib +++ b/TodoTxtMac/TTMFilters.xib @@ -3,6 +3,7 @@ + @@ -24,4500 +25,4768 @@ - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + rawText + + + + + + + + + + rawText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + projects + + + + + + + + + + projects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contexts + + + + + + + + + + contexts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + priorityText + + + + + + + + + + priorityText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dueDate + + + + + + + + + dueDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completionDate + + + + + + + + + completionDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + creationDate + + + + + + + + + creationDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thresholdDate + + + + + + + + + thresholdDate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + completed + + + + + + + + + completed + + + + + + + + + + + + + + + + + dueState + + + + + + + + + dueState + + + + + + + + + + + + + + + + + + + + thresholdState + + + + + + + + + thresholdState + + + + + + + + + + + + + + + + + + + + isHidden + + + + + + + + + isHidden + + + + + + + + + + + + + + + + + + NSKeyedUnarchiveFromData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawText - - - - - - - - - - rawText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - projects - - - - - - - - - - projects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - contexts - - - - - - - - - - contexts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - priorityText - - - - - - - - - - priorityText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dueDate - - - - - - - - - dueDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completionDate - - - - - - - - - completionDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - creationDate - - - - - - - - - creationDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - thresholdDate - - - - - - - - - thresholdDate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - completed - - - - - - - - - completed - - - - - - - - - - - - - - - - - dueState - - - - - - - - - dueState - - - - - - - - - - - - - - - - - - - - thresholdState - - - - - - - - - thresholdState - - - - - - - - - - - - - - - - - - - - - NSKeyedUnarchiveFromData - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + - - - - diff --git a/TodoTxtMac/TTMPredicateEditorCompletedRowTemplate.m b/TodoTxtMac/TTMPredicateEditorCompletedRowTemplate.m index 804e9c1..0b94733 100644 --- a/TodoTxtMac/TTMPredicateEditorCompletedRowTemplate.m +++ b/TodoTxtMac/TTMPredicateEditorCompletedRowTemplate.m @@ -61,8 +61,16 @@ - (NSPopUpButton*)keypathPopUp { keyEquivalent:@""]; [menuItem setRepresentedObject:[NSExpression expressionForKeyPath:@"completed"]]; [menuItem setEnabled:YES]; - + + NSMenuItem *menuItem2 = [[NSMenuItem alloc] + initWithTitle:@"hidden" + action:nil + keyEquivalent:@""]; + [menuItem2 setRepresentedObject:[NSExpression expressionForKeyPath:@"isHidden"]]; + [menuItem2 setEnabled:YES]; + [keypathMenu addItem:menuItem]; + [keypathMenu addItem:menuItem2]; _keypathPopUp = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO]; [_keypathPopUp setMenu:keypathMenu]; diff --git a/TodoTxtMac/TTMPredicateEditorDueRowTemplate.m b/TodoTxtMac/TTMPredicateEditorDueRowTemplate.m index 7518ce6..1afdc86 100644 --- a/TodoTxtMac/TTMPredicateEditorDueRowTemplate.m +++ b/TodoTxtMac/TTMPredicateEditorDueRowTemplate.m @@ -93,11 +93,19 @@ - (NSPopUpButton*)dueStatePopUp { [notDueItem setRepresentedObject:[NSExpression expressionForConstantValue:@(NotDue)]]; [notDueItem setEnabled:YES]; [notDueItem setTag:(long)NotDue]; + + NSMenuItem *noDueDateItem = [[NSMenuItem alloc] initWithTitle:@"no due date" + action:nil + keyEquivalent:@""]; + [noDueDateItem setRepresentedObject:[NSExpression expressionForConstantValue:@(NoDueDate)]]; + [noDueDateItem setEnabled:YES]; + [noDueDateItem setTag:(long)NoDueDate]; NSMenu *dueStateMenu = [[NSMenu alloc] initWithTitle:@"Due State"]; [dueStateMenu addItem:dueTodayItem]; [dueStateMenu addItem:overdueItem]; [dueStateMenu addItem:notDueItem]; + [dueStateMenu addItem:noDueDateItem]; _dueStatePopUp = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO]; [_dueStatePopUp setMenu:dueStateMenu]; diff --git a/TodoTxtMac/TTMPredicateEditorHiddenRowTemplate.h b/TodoTxtMac/TTMPredicateEditorHiddenRowTemplate.h new file mode 100644 index 0000000..6d785dc --- /dev/null +++ b/TodoTxtMac/TTMPredicateEditorHiddenRowTemplate.h @@ -0,0 +1,54 @@ +/** + * @author Michael Descy + * @copyright 2014-2015 Michael Descy + * @discussion Dual-licensed under the GNU General Public License and the MIT License + * + * + * + * @license GNU General Public License http://www.gnu.org/licenses/gpl.html + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * + * + * @license The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#import + +@interface TTMPredicateEditorHiddenRowTemplate : NSPredicateEditorRowTemplate + +@property (nonatomic, retain) NSPopUpButton *keypathPopUp; +@property (nonatomic, retain) NSPopUpButton *boolPopUp; + +@end diff --git a/TodoTxtMac/TTMPredicateEditorHiddenRowTemplate.m b/TodoTxtMac/TTMPredicateEditorHiddenRowTemplate.m new file mode 100644 index 0000000..eb1a324 --- /dev/null +++ b/TodoTxtMac/TTMPredicateEditorHiddenRowTemplate.m @@ -0,0 +1,122 @@ +/** + * @author Michael Descy + * @copyright 2014-2015 Michael Descy + * @discussion Dual-licensed under the GNU General Public License and the MIT License + * + * + * + * @license GNU General Public License http://www.gnu.org/licenses/gpl.html + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * + * + * @license The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#import "TTMPredicateEditorHiddenRowTemplate.h" + +@implementation TTMPredicateEditorHiddenRowTemplate + +#pragma mark - Class Property Getters + +- (NSPopUpButton*)keypathPopUp { + if(!_keypathPopUp) { + NSMenu *keypathMenu = [[NSMenu alloc] + initWithTitle:@"hidden menu"]; + + NSMenuItem *menuItem = [[NSMenuItem alloc] + initWithTitle:@"hidden" + action:nil + keyEquivalent:@""]; + [menuItem setRepresentedObject:[NSExpression expressionForKeyPath:@"isHidden"]]; + [menuItem setEnabled:YES]; + + [keypathMenu addItem:menuItem]; + + _keypathPopUp = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO]; + [_keypathPopUp setMenu:keypathMenu]; + } + return _keypathPopUp; +} + +- (NSPopUpButton*)boolPopUp { + if (!_boolPopUp) { + NSMenuItem *yesItem = [[NSMenuItem alloc] initWithTitle:@"Yes" action:nil keyEquivalent:@""]; + [yesItem setRepresentedObject:[NSExpression expressionForConstantValue:@YES]]; + [yesItem setEnabled:YES]; + [yesItem setTag:1]; + + NSMenuItem *noItem = [[NSMenuItem alloc] initWithTitle:@"No" action:nil keyEquivalent:@""]; + [noItem setRepresentedObject:[NSExpression expressionForConstantValue:@NO]]; + [noItem setEnabled:YES]; + [noItem setTag:0]; + + NSMenu *boolMenu = [[NSMenu alloc] initWithTitle:@"Yes/No"]; + [boolMenu addItem:yesItem]; + [boolMenu addItem:noItem]; + + _boolPopUp = [[NSPopUpButton alloc] initWithFrame:NSZeroRect pullsDown:NO]; + [_boolPopUp setMenu:boolMenu]; + } + return _boolPopUp; +} + +#pragma mark - NSPredicateEditorRowTemplate Method Overrides + +- (NSArray*)templateViews { + NSMutableArray *newTemplateViews = [[super templateViews] mutableCopy]; + [newTemplateViews replaceObjectAtIndex:0 withObject:self.keypathPopUp]; + [newTemplateViews replaceObjectAtIndex:2 withObject:self.boolPopUp]; + return newTemplateViews; +} + +- (void)setPredicate:(NSPredicate*)predicate { + id rightValue = [[(NSComparisonPredicate*)predicate rightExpression] constantValue]; + if ([rightValue isKindOfClass:[NSNumber class]]) { + [self.boolPopUp selectItemWithTag:[rightValue integerValue]]; + } +} + +- (NSPredicate*)predicateWithSubpredicates:(NSArray*)subpredicates { + NSPredicate *newPredicate = + [NSComparisonPredicate + predicateWithLeftExpression:[[self.keypathPopUp selectedItem] representedObject] + rightExpression:[[self.boolPopUp selectedItem] representedObject] + modifier:NSDirectPredicateModifier + type:NSEqualToPredicateOperatorType + options:0]; + return newPredicate; +} + +@end diff --git a/TodoTxtMac/TTMPreferences.xib b/TodoTxtMac/TTMPreferences.xib index 6ac4dd3..4b044f0 100644 --- a/TodoTxtMac/TTMPreferences.xib +++ b/TodoTxtMac/TTMPreferences.xib @@ -1,8 +1,8 @@ - + - + @@ -50,8 +50,8 @@ - - + + @@ -63,8 +63,8 @@ - - + + @@ -142,7 +142,6 @@ - @@ -157,7 +156,7 @@ - + @@ -169,8 +168,8 @@ - - + + @@ -245,7 +244,6 @@ - @@ -281,16 +279,16 @@ - + - + - + + + + + + + @@ -353,16 +376,15 @@ - - + - + - + @@ -445,20 +467,19 @@ - + - - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + - + diff --git a/TodoTxtMac/TodoTxtMac-Info.plist b/TodoTxtMac/TodoTxtMac-Info.plist index a85d93b..30a198e 100644 --- a/TodoTxtMac/TodoTxtMac-Info.plist +++ b/TodoTxtMac/TodoTxtMac-Info.plist @@ -38,11 +38,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.1.1 + 2.2.0 CFBundleSignature ???? CFBundleVersion - 2010 + 2020 LSApplicationCategoryType public.app-category.productivity LSMinimumSystemVersion diff --git a/TodoTxtMacTests/TTMTask_DueState_UnitTests.m b/TodoTxtMacTests/TTMTask_DueState_UnitTests.m index c72ca42..f3b6d03 100644 --- a/TodoTxtMacTests/TTMTask_DueState_UnitTests.m +++ b/TodoTxtMacTests/TTMTask_DueState_UnitTests.m @@ -68,10 +68,10 @@ - (void)tearDown { [super tearDown]; } -- (void)test_DueState_WhenTaskContainsNoDueDate_ShouldBeNotDue { +- (void)test_DueState_WhenTaskContainsNoDueDate_ShouldBeNoDueDate { NSString *rawText = @"(A) test task"; TTMTask *task = [[TTMTask alloc] initWithRawText:rawText withTaskId:self.taskId]; - XCTAssertEqual(NotDue, task.dueState); + XCTAssertEqual(NoDueDate, task.dueState); } - (void)test_DueState_WhenTaskContainsFutureDueDate_ShouldBeNotDue { diff --git a/TodoTxtMacTests/TTMTask_IsHidden_UnitTests.m b/TodoTxtMacTests/TTMTask_IsHidden_UnitTests.m new file mode 100644 index 0000000..19e8718 --- /dev/null +++ b/TodoTxtMacTests/TTMTask_IsHidden_UnitTests.m @@ -0,0 +1,101 @@ +/** + * @author Michael Descy + * @copyright 2014-2016 Michael Descy + * @discussion Dual-licensed under the GNU General Public License and the MIT License + * + * + * + * @license GNU General Public License http://www.gnu.org/licenses/gpl.html + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * + * + * + * @license The MIT License (MIT) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#import +#import +#import "TTMTask.h" + +@interface TTMTask_IsHidden_UnitTests : XCTestCase + +@property NSString *rawText; +@property NSUInteger taskId; + +@end + +@implementation TTMTask_IsHidden_UnitTests + +- (void)setUp { + [super setUp]; + self.taskId = 10; +} + +- (void)tearDown { + [super tearDown]; +} + +- (void)test_IsHidden_WhenHidden_ShouldBeTrue_Case1 { + NSString *rawText = @"h:1 x 2020-01-31 pick up groceries due:2020-01-31"; + TTMTask *task = [[TTMTask alloc] initWithRawText:rawText withTaskId:self.taskId]; + XCTAssertTrue(task.isHidden); +} + +- (void)test_IsHidden_WhenHidden_ShouldBeTrue_Case2 { + NSString *rawText = @"x 2020-01-31 h:1 pick up groceries due:2020-01-31"; + TTMTask *task = [[TTMTask alloc] initWithRawText:rawText withTaskId:self.taskId]; + XCTAssertTrue(task.isHidden); +} + +- (void)test_IsHidden_WhenHidden_ShouldBeTrue_Case3 { + NSString *rawText = @"h:1 x 2020-01-31 pick up groceries due:2020-01-31 h:1"; + TTMTask *task = [[TTMTask alloc] initWithRawText:rawText withTaskId:self.taskId]; + XCTAssertTrue(task.isHidden); +} + +- (void)test_IsHidden_WhenHidden_ShouldBeFalse_Case1 { + NSString *rawText = @"x 2020-01-31 pick up groceries due:2020-01-31"; + TTMTask *task = [[TTMTask alloc] initWithRawText:rawText withTaskId:self.taskId]; + XCTAssertFalse(task.isHidden); +} + +- (void)test_IsHidden_WhenHidden_ShouldBeFalse_Case2 { + NSString *rawText = @"h:1x 2020-01-31 pick up groceries due:2020-01-31"; + TTMTask *task = [[TTMTask alloc] initWithRawText:rawText withTaskId:self.taskId]; + XCTAssertFalse(task.isHidden); +} + +@end + + diff --git a/TodoTxtMacTests/TTMTasklistMetadata_UnitTests.m b/TodoTxtMacTests/TTMTasklistMetadata_UnitTests.m index 5a971e3..429fb7b 100644 --- a/TodoTxtMacTests/TTMTasklistMetadata_UnitTests.m +++ b/TodoTxtMacTests/TTMTasklistMetadata_UnitTests.m @@ -71,12 +71,17 @@ - (void)testDueTodayTaskCount - (void)testOverdueTaskCount { - XCTAssertEqual(self.tasklistMetadata.overdueTaskCount, 1); + XCTAssertEqual(self.tasklistMetadata.overdueTaskCount, 2); } - (void)testNotDueTaskCount { - XCTAssertEqual(self.tasklistMetadata.notDueTaskCount, 4); + XCTAssertEqual(self.tasklistMetadata.notDueTaskCount, 2); +} + +- (void)testNoDueDateTaskCount +{ + XCTAssertEqual(self.tasklistMetadata.noDueDateTaskCount, 1); } - (void)testProjectsArray