summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2020-03-16 13:50:00 +0200
committerTor Lillqvist <tml@collabora.com>2020-03-16 15:14:01 +0100
commitfc5400b167f1f6a9a788acfd5894622f440ee5f5 (patch)
tree2c6c50351d32861356d393940a1cca7e2dabc61e /comphelper
parente3daab4a0899ab89b42bdc1086217deba51bb993 (diff)
Rename isMobile to isMobilePhone and introduce a separate isTablet
The intended semantics of isMobile() has been to say whether the device is a mobile phone ot not. Not whether it is a mobile device in general. So make that explicit. Adjust call sites as necessary. Also, in a couple of places where it is likely that what is relevant is whether it is a mobile device in general, not just whether it is a mobile phone, check both isMobile() and isTablet(). For stable interoperability with current Online, keep accepting also the .uno:LOKSetMobile "command" (and .uno:LOKUnSetMobile, except that Online never sends that), but Online will be changed to use .uno:LOKSetMobilePhone. Also drop the default value for the bool parameter to setMobilePhone(). Default bool parameters can be quite confusing, and it was especially silly in this case as there is one (1) call site. Change-Id: I2a71c37323ee151cbc671bd8e714e1dee10f8b1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90560 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/lok.cxx31
1 files changed, 22 insertions, 9 deletions
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 7bfd776369e3..1f78c29f8b97 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -87,8 +87,11 @@ static LanguageAndLocale g_aLanguageAndLocale;
/// Scaling of the cairo or CoreGraphics canvas painting for hi-dpi
static double g_fDPIScale(1.0);
-/// List of <viewid, bMobile> pairs
-static std::map<int, bool> g_vIsViewMobile;
+/// Which views are on mobile phones?
+static std::map<int, bool> g_vIsViewMobilePhone;
+
+/// Which views are on tablets?
+static std::map<int, bool> g_vIsViewTablet;
void setActive(bool bActive)
{
@@ -100,18 +103,28 @@ bool isActive()
return g_bActive;
}
-void setMobile(int nViewId, bool bMobile)
+void setMobilePhone(int nViewId, bool bIsMobilePhone)
+{
+ g_vIsViewMobilePhone[nViewId] = bIsMobilePhone;
+}
+
+bool isMobilePhone(int nViewId)
{
- if (g_vIsViewMobile.find(nViewId) != g_vIsViewMobile.end())
- g_vIsViewMobile[nViewId] = bMobile;
+ if (g_vIsViewMobilePhone.find(nViewId) != g_vIsViewMobilePhone.end())
+ return g_vIsViewMobilePhone[nViewId];
else
- g_vIsViewMobile.insert(std::make_pair(nViewId, bMobile));
+ return false;
+}
+
+void setTablet(int nViewId, bool bIsTablet)
+{
+ g_vIsViewTablet[nViewId] = bIsTablet;
}
-bool isMobile(int nViewId)
+bool isTablet(int nViewId)
{
- if (g_vIsViewMobile.find(nViewId) != g_vIsViewMobile.end())
- return g_vIsViewMobile[nViewId];
+ if (g_vIsViewTablet.find(nViewId) != g_vIsViewTablet.end())
+ return g_vIsViewTablet[nViewId];
else
return false;
}