summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2006-07-26 08:05:13 +0000
committerRüdiger Timm <rt@openoffice.org>2006-07-26 08:05:13 +0000
commit719628ad9055712b94a86de382627e5a46a5609f (patch)
tree0d3b43539b0dd93b70500fecc9e26657a98a009e /fpicker
parent753730e5facad5bd39004d43431da412ecd2ce42 (diff)
INTEGRATION: CWS c06v2_SRC680 (1.8.24); FILE MERGED
2006/05/18 13:27:08 kso 1.8.24.1: #135918# - support for WorkDirMustContainRemovableMedia. Issue number: Submitted by: Reviewed by:
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/iodlg.cxx72
1 files changed, 70 insertions, 2 deletions
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 31cb371c8187..9ed1d91b78cf 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: iodlg.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: obo $ $Date: 2006-07-13 16:55:13 $
+ * last change: $Author: rt $ $Date: 2006-07-26 09:05:13 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -160,6 +160,12 @@
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
#include <com/sun/star/util/URL.hpp>
@@ -225,6 +231,7 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::sdbc;
using namespace ::utl;
using namespace ::svt;
@@ -2021,6 +2028,67 @@ String SvtFileDialog::implGetInitialURL( const String& _rPath, const String& _rF
//---------------------------------------------------------------------
short SvtFileDialog::Execute()
{
+ rtl::OUString aEnvValue;
+ if ( getEnvironmentValue( "WorkDirMustContainRemovableMedia", aEnvValue ) &&
+ aEnvValue.equalsAscii( "1" ) )
+ {
+ try
+ {
+ INetURLObject aStdDir( GetStandardDir() );
+ ::ucb::Content aCnt( rtl::OUString( aStdDir.GetMainURL(
+ INetURLObject::NO_DECODE ) ),
+ Reference< XCommandEnvironment >() );
+ Sequence< rtl::OUString > aProps(2);
+ aProps[0] = rtl::OUString::createFromAscii( "IsVolume" );
+ aProps[1] = rtl::OUString::createFromAscii( "IsRemoveable" );
+
+ Reference< XResultSet > xResultSet
+ = aCnt.createCursor( aProps, ::ucb::INCLUDE_FOLDERS_ONLY );
+ if ( xResultSet.is() )
+ {
+ Reference< XRow > xRow( xResultSet, UNO_QUERY );
+
+ bool bEmpty = true;
+ if ( !xResultSet->next() )
+ {
+ // folder is empty
+ bEmpty = true;
+ }
+ else
+ {
+// @@@ KSO 05/18/2006: support for removable media currently hardcoded/incomplete in OSL
+//
+// do
+// {
+// // check, whether child is a removable volume
+// if ( xRow->getBoolean( 1 ) && !xRow->wasNull() )
+// {
+// if ( xRow->getBoolean( 2 ) && !xRow->wasNull() )
+// {
+ bEmpty = false;
+// break;
+// }
+// }
+// }
+// while ( xResultSet->next() );
+ }
+
+ if ( bEmpty )
+ {
+ ErrorBox aBox( this, WB_OK, SvtResId( STR_SVT_NOREMOVABLEDEVICE ) );
+ aBox.Execute();
+ return 0;
+ }
+ }
+ }
+ catch ( ContentCreationException const & )
+ {
+ }
+ catch ( CommandAbortedException const & )
+ {
+ }
+ }
+
// #102204# ---------------
if ( ( _pImp->_nStyle & WB_SAVEAS ) && m_bHasFilename )
// when doing a save-as, we do not want the handler to handle "this file does not exist" messages