[Libreoffice-commits] core.git: 13 commits - fpicker/source fpicker/uiconfig include/svtools svtools/Library_svt.mk svtools/source svtools/uiconfig
Szymon Kłos
eszkadev at gmail.com
Sat Aug 29 04:10:17 PDT 2015
fpicker/source/office/RemoteFilesDialog.cxx | 123 ++++++++++++++++++++---
fpicker/source/office/RemoteFilesDialog.hxx | 9 +
fpicker/uiconfig/ui/remotefilesdialog.ui | 19 ++-
include/svtools/PlaceEditDialog.hxx | 2
include/svtools/ServerDetailsControls.hxx | 8 -
include/svtools/autocmpledit.hxx | 39 +++++++
include/svtools/breadcrumb.hxx | 4
include/svtools/fileview.hxx | 5
svtools/Library_svt.mk | 1
svtools/source/contnr/fileview.cxx | 23 ++--
svtools/source/control/autocmpledit.cxx | 110 ++++++++++++++++++++
svtools/source/control/breadcrumb.cxx | 35 ++++++
svtools/source/dialogs/PlaceEditDialog.cxx | 32 +----
svtools/source/dialogs/ServerDetailsControls.cxx | 36 ++++++
svtools/uiconfig/ui/placeedit.ui | 6 -
15 files changed, 383 insertions(+), 69 deletions(-)
New commits:
commit 51c3a6421ecdb3443121c26e3bdeb21b07bd1fd8
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Wed Aug 26 13:48:59 2015 +0200
remember password for all types of service
Change-Id: I8620332ac5228eee1d7c16d0b0ff7920031be331
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 4d1cc15..c8ffde0 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -687,11 +687,16 @@ void RemoteFilesDialog::DisableControls()
m_pCancel_btn->Enable( true );
}
-void RemoteFilesDialog::SavePassword( const OUString& rURL, const OUString& rUser, const OUString& rPassword )
+void RemoteFilesDialog::SavePassword( const OUString& rURL, const OUString& rUser
+ , const OUString& rPassword, bool bPersistent )
{
+ if( rURL.isEmpty() || rUser.isEmpty() || rPassword.isEmpty() )
+ return;
+
try
{
- if( m_xMasterPasswd->isPersistentStoringAllowed() && m_xMasterPasswd->authorizateWithMasterPassword( Reference< XInteractionHandler>() ) )
+ if( m_xMasterPasswd->isPersistentStoringAllowed() &&
+ ( !bPersistent || m_xMasterPasswd->authorizateWithMasterPassword( Reference< XInteractionHandler>() ) ) )
{
Reference< XInteractionHandler > xInteractionHandler(
InteractionHandler::createWithParent( m_xContext, 0 ),
@@ -700,8 +705,11 @@ void RemoteFilesDialog::SavePassword( const OUString& rURL, const OUString& rUse
Sequence< OUString > aPasswd( 1 );
aPasswd[0] = rPassword;
- m_xMasterPasswd->addPersistent(
- rURL, rUser, aPasswd, xInteractionHandler );
+ if( bPersistent )
+ m_xMasterPasswd->addPersistent(
+ rURL, rUser, aPasswd, xInteractionHandler );
+ else
+ m_xMasterPasswd->add( rURL, rUser, aPasswd, xInteractionHandler );
}
}
catch( const Exception& )
@@ -725,7 +733,8 @@ IMPL_LINK_NOARG_TYPED ( RemoteFilesDialog, AddServiceHdl, Button*, void )
OUString sUser = aDlg->GetUser();
if( !sUser.isEmpty() && !sPassword.isEmpty() )
{
- SavePassword( newService->GetUrl(), sUser, sPassword );
+ bool bPersistent = aDlg->IsRememberChecked();
+ SavePassword( newService->GetUrl(), sUser, sPassword, bPersistent );
}
OUString sPrefix = lcl_GetServiceType( newService );
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index 65ce6c2..a1ce0de 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -182,7 +182,8 @@ private:
void EnableControls();
void DisableControls();
- void SavePassword( const OUString& rURL, const OUString& rUser, const OUString& rPassword );
+ void SavePassword( const OUString& rURL, const OUString& rUser
+ , const OUString& rPassword, bool bPersistent );
DECL_LINK_TYPED ( AddServiceHdl, Button*, void );
DECL_LINK ( SelectServiceHdl, void * );
diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx
index 992c5e8..6acbf78 100644
--- a/include/svtools/PlaceEditDialog.hxx
+++ b/include/svtools/PlaceEditDialog.hxx
@@ -73,6 +73,7 @@ public :
OUString GetServerUrl();
OUString GetPassword() { return m_pEDPassword->GetText(); };
OUString GetUser() { return m_pEDUsername->GetText(); };
+ bool IsRememberChecked() { return m_pCBPassword->IsChecked(); }
void ShowPasswordControl( bool bShow = true ) { m_bShowPassword = bShow; }
@@ -88,7 +89,6 @@ private:
DECL_LINK ( SelectTypeHdl, void * );
DECL_LINK ( EditLabelHdl, void * );
DECL_LINK ( EditUsernameHdl, void * );
- DECL_LINK ( ToggledPassHdl, CheckBox * );
};
diff --git a/include/svtools/ServerDetailsControls.hxx b/include/svtools/ServerDetailsControls.hxx
index 6fe3363..334778b 100644
--- a/include/svtools/ServerDetailsControls.hxx
+++ b/include/svtools/ServerDetailsControls.hxx
@@ -12,6 +12,8 @@
#include <map>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/task/PasswordContainer.hpp>
+#include <com/sun/star/task/XPasswordContainer2.hpp>
#include <tools/urlobj.hxx>
#include <vcl/builder.hxx>
@@ -53,11 +55,10 @@ class DetailsContainer
virtual bool setUrl( const INetURLObject& rUrl );
virtual void setUsername( const OUString& /*rUsername*/ ) { };
+ virtual void setPassword( const OUString& ) { };
virtual void setActive( bool bActive = true );
- virtual bool hasPassEntry() { return true; }
-
protected:
void notifyChange( );
DECL_LINK ( ValueChangeHdl, void * );
@@ -124,6 +125,7 @@ class CmisDetailsContainer : public DetailsContainer
{
private:
OUString m_sUsername;
+ OUString m_sPassword;
com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
std::vector< OUString > m_aRepoIds;
OUString m_sRepoId;
@@ -142,7 +144,7 @@ class CmisDetailsContainer : public DetailsContainer
virtual INetURLObject getUrl( ) SAL_OVERRIDE;
virtual bool setUrl( const INetURLObject& rUrl ) SAL_OVERRIDE;
virtual void setUsername( const OUString& rUsername ) SAL_OVERRIDE;
- virtual bool hasPassEntry() SAL_OVERRIDE { return false; }
+ virtual void setPassword( const OUString& rPass ) SAL_OVERRIDE;
private:
void selectRepository( );
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx
index b244494..68e5741b 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -23,7 +23,7 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent)
, m_xCurrentDetails()
, m_nCurrentType( 0 )
, bLabelChanged( false )
- , m_bShowPassword( false )
+ , m_bShowPassword( true )
{
get( m_pEDServerName, "name" );
get( m_pLBServerType, "type" );
@@ -36,11 +36,6 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent)
get( m_pEDPassword, "password" );
get( m_pFTPasswordLabel, "passwordLabel" );
- m_pEDPassword->Hide();
- m_pFTPasswordLabel->Hide();
- m_pCBPassword->Hide();
- m_pCBPassword->SetToggleHdl( LINK( this, PlaceEditDialog, ToggledPassHdl ) );
-
m_pBTOk->SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) );
m_pBTOk->Enable( false );
@@ -52,6 +47,7 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent)
m_pLBServerType->SetSelectHdl( LINK( this, PlaceEditDialog, SelectTypeHdl ) );
m_pEDUsername->SetModifyHdl( LINK( this, PlaceEditDialog, EditUsernameHdl ) );
+ m_pEDPassword->SetModifyHdl( LINK( this, PlaceEditDialog, EditUsernameHdl ) );
InitDetails( );
}
@@ -76,7 +72,6 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla
m_pEDPassword->Hide();
m_pFTPasswordLabel->Hide();
m_pCBPassword->Hide();
- m_pCBPassword->SetToggleHdl( LINK( this, PlaceEditDialog, ToggledPassHdl ) );
m_pBTOk->SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) );
m_pBTDelete->SetClickHdl ( LINK( this, PlaceEditDialog, DelHdl) );
@@ -149,19 +144,6 @@ std::shared_ptr<Place> PlaceEditDialog::GetPlace()
return std::make_shared<Place>(m_pEDServerName->GetText(), GetServerUrl(), true);
}
-IMPL_LINK( PlaceEditDialog, ToggledPassHdl, CheckBox*, pCheckBox )
-{
- bool bChecked = pCheckBox->IsEnabled() && pCheckBox->IsChecked();
-
- m_pEDPassword->Enable( bChecked );
- m_pFTPasswordLabel->Enable( bChecked );
-
- if ( !bChecked )
- m_pEDPassword->SetText( "" );
-
- return 0;
-}
-
void PlaceEditDialog::InitDetails( )
{
// Create CMIS controls for each server type
@@ -322,6 +304,7 @@ IMPL_LINK_NOARG( PlaceEditDialog, EditUsernameHdl )
it != m_aDetailsContainers.end( ); ++it )
{
( *it )->setUsername( OUString( m_pEDUsername->GetText() ) );
+ ( *it )->setPassword( m_pEDPassword->GetText() );
}
EditHdl(NULL);
@@ -350,12 +333,9 @@ IMPL_LINK_NOARG( PlaceEditDialog, SelectTypeHdl )
m_xCurrentDetails->show();
- bool bShowPass = m_xCurrentDetails->hasPassEntry();
- m_pCBPassword->Show( bShowPass );
- m_pEDPassword->Show( bShowPass );
- m_pFTPasswordLabel->Show( bShowPass );
-
- ToggledPassHdl( m_pCBPassword );
+ m_pCBPassword->Show( m_bShowPassword );
+ m_pEDPassword->Show( m_bShowPassword );
+ m_pFTPasswordLabel->Show( m_bShowPassword );
SetSizePixel(GetOptimalSize());
diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx
index 96da591..5b5f083 100644
--- a/svtools/source/dialogs/ServerDetailsControls.cxx
+++ b/svtools/source/dialogs/ServerDetailsControls.cxx
@@ -382,6 +382,11 @@ void CmisDetailsContainer::setUsername( const OUString& rUsername )
m_sUsername = rUsername;
}
+void CmisDetailsContainer::setPassword( const OUString& rPass )
+{
+ m_sPassword = rPass;
+}
+
void CmisDetailsContainer::selectRepository( )
{
// Get the repo ID and call the Change listener
@@ -395,6 +400,10 @@ void CmisDetailsContainer::selectRepository( )
IMPL_LINK_NOARG_TYPED( CmisDetailsContainer, RefreshReposHdl, Button*, void )
{
+ Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ Reference< XPasswordContainer2 > xMasterPasswd = PasswordContainer::create( xContext );
+
+
OUString sBindingUrl = m_pEDHost->GetText().trim( );
OUString sEncodedUsername = "";
@@ -424,6 +433,25 @@ IMPL_LINK_NOARG_TYPED( CmisDetailsContainer, RefreshReposHdl, Button*, void )
sUrl = "vnd.libreoffice.cmis://" + sEncodedUsername + sEncodedBinding;
}
+ // temporary remember the password
+ try
+ {
+ if( xMasterPasswd->isPersistentStoringAllowed() && !sUrl.isEmpty() && !m_sUsername.isEmpty() && !m_sPassword.isEmpty() )
+ {
+ Reference< XInteractionHandler > xInteractionHandler(
+ InteractionHandler::createWithParent( xContext, 0 ),
+ UNO_QUERY );
+
+ Sequence< OUString > aPasswd( 1 );
+ aPasswd[0] = m_sPassword;
+
+ xMasterPasswd->add(
+ sUrl, m_sUsername, aPasswd, xInteractionHandler );
+ }
+ }
+ catch( const Exception& )
+ {}
+
// Get the Content
::ucbhelper::Content aCnt( sUrl, m_xCmdEnv, comphelper::getProcessComponentContext() );
Sequence< OUString > aProps( 1 );
@@ -456,6 +484,14 @@ IMPL_LINK_NOARG_TYPED( CmisDetailsContainer, RefreshReposHdl, Button*, void )
m_pLBRepository->SelectEntryPos( 0 );
selectRepository( );
}
+
+ // remove temporary password
+ try
+ {
+ xMasterPasswd->remove( sUrl, m_sUsername );
+ }
+ catch( const Exception& )
+ {}
}
IMPL_LINK_NOARG( CmisDetailsContainer, SelectRepoHdl )
diff --git a/svtools/uiconfig/ui/placeedit.ui b/svtools/uiconfig/ui/placeedit.ui
index 8f4e0e5..e3c0d3c 100644
--- a/svtools/uiconfig/ui/placeedit.ui
+++ b/svtools/uiconfig/ui/placeedit.ui
@@ -416,7 +416,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>
@@ -428,7 +428,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">4</property>
</packing>
</child>
<child>
@@ -442,7 +442,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
</packing>
</child>
<child>
commit c879fa8e5fd7779ca242fe368cbdd70084df049b
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Wed Aug 26 11:52:42 2015 +0200
Date modified column - no seconds
Change-Id: I443d0dd691d8030ab6a0bf5e4eeded5ad73750a5
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 1ce95e8..6f7b8c4 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1945,7 +1945,7 @@ void SvtFileView_Impl::CreateDisplayText_Impl()
const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData();
aValue += rLocaleData.getDate( (*aIt)->maModDate );
aValue += aDateSep;
- aValue += rLocaleData.getTime( (*aIt)->maModDate );
+ aValue += rLocaleData.getTime( (*aIt)->maModDate, false );
}
(*aIt)->maDisplayText = aValue;
commit 808f14886c08b7140ecff06c4d65d2db8286f0b1
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Tue Aug 25 11:51:11 2015 +0200
Remove stored password if service is deleted
Change-Id: I500a8ee2874f7a9577e37fe25f5813e5821e9719
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 1b541ba..4d1cc15 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -822,6 +822,30 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton,
if( aBox->Execute() == RET_YES )
{
+ // remove password
+ try
+ {
+ if( m_xMasterPasswd->isPersistentStoringAllowed() )
+ {
+ OUString sUrl( m_aServices[nPos]->GetUrl() );
+
+ Reference< XInteractionHandler > xInteractionHandler(
+ InteractionHandler::createWithParent( m_xContext, 0 ),
+ UNO_QUERY );
+
+ UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, xInteractionHandler );
+
+ if( aURLEntries.Url == sUrl && aURLEntries.UserList.getLength() )
+ {
+ OUString sUserName = aURLEntries.UserList[0].UserName;
+
+ m_xMasterPasswd->removePersistent( sUrl, sUserName );
+ }
+ }
+ }
+ catch( const Exception& )
+ {}
+
m_aServices.erase( m_aServices.begin() + nPos );
m_pServices_lb->RemoveEntry( nSelected );
commit 6bf5bc98739c89537f7f3f1247f703943f907818
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Mon Aug 24 12:51:21 2015 +0200
Remember window size
Change-Id: I4e9bd5e2516b66f47b560a388237b75059a7f142
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index b00f0db2..1b541ba 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -6,7 +6,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-
#include "RemoteFilesDialog.hxx"
class FileViewContainer : public vcl::Window
@@ -172,6 +171,8 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
: SvtFileDialog_Base( pParent, "RemoteFilesDialog", "fps/ui/remotefilesdialog.ui" )
, m_xContext( comphelper::getProcessComponentContext() )
, m_xMasterPasswd( PasswordContainer::create( m_xContext ) )
+ , m_nWidth( 0 )
+ , m_nHeight( 0 )
, m_pCurrentAsyncAction( NULL )
, m_pFileNotifier( NULL )
, m_pSplitter( NULL )
@@ -297,9 +298,15 @@ void RemoteFilesDialog::dispose()
{
SvtViewOptions aDlgOpt( E_DIALOG, m_sIniKey );
aDlgOpt.SetWindowState( OStringToOUString( GetWindowState(), osl_getThreadTextEncoding() ) );
+
+ Size aSize( GetSizePixel() );
+
+ OUString sSize = OUString::number( aSize.Width() ) + "|";
+ sSize = sSize + OUString::number( aSize.Height() ) + "|";
+
OUString sUserData = m_pFileView->GetConfigString();
aDlgOpt.SetUserItem( OUString( "UserData" ),
- makeAny( sUserData ) );
+ makeAny( sSize + sUserData ) );
}
// save services
@@ -373,6 +380,17 @@ short RemoteFilesDialog::Execute()
return nRet;
}
+void RemoteFilesDialog::Show()
+{
+ SvtFileDialog_Base::Show();
+
+ if( m_nWidth > 0 && m_nHeight > 0 )
+ {
+ Size aSize( m_nWidth, m_nHeight );
+ SetSizePixel( aSize );
+ }
+}
+
OUString lcl_GetServiceType( ServicePtr pService )
{
INetProtocol aProtocol = pService->GetUrlObject().GetProtocol();
@@ -423,7 +441,21 @@ void RemoteFilesDialog::InitSize()
Any aUserData = aDlgOpt.GetUserItem( OUString( "UserData" ) );
OUString sCfgStr;
if( aUserData >>= sCfgStr )
- m_pFileView->SetConfigString( sCfgStr );
+ {
+ int nPos = sCfgStr.indexOf( "|" );
+ if( nPos != -1 )
+ {
+ nPos = sCfgStr.indexOf( "|", nPos + 1 );
+ if( nPos != -1 )
+ {
+ sal_Int32 nIdx = 0;
+ m_nWidth = sCfgStr.getToken( 0, '|', nIdx ).toInt32();
+ m_nHeight = sCfgStr.getToken( 0, '|', nIdx ).toInt32();
+
+ m_pFileView->SetConfigString( sCfgStr.copy( nPos + 1) );
+ }
+ }
+ }
}
}
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index ad1323c..65ce6c2 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -77,6 +77,7 @@ public:
virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
+ virtual void Show();
// SvtFileDialog_Base
@@ -134,6 +135,8 @@ private:
bool m_bServiceChanged;
OUString m_sIniKey;
+ int m_nWidth;
+ int m_nHeight;
OUString m_sPath;
OUString m_sStdDir;
commit 470d6ab5d35045902c2d07815314df9b03b6326e
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Fri Aug 21 12:10:07 2015 +0200
wider dialog
Change-Id: Ie90920c6fcd797b49cc16487cf4754822f771cf0
diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui
index 7859348..00e14da 100644
--- a/fpicker/uiconfig/ui/remotefilesdialog.ui
+++ b/fpicker/uiconfig/ui/remotefilesdialog.ui
@@ -186,7 +186,7 @@
</child>
<child>
<object class="GtkBox" id="container">
- <property name="width_request">500</property>
+ <property name="width_request">555</property>
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
commit 16304077dcb1e7f50b25d147d59c4fa5c4b415ca
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Fri Aug 21 12:04:27 2015 +0200
disable interface after service delete
Change-Id: Ia6706ba12154bab9b36da8582190db7ca6af1072
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index b29bd2b..b00f0db2 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -797,6 +797,9 @@ IMPL_LINK_TYPED ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton,
m_pAddService_btn->SetPopupMenu( NULL );
m_bIsUpdated = true;
+
+ m_bIsConnected = false;
+ EnableControls();
}
}
}
commit 1d5f0716bf233bd468b8f271c2f45597dfc63bd2
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Fri Aug 21 11:47:52 2015 +0200
focus for the file list after opening folder using a tree
Change-Id: I7cf75e3fb734b4bf0be9135c200130b8e86bf54f
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 1b2ec72..b29bd2b 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -975,7 +975,10 @@ IMPL_LINK ( RemoteFilesDialog, TreeSelectHdl, FolderTree *, pBox )
OUString* sURL = static_cast< OUString* >( pBox->GetHdlEntry()->GetUserData() );
if( sURL )
+ {
OpenURL( *sURL );
+ m_pFileView->GrabFocus();
+ }
return 1;
}
commit 1f557470fd003a67d7d497d48094c33aea5d7e57
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Fri Aug 21 10:51:08 2015 +0200
Autocompletion should be case insensitive
Change-Id: I6f173590a94df6a04d5eee76653fa47ea8f71853
diff --git a/svtools/source/control/autocmpledit.cxx b/svtools/source/control/autocmpledit.cxx
index 14cf58b..8032b6e 100644
--- a/svtools/source/control/autocmpledit.cxx
+++ b/svtools/source/control/autocmpledit.cxx
@@ -70,7 +70,7 @@ bool AutocompleteEdit::Match( const OUString& rText )
for( std::vector< OUString >::size_type i = 0; i < m_aEntries.size(); ++i )
{
- if( m_aEntries[i].startsWith( rText ) )
+ if( m_aEntries[i].startsWithIgnoreAsciiCase( rText ) )
{
m_aMatching.push_back( m_aEntries[i] );
bRet = true;
commit d6ebf7f5ee4aa0684a9f219dc8a5831013b7feb3
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Fri Aug 21 10:42:37 2015 +0200
clear file name field while changing dir
Change-Id: I46e9d9e7b56c09c65808fe231e5ba4eeddf90ad2
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index ab6159a..1b2ec72 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -541,6 +541,9 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString const & sURL )
// -1 timeout - sync
m_pCurrentAsyncAction->execute( sURL, sFilter, -1, -1, GetBlackList() );
+
+ if( m_eMode != REMOTEDLG_MODE_SAVE )
+ m_pName_ed->SetText( "" );
}
else
{
commit 682c74f0dbb9bea3178e340c3f8cde69272829ad
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Fri Aug 21 10:29:49 2015 +0200
Breadcrumb: mouseover effect
Change-Id: If38d799e0fa7506416082fb15f37b12267a9b5df
diff --git a/include/svtools/breadcrumb.hxx b/include/svtools/breadcrumb.hxx
index d749f27..d06e097 100644
--- a/include/svtools/breadcrumb.hxx
+++ b/include/svtools/breadcrumb.hxx
@@ -27,10 +27,12 @@ enum SvtBreadcrumbMode
ALL_VISITED = 1
};
+class CustomLink;
+
class SVT_DLLPUBLIC Breadcrumb : public VclHBox
{
private:
- std::vector< VclPtr< FixedHyperlink > > m_aLinks;
+ std::vector< VclPtr< CustomLink > > m_aLinks;
std::vector< VclPtr< FixedText > > m_aSeparators;
OUString m_sRootName;
diff --git a/svtools/source/control/breadcrumb.cxx b/svtools/source/control/breadcrumb.cxx
index 306d33f..8ccbd81 100644
--- a/svtools/source/control/breadcrumb.cxx
+++ b/svtools/source/control/breadcrumb.cxx
@@ -9,6 +9,38 @@
#include <svtools/breadcrumb.hxx>
+class CustomLink : public FixedHyperlink
+{
+public:
+ CustomLink( vcl::Window* pParent, WinBits nWinStyle )
+ : FixedHyperlink( pParent, nWinStyle )
+ {
+ vcl::Font aFont = GetControlFont( );
+ aFont.SetUnderline( UNDERLINE_NONE );
+ SetControlFont( aFont );
+ }
+
+protected:
+ virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE
+ {
+ // changes the style if the control is enabled
+ if ( !rMEvt.IsLeaveWindow() && IsEnabled() )
+ {
+ vcl::Font aFont = GetControlFont( );
+ aFont.SetUnderline( UNDERLINE_SINGLE );
+ SetControlFont( aFont );
+ }
+ else
+ {
+ vcl::Font aFont = GetControlFont( );
+ aFont.SetUnderline( UNDERLINE_NONE );
+ SetControlFont( aFont );
+ }
+
+ FixedHyperlink::MouseMove( rMEvt );
+ }
+};
+
Breadcrumb::Breadcrumb( vcl::Window* pParent, WinBits nWinStyle ) : VclHBox( pParent, nWinStyle )
{
m_eMode = SvtBreadcrumbMode::ONLY_CURRENT_PATH;
@@ -112,6 +144,7 @@ void Breadcrumb::SetURL( const OUString& rURL )
m_aLinks[i]->SetURL( sRootPath + OUString( sPath.getStr(), nEnd ) );
m_aLinks[i]->Hide();
m_aLinks[i]->Enable( true );
+
m_aSeparators[i]->Hide();
nPos = nEnd;
@@ -208,7 +241,7 @@ void Breadcrumb::SetMode( SvtBreadcrumbMode eMode )
void Breadcrumb::appendField()
{
- m_aLinks.push_back( VclPtr< FixedHyperlink >::Create( this, WB_TABSTOP ) );
+ m_aLinks.push_back( VclPtr< CustomLink >::Create( this, WB_TABSTOP ) );
m_aLinks[m_aLinks.size() - 1]->Hide();
m_aLinks[m_aLinks.size() - 1]->SetClickHdl( LINK( this, Breadcrumb, ClickLinkHdl ) );
commit 495285ee3a00d6c14e3d5a8df2e5715fb7edb233
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Tue Aug 18 10:42:41 2015 +0200
RemoteFilesDialog: file name autocompletion
Change-Id: Iab051ccaf075cc91acce67e01863e8d7ecac820c
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index e87f6cb..ab6159a 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -183,7 +183,6 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
get( m_pAddService_btn, "add_service_btn" );
get( m_pServices_lb, "services_lb" );
get( m_pFilter_lb, "filter_lb" );
- get( m_pName_ed, "name_ed" );
get( m_pNewFolder, "new_folder" );
m_eMode = ( nBits & WB_SAVEAS ) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN;
@@ -194,6 +193,9 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
m_bServiceChanged = false;
m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND;
+ m_pName_ed = VclPtr< AutocompleteEdit >::Create( get< vcl::Window >( "filename_container" ) );
+ m_pName_ed->Show();
+
m_pFilter_lb->Enable( false );
m_pName_ed->Enable( false );
@@ -1252,8 +1254,31 @@ void RemoteFilesDialog::UpdateControls( const OUString& rURL )
m_pTreeView->SetSelectHdl( Link<>() );
// read cached data for this url and fill the tree
- const ::std::vector< std::pair< OUString, OUString > >& rFolders = m_pFileView->GetSubFolders();
- m_pTreeView->FillTreeEntry( rURL, rFolders );
+ const ::std::vector< SvtContentEntry >& rFolders = m_pFileView->GetContent();
+ ::std::vector< std::pair< OUString, OUString > > aFolders;
+
+ m_pName_ed->ClearEntries();
+
+ for( ::std::vector< SvtContentEntry >::size_type i = 0; i < rFolders.size(); i++ )
+ {
+ int nTitleStart = rFolders[i].maURL.lastIndexOf( '/' );
+ if( nTitleStart != -1 )
+ {
+ OUString sTitle( INetURLObject::decode(
+ rFolders[i].maURL.copy( nTitleStart + 1 ),
+ INetURLObject::DECODE_WITH_CHARSET ) );
+
+ if( rFolders[i].mbIsFolder )
+ {
+ aFolders.push_back( std::pair< OUString, OUString > ( sTitle, rFolders[i].maURL ) );
+ }
+
+ // add entries to the autocompletion mechanism
+ m_pName_ed->AddEntry( sTitle );
+ }
+ }
+
+ m_pTreeView->FillTreeEntry( rURL, aFolders );
m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) );
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index 4fef385..ad1323c 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -12,6 +12,7 @@
#include <comphelper/docpasswordrequest.hxx>
+#include <svtools/autocmpledit.hxx>
#include <svtools/foldertree.hxx>
#include <svtools/place.hxx>
#include <svtools/PlaceEditDialog.hxx>
@@ -156,7 +157,7 @@ private:
VclPtr< SvtFileView > m_pFileView;
VclPtr< FileViewContainer > m_pContainer;
VclPtr< ListBox > m_pFilter_lb;
- VclPtr< Edit > m_pName_ed;
+ VclPtr< AutocompleteEdit > m_pName_ed;
PopupMenu* m_pAddMenu;
ImageList m_aImages;
diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui
index e0699a5..7859348 100644
--- a/fpicker/uiconfig/ui/remotefilesdialog.ui
+++ b/fpicker/uiconfig/ui/remotefilesdialog.ui
@@ -234,26 +234,29 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="name_ed">
+ <object class="GtkComboBox" id="filter_lb">
+ <property name="width_request">200</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="filter_lb">
- <property name="width_request">200</property>
+ <object class="GtkBox" id="filename_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
</object>
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index db6d491..afc7dab 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -36,6 +36,7 @@ class ViewTabListBox_Impl;
class SvtFileView_Impl;
class SvTreeListEntry;
class HeaderBar;
+struct SvtContentEntry;
/// the result of an action in the FileView
enum FileViewResult
@@ -173,7 +174,7 @@ public:
void EndInplaceEditing( bool _bCancel );
- ::std::vector< std::pair< OUString, OUString > > GetSubFolders();
+ ::std::vector< SvtContentEntry > GetContent();
protected:
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 81e7f5e..1ce95e8 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1393,17 +1393,14 @@ OUString SvtFileView::GetConfigString() const
return sRet;
}
-::std::vector< std::pair< OUString, OUString > > SvtFileView::GetSubFolders()
+::std::vector< SvtContentEntry > SvtFileView::GetContent()
{
- ::std::vector< std::pair< OUString, OUString > > aContent;
+ ::std::vector< SvtContentEntry > aContent;
for( ::std::vector< SortingData_Impl* >::size_type i = 0; i < mpImp->maContent.size(); i++ )
{
- if( mpImp->maContent[i]->mbIsFolder )
- {
- std::pair< OUString, OUString > aEntry( mpImp->maContent[i]->GetTitle(), mpImp->maContent[i]->maTargetURL );
- aContent.push_back( aEntry );
- }
+ SvtContentEntry aEntry( mpImp->maContent[i]->maTargetURL, mpImp->maContent[i]->mbIsFolder );
+ aContent.push_back( aEntry );
}
return aContent;
commit 5f2f8343927a447b5005ba7f49fb84603b92ea6c
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Mon Aug 17 23:01:53 2015 +0200
Edit control with autocompletion
Change-Id: Id3aefbffa6b36b475ca78856c9e103cef433f88c
diff --git a/include/svtools/autocmpledit.hxx b/include/svtools/autocmpledit.hxx
new file mode 100644
index 0000000..49407d44
--- /dev/null
+++ b/include/svtools/autocmpledit.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
+#define INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
+
+#include <svtools/svtdllapi.h>
+
+#include <vcl/edit.hxx>
+
+#include <vector>
+
+class SVT_DLLPUBLIC AutocompleteEdit : public Edit
+{
+private:
+ std::vector< OUString > m_aEntries;
+ std::vector< OUString > m_aMatching;
+ std::vector< OUString >::size_type m_nCurrent;
+
+ void AutoCompleteHandler( Edit* );
+ bool Match( const OUString& rText );
+ bool PreNotify( NotifyEvent& rNEvt );
+
+public:
+ AutocompleteEdit( vcl::Window* pParent );
+
+ void AddEntry( const OUString& rEntry );
+ void ClearEntries();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index f6c834d..b877d46 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -107,6 +107,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/contnr/viewdataentry \
svtools/source/control/accessibleruler \
svtools/source/control/asynclink \
+ svtools/source/control/autocmpledit \
svtools/source/control/breadcrumb \
svtools/source/control/calendar \
svtools/source/control/collatorres \
diff --git a/svtools/source/control/autocmpledit.cxx b/svtools/source/control/autocmpledit.cxx
new file mode 100644
index 0000000..14cf58b
--- /dev/null
+++ b/svtools/source/control/autocmpledit.cxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <svtools/autocmpledit.hxx>
+#include <vcl/svapp.hxx>
+
+AutocompleteEdit::AutocompleteEdit( vcl::Window* pParent )
+ : Edit( pParent )
+ , m_nCurrent( 0 )
+{
+ SignalConnectAutocomplete( nullptr,
+ [this] ( Edit *const pEdit ) { this->AutoCompleteHandler( pEdit ); } );
+}
+
+void AutocompleteEdit::AddEntry( const OUString& rEntry )
+{
+ m_aEntries.push_back( rEntry );
+}
+
+void AutocompleteEdit::ClearEntries()
+{
+ m_aEntries.clear();
+ m_aMatching.clear();
+}
+
+void AutocompleteEdit::AutoCompleteHandler( Edit* )
+{
+ if( GetAutocompleteAction() != AUTOCOMPLETE_KEYINPUT )
+ return;
+
+ if( Application::AnyInput( VclInputFlags::KEYBOARD ) )
+ return;
+
+ OUString aCurText = GetText();
+ Selection aSelection( GetSelection() );
+
+ if( aSelection.Max() != aCurText.getLength() )
+ return;
+
+ sal_uInt16 nLen = ( sal_uInt16 )aSelection.Min();
+ aCurText = aCurText.copy( 0, nLen );
+ if( !aCurText.isEmpty() )
+ {
+ if( m_aEntries.size() )
+ {
+ if( Match( aCurText ) )
+ {
+ m_nCurrent = 0;
+ SetText( m_aMatching[0] );
+ sal_uInt16 nNewLen = m_aMatching[0].getLength();
+
+ Selection aSel( nLen, nNewLen );
+ SetSelection( aSel );
+ }
+ }
+ }
+}
+
+bool AutocompleteEdit::Match( const OUString& rText )
+{
+ bool bRet = false;
+
+ m_aMatching.clear();
+
+ for( std::vector< OUString >::size_type i = 0; i < m_aEntries.size(); ++i )
+ {
+ if( m_aEntries[i].startsWith( rText ) )
+ {
+ m_aMatching.push_back( m_aEntries[i] );
+ bRet = true;
+ }
+ }
+
+ return bRet;
+}
+
+bool AutocompleteEdit::PreNotify( NotifyEvent& rNEvt )
+{
+ if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+ {
+ const KeyEvent& rEvent = *rNEvt.GetKeyEvent();
+ const vcl::KeyCode& rKey = rEvent.GetKeyCode();
+ vcl::KeyCode aCode( rKey.GetCode() );
+
+ if( ( aCode == KEY_UP || aCode == KEY_DOWN ) && !rKey.IsMod2() )
+ {
+ Selection aSelection( GetSelection() );
+ sal_uInt16 nLen = ( sal_uInt16 )aSelection.Min();
+
+ if( m_aMatching.size() &&
+ ( ( aCode == KEY_DOWN && m_nCurrent + 1 < m_aMatching.size() )
+ || ( aCode == KEY_UP && m_nCurrent > 0 ) ) )
+ {
+ SetText( m_aMatching[ aCode == KEY_DOWN ? ++m_nCurrent : --m_nCurrent ] );
+ SetSelection( Selection( nLen, GetText().getLength() ) );
+ return true;
+ }
+ }
+ }
+
+ return Edit::PreNotify( rNEvt );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit fb82388b3c3bc7b2e1e4c2b51b9c3165c5ac14da
Author: Szymon Kłos <eszkadev at gmail.com>
Date: Mon Aug 17 17:54:13 2015 +0200
don't show type column in the RemoteFilesDialog
Change-Id: I103bf8dabe3a513da65c6d21b9c9199aefb0bebe
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index c0f3a49..e87f6cb 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -232,7 +232,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
m_pFileView = VclPtr< SvtFileView >::Create( m_pContainer, WB_BORDER | WB_TABSTOP,
REMOTEDLG_TYPE_PATHDLG == m_eType,
- m_bMultiselection );
+ m_bMultiselection, false );
m_pFileView->Show();
m_pFileView->EnableAutoResize();
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index 0621dd77..db6d491 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -74,7 +74,7 @@ protected:
virtual void GetFocus() SAL_OVERRIDE;
public:
- SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection );
+ SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection, bool bShowType = true );
virtual ~SvtFileView();
virtual void dispose() SAL_OVERRIDE;
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 3c3f6d9..81e7f5e 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -101,6 +101,7 @@ enum class FileViewFlags
NONE = 0x00,
ONLYFOLDER = 0x01,
MULTISELECTION = 0x02,
+ SHOW_TYPE = 0x04,
SHOW_ONLYTITLE = 0x10,
SHOW_NONE = 0x20,
};
@@ -531,7 +532,10 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
SetTabJustify(2, AdjustRight); // column "Size"
mpHeaderBar->InsertItem(COLUMN_TITLE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TITLE), 180, nBits | HeaderBarItemBits::UPARROW);
- mpHeaderBar->InsertItem(COLUMN_TYPE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TYPE), 140, nBits);
+ if (nFlags & FileViewFlags::SHOW_TYPE)
+ {
+ mpHeaderBar->InsertItem(COLUMN_TYPE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_TYPE), 140, nBits);
+ }
mpHeaderBar->InsertItem(COLUMN_SIZE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_SIZE), 80, nBits);
mpHeaderBar->InsertItem(COLUMN_DATE, SVT_RESSTR(STR_SVT_FILEVIEW_COLUMN_DATE), 500, nBits);
}
@@ -998,7 +1002,7 @@ bool ViewTabListBox_Impl::Kill( const OUString& rContent )
// class SvtFileView -----------------------------------------------------
SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits,
- bool bOnlyFolder, bool bMultiSelection ) :
+ bool bOnlyFolder, bool bMultiSelection, bool bShowType ) :
Control( pParent, nBits )
{
@@ -1007,6 +1011,8 @@ SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits,
nFlags |= FileViewFlags::ONLYFOLDER;
if ( bMultiSelection )
nFlags |= FileViewFlags::MULTISELECTION;
+ if ( bShowType )
+ nFlags |= FileViewFlags::SHOW_TYPE;
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
Reference< XInteractionHandler > xInteractionHandler(
More information about the Libreoffice-commits
mailing list