<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,8 +5,8 @@ type: :task
 component: milpon
 release: &quot;1.1&quot;
 reporter: mootoh &lt;mootoh@gmail.com&gt;
-status: :unstarted
-disposition: 
+status: :closed
+disposition: :fixed
 creation_time: 2009-02-19 12:00:08.190661 Z
 references: []
 
@@ -20,5 +20,9 @@ log_events:
   - mootoh &lt;mootoh@gmail.com&gt;
   - assigned to release 1.1 from unassigned
   - &quot;&quot;
+- - 2009-05-16 08:00:45.328397 Z
+  - mootoh &lt;mootoh@gmail.com&gt;
+  - closed with disposition fixed
+  - &quot;&quot;
 git_branch: 
 claimer: </diff>
      <filename>.ditz/issue-2688ce4bfed9dcc8f5a51e1d190493cc992c7016.yaml</filename>
    </modified>
    <modified>
      <diff>@@ -374,8 +374,6 @@
 		B9160FD20F565DE000473A95 /* FunctionalTestAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionalTestAppDelegate.m; sourceTree = &quot;&lt;group&gt;&quot;; };
 		B9160FD30F565DE000473A95 /* MockRTMAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockRTMAPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
 		B9160FD40F565DE000473A95 /* MockRTMAPI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MockRTMAPI.m; sourceTree = &quot;&lt;group&gt;&quot;; };
-		B9160FD50F565DE000473A95 /* ProgressViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProgressViewController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-		B9160FD60F565DE000473A95 /* ProgressViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProgressViewController.m; sourceTree = &quot;&lt;group&gt;&quot;; };
 		B9160FD70F565DE000473A95 /* RTMAPIAuthTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RTMAPIAuthTest.m; sourceTree = &quot;&lt;group&gt;&quot;; };
 		B9160FD80F565DE000473A95 /* RTMAPIListTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RTMAPIListTest.m; sourceTree = &quot;&lt;group&gt;&quot;; };
 		B9160FD90F565DE000473A95 /* RTMAPITaskTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RTMAPITaskTest.m; sourceTree = &quot;&lt;group&gt;&quot;; };
@@ -769,8 +767,6 @@
 				B9160FB70F565DB600473A95 /* FunctionalTestProgressViewWindow.xib */,
 				B9160FD10F565DE000473A95 /* FunctionalTestAppDelegate.h */,
 				B9160FD20F565DE000473A95 /* FunctionalTestAppDelegate.m */,
-				B9160FD50F565DE000473A95 /* ProgressViewController.h */,
-				B9160FD60F565DE000473A95 /* ProgressViewController.m */,
 				B9160FDC0F565DE000473A95 /* LocalCacheTest.m */,
 				B9160FDE0F565DE000473A95 /* RTMPendingTaskTest.m */,
 				B9160FE00F565DE000473A95 /* RTMTaskEntryTest.m */,</diff>
      <filename>Milpon.xcodeproj/project.pbxproj</filename>
    </modified>
    <modified>
      <diff>@@ -225,6 +225,8 @@
       for (NSDictionary *task in [params objectForKey:@&quot;tasks&quot;]) {
          NSInteger task_id = [[task objectForKey:@&quot;id&quot;] integerValue];
          RTMTask *rtm_task = [self taskForTaskID:task_id];
+         if (rtm_task == nil) // maybe deleted already.
+            continue;
          [[NoteProvider sharedNoteProvider] removeForTask:rtm_task];
       }
       [self removeForTaskseries:[params objectForKey:@&quot;id&quot;]]; // remove anyway
@@ -236,7 +238,8 @@
 - (RTMTask *) taskForTaskID:(NSInteger) task_id
 {
    NSMutableDictionary *cond = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@&quot;task_id=%d&quot;, task_id] forKey:@&quot;WHERE&quot;];
-   return [[self tasksWithCondition:cond] objectAtIndex:0];
+   NSArray *ret = [self tasksWithCondition:cond];
+   return ret.count &gt; 0 ? [ret objectAtIndex:0] : nil;
 }
 
 - (void) remove:(RTMTask *) task</diff>
      <filename>model/DBTaskProvider.m</filename>
    </modified>
    <modified>
      <diff>@@ -125,7 +125,8 @@
    int i=0;
    for (NSDictionary *taskseries in taskserieses_updated) {
       if (progressView)
-         [progressView updateMessage:[NSString stringWithFormat:@&quot;syncing task %d/%d&quot;, i, taskserieses_updated.count] withProgress:(float)i/(float)taskserieses_updated.count];
+         //[progressView updateMessage:[NSString stringWithFormat:@&quot;syncing task %d/%d&quot;, i, taskserieses_updated.count] withProgress:(float)i/(float)taskserieses_updated.count];
+         progressView.message = [NSString stringWithFormat:@&quot;syncing task %d/%d&quot;, i, taskserieses_updated.count];
 
       [[TaskProvider sharedTaskProvider] createOrUpdate:taskseries];
       i++;
@@ -143,6 +144,9 @@
 
    int i=1;
    for (RTMTask *task in pendings) {
+      //[progressView updateMessage:[NSString stringWithFormat:@&quot;uploading %d/%d tasks&quot;, i, pendings.count] withProgress:(float)i/(float)pendings.count];
+      progressView.message = [NSString stringWithFormat:@&quot;uploading %d/%d tasks...&quot;, i, pendings.count];
+
       NSString *list_id = [task.list_id stringValue];
       NSDictionary *task_ret = [api_task add:task.name inList:list_id];
       if (task_ret == nil)
@@ -197,7 +201,6 @@
 
       [[TaskProvider sharedTaskProvider] remove:task]; // TODO: update IDS instaed of removing
 
-      [progressView updateMessage:[NSString stringWithFormat:@&quot;uploading %d/%d tasks&quot;, i, pendings.count] withProgress:(float)i/(float)pendings.count];
       i++;
    }
 
@@ -213,7 +216,8 @@
    NSArray *tasks = [[TaskProvider sharedTaskProvider] modifiedTasks];
    for (RTMTask *task in tasks) {
       if (progressView)
-         [progressView updateMessage:[NSString stringWithFormat:@&quot;updating %d/%d, %@...&quot;, i,tasks.count, task.name] withProgress:(float)i/(float)tasks.count];
+         //[progressView updateMessage:[NSString stringWithFormat:@&quot;updating %d/%d, %@...&quot;, i,tasks.count, task.name] withProgress:(float)i/(float)tasks.count];
+         progressView.message = [NSString stringWithFormat:@&quot;updating %d/%d\n%@...&quot;, i,tasks.count, task.name];
       NSInteger edit_bits = task.edit_bits;
 
       if (edit_bits &amp; EB_TASK_DUE) {</diff>
      <filename>model/RTMSynchronizer.m</filename>
    </modified>
    <modified>
      <diff>@@ -16,11 +16,13 @@
    RTMAuth                         *auth;
    NSOperationQueue                *operationQueue;
    ProgressView                    *pv;
+   UIBarButtonItem                 *refreshButton;
 }
 
 @property (nonatomic, retain) UIWindow *window;
 @property (nonatomic, retain) RTMAuth *auth;
 @property (nonatomic, retain) NSOperationQueue *operationQueue;
+@property (nonatomic, retain) UIBarButtonItem *refreshButton;
 
 - (IBAction) addTask;
 - (IBAction) saveAuth;</diff>
      <filename>ui/AppDelegate.h</filename>
    </modified>
    <modified>
      <diff>@@ -74,7 +74,7 @@
 
 @implementation AppDelegate
 
-@synthesize window, auth, operationQueue;
+@synthesize window, auth, operationQueue, refreshButton;
 
 /**
   * init DB and authorization info
@@ -96,6 +96,7 @@
 
 - (void) dealloc
 {
+   [refreshButton release];
    [pv release];
    [navigationController release];
    [operationQueue release];
@@ -106,6 +107,7 @@
 
 - (void) applicationDidFinishLaunching:(UIApplication *)application
 {
+   self.refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh)];
    RootMenuViewController *rmvc = [[RootMenuViewController alloc] initWithStyle:UITableViewStyleGrouped];
    navigationController = [[UINavigationController alloc] initWithRootViewController:rmvc];
    [rmvc release];
@@ -173,7 +175,7 @@
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
 }
 
-- (IBAction) refresh
+- (BOOL) is_reachable
 {
 #ifndef LOCAL_DEBUG
    Reachability *reach = [Reachability sharedReachability];
@@ -182,40 +184,34 @@
    reach.networkStatusNotificationsEnabled = NO;
    if (stat == NotReachable) {
       UIAlertView *av = [[UIAlertView alloc] initWithTitle:@&quot;Not Connected&quot;
-         message:@&quot;Not connected to the RTM site. Sync when you are online.&quot;
-         delegate:nil
-         cancelButtonTitle:@&quot;OK&quot;
-         otherButtonTitles:nil];
+                                                   message:@&quot;Not connected to the RTM site. Sync when you are online.&quot;
+                                                  delegate:nil
+                                         cancelButtonTitle:@&quot;OK&quot;
+                                         otherButtonTitles:nil];
       [av show];
       [av release];
-      return;
-   } else {
-      LOG(@&quot;OK&quot;);
+      return NO;
    }
-#endif // 0
+#endif // LOCAL_DEBUG
+   return YES;
+}
 
-   NSInvocationOperation *ope = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(uploadOperation) object:nil];
+- (IBAction) refresh
+{
+   if (! [self is_reachable]) return;
+
+   refreshButton.enabled = NO;
+   [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    [self showDialog];
 
+   NSInvocationOperation *ope = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(uploadOperation) object:nil];
    AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [app.operationQueue addOperation:ope];
    [ope release];
 }
  
-- (void) replaceAll
-{
-   [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
-   AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-   [app fetchAll];
-   [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
-}
-
-// TODO: shows CoreAnimation animated progressbar
 - (void) uploadOperation
 {
-   navigationController.navigationBar.topItem.leftBarButtonItem.enabled = NO;
-   [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
-
    RTMSynchronizer *syncer = [[RTMSynchronizer alloc] init:auth];
 
    [syncer uploadPendingTasks:pv];
@@ -223,24 +219,6 @@
    [syncer syncTasks:pv];
    [syncer release];
 
-   //[self reload];
-
-#if 0
-   NSString *lastUpdated = [[LocalCache sharedLocalCache] lastSync];
-   lastUpdated = [lastUpdated stringByReplacingOccurrencesOfString:@&quot;T&quot; withString:@&quot;_&quot;];
-   lastUpdated = [lastUpdated stringByReplacingOccurrencesOfString:@&quot;Z&quot; withString:@&quot; GMT&quot;];
-
-   NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-   [formatter setFormatterBehavior:NSDateFormatterBehavior10_4];
-   [formatter setDateFormat:@&quot;yyyy-MM-dd_HH:mm:ss zzz&quot;];
-
-   NSDate *lu = [formatter dateFromString:lastUpdated];
-   [formatter setDateFormat:@&quot;MM/dd HH:mm&quot;];
-   lastUpdated = [formatter stringFromDate:lu];
-
-   [progressView updateMessage:[NSString stringWithFormat:@&quot;Updated: %@&quot;, lastUpdated]];
-#endif // 0
-
    [self performSelectorOnMainThread:@selector(hideDialog) withObject:nil waitUntilDone:YES];
 }
 
@@ -250,38 +228,34 @@
    pv.alpha = 0.0f;
    pv.backgroundColor = [UIColor blackColor];
    pv.opaque = YES;
+   pv.message = @&quot;Syncing...&quot;;
 
    // animation part
    [UIView beginAnimations:nil context:NULL]; {
       [UIView setAnimationDuration:0.20f];
       [UIView setAnimationDelegate:self];
-      [UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
 
       pv.alpha = 0.8f;
       pv.frame = CGRectMake(appFrame.origin.x, appFrame.size.height-80, appFrame.size.width, 100);
    } [UIView commitAnimations];
 }
 
-- (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context
-{
-   LOG(@&quot;dialogAnimDidStop&quot;);
-}
-
 - (IBAction) hideDialog
 {
    CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
+   pv.message = @&quot;Synced.&quot;;
+
    // animation part
    [UIView beginAnimations:nil context:NULL]; {
       [UIView setAnimationDuration:0.20f];
       [UIView setAnimationDelegate:self];
-      [UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
       
       pv.alpha = 0.0f;
       pv.frame = CGRectMake(appFrame.origin.x, appFrame.size.height, appFrame.size.width, 100);
    } [UIView commitAnimations];
    
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
-   navigationController.navigationBar.topItem.leftBarButtonItem.enabled = YES;
+   refreshButton.enabled = YES;
    [self.window setNeedsDisplay];
 }
 </diff>
      <filename>ui/AppDelegate.m</filename>
    </modified>
    <modified>
      <diff>@@ -24,12 +24,10 @@ enum {
 
 - (void) progressBegin;
 - (void) progressEnd;
-- (void) updateMessage:(NSString *)msg;
-
+#if 0
 /**
  * @note should be called in background thread (not main thread)
  */
 - (void) updateMessage:(NSString *)msg withProgress:(float)pg;
-- (void) toggleDisplay;
-
+#endif // 0
 @end</diff>
      <filename>ui/ProgressView.h</filename>
    </modified>
    <modified>
      <diff>@@ -8,6 +8,10 @@
 
 #import &quot;ProgressView.h&quot;
 
+@interface ProgressView (Private)
+- (void) toggleDisplay;
+@end
+
 @implementation ProgressView
 
 static const float messageLabelPadding = 18.0f;
@@ -29,10 +33,10 @@ static const float messageLabelPadding = 18.0f;
       messageLabel = [[UILabel alloc] initWithFrame:messageRect];
       messageLabel.backgroundColor = [UIColor colorWithRed:1.0f green:0 blue:0 alpha:0.0f];
       messageLabel.opaque = YES;
-      messageLabel.font = [UIFont systemFontOfSize:12];
+      messageLabel.font = [UIFont systemFontOfSize:14];
       messageLabel.textColor = [UIColor whiteColor];
       messageLabel.textAlignment = UITextAlignmentCenter;
-      //messageLabel.text = @&quot;yes&quot;;
+      messageLabel.numberOfLines = 2;
       [self addSubview:messageLabel];
 
       progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
@@ -67,9 +71,9 @@ static const float messageLabelPadding = 18.0f;
    progressView.progress = 1.0;
 }
 
-- (void) updateMessage:(NSString *)msg
+- (void) updateTheView
 {
-   messageLabel.text = msg;
+   [messageLabel setNeedsDisplay];
 }
 
 - (void) updateMessage:(NSString *)msg withProgress:(float)pg
@@ -88,11 +92,14 @@ static const float messageLabelPadding = 18.0f;
 {
    if (message) [message release];
    message = [msg retain];
-
+   messageLabel.text = msg;
+   [self performSelectorOnMainThread:@selector(updateTheView) withObject:nil waitUntilDone:NO];
+   
+#if 0
    if (! inProgress) {
-      messageLabel.text = msg;
       [messageLabel setNeedsDisplay];
    }
+#endif // 0
 }
 
 - (NSString *)message</diff>
      <filename>ui/ProgressView.m</filename>
    </modified>
    <modified>
      <diff>@@ -49,14 +49,11 @@ enum sec_one {
    AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
 
    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:app action:@selector(addTask)];
-   UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:app action:@selector(refresh)];
-
-   //UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:app action:@selector(showDialog)];
+   
    self.navigationItem.rightBarButtonItem = addButton;
-   self.navigationItem.leftBarButtonItem  = refreshButton;
+   self.navigationItem.leftBarButtonItem  = app.refreshButton;
 
    [addButton release];
-   [refreshButton release];
 }
 /*
 - (void)viewWillAppear:(BOOL)animated {</diff>
      <filename>ui/RootMenuViewController.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4778fbc3201772ad78372fe6311c414c1078cde6</id>
    </parent>
  </parents>
  <author>
    <name>mootoh</name>
    <email>mootoh@gmail.com</email>
  </author>
  <url>http://github.com/mootoh/milpon/commit/5b23ac8c5a3c89d1838b76e0938dcbd89684600b</url>
  <id>5b23ac8c5a3c89d1838b76e0938dcbd89684600b</id>
  <committed-date>2009-05-16T01:01:07-07:00</committed-date>
  <authored-date>2009-05-16T01:01:07-07:00</authored-date>
  <message>fixed note sync issue in recurrent tasks.</message>
  <tree>f79c0e2591ee7b066198baba147d9b77adaf95c2</tree>
  <committer>
    <name>mootoh</name>
    <email>mootoh@gmail.com</email>
  </committer>
</commit>
