#90314# replace ugly old svtools path dialogue with folder picker service

This commit is contained in:
Philipp Lohmann 2001-09-04 15:24:50 +00:00
parent 4fb34196f6
commit cbbe10fec9
7 changed files with 150 additions and 91 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: adddlg.cxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: pl $ $Date: 2001-06-19 13:47:44 $
* last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -79,9 +79,6 @@
#ifndef _PSPRINT_STRHELPER_HXX_
#include <psprint/strhelper.hxx>
#endif
#ifndef _SVT_FILEDLG_HXX
#include <filedlg.hxx>
#endif
#ifndef _OSL_THREAD_H_
#include <osl/thread.h>
#endif
@ -450,10 +447,9 @@ IMPL_LINK( APCommandPage, ClickBtnHdl, PushButton*, pButton )
}
else if( pButton == &m_aPdfDirBtn )
{
PathDialog aDialog( this );
aDialog.SetPath( m_aPdfDirEdt.GetText() );
if( aDialog.Execute() )
m_aPdfDirEdt.SetText( aDialog.GetPath() );
String aPath( m_aPdfDirEdt.GetText() );
if( chooseDirectory( this, aPath ) )
m_aPdfDirEdt.SetText( aPath );
}
return 0;
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: fontentry.cxx,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: pl $ $Date: 2001-06-27 16:03:31 $
* last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -77,9 +77,6 @@
#ifndef _PAD_FONTENTRY_HXX_
#include <fontentry.hxx>
#endif
#ifndef _SVT_FILEDLG_HXX
#include <filedlg.hxx>
#endif
#ifndef _PAD_HELPER_HXX_
#include <helper.hxx>
#endif
@ -685,11 +682,10 @@ IMPL_LINK( FontImportDialog, ClickBtnHdl, Button*, pButton )
{
if( pButton == &m_aFromBtn )
{
PathDialog aDlg( this );
aDlg.SetPath( m_aFromDirEdt.GetText() );
if( aDlg.Execute() )
String aPath( m_aFromDirEdt.GetText() );
if( chooseDirectory( this, aPath ) )
{
m_aFromDirEdt.SetText( aDlg.GetPath() );
m_aFromDirEdt.SetText( aPath );
RefreshTimeoutHdl( NULL );
}
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: helper.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: pl $ $Date: 2001-07-04 14:06:14 $
* last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -86,10 +86,30 @@
#ifndef _CONFIG_HXX
#include <tools/config.hxx>
#endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_EXECUTABLEDIALOGRESULTS_HPP_
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#endif
#ifndef _COM_SUN_STAR_UI_DIALOGS_XFOLDERPICKER_HPP_
#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
using namespace osl;
using namespace rtl;
using namespace padmin;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ui::dialogs;
#define MAX_PATH 1024
@ -277,3 +297,29 @@ void padmin::freePadminRC()
if( pRC )
delete pRC, pRC = NULL;
}
bool padmin::chooseDirectory( Window* pParent, String& rInOutPath )
{
bool bRet = false;
Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
if( xFactory.is() )
{
Reference< XFolderPicker > xFolderPicker( xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY );
if( xFolderPicker.is() )
{
INetURLObject aObj( rInOutPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL );
xFolderPicker->setDisplayDirectory( aObj.GetMainURL() );
if( xFolderPicker->execute() == ExecutableDialogResults::OK )
{
aObj = INetURLObject( xFolderPicker->getDirectory() );
rInOutPath = aObj.PathToFileName();
bRet = true;
}
}
#ifdef DEBUG
else
fprintf( stderr, "could not get FolderPicker service\n" );
#endif
}
return bRet;
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: helper.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: pl $ $Date: 2001-06-26 19:27:24 $
* last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -96,72 +96,74 @@ class Config;
namespace padmin
{
class DelMultiListBox : public MultiListBox
class DelMultiListBox : public MultiListBox
{
Link m_aDelPressedLink;
public:
DelMultiListBox( Window* pParent, const ResId& rResId ) :
MultiListBox( pParent, rResId ) {}
~DelMultiListBox() {}
virtual long Notify( NotifyEvent& rEvent );
Link setDelPressedLink( const Link& rLink )
{
Link m_aDelPressedLink;
public:
DelMultiListBox( Window* pParent, const ResId& rResId ) :
MultiListBox( pParent, rResId ) {}
~DelMultiListBox() {}
virtual long Notify( NotifyEvent& rEvent );
Link setDelPressedLink( const Link& rLink )
{
Link aOldLink( m_aDelPressedLink );
Link aOldLink( m_aDelPressedLink );
m_aDelPressedLink = rLink;
return aOldLink;
}
const Link& getDelPressedLink() const { return m_aDelPressedLink; }
};
}
const Link& getDelPressedLink() const { return m_aDelPressedLink; }
};
class DelListBox : public ListBox
{
Link m_aDelPressedLink;
public:
DelListBox( Window* pParent, const ResId& rResId ) :
class DelListBox : public ListBox
{
Link m_aDelPressedLink;
public:
DelListBox( Window* pParent, const ResId& rResId ) :
ListBox( pParent, rResId ) {}
~DelListBox() {}
~DelListBox() {}
virtual long Notify( NotifyEvent& rEvent );
virtual long Notify( NotifyEvent& rEvent );
Link setDelPressedLink( const Link& rLink )
{
Link aOldLink( m_aDelPressedLink );
m_aDelPressedLink = rLink;
return aOldLink;
}
const Link& getDelPressedLink() const { return m_aDelPressedLink; }
};
class QueryString : public ModalDialog
Link setDelPressedLink( const Link& rLink )
{
private:
OKButton m_aOKButton;
CancelButton m_aCancelButton;
FixedText m_aFixedText;
Edit m_aEdit;
ComboBox m_aComboBox;
Link aOldLink( m_aDelPressedLink );
m_aDelPressedLink = rLink;
return aOldLink;
}
const Link& getDelPressedLink() const { return m_aDelPressedLink; }
};
String& m_rReturnValue;
bool m_bUseEdit;
class QueryString : public ModalDialog
{
private:
OKButton m_aOKButton;
CancelButton m_aCancelButton;
FixedText m_aFixedText;
Edit m_aEdit;
ComboBox m_aComboBox;
DECL_LINK( ClickBtnHdl, Button* );
String& m_rReturnValue;
bool m_bUseEdit;
public:
QueryString( Window*, String &, String &, const ::std::list< String >& rChoices = ::std::list<String>() );
// parent window, Query text, initial value
~QueryString();
};
DECL_LINK( ClickBtnHdl, Button* );
BOOL AreYouSure( Window*, int nRid = -1 );
public:
QueryString( Window*, String &, String &, const ::std::list< String >& rChoices = ::std::list<String>() );
// parent window, Query text, initial value
~QueryString();
};
ResId PaResId( ULONG nId );
BOOL AreYouSure( Window*, int nRid = -1 );
void FindFiles( const String& rDirectory, ::std::list< String >& rResult, const String& rSuffixes );
ResId PaResId( ULONG nId );
Config& getPadminRC();
void freePadminRC();
void FindFiles( const String& rDirectory, ::std::list< String >& rResult, const String& rSuffixes );
Config& getPadminRC();
void freePadminRC();
bool chooseDirectory( Window* pParent, String& rInOutPath );
} // namespace padmin

View file

@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.4 $
# $Revision: 1.5 $
#
# last change: $Author: pl $ $Date: 2001-07-09 15:46:37 $
# last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@ -71,15 +71,13 @@ LIBTARGET=NO
# --- Files --------------------------------------------------------
SRCFILES=padialog.src filedlg2.src rtsetup.src
SRCFILES=padialog.src rtsetup.src
RESLIB1NAME=spa
RESLIB1SRSFILES= $(SRS)$/padmin.srs
RESLIB1DEPN=\
padialog.src \
padialog.hrc \
filedlg2.hrc \
filedlg2.src \
rtsetup.src \
rtsetup.hrc
RESLIB1BMPS=\
@ -94,8 +92,6 @@ SLOFILES=\
$(SLO)$/cmddlg.obj \
$(SLO)$/progress.obj \
$(SLO)$/newppdlg.obj \
$(SLO)$/filedlg.obj \
$(SLO)$/filedlg2.obj \
$(SLO)$/prtsetup.obj \
$(SLO)$/prgsbar.obj \
$(SLO)$/fontentry.obj \
@ -130,6 +126,7 @@ APP1OBJS=\
APP1STDLIBS= \
-l$(SHL1TARGET) \
$(SHL1STDLIBS) \
$(UCBHELPERLIB) \
-lXext -lX11
# --- Targets ------------------------------------------------------

View file

@ -2,9 +2,9 @@
*
* $RCSfile: newppdlg.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: rt $ $Date: 2001-05-22 14:59:21 $
* last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -68,9 +68,6 @@
#ifndef _PSPRINT_HELPER_HXX_
#include <psprint/helper.hxx>
#endif
#ifndef _SVT_FILEDLG_HXX
#include <filedlg.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
@ -254,11 +251,10 @@ IMPL_LINK( PPDImportDialog, ClickBtnHdl, PushButton*, pButton )
}
else if( pButton == &m_aSearchBtn )
{
PathDialog aDlg( this );
aDlg.SetPath( m_aPathBox.GetText() );
if( aDlg.Execute() )
String aPath( m_aPathBox.GetText() );
if( chooseDirectory( this, aPath ) )
{
m_aPathBox.SetText( aDlg.GetPath() );
m_aPathBox.SetText( aPath );
Import();
}
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: pamain.cxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: pl $ $Date: 2001-05-08 11:56:36 $
* last change: $Author: pl $ $Date: 2001-09-04 16:24:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -86,6 +86,14 @@
#include <comphelper/processfactory.hxx>
#endif
#ifndef _UCBHELPER_CONTENTBROKER_HXX
#include <ucbhelper/contentbroker.hxx>
#endif
#ifndef _UCBHELPER_CONFIGURATIONKEYS_HXX_
#include <ucbhelper/configurationkeys.hxx>
#endif
using namespace padmin;
using namespace rtl;
using namespace cppu;
@ -150,11 +158,29 @@ void MyApp::Main()
fprintf( stderr, "could not create service factory\n" );
#endif
/*
* Create UCB.
*/
Sequence< Any > aArgs( 2 );
aArgs[ 0 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
aArgs[ 1 ] <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
sal_Bool bSuccess = ::ucb::ContentBroker::initialize( xFactory, aArgs );
#ifdef DEBUG
if ( !bSuccess )
fprintf( stderr, "Error creating UCB\n" );
#endif
pPADialog = PADialog::Create( NULL , FALSE );
Application::SetDisplayName( pPADialog->GetText() );
pPADialog->Execute();
delete pPADialog;
/*
* clean up UCB
*/
::ucb::ContentBroker::deinitialize();
OString aTmp( OUStringToOString( aWriteRdbName, RTL_TEXTENCODING_ISO_8859_1 ) );
unlink( aTmp.getStr() );
}