[Libreoffice-commits] core.git: 6 commits - include/touch ios/experimental ios/shared vcl/source

Tor Lillqvist tml at collabora.com
Thu Oct 31 23:24:06 CET 2013


 include/touch/touch.h                                  |   21 +++++
 ios/experimental/LibreOffice/LibreOffice/AppDelegate.m |   25 ++++++
 ios/experimental/LibreOffice/LibreOffice/lo.mm         |    2 
 ios/shared/ios_sharedlo/cxx/mlo.mm                     |    9 ++
 vcl/source/window/dialog.cxx                           |   66 ++++++++++++++---
 5 files changed, 112 insertions(+), 11 deletions(-)

New commits:
commit 5a0aec771f10e14558ce229ff70cd81717d85ac8
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Oct 31 22:20:15 2013 +0200

    Add dummy touch_ui_dialog_modal() here, too
    
    Change-Id: I1b1e47de2eec94150a0abee4aa74994f55b9b88e

diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
index 11d4642..198fb34 100644
--- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
+++ b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m
@@ -218,6 +218,31 @@ bool touch_ui_keyboard_visible()
     return keyboardShows;
 }
 
+static const char *
+dialog_kind_to_string(MLODialogKind kind)
+{
+    switch (kind) {
+    case MLODialogMessage:
+        return "MSG";
+    case MLODialogInformation:
+        return "INF";
+    case MLODialogWarning:
+        return "WRN";
+    case MLODialogError:
+        return "ERR";
+    case MLODialogQuery:
+        return "QRY";
+    default:
+        return "WTF";
+    }
+}
+
+MLODialogResult touch_ui_dialog_modal(MLODialogKind kind, const char *message)
+{
+    NSLog(@"===>  %s: %s", dialog_kind_to_string(kind), message);
+    return MLODialogOK;
+}
+
 void touch_ui_selection_start(MLOSelectionKind kind,
                               const void *documentHandle,
                               MLORect *rectangles,
commit 9fabf25bc47c7b16eb22eca3a934c18070e1e9e5
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Oct 31 21:30:19 2013 +0200

    Dummy implementation of touch_ui_dialog_modal()
    
    Change-Id: I38b72837d8a26ef95d84deca299023c1646169cf

diff --git a/ios/shared/ios_sharedlo/cxx/mlo.mm b/ios/shared/ios_sharedlo/cxx/mlo.mm
index 8f551fb..dc6fa42 100644
--- a/ios/shared/ios_sharedlo/cxx/mlo.mm
+++ b/ios/shared/ios_sharedlo/cxx/mlo.mm
@@ -216,5 +216,12 @@ mlo_initialize(void)
     osl_setCommandArgs(argc, (char **) argv);
 }
 
+// Dummy implementation for now, probably this should be handled in a
+// different way in each app that uses this "shared" library? Like
+// most in touch.h, the dialog API is not set in stone yet.
 
-
+MLODialogResult touch_ui_dialog_modal(MLODialogKind kind, const char *message)
+{
+    NSLog(@"===>  %s", message);
+    return MLODialogOK;
+}
commit ec2ea6e6e087d13d484d0e4b938144d28c4395dd
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Oct 31 21:29:47 2013 +0200

    Maybe Dialog::Execute() is one good place to call touch_ui_dialog_modal()
    
    Change-Id: I5f1b9fd266d7920a947d3dfb6bcd584e3cc30b53

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index e0cd445..0298d5d 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
+
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/util/PathSettings.hpp>
 #include <comphelper/processfactory.hxx>
@@ -45,6 +47,10 @@
 #include <vcl/unowrap.hxx>
 #include <iostream>
 
+#if !HAVE_FEATURE_DESKTOP
+#include <touch/touch.h>
+#endif
+
 // =======================================================================
 
 static OString ImplGetDialogText( Dialog* pDialog )
@@ -884,6 +890,8 @@ void Dialog::ImplEndExecuteModal()
 
 short Dialog::Execute()
 {
+#if HAVE_FEATURE_DESKTOP
+
     setDeferredProperties();
 
     if ( !ImplStartExecuteModal() )
@@ -904,7 +912,7 @@ short Dialog::Execute()
     while ( !aDelData.IsDead() && mbInExecute )
         Application::Yield();
 
-    ImplEndExecuteModal();
+    ImplEndExecutModal();
 
 #ifdef DBG_UTIL
     if( pDialogParent  )
@@ -927,6 +935,56 @@ short Dialog::Execute()
     long nRet = mpDialogImpl->mnResult;
     mpDialogImpl->mnResult = -1;
     return (short)nRet;
+
+#else
+
+    MLODialogKind kind;
+
+    switch (GetType())
+    {
+    case WINDOW_MESSBOX:
+        kind = MLODialogMessage;
+        break;
+    case WINDOW_INFOBOX:
+        kind = MLODialogInformation;
+        break;
+    case WINDOW_WARNINGBOX:
+        kind = MLODialogWarning;
+        break;
+    case WINDOW_ERRORBOX:
+        kind = MLODialogError;
+        break;
+    case WINDOW_QUERYBOX:
+        kind = MLODialogQuery;
+        break;
+    default:
+        SAL_WARN("vcl", "Dialog::Execute: Unhandled window type %d" << GetType());
+        kind = MLODialogInformation;
+        break;
+    }
+
+    MLODialogResult result = touch_ui_dialog_modal(kind, ImplGetDialogText(this).getStr());
+
+    switch (result)
+    {
+    case MLODialogOK:
+        return RET_OK;
+    case MLODialogCancel:
+        return RET_CANCEL;
+    case MLODialogNo:
+        return RET_NO;
+    case MLODialogYes:
+        return RET_YES;
+    case MLODialogRetry:
+        return RET_RETRY;
+    case MLODialogIgnore:
+        return RET_IGNORE;
+    default:
+        SAL_WARN("vcl", "Dialog::Execute: Unhandled dialog result %d" << result);
+        return RET_OK;
+    }
+
+#endif
 }
 
 // -----------------------------------------------------------------------
commit 139bd9b4402eb19a8de71cceb2ce3807cbb5dbf0
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Oct 31 21:26:02 2013 +0200

    Add first attempt at an error message etc API
    
    Add a touch_ui_dialog_modal() function which in some way displays an
    error or other message to the user, and possibly offers the
    possibility to choose some "OK", "Cancel", "Retry", "Ignore" type of
    response. Note that the "modality" is from the point of view of the LO
    thread.
    
    Change-Id: I1b2ad15854f8d76e2c30f93fb5356fad7e5d02ca

diff --git a/include/touch/touch.h b/include/touch/touch.h
index 7dddaf3..56e0eec 100644
--- a/include/touch/touch.h
+++ b/include/touch/touch.h
@@ -57,6 +57,27 @@ void touch_ui_show_keyboard();
 void touch_ui_hide_keyboard();
 bool touch_ui_keyboard_visible();
 
+// Dialogs, work in progress, no clear plan yet what to do
+
+typedef enum {
+    MLODialogMessage,
+    MLODialogInformation,
+    MLODialogWarning,
+    MLODialogError,
+    MLODialogQuery
+} MLODialogKind;
+
+typedef enum {
+    MLODialogOK,
+    MLODialogCancel,
+    MLODialogNo,
+    MLODialogYes,
+    MLODialogRetry,
+    MLODialogIgnore,
+} MLODialogResult;
+
+MLODialogResult touch_ui_dialog_modal(MLODialogKind kind, const char *message);
+
 typedef enum {
     MLOSelectionNone,
     MLOSelectionText,
commit ac535415fe0a466acc23cdc32aabb6b7d03a31e3
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Oct 31 20:45:23 2013 +0200

    Bin pointless Android ifdefs
    
    It did not do anything.
    
    How to handle dialog attempts from random places in the code on
    non-desktop needs to be re-done properly.
    
    Change-Id: I854a12faba3f98c61f637b465789976493326d43

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 17f0e37..e0cd445 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -45,10 +45,6 @@
 #include <vcl/unowrap.hxx>
 #include <iostream>
 
-#ifdef ANDROID
-#include <osl/detail/android-bootstrap.h>
-#endif
-
 // =======================================================================
 
 static OString ImplGetDialogText( Dialog* pDialog )
@@ -801,12 +797,6 @@ sal_Bool Dialog::Close()
 
 sal_Bool Dialog::ImplStartExecuteModal()
 {
-#ifdef ANDROID
-    // Not sure if the idea is that this will be called on Android or
-    // not? But OK, let's try to have the below code reached on
-    // Android...
-#endif
-
     if ( mbInExecute )
     {
 #ifdef DBG_UTIL
commit 13c3ab57892ab7553c3c4eb65ed6cd9344751f67
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Oct 31 22:20:32 2013 +0200

    Use actual executable path
    
    Change-Id: I75ffc83be6af34b09b4a98a5890b3585b4a76bde

diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.mm b/ios/experimental/LibreOffice/LibreOffice/lo.mm
index 16d0752..eec4c43 100644
--- a/ios/experimental/LibreOffice/LibreOffice/lo.mm
+++ b/ios/experimental/LibreOffice/LibreOffice/lo.mm
@@ -155,7 +155,7 @@ lo_initialize(void)
 
     const int argc = sizeof(argv)/sizeof(*argv);
 
-    argv[0] = [[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent: @"LibreOffice"] UTF8String];
+    argv[0] = [[[NSBundle mainBundle] executablePath] UTF8String];
 
     NSString *app_root_escaped = [[[NSBundle mainBundle] bundlePath] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
 


More information about the Libreoffice-commits mailing list