Commits

Anonymous committed 68cd119

oooimprovement6: #i97340# disable show data button when no file exists

  • Participants
  • Parent commits e279c20

Comments (0)

Files changed (1)

File cui/source/options/optimprove2.cxx

 #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))
 
 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 ) :
                 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);
     }
 }