[Libreoffice-commits] core.git: sfx2/source
Cao Cuong Ngo
cao.cuong.ngo at gmail.com
Fri Sep 27 14:06:23 PDT 2013
sfx2/source/doc/objserv.cxx | 24 ++++++++++++++++--------
sfx2/source/view/sfxbasecontroller.cxx | 19 ++++++++++++-------
2 files changed, 28 insertions(+), 15 deletions(-)
New commits:
commit 4fd449b1ca4dce9f1425fc035291651bfc510a3e
Author: Cao Cuong Ngo <cao.cuong.ngo at gmail.com>
Date: Fri Sep 27 21:42:14 2013 +0200
Google Drive files don't need Checkout bar.
Plus, the Name property has been changed to Id,
that was the reason the Checkin bar disappeared.
Change-Id: I03f6ef4e1399c0f8b2a347ca8acd8a42daffa497
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index fc40769..3a2ce2e 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -947,17 +947,22 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
// Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
- bool bFoundCheckedout = false;
+ bool bIsGoogleFile = false;
sal_Bool bCheckedOut = sal_False;
- for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
+ for ( sal_Int32 i = 0; i < aCmisProperties.getLength(); ++i )
{
- if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" )
+ if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" )
{
- bFoundCheckedout = true;
- aCmisProperties[i].Value >>= bCheckedOut;
+ uno::Sequence< sal_Bool > bTmp;
+ aCmisProperties[i].Value >>= bTmp;
+ bCheckedOut = bTmp[0];
}
+ // using title to know if it's a Google Drive file
+ // maybe there's a safer way.
+ if ( aCmisProperties[i].Name == "title" )
+ bIsGoogleFile = true;
}
- bShow = !bCheckedOut;
+ bShow = !bCheckedOut && !bIsGoogleFile;
}
if ( !bShow )
@@ -982,10 +987,13 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
sal_Bool bCheckedOut = sal_False;
for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
{
- if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" )
+ if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" )
{
bFoundCheckedout = true;
- aCmisProperties[i].Value >>= bCheckedOut;
+ uno::Sequence< sal_Bool > bTmp;
+ aCmisProperties[i].Value >>= bTmp;
+ bCheckedOut = bTmp[0];
+
}
}
bShow = bCheckedOut;
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 5ebbf71..a119281 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1434,18 +1434,23 @@ void SfxBaseController::ShowInfoBars( )
if ( xCmisDoc->isVersionable( ) && aCmisProperties.hasElements( ) )
{
// Loop over the CMIS Properties to find cmis:isVersionSeriesCheckedOut
- bool bFoundCheckedout = false;
+ // and find if it is a Google Drive file.
+ bool bIsGoogleFile = false;
sal_Bool bCheckedOut = sal_False;
- for ( sal_Int32 i = 0; i < aCmisProperties.getLength() && !bFoundCheckedout; ++i )
+ for ( sal_Int32 i = 0; i < aCmisProperties.getLength(); ++i )
{
- if ( aCmisProperties[i].Name == "cmis:isVersionSeriesCheckedOut" )
- {
- bFoundCheckedout = true;
- aCmisProperties[i].Value >>= bCheckedOut;
+ if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" ) {
+ uno::Sequence< sal_Bool > bTmp;
+ aCmisProperties[i].Value >>= bTmp;
+ bCheckedOut = bTmp[0];
}
+ // if it is a Google Drive file, we don't need the checkout bar,
+ // still need the checkout feature for the version dialog.
+ if ( aCmisProperties[i].Name == "title" )
+ bIsGoogleFile = true;
}
- if ( !bCheckedOut )
+ if ( !bCheckedOut && !bIsGoogleFile )
{
// Get the Frame and show the InfoBar if not checked out
SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame();
More information about the Libreoffice-commits
mailing list