Permalink
Browse files

Import MobileOrg source tree

  • Loading branch information...
1 parent 677c795 commit 85eaca300f396c51d89095928da0b50784426fd9 @richard richard committed Oct 11, 2009
Showing with 14,088 additions and 0 deletions.
  1. +6 −0 .gitignore
  2. +42 −0 Classes/Capture/NewNoteController.h
  3. +228 −0 Classes/Capture/NewNoteController.m
  4. +40 −0 Classes/Capture/NoteListController.h
  5. +283 −0 Classes/Capture/NoteListController.m
  6. +36 −0 Classes/DataModel/FileChecksum.h
  7. +31 −0 Classes/DataModel/FileChecksum.m
  8. +40 −0 Classes/DataModel/LocalEditAction.h
  9. +35 −0 Classes/DataModel/LocalEditAction.m
  10. +80 −0 Classes/DataModel/Node.h
  11. +539 −0 Classes/DataModel/Node.m
  12. +44 −0 Classes/DataModel/Note.h
  13. +102 −0 Classes/DataModel/Note.m
  14. +79 −0 Classes/MobileOrgAppDelegate.h
  15. +275 −0 Classes/MobileOrgAppDelegate.m
  16. +69 −0 Classes/Outline/ActionMenuController.h
  17. +286 −0 Classes/Outline/ActionMenuController.m
  18. +39 −0 Classes/Outline/DetailsViewController.h
  19. +494 −0 Classes/Outline/DetailsViewController.m
  20. +42 −0 Classes/Outline/DocumentViewController.h
  21. +194 −0 Classes/Outline/DocumentViewController.m
  22. +51 −0 Classes/Outline/NodeTextEditController.h
  23. +253 −0 Classes/Outline/NodeTextEditController.m
  24. +37 −0 Classes/Outline/OutlineTableView.h
  25. +107 −0 Classes/Outline/OutlineTableView.m
  26. +64 −0 Classes/Outline/OutlineViewController.h
  27. +415 −0 Classes/Outline/OutlineViewController.m
  28. +40 −0 Classes/Outline/PriorityEditController.h
  29. +146 −0 Classes/Outline/PriorityEditController.m
  30. +44 −0 Classes/Outline/TagEditController.h
  31. +292 −0 Classes/Outline/TagEditController.m
  32. +40 −0 Classes/Outline/TodoStateEditController.h
  33. +209 −0 Classes/Outline/TodoStateEditController.m
  34. +34 −0 Classes/Parsing/ChecksumFileParser.h
  35. +115 −0 Classes/Parsing/ChecksumFileParser.m
  36. +47 −0 Classes/Parsing/EditEntity.h
  37. +47 −0 Classes/Parsing/EditEntity.m
  38. +40 −0 Classes/Parsing/EditsFileParser.h
  39. +272 −0 Classes/Parsing/EditsFileParser.m
  40. +39 −0 Classes/Parsing/OrgFileParser.h
  41. +470 −0 Classes/Parsing/OrgFileParser.m
  42. +40 −0 Classes/Search/SearchController.h
  43. +290 −0 Classes/Search/SearchController.m
  44. +41 −0 Classes/Settings/OutlineState.h
  45. +51 −0 Classes/Settings/OutlineState.m
  46. +52 −0 Classes/Settings/SessionManager.h
  47. +139 −0 Classes/Settings/SessionManager.m
  48. +66 −0 Classes/Settings/Settings.h
  49. +285 −0 Classes/Settings/Settings.m
  50. +31 −0 Classes/Settings/SettingsController.h
  51. +362 −0 Classes/Settings/SettingsController.m
  52. +47 −0 Classes/Status/StatusViewController.h
  53. +215 −0 Classes/Status/StatusViewController.m
  54. +67 −0 Classes/Sync/SyncManager.h
  55. +821 −0 Classes/Sync/SyncManager.m
  56. +51 −0 Classes/Sync/TransferContext.h
  57. +54 −0 Classes/Sync/TransferContext.m
  58. +47 −0 Classes/Sync/TransferManager.h
  59. +325 −0 Classes/Sync/TransferManager.m
  60. +34 −0 Classes/Sync/TransferManagerDelegate.h
  61. +88 −0 Classes/ThirdParty/Reachability/Reachability.h
  62. +274 −0 Classes/ThirdParty/Reachability/Reachability.m
  63. +220 −0 Classes/ThirdParty/RegexKitLite/RegexKitLite.h
  64. +1,634 −0 Classes/ThirdParty/RegexKitLite/RegexKitLite.m
  65. +85 −0 Classes/Utilities/DataUtils.h
  66. +704 −0 Classes/Utilities/DataUtils.m
  67. +35 −0 Classes/Utilities/GlobalUtils.h
  68. +51 −0 Classes/Utilities/GlobalUtils.m
  69. +34 −0 Classes/Utilities/RoundedLabel.h
  70. +99 −0 Classes/Utilities/RoundedLabel.m
  71. +31 −0 Classes/Utilities/StatusUtils.h
  72. +31 −0 Classes/Utilities/StatusUtils.m
  73. +33 −0 Classes/Utilities/TableUtils.h
  74. +258 −0 Classes/Utilities/TableUtils.m
  75. +8 −0 Entitlements.plist
  76. BIN Icon-Small.png
  77. BIN Icon-beta.png
  78. BIN Icon-debug.png
  79. BIN Icon.png
  80. +339 −0 LICENSE.txt
  81. +200 −0 MainWindow.xib
  82. +32 −0 MobileOrg-Info-AdHoc.plist
  83. +32 −0 MobileOrg-Info-Debug.plist
  84. +32 −0 MobileOrg-Info.plist
  85. BIN MobileOrg.xcdatamodel/elements
  86. BIN MobileOrg.xcdatamodel/layout
  87. +756 −0 MobileOrg.xcodeproj/project.pbxproj
  88. +16 −0 MobileOrg_Prefix.pch
  89. BIN Other/Icon.psd
  90. +100 −0 Resources/Css/DocumentView.css
  91. BIN Resources/Images/AlertTextField.png
  92. BIN Resources/Images/Default.png
  93. BIN Resources/Images/back.png
  94. BIN Resources/Images/capture.png
  95. BIN Resources/Images/children.png
  96. BIN Resources/Images/down.png
  97. BIN Resources/Images/flag.png
  98. BIN Resources/Images/flagged.png
  99. BIN Resources/Images/forward.png
  100. BIN Resources/Images/home.png
  101. BIN Resources/Images/inbox.png
  102. BIN Resources/Images/noflag.png
  103. BIN Resources/Images/note_entry.png
  104. BIN Resources/Images/outline.png
  105. BIN Resources/Images/search.png
  106. BIN Resources/Images/settings.png
  107. BIN Resources/Images/table_gray.png
  108. BIN Resources/Images/up.png
  109. +34 −0 Resources/Javascript/DocumentView.js
  110. +3 −0 Scripts/bump_build.sh
  111. +3 −0 Scripts/set_version.sh
  112. +4 −0 Scripts/what_version.sh
  113. +31 −0 main.m
  114. +78 −0 setup_neon.sh
  115. +79 −0 setup_openssl.sh
View
@@ -0,0 +1,6 @@
+build
+*.pbxuser
+*.mode1v3
+*.perspectivev3
+.DS_Store
+vendor-libs
@@ -0,0 +1,42 @@
+//
+// NewNoteController.h
+// MobileOrg
+//
+// Created by Richard Moreland on 10/6/09.
+// Copyright 2009 Richard Moreland.
+//
+// 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 2
+// 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, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+#import <Foundation/Foundation.h>
+
+@class Note;
+
+@interface NewNoteController : UIViewController <UITextViewDelegate> {
+ UITextView *textField;
+ UIBarButtonItem *doneButton;
+ UIBarButtonItem *addButton;
+ Note *note;
+ bool keyboardShown;
+ bool showKeyboardOnLoad;
+}
+
+@property (nonatomic, retain) UITextView *textField;
+@property (nonatomic, retain) UIBarButtonItem *doneButton;
+@property (nonatomic, retain) UIBarButtonItem *addButton;
+@property (nonatomic, retain) Note *note;
+@property (nonatomic) bool showKeyboardOnLoad;
+
+@end
@@ -0,0 +1,228 @@
+//
+// NewNoteController.m
+// MobileOrg
+//
+// Created by Richard Moreland on 10/6/09.
+// Copyright 2009 Richard Moreland.
+//
+// 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 2
+// 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, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+#import "NewNoteController.h"
+#import "Note.h"
+#import "DataUtils.h"
+#import "GlobalUtils.h"
+#import "MobileOrgAppDelegate.h"
+#import "NoteListController.h"
+
+@implementation NewNoteController
+
+@synthesize textField;
+@synthesize note;
+@synthesize doneButton, addButton;
+@synthesize showKeyboardOnLoad;
+
+- (void)save:(bool)giveUpKeyboard {
+ if (!note.text || [note.text compare:textField.text] != NSOrderedSame) {
+ note.text = textField.text;
+ note.createdAt = [NSDate date];
+ note.locallyModified = [NSNumber numberWithBool:true];
+ Save();
+ }
+
+ if (giveUpKeyboard)
+ [textField resignFirstResponder];
+}
+
+- (void)save {
+ [self save:true];
+}
+
+- (void)textViewDidChange:(UITextView *)textView {
+ [self save:false];
+}
+
+- (void)add {
+ [self save:true];
+
+ Note *newNote = (Note*)[NSEntityDescription insertNewObjectForEntityForName:@"Note" inManagedObjectContext:[note managedObjectContext]];
+ [newNote setCreatedAt:[NSDate date]];
+ [newNote setNoteId:UUID()];
+ [newNote setLocallyModified:[NSNumber numberWithBool:true]];
+
+ Save();
+
+ [[AppInstance() noteListController] updateNoteCount];
+ [[AppInstance() noteListController] editNote:newNote withKeyboard:true];
+}
+
+- (void)done {
+}
+
+// Call this method somewhere in your view controller setup code.
+- (void)registerForKeyboardNotifications
+{
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(keyboardWasShown:)
+ name:UIKeyboardDidShowNotification object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(keyboardWasHidden:)
+ name:UIKeyboardDidHideNotification object:nil];
+}
+
+- (void)unregisterForKeyboardNotifications
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:UIKeyboardDidShowNotification object:nil];
+
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:UIKeyboardDidHideNotification object:nil];
+}
+
+// Implement loadView to create a view hierarchy programmatically, without using a nib.
+- (void)loadView {
+ textField = [[UITextView alloc] init];
+ [textField setScrollEnabled:YES];
+ [textField setScrollsToTop:YES];
+ [textField setFont:[UIFont systemFontOfSize:14.0]];
+ [textField setDelegate:self];
+ [self setView:textField];
+}
+
+// Called when the UIKeyboardDidShowNotification is sent.
+- (void)keyboardWasShown:(NSNotification*)aNotification
+{
+ if (keyboardShown)
+ return;
+
+ // Resize the scroll view (which is the root view of the window)
+ switch ([[UIDevice currentDevice] orientation]) {
+ case UIDeviceOrientationLandscapeLeft:
+ case UIDeviceOrientationLandscapeRight:
+ [[self view] setFrame:CGRectMake(0, 0, 480, 135)];
+ break;
+
+ case UIDeviceOrientationUnknown:
+ case UIDeviceOrientationPortrait:
+ case UIDeviceOrientationPortraitUpsideDown:
+ case UIDeviceOrientationFaceUp:
+ case UIDeviceOrientationFaceDown:
+ default:
+ [[self view] setFrame:CGRectMake(0, 0, 320, 220)];
+ break;
+ }
+
+ // Scroll the active text field into view.
+ [textField scrollRangeToVisible:NSMakeRange([textField.text length], 0)];
+
+ keyboardShown = YES;
+
+ self.navigationItem.rightBarButtonItem = doneButton;
+}
+
+
+// Called when the UIKeyboardDidHideNotification is sent
+- (void)keyboardWasHidden:(NSNotification*)aNotification
+{
+ NSDictionary* info = [aNotification userInfo];
+
+ // Get the size of the keyboard.
+ NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];
+ CGSize keyboardSize = [aValue CGRectValue].size;
+
+ // Reset the height of the scroll view to its original value
+ CGRect viewFrame = [[self view] frame];
+ viewFrame.size.height += keyboardSize.height;
+ viewFrame.size.height -= 55;
+ [[self view] setFrame:viewFrame];
+
+ keyboardShown = NO;
+
+ self.navigationItem.rightBarButtonItem = addButton;
+}
+
+// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ [textField setText:[note text]];
+
+ if ([note isFlagEntry]) {
+ if (!note.text || [note.text length] == 0) {
+ self.title = @"New flagging note";
+ [textField becomeFirstResponder];
+ } else {
+ self.title = @"Edit flagging note";
+ }
+ } else {
+ if (!note.text || [note.text length] == 0) {
+ self.title = @"New note";
+ [textField becomeFirstResponder];
+ } else {
+ self.title = @"Edit note";
+ }
+ }
+
+ addButton = [[UIBarButtonItem alloc]
+ initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(add)];
+
+ doneButton = [[UIBarButtonItem alloc]
+ initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(save)];
+
+ if (self.showKeyboardOnLoad) {
+ [textField becomeFirstResponder];
+ self.navigationItem.rightBarButtonItem = doneButton;
+ } else {
+ self.navigationItem.rightBarButtonItem = addButton;
+ }
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return YES;
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
+ [self save:true];
+ [self registerForKeyboardNotifications];
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+ [super viewWillDisappear:animated];
+ [self unregisterForKeyboardNotifications];
+}
+
+- (void)didReceiveMemoryWarning {
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidUnload {
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+- (void)dealloc {
+ [note release];
+ [doneButton release];
+ [addButton release];
+ [textField release];
+ [super dealloc];
+}
+
+@end
@@ -0,0 +1,40 @@
+//
+// NoteListController.h
+// MobileOrg
+//
+// Created by Richard Moreland on 10/6/09.
+// Copyright 2009 Richard Moreland.
+//
+// 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 2
+// 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, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+#import <UIKit/UIKit.h>
+
+@class Note;
+
+@interface NoteListController : UITableViewController {
+ NSMutableArray *notesArray;
+ UIBarButtonItem *addButton;
+ UIBarButtonItem *editButton;
+ UIBarButtonItem *doneButton;
+}
+
+@property (nonatomic, retain) NSMutableArray *notesArray;
+
+- (void)addNote;
+- (void)updateNoteCount;
+- (void)editNote:(Note*)note withKeyboard:(bool)keyboard;
+
+@end
Oops, something went wrong.

0 comments on commit 85eaca3

Please sign in to comment.