[Libreoffice-commits] core.git: 2 commits - ios/iosremote sdext/source

Siqi LIU me at siqi.fr
Fri Jul 19 16:07:42 PDT 2013


 ios/iosremote/iosremote/serverList_vc.m        |   40 ++++++++++++++++++++-----
 sdext/source/presenter/PresenterController.cxx |    3 +
 2 files changed, 35 insertions(+), 8 deletions(-)

New commits:
commit d9e8255e6453568247dbda3333a45e7a40cfb58f
Author: Siqi LIU <me at siqi.fr>
Date:   Sat Jul 20 01:06:54 2013 +0200

    remove server if no longer visible
    
    Change-Id: I75902afe3040304155d164fd0502a00869e4f9d7

diff --git a/ios/iosremote/iosremote/serverList_vc.m b/ios/iosremote/iosremote/serverList_vc.m
index 9d25bb8..78f5d3b 100644
--- a/ios/iosremote/iosremote/serverList_vc.m
+++ b/ios/iosremote/iosremote/serverList_vc.m
@@ -76,8 +76,9 @@
 - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didNotSearch:(NSDictionary *)errorDict
 {
     NSLog(@"search error");
-    UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
-    [(UIActivityIndicatorView *)[cell viewWithTag:5] stopAnimating];
+//    UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
+//    [(UIActivityIndicatorView *)[cell viewWithTag:5] stopAnimating];
+    [self.serviceBrowser searchForServicesOfType:@"_impressRemote._tcp" inDomain:@"local"];
 }
 
 - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser
@@ -104,11 +105,34 @@
          didRemoveService:(NSNetService *)aNetService
                moreComing:(BOOL)moreComing
 {
+    NSLog(@"Did remove");
+    NSString * ipString;
+    
+    if ([[aNetService addresses] count] > 0){
+        NSData * address = [[aNetService addresses] objectAtIndex: 0];
+        struct sockaddr_in *socketAddress = (struct sockaddr_in *) [address bytes];
+        ipString = [NSString stringWithFormat: @"%s",inet_ntoa(socketAddress->sin_addr)];
+    }
+    
+    for (Server * s in self.comManager.autoDiscoveryServers) {
+        if (ipString){
+            if ([s.serverName isEqualToString:aNetService.name] && [s.serverAddress isEqualToString:ipString])
+                [self.comManager.autoDiscoveryServers removeObjectIdenticalTo:s];
+        } else {
+            if ([s.serverName isEqualToString:aNetService.name])
+                [self.comManager.autoDiscoveryServers removeObjectIdenticalTo:s];
+        }
+    }
+    // in case any residuous netServices still stay in the list
     [self.comManager.autoDiscoveryServers removeObject:aNetService];
     
     if(!moreComing)
     {
         [self.tableView reloadData];
+        if ([self.comManager.autoDiscoveryServers count] == 0) {
+            UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
+            [(UIActivityIndicatorView *)[cell viewWithTag:5] startAnimating];
+        }
     }
 }
 
@@ -170,6 +194,8 @@
 - (void) viewWillDisappear:(BOOL)animated
 {
     [self disableSpinner];
+    [self.serviceBrowser stop];
+    [self.serviceBrowser removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
     [super viewWillDisappear:animated];
 }
 
@@ -266,13 +292,13 @@
 
 - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
     if ([self.comManager.servers count] == 0 && section == 1) {
-        UILabel *sectionFooter = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, tableView.frame.size.width - 50, 40)];
-        [sectionFooter setLineBreakMode:NSLineBreakByCharWrapping];
+        UILabel *sectionFooter = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, tableView.frame.size.width - 50, 60)];
+        [sectionFooter setLineBreakMode:NSLineBreakByWordWrapping];
         [sectionFooter setNumberOfLines:5];
         sectionFooter.backgroundColor = [UIColor clearColor];
         sectionFooter.font = [UIFont systemFontOfSize:14];
         sectionFooter.textColor = [UIColor colorWithRed:0.22 green:0.33 blue:0.53 alpha:1.0];
-        sectionFooter.text = @"Please manually add a computer with its IP address.";
+        sectionFooter.text = @"In case your computer does not appear in the section above, manually add a computer with its IP address.";
         
         UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, [self tableView:tableView heightForHeaderInSection:section])];
         [view addSubview:sectionFooter];
@@ -331,7 +357,7 @@
                 [cell.detailTextLabel setText:[s serverAddress]];
             } else if ([s isKindOfClass:[NSNetService class]]){
                 [cell.textLabel setText:[s name]];
-                [cell.detailTextLabel setText:@"loading..."];
+                [cell.detailTextLabel setText:@"Resolving..."];
             }
         }
     }
diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx
index d105f90..f0bbc53 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -176,7 +176,7 @@ PresenterController::PresenterController (
         }
     }
 
-    // UpdateCurrentSlide(0);
+    UpdateCurrentSlide(0);
 
     maInstances[mxController->getFrame()] = this;
 
@@ -255,6 +255,7 @@ void PresenterController::disposing (void)
 
 void PresenterController::UpdateCurrentSlide (const sal_Int32 nOffset)
 {
+    std::cerr << "Updating current Slide to " << nOffset << std::endl;
     GetSlides(nOffset);
     UpdatePaneTitles();
     UpdateViews();
@@ -774,7 +775,7 @@ void SAL_CALL PresenterController::notifyConfigurationChange (
             if (IsAccessibilityActive())
             {
                 mpAccessibleObject->UpdateAccessibilityHierarchy();
-                // UpdateCurrentSlide(0);
+                UpdateCurrentSlide(0);
             }
             break;
     }
@@ -1121,7 +1122,7 @@ void PresenterController::InitializeMainPane (const Reference<XPane>& rxPane)
     if (mxSlideShowController.is())
         mxSlideShowController->activate();
 
-    // UpdateCurrentSlide(0);
+    UpdateCurrentSlide(0);
 }
 
 void PresenterController::LoadTheme (const Reference<XPane>& rxPane)
commit f63d44df0ae3820803a5016dad0fed6f3cef8a59
Author: Siqi LIU <me at siqi.fr>
Date:   Fri Jul 19 22:57:20 2013 +0200

    minor bug fix
    
    Change-Id: Ib2358feb09812a219966525d0992eb49a62dbdfc

diff --git a/ios/iosremote/iosremote/serverList_vc.m b/ios/iosremote/iosremote/serverList_vc.m
index 28ebba7..9d25bb8 100644
--- a/ios/iosremote/iosremote/serverList_vc.m
+++ b/ios/iosremote/iosremote/serverList_vc.m
@@ -227,7 +227,7 @@
         NSLog(@"Connecting to %@:%@", [[self.comManager.servers objectAtIndex:indexPath.row] serverName], [[self.comManager.servers objectAtIndex:indexPath.row] serverAddress]);
         [self.comManager connectToServer:[self.comManager.servers objectAtIndex:indexPath.row]];
     } else if (indexPath.section == 0){
-        NSLog(@"Connecting to %@:%@", [[self.comManager.servers objectAtIndex:indexPath.row] serverName], [[self.comManager.autoDiscoveryServers objectAtIndex:indexPath.row] serverAddress]);
+        NSLog(@"Connecting to %@:%@", [[self.comManager.autoDiscoveryServers objectAtIndex:indexPath.row] serverName], [[self.comManager.autoDiscoveryServers objectAtIndex:indexPath.row] serverAddress]);
         [self.comManager connectToServer:[self.comManager.autoDiscoveryServers objectAtIndex:indexPath.row]];
     }
     
diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx
index 7029b75..d105f90 100644
--- a/sdext/source/presenter/PresenterController.cxx
+++ b/sdext/source/presenter/PresenterController.cxx
@@ -774,7 +774,7 @@ void SAL_CALL PresenterController::notifyConfigurationChange (
             if (IsAccessibilityActive())
             {
                 mpAccessibleObject->UpdateAccessibilityHierarchy();
-                UpdateCurrentSlide(0);
+                // UpdateCurrentSlide(0);
             }
             break;
     }
@@ -1121,7 +1121,7 @@ void PresenterController::InitializeMainPane (const Reference<XPane>& rxPane)
     if (mxSlideShowController.is())
         mxSlideShowController->activate();
 
-    UpdateCurrentSlide(0);
+    // UpdateCurrentSlide(0);
 }
 
 void PresenterController::LoadTheme (const Reference<XPane>& rxPane)


More information about the Libreoffice-commits mailing list