summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-21 14:20:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-10-29 13:58:47 +0100
commit09e3d45cdc5c739e5246388a83ccfc6d76bf66e9 (patch)
tree5ae533f38a626016951b02e7d2406c368b298723 /svtools
parent93a641d291adf86491cc68ac64f4f614c937183a (diff)
weld fpicker cluster
Change-Id: I6566263809ff0032388a0b56571f0cf7428058d7 Reviewed-on: https://gerrit.libreoffice.org/81334 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/control/inettbc.cxx39
-rw-r--r--svtools/source/misc/imagemgr.cxx17
2 files changed, 50 insertions, 6 deletions
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 0486958c067b..0f68239194ff 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -126,6 +126,8 @@ class MatchContext_Impl: public salhelper::Thread
svtools::AsynchronLink aLink;
OUString const aText;
URLBox* pBox;
+ bool const bOnlyDirectories;
+ bool const bNoSelection;
osl::Mutex mutex_;
bool stopped_;
@@ -482,6 +484,8 @@ MatchContext_Impl::MatchContext_Impl(URLBox* pBoxP, const OUString& rText)
, aLink( LINK( this, MatchContext_Impl, Select_Impl ) )
, aText( rText )
, pBox( pBoxP )
+ , bOnlyDirectories( pBoxP->bOnlyDirectories )
+ , bNoSelection( pBoxP->bNoSelection )
, stopped_(false)
, commandId_(0)
{
@@ -587,7 +591,7 @@ IMPL_LINK_NOARG( MatchContext_Impl, Select_Impl, void*, void )
pBox->append_text(completion);
}
- pBox->EnableAutocomplete();
+ pBox->EnableAutocomplete(!bNoSelection);
// transfer string lists to listbox and forget them
pBox->pImpl->aURLs = aURLs;
@@ -682,7 +686,10 @@ void MatchContext_Impl::ReadFolder( const OUString& rURL,
try
{
- uno::Reference< XDynamicResultSet > xDynResultSet = aCnt.createDynamicCursor( aProps, INCLUDE_FOLDERS_AND_DOCUMENTS );
+ ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS;
+ if ( bOnlyDirectories )
+ eInclude = INCLUDE_FOLDERS_ONLY;
+ uno::Reference< XDynamicResultSet > xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude );
uno::Reference < XAnyCompareFactory > xCompare;
uno::Reference < XSortedDynamicResultSetFactory > xSRSFac =
@@ -1240,6 +1247,10 @@ void MatchContext_Impl::doExecute()
}
}
+ if ( bOnlyDirectories )
+ // don't scan history picklist if only directories are allowed, picklist contains only files
+ return;
+
bool bFull = false;
INetURLObject aCurObj;
@@ -1957,9 +1968,11 @@ IMPL_LINK_NOARG(URLBox, TryAutoComplete, Timer *, void)
OUString aCurText = m_xWidget->get_active_text();
int nStartPos, nEndPos;
m_xWidget->get_entry_selection_bounds(nStartPos, nEndPos);
- if (nEndPos != aCurText.getLength())
+ if (std::max(nStartPos, nEndPos) != aCurText.getLength())
return;
- aCurText = aCurText.copy(0, nStartPos);
+
+ auto nLen = std::min(nStartPos, nEndPos);
+ aCurText = aCurText.copy( 0, nLen );
if (!aCurText.isEmpty())
{
if (pCtx.is())
@@ -1977,7 +1990,9 @@ IMPL_LINK_NOARG(URLBox, TryAutoComplete, Timer *, void)
URLBox::URLBox(std::unique_ptr<weld::ComboBox> pWidget)
: eSmartProtocol(INetProtocol::NotValid)
- , bHistoryDisabled(false)
+ , bOnlyDirectories( false )
+ , bHistoryDisabled( false )
+ , bNoSelection( false )
, m_xWidget(std::move(pWidget))
{
//don't grow to fix mega-long urls
@@ -2085,11 +2100,11 @@ IMPL_LINK_NOARG(URLBox, ChangedHdl, weld::ComboBox&, void)
IMPL_LINK_NOARG(URLBox, FocusInHdl, weld::Widget&, void)
{
- (void)this; // loplugin:staticmethod
#ifndef UNX
// pb: don't select automatically on unix #93251#
m_xWidget->select_entry_region(0, -1);
#endif
+ aFocusInHdl.Call(*m_xWidget);
}
IMPL_LINK_NOARG(URLBox, FocusOutHdl, weld::Widget&, void)
@@ -2103,6 +2118,18 @@ IMPL_LINK_NOARG(URLBox, FocusOutHdl, weld::Widget&, void)
aFocusOutHdl.Call(*m_xWidget);
}
+void URLBox::SetOnlyDirectories( bool bDir )
+{
+ bOnlyDirectories = bDir;
+ if ( bOnlyDirectories )
+ m_xWidget->clear();
+}
+
+void URLBox::SetNoURLSelection( bool bSet )
+{
+ bNoSelection = bSet;
+}
+
OUString URLBox::GetURL()
{
// wait for end of autocompletion
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index bd16300c5ced..32edd99987cc 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -788,6 +788,23 @@ Image SvFileInformationManager::GetImageNoDefault(const INetURLObject& rObject,
return GetImageFromList_Impl(nImage, bBig, rPreferredSize);
}
+OUString SvFileInformationManager::GetFolderImageId( const svtools::VolumeInfo& rInfo )
+{
+ SvImageId nImage = SvImageId::Folder;
+ DBG_ASSERT( nImage != SvImageId::NONE, "invalid ImageId" );
+
+ if ( rInfo.m_bIsRemote )
+ nImage = SvImageId::NetworkDevice;
+ else if ( rInfo.m_bIsCompactDisc )
+ nImage = SvImageId::CDRomDevice;
+ else if ( rInfo.m_bIsRemoveable || rInfo.m_bIsFloppy )
+ nImage = SvImageId::RemoveableDevice;
+ else if ( rInfo.m_bIsVolume )
+ nImage = SvImageId::FixedDevice;
+
+ return GetImageNameFromList_Impl(nImage, false/*bBig*/);
+}
+
Image SvFileInformationManager::GetFolderImage( const svtools::VolumeInfo& rInfo )
{
SvImageId nImage = SvImageId::Folder;