<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>design/api_request-and-model.jpg</filename>
    </added>
    <added>
      <filename>design/bulk-update.jpg</filename>
    </added>
    <added>
      <filename>design/mvc-brainstorming-01.jpg</filename>
    </added>
    <added>
      <filename>design/mvc-brainstorming-02.jpg</filename>
    </added>
    <added>
      <filename>design/setting-view.jpg</filename>
    </added>
    <added>
      <filename>design/topmenu-view.jpg</filename>
    </added>
    <added>
      <filename>design/web-db-model.jpg</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -36,5 +36,6 @@
 @property (nonatomic, retain) NSString *estimate;
 
 - (IBAction) save;
+- (void) commitTextFields;
 
 @end</diff>
      <filename>controller/AddTaskViewController.h</filename>
    </modified>
    <modified>
      <diff>@@ -43,6 +43,12 @@ enum {
     self.title = @&quot;Add a Task&quot;;
     self.list = [lists objectAtIndex:0]; // list default: INBOX
     self.priority = @&quot;0&quot;;
+    self.tableView.bounces = NO;
+
+    // footer for scroll
+    UIView *fotterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
+    self.tableView.tableFooterView = fotterView;
+    [fotterView release];
 	}
 	return self;
 }
@@ -71,11 +77,11 @@ enum {
       if (name) {
         name_field.text = name;
       }
-      [cell addSubview:name_field];
+      [cell.contentView addSubview:name_field];
       break;
     case CELL_PRIORITY: {
       cell.label = @&quot;Priority:&quot;;
-      [cell addSubview:priority_segment];
+      [cell.contentView addSubview:priority_segment];
       break;
     }
     case CELL_LIST:
@@ -84,7 +90,7 @@ enum {
       break;
     case CELL_ESTIMATE: {
       cell.label = @&quot;Estimate:&quot;;
-      [cell addSubview:estimate_field];
+      [cell.contentView addSubview:estimate_field];
       break;
     }
     case CELL_LOCATION:
@@ -109,6 +115,10 @@ enum {
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   switch ([indexPath row]) {
+    case CELL_NAME:
+      [self textFieldShouldReturn:estimate_field];
+      [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
+      break;
     case CELL_LIST: {
       ListSelectViewController *ctr = [[[ListSelectViewController alloc] initWithStyle:UITableViewStyleGrouped] autorelease];
       ctr.parent = self;
@@ -118,6 +128,15 @@ enum {
       [[self navigationController] pushViewController:ctr animated:YES];
       break;
     }
+    case CELL_PRIORITY: {
+      [self textFieldShouldReturn:name_field];
+      [self textFieldShouldReturn:estimate_field];
+      break;
+    }
+    case CELL_ESTIMATE:
+      [self textFieldShouldReturn:name_field];
+      [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
+      break;
     case CELL_DUE: {
       DueDatePickViewController *duePickController = [[DueDatePickViewController alloc] initWithNibName:nil bundle:nil];
       duePickController.parent = self;
@@ -129,29 +148,6 @@ enum {
       break;
   }
 }
-/*
-- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
-	
-	if (editingStyle == UITableViewCellEditingStyleDelete) {
-	}
-	if (editingStyle == UITableViewCellEditingStyleInsert) {
-	}
-}
-*/
-/*
-- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
-	return YES;
-}
-*/
-/*
-- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
-}
-*/
-/*
-- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
-	return YES;
-}
-*/
 
 - (void)dealloc {
   [name release];
@@ -167,12 +163,6 @@ enum {
 	[super dealloc];
 }
 
-
-- (void)viewDidLoad {
-	[super viewDidLoad];
-}
-
-
 - (void)viewWillAppear:(BOOL)animated {
 	[super viewWillAppear:animated];
 }
@@ -207,8 +197,7 @@ enum {
   return 1;
 }
 
-- (BOOL)textFieldShouldReturn:(UITextField *)textField
-{
+- (BOOL)textFieldShouldReturn:(UITextField *)textField {
   if (textField == name_field) {
     self.name = textField.text;
   } else if (textField == estimate_field) {
@@ -219,6 +208,13 @@ enum {
   return YES;
 }
 
+- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
+  UITableViewCell *cell = (UITableViewCell *)[[textField superview] superview];
+  NSIndexPath *path = [self.tableView indexPathForCell:cell];
+  [self.tableView scrollToRowAtIndexPath:path atScrollPosition:UITableViewScrollPositionTop animated:YES];
+  return YES;
+}
+
 - (void) updatePriority {
   self.priority = [NSString stringWithFormat:@&quot;%d&quot;, priority_segment.selectedSegmentIndex];
 }
@@ -234,16 +230,19 @@ enum {
   [self close];
 }
 
+- (void) commitTextFields {
+  [self textFieldShouldReturn:name_field];
+  [self textFieldShouldReturn:estimate_field];
+}
+
+
 /*
  * create RTMTask from given fields
  *
  * TODO: how to validate the fields ?
  */
 - (IBAction) save {
-  if (!name) {
-    // show alert
-    return;
-  }
+  [self commitTextFields];
 
   // store it to the DB
   AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
@@ -274,19 +273,19 @@ enum {
   submitButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(save)];
   self.navigationItem.rightBarButtonItem = submitButton;
 
-  name_field = [[UITextField alloc] initWithFrame:CGRectMake(64, 12, CGRectGetWidth(self.view.frame)-64, CGRectGetHeight(self.view.frame)-8)];
+  name_field = [[UITextField alloc] initWithFrame:CGRectMake(32, 12, CGRectGetWidth(self.view.frame)-32, CGRectGetHeight(self.view.frame)-8)];
   name_field.placeholder = @&quot;...&quot;;
   name_field.returnKeyType = UIReturnKeyDone;
   name_field.delegate = self;
 
-  estimate_field = [[UITextField alloc] initWithFrame:CGRectMake(64, 12, CGRectGetWidth(self.view.frame)-64, CGRectGetHeight(self.view.frame)-8)];
+  estimate_field = [[UITextField alloc] initWithFrame:CGRectMake(32, 12, CGRectGetWidth(self.view.frame)-32, CGRectGetHeight(self.view.frame)-8)];
   estimate_field.placeholder = @&quot;...&quot;;
   estimate_field.returnKeyType = UIReturnKeyDone;
   estimate_field.delegate = self;
 
   // setup priority segment
   NSArray *priority_items = [NSArray arrayWithObjects:@&quot;0&quot;, @&quot;1&quot;, @&quot;2&quot;, @&quot;3&quot;, nil];
-  priority_segment = [[UISegmentedControl alloc] initWithFrame:CGRectMake(64, 8, CGRectGetWidth(self.view.frame)-96, 28)];
+  priority_segment = [[UISegmentedControl alloc] initWithFrame:CGRectMake(32, 8, CGRectGetWidth(self.view.frame)-96, 28)];
   for (int i=0; i&lt;priority_items.count; i++)
     [priority_segment insertSegmentWithTitle:[priority_items objectAtIndex:i] atIndex:i animated:NO];
 </diff>
      <filename>controller/AddTaskViewController.m</filename>
    </modified>
    <modified>
      <diff>@@ -22,7 +22,6 @@
 
 - (IBAction) addTask;
 - (IBAction) upload;
-- (IBAction) sync;
 - (void) fetchAll;
 
 @end</diff>
      <filename>controller/RootViewController.h</filename>
    </modified>
    <modified>
      <diff>@@ -37,31 +37,21 @@
 - (void)loadView {
   [super loadView];
 
-  /*
-   * create a root view.
-   */
   CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
-	//CGFloat toolbarHeight = [toolbar frame].size.height;
 	const CGFloat toolbarHeight = 44;
 
   // create a top ViewController.
   MenuViewController *menuViewController = [[MenuViewController alloc] initWithStyle:UITableViewStylePlain];
   menuViewController.rootViewController = self;
 
-  /*
-   * create a NavigationController.
-   */
+  // create a NavigationController.
   UINavigationController *naviController = [[UINavigationController alloc] initWithRootViewController:menuViewController];
   naviController.view.frame = CGRectMake(0, 0, appFrame.size.width, appFrame.size.height-toolbarHeight);
   naviController.view.backgroundColor = [UIColor greenColor];
   [self.view addSubview:naviController.view];
   self.navigationController = naviController;
 
-
-  /*
-   * create a bottom bar.
-   */
-
+  // create a bottom bar.
   UIToolbar *bar = [[UIToolbar alloc] initWithFrame:CGRectMake(appFrame.origin.x, appFrame.size.height-toolbarHeight, appFrame.size.width, toolbarHeight)];
   UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addTask)];
   UIBarButtonItem *uploadButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(upload)];
@@ -81,12 +71,6 @@
     AuthViewController *avc = [[AuthViewController alloc] initWithNibName:nil bundle:nil];
     avc.rootViewController = self;
 
-    /*
-    self.hidesBottomBarWhenPushed = YES;
-    menuViewController.hidesBottomBarWhenPushed = YES;
-    avc.hidesBottomBarWhenPushed = YES;
-    */
-    //naviController.navigationBarHidden = YES;
     avc.navigationItem.hidesBackButton = YES;
     avc.bottomBar = bottomBar;
     bottomBar.hidden = YES;
@@ -97,12 +81,6 @@
   [menuViewController release];
 }
 
-/*
-// Implement viewDidLoad to do additional setup after loading the view.
-- (void)viewDidLoad {
-}
-*/
-
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
   // Return YES for supported orientations
   return (interfaceOrientation == UIInterfaceOrientationPortrait);
@@ -120,14 +98,12 @@
   self.bottomBar.hidden = YES;
 
   AddTaskViewController *ctrl = [[AddTaskViewController alloc] initWithStyle:UITableViewStylePlain];
-  //ctrl.view.frame = CGRectMake(0, 44, appFrame.size.width, appFrame.size.height-44);
 
   UINavigationController *modalController = [[UINavigationController alloc] initWithRootViewController:ctrl];
   modalController.view.frame = CGRectMake(0, 44, appFrame.size.width, appFrame.size.height-44);
   [self presentModalViewController:modalController animated:YES];
   [modalController release];
   [ctrl release];
-
 }
 
 - (void) reload {
@@ -159,9 +135,6 @@
   [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
 }
 
-- (IBAction) sync {
-}
-
 - (void) fetchAll {
   [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
 </diff>
      <filename>controller/RootViewController.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>96360232ea4585269aaabad4300523a60d37b54e</id>
    </parent>
  </parents>
  <author>
    <name>mootoh</name>
    <email>mootoh@gmail.com</email>
  </author>
  <url>http://github.com/mootoh/milpon/commit/fa97822ff94b0768db3862d415a663042a6cd0db</url>
  <id>fa97822ff94b0768db3862d415a663042a6cd0db</id>
  <committed-date>2008-10-25T00:32:39-07:00</committed-date>
  <authored-date>2008-10-25T00:32:39-07:00</authored-date>
  <message>fixed #36, #37: scroll to the current editing field in AddTask view .</message>
  <tree>89a386e68a037f9b9be8f37a8e61dbdd8d1f8e91</tree>
  <committer>
    <name>mootoh</name>
    <email>mootoh@gmail.com</email>
  </committer>
</commit>
