Kaydet (Commit) 9d499f5f authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Internal fpicker cleanup and rework

Changes:
* Use SvHeaderTabListBox for the places list to get a nicer list
* Remove the "Default Directory" button: it's in the places
* Remove the Up and New Folder icons: look ugly beside the edit field
* Added proper icons for places
üst 5e301969
......@@ -60,8 +60,8 @@ $(eval $(call gb_Library_add_exception_objects,fps_office,\
fpicker/source/office/OfficeControlAccess \
fpicker/source/office/OfficeFilePicker \
fpicker/source/office/OfficeFolderPicker \
fpicker/source/office/PlaceEditDialog \
fpicker/source/office/PlacesListBox \
fpicker/source/office/SvtPlaceDialog \
))
# vim: set noet sw=4 ts=4:
......@@ -32,10 +32,10 @@
#include "fpsofficeResMgr.hxx"
#include "PlacesListBox.hxx"
#include "SvtPlaceDialog.hxx"
#include "PlaceEditDialog.hxx"
SvtPlaceDialog::SvtPlaceDialog( Window* pParent ) :
PlaceEditDialog::PlaceEditDialog( Window* pParent ) :
ModalDialog( pParent, SvtResId( DLG_SVT_ADDPLACE ) ),
m_aFTServerUrl( this, SvtResId( FT_ADDPLACE_SERVERURL ) ),
m_aFTServerName( this, SvtResId( FT_ADDPLACE_SERVERNAME ) ),
......@@ -53,11 +53,11 @@ SvtPlaceDialog::SvtPlaceDialog( Window* pParent ) :
{
// This constructor is called when user request a place creation, so
// delete button is hidden.
m_aBTOk.SetClickHdl( LINK( this, SvtPlaceDialog, OKHdl) );
m_aBTOk.SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) );
m_aBTOk.Enable( sal_False );
m_aEDServerName.SetModifyHdl( LINK( this, SvtPlaceDialog, EditHdl) );
m_aEDServerUrl.SetModifyHdl( LINK( this, SvtPlaceDialog, EditHdl) );
m_aEDServerName.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) );
m_aEDServerUrl.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) );
m_aEDServerUrl.SetUrlFilter( &m_UrlFilter );
Edit aDummyEdit ( this, SvtResId( ED_ADDPLACE_SERVERURL ) );
......@@ -66,7 +66,7 @@ SvtPlaceDialog::SvtPlaceDialog( Window* pParent ) :
m_aBTDelete.Hide();
}
SvtPlaceDialog::SvtPlaceDialog( Window* pParent, PlacePtr pPlace ) :
PlaceEditDialog::PlaceEditDialog( Window* pParent, PlacePtr pPlace ) :
ModalDialog( pParent, SvtResId( DLG_SVT_ADDPLACE ) ),
m_aFTServerUrl( this, SvtResId( FT_ADDPLACE_SERVERURL ) ),
m_aFTServerName( this, SvtResId( FT_ADDPLACE_SERVERNAME ) ),
......@@ -82,11 +82,11 @@ SvtPlaceDialog::SvtPlaceDialog( Window* pParent, PlacePtr pPlace ) :
m_aBTCancel ( this, SvtResId ( BT_ADDPLACE_CANCEL ) ),
m_aBTDelete ( this, SvtResId (BT_ADDPLACE_DELETE ) )
{
m_aBTOk.SetClickHdl( LINK( this, SvtPlaceDialog, OKHdl) );
m_aBTDelete.SetClickHdl ( LINK( this, SvtPlaceDialog, DelHdl) );
m_aBTOk.SetClickHdl( LINK( this, PlaceEditDialog, OKHdl) );
m_aBTDelete.SetClickHdl ( LINK( this, PlaceEditDialog, DelHdl) );
m_aEDServerName.SetModifyHdl( LINK( this, SvtPlaceDialog, EditHdl) );
m_aEDServerUrl.SetModifyHdl( LINK( this, SvtPlaceDialog, EditHdl) );
m_aEDServerName.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) );
m_aEDServerUrl.SetModifyHdl( LINK( this, PlaceEditDialog, EditHdl) );
m_aEDServerUrl.SetUrlFilter( &m_UrlFilter );
Edit aDummyEdit ( this, SvtResId( ED_ADDPLACE_SERVERURL ) );
......@@ -97,30 +97,30 @@ SvtPlaceDialog::SvtPlaceDialog( Window* pParent, PlacePtr pPlace ) :
m_aEDServerUrl.SetText( pPlace->GetUrl() );
}
SvtPlaceDialog::~SvtPlaceDialog()
PlaceEditDialog::~PlaceEditDialog()
{
}
PlacePtr SvtPlaceDialog::GetPlace()
PlacePtr PlaceEditDialog::GetPlace()
{
PlacePtr newPlace( new Place( m_aEDServerName.GetText(), m_aEDServerUrl.GetURL(), Place::e_PlaceLocal, true) );
PlacePtr newPlace( new Place( m_aEDServerName.GetText(), m_aEDServerUrl.GetURL(), true) );
return newPlace;
}
IMPL_LINK ( SvtPlaceDialog, OKHdl, Button *, EMPTYARG )
IMPL_LINK ( PlaceEditDialog, OKHdl, Button *, EMPTYARG )
{
EndDialog( RET_OK );
return 1;
}
IMPL_LINK ( SvtPlaceDialog, DelHdl, Button *, EMPTYARG )
IMPL_LINK ( PlaceEditDialog, DelHdl, Button *, EMPTYARG )
{
// ReUsing existing symbols...
EndDialog( RET_NO );
return 1;
}
IMPL_LINK ( SvtPlaceDialog, EditHdl, Edit *, EMPTYARG )
IMPL_LINK ( PlaceEditDialog, EditHdl, Edit *, EMPTYARG )
{
String anUrl = m_aEDServerUrl.GetText();
anUrl.EraseLeadingChars().EraseTrailingChars();
......
......@@ -28,6 +28,8 @@
#ifndef _SVTPLACEDIALOG_HXX
#define _SVTPLACEDIALOG_HXX
#include "PlacesListBox.hxx"
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
......@@ -38,7 +40,7 @@
#include <svl/restrictedpaths.hxx>
class Place;
class SvtPlaceDialog : public ModalDialog
class PlaceEditDialog : public ModalDialog
{
private :
......@@ -69,9 +71,9 @@ private :
public :
SvtPlaceDialog( Window* pParent);
SvtPlaceDialog( Window* pParent, PlacePtr pPlace );
~SvtPlaceDialog();
PlaceEditDialog( Window* pParent);
PlaceEditDialog( Window* pParent, PlacePtr pPlace );
~PlaceEditDialog();
// Returns a place instance with given informations
PlacePtr GetPlace();
......
......@@ -28,33 +28,68 @@
#include <iodlg.hrc>
#include <PlacesListBox.hxx>
#include "SvtPlaceDialog.hxx"
#include "PlaceEditDialog.hxx"
#include <vcl/msgbox.hxx>
#include <svtools/headbar.hxx>
#include <svtools/svtdata.hxx>
#define COLUMN_NAME 1
namespace css = com::sun::star;
using rtl::OUString;
PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const ResId& rResId ) :
ListBox( pFileDlg, rResId ),
PlacesListBox_Impl::PlacesListBox_Impl( Window* pParent, const rtl::OUString& rTitle ) :
SvHeaderTabListBox( pParent, WB_TABSTOP ),
mpHeaderBar( NULL )
{
Size aBoxSize = pParent->GetSizePixel( );
mpHeaderBar = new HeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.getWidth(), 16 ) );
long pTabs[] = { 2, 20, aBoxSize.getWidth() };
SetTabs( &pTabs[0], MAP_PIXEL );
mpHeaderBar->InsertItem( COLUMN_NAME, rTitle, aBoxSize.getWidth(), HIB_LEFT | HIB_VCENTER );
Size aHeadSize = mpHeaderBar->GetSizePixel();
SetPosSizePixel( Point( 0, aHeadSize.getHeight() ),
Size( aBoxSize.getWidth(), aBoxSize.getHeight() - aHeadSize.getHeight() ) );
InitHeaderBar( mpHeaderBar );
Show( );
mpHeaderBar->Show();
}
PlacesListBox_Impl::~PlacesListBox_Impl( )
{
delete mpHeaderBar;
}
PlacesListBox::PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTitle, const ResId& rResId ) :
Control( pFileDlg, rResId ),
maPlaces( ),
mpDlg( pFileDlg ),
mpImpl( NULL ),
mnNbEditables( 0 ),
mbUpdated( false )
{
SetSelectHdl( LINK( this, PlacesListBox, SelectHdl ) );
SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClickHdl ) ) ;
mpImpl = new PlacesListBox_Impl( this, rTitle );
mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) );
mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ;
}
PlacesListBox::~PlacesListBox( )
{
delete mpImpl;
}
void PlacesListBox::AppendPlace( PlacePtr pPlace )
{
maPlaces.push_back( pPlace );
InsertEntry( pPlace->GetName( ), getEntryIcon( pPlace->GetType( ) ));
mpImpl->InsertEntry( pPlace->GetName( ),
getEntryIcon( pPlace ), getEntryIcon( pPlace ) );
if(pPlace->IsEditable()) {
++mnNbEditables;
......@@ -91,53 +126,50 @@ void PlacesListBox::RemovePlace( sal_uInt16 nPos )
mbUpdated = true;
}
maPlaces.erase( maPlaces.begin() + nPos );
RemoveEntry( nPos );
SvLBoxEntry* pEntry = mpImpl->GetEntry( nPos );
mpImpl->RemoveEntry( pEntry );
}
}
void PlacesListBox::RemoveSelectedPlace() {
RemovePlace(GetSelectEntryPos());
RemovePlace(mpImpl->GetCurrRow());
}
void PlacesListBox::SetSizePixel( const Size& rNewSize )
{
Control::SetSizePixel( rNewSize );
mpImpl->SetSizePixel( rNewSize );
}
Image PlacesListBox::getEntryIcon(Place::ePlaceType aType)
Image PlacesListBox::getEntryIcon( PlacePtr pPlace )
{
Image theImage;
switch (aType) {
case Place::e_PlaceCmis:
theImage = mpDlg->GetButtonImage( IMG_FILEDLG_BTN_UP );
break;
case Place::e_PlaceFtp:
theImage = mpDlg->GetButtonImage( IMG_FILEDLG_BTN_UP );
break;
case Place::e_PlaceLocal:
default:
theImage = mpDlg->GetButtonImage( IMG_FILEDLG_BTN_UP );
break;
};
Image theImage = mpDlg->GetButtonImage( IMG_FILEDLG_PLACE_LOCAL );
if ( !pPlace->IsLocal( ) )
theImage = mpDlg->GetButtonImage( IMG_FILEDLG_PLACE_REMOTE );
return theImage;
}
IMPL_LINK( PlacesListBox, SelectHdl, ListBox* , EMPTYARG )
IMPL_LINK( PlacesListBox, Selection, void* , EMPTYARG )
{
sal_uInt16 nSelected = GetSelectEntryPos();
sal_uInt32 nSelected = mpImpl->GetCurrRow();
PlacePtr pPlace = maPlaces[nSelected];
mpDlg->OpenURL_Impl( pPlace->GetUrl() );
if(pPlace->IsEditable())
mpDlg->RemovablePlaceSelected();
else
mpDlg->RemovablePlaceSelected(false);
return 0;
}
IMPL_LINK ( PlacesListBox, DoubleClickHdl, ListBox*, EMPTYARG )
IMPL_LINK ( PlacesListBox, DoubleClick, void*, EMPTYARG )
{
sal_uInt16 nSelected = GetSelectEntryPos();
sal_uInt16 nSelected = mpImpl->GetCurrRow();
PlacePtr pPlace = maPlaces[nSelected];
if ( pPlace->IsEditable() == true )
{
SvtPlaceDialog aDlg(mpDlg,pPlace);
PlaceEditDialog aDlg(mpDlg,pPlace);
short aRetCode = aDlg.Execute();
switch(aRetCode) {
case RET_OK :
......
......@@ -29,63 +29,68 @@
#define _PLACESLISTBOX_HXX_
#include <iodlg.hxx>
#include <vcl/lstbox.hxx>
#include <boost/shared_ptr.hpp>
#include <svtools/svtabbx.hxx>
#include <tools/urlobj.hxx>
#include <vector>
/** Class representing a file location: it mainly consist of display attributes and a URL.
*/
class Place
{
public:
enum ePlaceType {
e_PlaceLocal = 0,
e_PlaceFtp,
e_PlaceCmis
};
private:
rtl::OUString msName;
rtl::OUString msUrl;
ePlaceType meType;
INetURLObject maUrl;
sal_Bool mbEditable;
public:
Place( rtl::OUString sName, rtl::OUString sUrl, ePlaceType eType, sal_Bool bEditable = false) :
Place( rtl::OUString sName, rtl::OUString sUrl, sal_Bool bEditable = false) :
msName( sName ),
msUrl( sUrl ),
meType( eType ),
maUrl( sUrl ),
mbEditable( bEditable ) {};
~Place( ) {};
Place( const Place& rCopy ) : msName( rCopy.msName ), msUrl( rCopy.msUrl ), meType( rCopy.meType ){ };
Place( const Place& rCopy ) : msName( rCopy.msName ), maUrl( rCopy.maUrl ) { };
void SetName(const rtl::OUString& aName ) { msName = aName; }
void SetUrl(const rtl::OUString& aUrl ) { msUrl = aUrl; }
void SetUrl(const rtl::OUString& aUrl ) { maUrl.SetURL( aUrl ); }
rtl::OUString& GetName( ) { return msName; }
rtl::OUString& GetUrl( ) { return msUrl; }
ePlaceType& GetType( ) { return meType; }
rtl::OUString GetUrl( ) { return maUrl.GetMainURL( INetURLObject::NO_DECODE ); }
sal_Bool IsLocal( ) { return maUrl.GetProtocol() == INET_PROT_FILE; };
sal_Bool& IsEditable( ) { return mbEditable; }
};
typedef boost::shared_ptr< Place > PlacePtr;
class PlacesListBox_Impl : public SvHeaderTabListBox
{
private:
HeaderBar* mpHeaderBar;
public:
PlacesListBox_Impl( Window* pParent, const rtl::OUString& rTitle );
~PlacesListBox_Impl( );
};
/** ListBox to handle Places.
*/
class PlacesListBox : public ListBox
class PlacesListBox : public Control
{
private:
std::vector< PlacePtr > maPlaces;
SvtFileDialog* mpDlg;
PlacesListBox_Impl* mpImpl;
sal_Int32 mnNbEditables;
bool mbUpdated;
public:
PlacesListBox( SvtFileDialog* pFileDlg, const ResId& rResId );
PlacesListBox( SvtFileDialog* pFileDlg, const rtl::OUString& rTitle, const ResId& rResId );
~PlacesListBox( );
void AppendPlace( PlacePtr pPlace );
......@@ -96,12 +101,14 @@ class PlacesListBox : public ListBox
bool IsUpdated();
const std::vector<PlacePtr>& GetPlaces();
void SetSizePixel( const Size& rNewSize );
private:
Image getEntryIcon( Place::ePlaceType eType);
DECL_LINK( SelectHdl, ListBox* );
DECL_LINK( DoubleClickHdl, ListBox* );
Image getEntryIcon( PlacePtr pPlace );
DECL_LINK( Selection, void* );
DECL_LINK( DoubleClick, void* );
};
#endif
......
This diff is collapsed.
......@@ -36,7 +36,6 @@
#define ED_EXPLORERFILE_CURRENTPATH 10
#define BTN_EXPLORERFILE_NEWFOLDER 11
#define BTN_EXPLORERFILE_UP 12
#define BTN_EXPLORERFILE_STANDARD 13
#define BTN_EXPLORERFILE_OPEN 14
#define BTN_EXPLORERFILE_CANCEL 15
#define BTN_EXPLORERFILE_HELP 16
......@@ -44,6 +43,8 @@
#define IMG_FILEDLG_BTN_UP 10
#define IMG_FILEDLG_BTN_STD 11
#define IMG_FILEDLG_CREATEFOLDER 14
#define IMG_FILEDLG_PLACE_LOCAL 15
#define IMG_FILEDLG_PLACE_REMOTE 16
#define CTL_EXPLORERFILE_FILELIST 20
......@@ -74,16 +75,17 @@
#define STR_BUTTONSELECT 6
#define STR_ACTUALVERSION 7
#define STR_PREVIEW 8
#define STR_MY_DOCUMENTS 9
#define STR_DEFAULT_DIRECTORY 9
#define STR_PLACES_TITLE 10
// DLG_SVT_ADDPLACE ------------------------------
#define FT_ADDPLACE_SERVERURL 10
#define FT_ADDPLACE_SERVERURL 10
#define FT_ADDPLACE_SERVERNAME 11
#define FT_ADDPLACE_SERVERTYPE 12
#define FT_ADDPLACE_SERVERLOGIN 13
#define FT_ADDPLACE_SERVERPASSWORD 14
#define ED_ADDPLACE_SERVERURL 15
#define ED_ADDPLACE_SERVERURL 15
#define ED_ADDPLACE_SERVERNAME 16
#define ED_ADDPLACE_SERVERTYPE 17
#define ED_ADDPLACE_SERVERLOGIN 18
......
......@@ -344,9 +344,6 @@ private:
String implGetInitialURL( const String& _rPath, const String& _rFallback );
/// initializes the special URL lists, such as our favourites and our restricted paths
void implInitializeSpecialURLLists( );
/// executes a certain FileView action asynchronously
void executeAsync(
::svt::AsyncPickerAction::Action _eAction,
......
......@@ -36,10 +36,12 @@
IMG_FILEDLG_BTN_UP; \
IMG_FILEDLG_BTN_STD; \
IMG_FILEDLG_CREATEFOLDER; \
IMG_FILEDLG_PLACE_LOCAL; \
IMG_FILEDLG_PLACE_REMOTE; \
}; \
IdCount = \
{ \
3; \
5; \
};
#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; };
......@@ -67,7 +69,7 @@ ModalDialog DLG_SVT_EXPLORERFILE
Edit ED_EXPLORERFILE_CURRENTPATH
{
Pos = MAP_APPFONT ( 6 , 6 ) ;
Size = MAP_APPFONT ( 90 , 14 ) ;
Size = MAP_APPFONT ( 90 , 12 ) ;
Border = TRUE ;
};
ImageButton BTN_EXPLORERFILE_NEWFOLDER
......@@ -75,6 +77,7 @@ ModalDialog DLG_SVT_EXPLORERFILE
HelpID = "fpicker:ImageButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_NEWFOLDER";
TabStop = FALSE ;
Pos = MAP_APPFONT ( 59 , 6 ) ;
Size = MAP_APPFONT( 12, 12 ) ;
QuickHelpText [ en-US ] = "Create New Directory" ;
};
MenuButton BTN_EXPLORERFILE_UP
......@@ -82,31 +85,21 @@ ModalDialog DLG_SVT_EXPLORERFILE
HelpID = "fpicker:MenuButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_UP";
TabStop = FALSE ;
Pos = MAP_APPFONT ( 109 , 6 ) ;
Size = MAP_APPFONT( 12, 12 ) ;
QuickHelpText [ en-US ] = "Up One Level" ;
};
MenuButton BTN_EXPLORERFILE_STANDARD
{
HelpID = "fpicker:MenuButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_STANDARD";
TabStop = FALSE ;
Pos = MAP_APPFONT ( 59 , 6 ) ;
QuickHelpText [ en-US ] = "Default Directory" ;
};
ListBox LB_EXPLORERFILE_PLACES_LISTBOX
Control LB_EXPLORERFILE_PLACES_LISTBOX
{
HelpID = "fpicker:ListBox:DLG_SVT_EXPLORERFILE:LB_EXPLORERFILE_PLACES_LISTBOX";
Pos = MAP_APPFONT ( 6 , 26 ) ;
Size = MAP_APPFONT ( 50 , 75 ) ;
DropDown = FALSE ;
AutoSize = FALSE ;
AutoHScroll = TRUE ;
Border = TRUE ;
};
PushButton BTN_EXPLORERFILE_CONNECT_TO_SERVER
{
HelpID = "fpicker:PushButton:DLG_SVT_EXPLORERFILE:BTN_EXPLORERFILE_CONNECT_TO_SERVER";
Pos = MAP_APPFONT ( 94 , 6 ) ;
Size = MAP_APPFONT ( 15 , 10 ) ;
Size = MAP_APPFONT ( 12 , 12 ) ;
Text [ en-US ] = "..." ;
QuickHelpText [ en-US ] = "Connect To Server" ;
};
......@@ -252,9 +245,13 @@ ModalDialog DLG_SVT_EXPLORERFILE
{
Text [ en-US ] = "File Preview";
};
String STR_MY_DOCUMENTS
String STR_DEFAULT_DIRECTORY
{
Text [ en-US ] = "Default Directory" ;
};
String STR_PLACES_TITLE
{
Text [ en-US ] = "My Documents" ;
Text [ en-US ] = "Places" ;
};
};
......
......@@ -358,7 +358,6 @@ SvtExpFileDlg_Impl::SvtExpFileDlg_Impl( WinBits ) :
_pBtnHelp ( NULL ),
_pBtnUp ( NULL ),
_pBtnNewFolder ( NULL ),
_pBtnStandard ( NULL ),
_pCbPassword ( NULL ),
_pEdCurrentPath ( NULL ),
_pCbAutoExtension ( NULL ),
......@@ -386,7 +385,6 @@ SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl()
delete _pCbPassword;
delete _pCbAutoExtension;
delete _pCbOptions;
delete _pBtnStandard;
delete _pBtnNewFolder;
delete _pBtnUp;
delete _pBtnHelp;
......
......@@ -184,7 +184,6 @@ public:
HelpButton* _pBtnHelp;
SvtUpButton_Impl* _pBtnUp;
ImageButton* _pBtnNewFolder;
SvtTravelButton_Impl* _pBtnStandard;
CheckBox* _pCbPassword;
SvtURLBox* _pEdCurrentPath;
CheckBox* _pCbAutoExtension;
......
......@@ -590,7 +590,10 @@
<value oor:external=
"com.sun.star.configuration.backend.GconfBackend SymbolSet"/>
</prop>
<prop oor:name="FilePickerPlaces">
<prop oor:name="FilePickerPlacesUrls">
<value/>
</prop>
<prop oor:name="FilePickerPlacesNames">
<value/>
</prop>
</node>
......
......@@ -6755,9 +6755,14 @@
</info>
<value>true</value>
</prop>
<prop oor:name="FilePickerPlaces" oor:type="oor:string-list" oor:nillable="false">
<prop oor:name="FilePickerPlacesUrls" oor:type="oor:string-list" oor:nillable="false">
<info>
<desc>List of the places the user bookmarked in the file picker dialog.</desc>
<desc>List of URLs of the places the user bookmarked in the file picker dialog.</desc>
</info>
</prop>
<prop oor:name="FilePickerPlacesNames" oor:type="oor:string-list" oor:nillable="false">
<info>
<desc>List of names of the places the user bookmarked in the file picker dialog.</desc>
</info>
</prop>
</group>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment