diff options
author | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-08-11 09:47:56 +0200 |
---|---|---|
committer | Bjoern Michaelsen <b_michaelsen@openoffice.org> | 2010-08-11 09:47:56 +0200 |
commit | f250c783207d3c2f1d0515ebd1b1b21a7639aca7 (patch) | |
tree | b140a900639402358666d429ed1eaec8d7a6076d | |
parent | e7a9197c3ce682dfbf829aa6187390ddfb34a18e (diff) |
oooimprovement6: #i97340# disable show data button when no file exists
-rw-r--r-- | cui/source/options/optimprove2.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cui/source/options/optimprove2.cxx b/cui/source/options/optimprove2.cxx index 8569f7e41..1e4150766 100644 --- a/cui/source/options/optimprove2.cxx +++ b/cui/source/options/optimprove2.cxx @@ -52,6 +52,7 @@ #include <comphelper/synchronousdispatch.hxx> #include <comphelper/uieventslogger.hxx> #include <tools/testtoolloader.hxx> +#include <osl/file.hxx> #define C2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) @@ -61,6 +62,18 @@ namespace uno = ::com::sun::star::uno; namespace util = ::com::sun::star::util; using namespace com::sun::star::system; + +namespace +{ + bool lcl_doesLogfileExist(const ::rtl::OUString& sLogPath) + { + ::rtl::OUString sLogFile( sLogPath ); + sLogFile += C2S("/Current.csv"); + ::osl::File aLogFile(sLogFile); + return aLogFile.open(osl_File_OpenFlag_Read) == ::osl::FileBase::E_None; + } +} + // class SvxEmptyPage ---------------------------------------------------- SvxEmptyPage::SvxEmptyPage( Window* pParent ) : @@ -262,11 +275,13 @@ void SvxImprovementOptionsPage::Reset( const SfxItemSet& /*rSet*/ ) if ( xSubst.is() ) sPath = xSubst->substituteVariables( sPath, sal_False ); m_sLogPath = sPath; + m_aShowDataPB.Enable(lcl_doesLogfileExist(m_sLogPath)); } } } catch( uno::Exception& ) { + m_aShowDataPB.Enable(false); } } |