Kaydet (Commit) 40078b3e authored tarafından Caolán McNamara's avatar Caolán McNamara

remove the 4 send crash report tabpages

and other logical consequences of

officecfg::Office::Recovery::CrashReporter::Enabled ==  false

because we have this disabled by default since the first LibreOffice release
and we have no backend infrastucture to handle the submissions anyway and it's
blocking conversion of legacy .src dialogs to .ui format

Change-Id: Id5481af3ec970032b3728c0e6cc0c6a52d3ed3dc
üst 10da10ee
...@@ -169,7 +169,6 @@ class Desktop : public Application ...@@ -169,7 +169,6 @@ class Desktop : public Application
static sal_Bool SaveTasks(); static sal_Bool SaveTasks();
static void retrieveCrashReporterState();
static sal_Bool isUIOnSessionShutdownAllowed(); static sal_Bool isUIOnSessionShutdownAllowed();
// on-demand acceptors // on-demand acceptors
......
...@@ -156,7 +156,6 @@ namespace desktop ...@@ -156,7 +156,6 @@ namespace desktop
{ {
static oslSignalHandler pSignalHandler = 0; static oslSignalHandler pSignalHandler = 0;
static sal_Bool _bCrashReporterEnabled = sal_True;
namespace { namespace {
...@@ -1071,27 +1070,12 @@ void Desktop::HandleBootstrapErrors( ...@@ -1071,27 +1070,12 @@ void Desktop::HandleBootstrapErrors(
} }
void Desktop::retrieveCrashReporterState()
{
_bCrashReporterEnabled
= officecfg::Office::Recovery::CrashReporter::Enabled::get();
}
sal_Bool Desktop::isUIOnSessionShutdownAllowed() sal_Bool Desktop::isUIOnSessionShutdownAllowed()
{ {
return officecfg::Office::Recovery::SessionShutdown::DocumentStoreUIEnabled return officecfg::Office::Recovery::SessionShutdown::DocumentStoreUIEnabled
::get(); ::get();
} }
//-----------------------------------------------
/** @short check if crash reporter feature is enabled or
disabled.
*/
sal_Bool Desktop::isCrashReporterEnabled()
{
return _bCrashReporterEnabled;
}
//----------------------------------------------- //-----------------------------------------------
/** @short check if recovery must be started or not. /** @short check if recovery must be started or not.
...@@ -1129,13 +1113,11 @@ void impl_checkRecoveryState(sal_Bool& bCrashed , ...@@ -1129,13 +1113,11 @@ void impl_checkRecoveryState(sal_Bool& bCrashed ,
differs between EMERGENCY_SAVE and RECOVERY differs between EMERGENCY_SAVE and RECOVERY
*/ */
sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave , sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave ,
sal_Bool bCrashed ,
sal_Bool bExistsRecoveryData) sal_Bool bExistsRecoveryData)
{ {
static OUString SERVICENAME_RECOVERYUI("com.sun.star.comp.svx.RecoveryUI"); static OUString SERVICENAME_RECOVERYUI("com.sun.star.comp.svx.RecoveryUI");
static OUString COMMAND_EMERGENCYSAVE("vnd.sun.star.autorecovery:/doEmergencySave"); static OUString COMMAND_EMERGENCYSAVE("vnd.sun.star.autorecovery:/doEmergencySave");
static OUString COMMAND_RECOVERY("vnd.sun.star.autorecovery:/doAutoRecovery"); static OUString COMMAND_RECOVERY("vnd.sun.star.autorecovery:/doAutoRecovery");
static OUString COMMAND_CRASHREPORT("vnd.sun.star.autorecovery:/doCrashReport");
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
...@@ -1151,8 +1133,6 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave , ...@@ -1151,8 +1133,6 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave ,
aURL.Complete = COMMAND_EMERGENCYSAVE; aURL.Complete = COMMAND_EMERGENCYSAVE;
else if (bExistsRecoveryData) else if (bExistsRecoveryData)
aURL.Complete = COMMAND_RECOVERY; aURL.Complete = COMMAND_RECOVERY;
else if (bCrashed && Desktop::isCrashReporterEnabled() )
aURL.Complete = COMMAND_CRASHREPORT;
else else
return false; return false;
...@@ -1176,7 +1156,6 @@ sal_Bool Desktop::SaveTasks() ...@@ -1176,7 +1156,6 @@ sal_Bool Desktop::SaveTasks()
{ {
return impl_callRecoveryUI( return impl_callRecoveryUI(
sal_True , // sal_True => force emergency save sal_True , // sal_True => force emergency save
sal_False, // 2. and 3. param not used if 1. = true!
sal_False); sal_False);
} }
...@@ -1475,10 +1454,8 @@ int Desktop::Main() ...@@ -1475,10 +1454,8 @@ int Desktop::Main()
SetSplashScreenProgress(30); SetSplashScreenProgress(30);
// set static variable to enabled/disable crash reporter // set static variable to disable crash reporting
retrieveCrashReporterState(); osl_setErrorReporting( false );
const bool bCrashReporterEnabled = isCrashReporterEnabled();
osl_setErrorReporting( !bCrashReporterEnabled );
// create title string // create title string
LanguageTag aLocale( LANGUAGE_SYSTEM); LanguageTag aLocale( LANGUAGE_SYSTEM);
...@@ -2369,7 +2346,6 @@ void Desktop::OpenClients() ...@@ -2369,7 +2346,6 @@ void Desktop::OpenClients()
{ {
bRecovery = impl_callRecoveryUI( bRecovery = impl_callRecoveryUI(
sal_False , // false => force recovery instead of emergency save sal_False , // false => force recovery instead of emergency save
bCrashed ,
bExistsRecoveryData); bExistsRecoveryData);
} }
catch(const css::uno::Exception& e) catch(const css::uno::Exception& e)
......
...@@ -1019,15 +1019,11 @@ ...@@ -1019,15 +1019,11 @@
// recycling ids from DBMgr // recycling ids from DBMgr
#define RID_SVX_MDLG_DOCRECOVERY_PROGR ( RID_SVX_START + 11 ) #define RID_SVX_MDLG_DOCRECOVERY_PROGR ( RID_SVX_START + 11 )
#define RID_SVX_MDLG_DOCRECOVERY_BROKEN ( RID_SVX_START + 12 ) #define RID_SVX_MDLG_DOCRECOVERY_BROKEN ( RID_SVX_START + 12 )
#define RID_SVX_MDLG_ERR_REP_OPTIONS ( RID_SVX_START + 13 )
#define RID_SVX_MDLG_ERR_REP_PREVIEW ( RID_SVX_START + 14 )
#define RID_SVX_TABDLG_DOCRECOVERY ( RID_SVX_START + 0 ) #define RID_SVX_TABDLG_DOCRECOVERY ( RID_SVX_START + 0 )
#define RID_SVXPAGE_DOCRECOVERY_SAVE ( RID_SVX_START + 8 ) #define RID_SVXPAGE_DOCRECOVERY_SAVE ( RID_SVX_START + 8 )
#define RID_SVXPAGE_DOCRECOVERY_RECOVER ( RID_SVX_START + 9 ) #define RID_SVXPAGE_DOCRECOVERY_RECOVER ( RID_SVX_START + 9 )
#define RID_SVXPAGE_ERR_REP_WELCOME ( RID_SVX_START + 10 )
#define RID_SVXPAGE_ERR_REP_SEND ( RID_SVX_START + 11 )
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -108,17 +108,6 @@ ...@@ -108,17 +108,6 @@
<value>false</value> <value>false</value>
</prop> </prop>
</group> </group>
<group oor:name="CrashReporter">
<info>
<desc>Settings for the crash reporter.</desc>
</info>
<prop oor:name="Enabled" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies if the crash reporter should be enabled or disabled.</desc>
</info>
<value>false</value>
</prop>
</group>
<group oor:name="AutoSave"> <group oor:name="AutoSave">
<info> <info>
<desc> </desc> <desc> </desc>
......
...@@ -262,23 +262,10 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ ...@@ -262,23 +262,10 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
)) ))
endif endif
ifneq (,$(filter LINUX DRAGONFLY OPENBSD FREEBSD NETBSD, $(OS)))
$(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/dialog/sendreportunx \
))
else
ifeq ($(OS),WNT) ifeq ($(OS),WNT)
$(eval $(call gb_Library_use_system_win32_libs,svx,\ $(eval $(call gb_Library_use_system_win32_libs,svx,\
advapi32 \ advapi32 \
)) ))
$(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/dialog/sendreportw32 \
))
else
$(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/dialog/sendreportgen \
))
endif
endif endif
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -100,9 +100,7 @@ ...@@ -100,9 +100,7 @@
#define STR_RECOVFAILED 22 #define STR_RECOVFAILED 22
#define STR_RECOVINPROGR 23 #define STR_RECOVINPROGR 23
#define STR_NOTRECOVYET 24 #define STR_NOTRECOVYET 24
#define STR_RECOVERY_NEXT 25
#define STR_RECOVERY_INPROGRESS 26 #define STR_RECOVERY_INPROGRESS 26
#define STR_RECOVERY_REPORT 27
#define STR_RECOVERYONLY_FINISH_DESCR 28 #define STR_RECOVERYONLY_FINISH_DESCR 28
#define STR_RECOVERYONLY_FINISH 29 #define STR_RECOVERYONLY_FINISH 29
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "docrecovery.hxx"
namespace svx{
namespace DocRecovery{
bool ErrorRepSendDialog::ReadParams()
{
return false;
}
bool ErrorRepSendDialog::SaveParams()
{
return false;
}
bool ErrorRepSendDialog::SendReport()
{
return false;
}
} // namespace DocRecovery
} // namespace svx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <config_folders.h>
#include "docrecovery.hxx"
#include "osl/file.hxx"
#include "osl/process.h"
#include "rtl/bootstrap.hxx"
#include "rtl/strbuf.hxx"
#include "tools/appendunixshellword.hxx"
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#define RCFILE ".crash_reportrc"
using namespace ::std;
static const char *get_home_dir()
{
struct passwd *ppwd = getpwuid( getuid() );
return ppwd ? (ppwd->pw_dir ? ppwd->pw_dir : "/") : "/";
}
static bool read_line( FILE *fp, string& rLine )
{
char szBuffer[1024];
bool bSuccess = false;
bool bEOL = false;
string line;
while ( !bEOL && fgets( szBuffer, sizeof(szBuffer), fp ) )
{
int len = strlen(szBuffer);
bSuccess = true;
while ( len && szBuffer[len - 1] == '\n' )
{
szBuffer[--len] = 0;
bEOL = true;
}
line.append( szBuffer );
}
rLine = line;
return bSuccess;
}
static string trim_string( const string& rString )
{
string temp = rString;
while ( temp.length() && (temp[0] == ' ' || temp[0] == '\t') )
temp.erase( 0, 1 );
string::size_type len = temp.length();
while ( len && (temp[len-1] == ' ' || temp[len-1] == '\t') )
{
temp.erase( len - 1, 1 );
len = temp.length();
}
return temp;
}
static string get_profile_string( const char *pFileName, const char *pSectionName, const char *pKeyName, const char *pDefault = NULL )
{
FILE *fp = fopen( pFileName, "r" );
string retValue = pDefault ? pDefault : "";
if ( fp )
{
string line;
string section;
while ( read_line( fp, line ) )
{
line = trim_string( line );
if ( line.length() && line[0] == '[' )
{
line.erase( 0, 1 );
string::size_type end = line.find( ']', 0 );
if ( string::npos != end )
section = trim_string( line.substr( 0, end ) );
}
else
{
string::size_type iEqualSign = line.find( '=', 0 );
if ( iEqualSign != string::npos )
{
string keyname = line.substr( 0, iEqualSign );
keyname = trim_string( keyname );
string value = line.substr( iEqualSign + 1, string::npos );
value = trim_string( value );
if (
0 == strcasecmp( section.c_str(), pSectionName ) &&
0 == strcasecmp( keyname.c_str(), pKeyName )
)
{
retValue = value;
break;
}
}
}
}
fclose( fp );
}
return retValue;
}
static bool get_profile_bool( const char *pFileName, const char *pSectionName, const char *pKeyName )
{
string str = get_profile_string( pFileName, pSectionName, pKeyName );
if ( !strcasecmp( str.c_str(), "true" ) )
return true;
return false;
}
static OUString get_profile_String( const char *pFileName, const char *pSectionName, const char *pKeyName, const char * = NULL )
{
string str = get_profile_string( pFileName, pSectionName, pKeyName );
OUString result( str.c_str(), str.length(), RTL_TEXTENCODING_UTF8 );
return result;
}
namespace svx{
namespace DocRecovery{
bool ErrorRepSendDialog::ReadParams()
{
string sRCFile = get_home_dir();
sRCFile += "/";
sRCFile += string(RCFILE);
maEMailAddrED.SetText( get_profile_String( sRCFile.c_str(), "Options", "ReturnAddress" ) );
maParams.maHTTPProxyServer = get_profile_String( sRCFile.c_str(), "Options", "ProxyServer" );
maParams.maHTTPProxyPort = get_profile_String( sRCFile.c_str(), "Options", "ProxyPort" );
maParams.miHTTPConnectionType = get_profile_bool( sRCFile.c_str(), "Options", "UseProxy" ) ? 2 : 1;
maContactCB.Check( get_profile_bool( sRCFile.c_str(), "Options", "AllowContact" ) );
return true;
}
bool ErrorRepSendDialog::SaveParams()
{
bool success = false;
string sRCFile = get_home_dir();
sRCFile += "/";
sRCFile += string(RCFILE);
FILE *fp = fopen( sRCFile.c_str(), "w" );
if ( fp )
{
fprintf( fp, "[Options]\n" );
fprintf( fp, "UseProxy=%s\n", 2 == maParams.miHTTPConnectionType ? "true" : "false" );
fprintf( fp, "ProxyServer=%s\n", OUStringToOString( maParams.maHTTPProxyServer, RTL_TEXTENCODING_UTF8 ).getStr() );
fprintf( fp, "ProxyPort=%s\n", OUStringToOString( maParams.maHTTPProxyPort, RTL_TEXTENCODING_UTF8 ).getStr() );
fprintf( fp, "ReturnAddress=%s\n", OUStringToOString( GetEMailAddress(), RTL_TEXTENCODING_UTF8 ).getStr() );
fprintf( fp, "AllowContact=%s\n", IsContactAllowed() ? "true" : "false" );
fclose( fp );
}
return success;
}
bool ErrorRepSendDialog::SendReport()
{
OUString sSubEnvVar("ERRORREPORT_SUBJECT");
OUString strSubject(GetDocType());
osl_setEnvironment(sSubEnvVar.pData, strSubject.pData);
char szBodyFile[]="/tmp/locrsXXXXXXX";
mode_t nOrigMode = umask(S_IRWXG | S_IRWXO);
int nDescriptor = mkstemp(szBodyFile);
umask(nOrigMode);
FILE *fp = nDescriptor != -1 ? fdopen(nDescriptor, "w") : NULL;
if ( fp )
{
OString strUTF8(OUStringToOString(GetUsing(), RTL_TEXTENCODING_UTF8));
size_t nWritten = fwrite(strUTF8.getStr(), 1, strUTF8.getLength(), fp);
OSL_VERIFY(nWritten == static_cast<size_t>(strUTF8.getLength()));
fclose( fp );
OUString sBodyEnvVar("ERRORREPORT_BODYFILE");
OUString strBodyFile(OStringToOUString(OString(szBodyFile),
osl_getThreadTextEncoding()));
osl_setEnvironment(sBodyEnvVar.pData, strBodyFile.pData);
}
int ret = -1;
OUString path1("$BRAND_BASE_DIR/" LIBO_LIBEXEC_FOLDER "/crashrep");
rtl::Bootstrap::expandMacros(path1);
OString path2;
if ((osl::FileBase::getSystemPathFromFileURL(path1, path1) ==
osl::FileBase::E_None) &&
path1.convertToString(
&path2, osl_getThreadTextEncoding(),
(RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
{
OStringBuffer cmd;
tools::appendUnixShellWord(&cmd, path2);
cmd.append(" -debug -load -send -noui");
ret = system(cmd.getStr());
}
if ( szBodyFile[0] )
{
unlink( szBodyFile );
}
return -1 != ret;
}
} // namespace DocRecovery
} // namespace svx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#define UNICODE
#define _UNICODE
#include "docrecovery.hxx"
#undef WB_LEFT
#undef WB_RIGHT
#include <prewin.h>
#include <postwin.h>
#include <tchar.h>
#include <stdio.h>
#include <systools/win32/uwinapi.h>
#include <sal/macros.h>
// need to undef min and max macros from MS headers here to make
// the std::min and std::max from stl visible again
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
//***************************************************************************
static LONG RegReadValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPVOID lpData, DWORD cbData )
{
HKEY hKey = NULL;
LONG lResult;
lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
if ( ERROR_SUCCESS == lResult )
{
lResult = RegQueryValueEx( hKey, lpValueName, NULL, NULL, (LPBYTE)lpData, &cbData );
RegCloseKey( hKey );
}
return lResult;
}
//***************************************************************************
static LONG RegWriteValue( HKEY hBaseKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, DWORD dwType, LPCVOID lpData, DWORD cbData )
{
HKEY hKey = NULL;
LONG lResult;
lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL );
if ( ERROR_SUCCESS == lResult )
{
lResult = RegSetValueEx( hKey, lpValueName, 0, dwType, (CONST sal_uInt8 *)lpData, cbData );
RegCloseKey( hKey );
}
return lResult;
}
//***************************************************************************
namespace svx{
namespace DocRecovery{
bool ErrorRepSendDialog::ReadParams()
{
_TCHAR szBuffer[2048];
if ( ERROR_SUCCESS == RegReadValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("HTTPProxyServer"),
szBuffer,
sizeof(szBuffer) ) )
maParams.maHTTPProxyServer = (sal_Unicode *)szBuffer;
DWORD dwProxyPort;
if ( ERROR_SUCCESS == RegReadValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("HTTPProxyPort"),
&dwProxyPort,
sizeof(dwProxyPort) ) )
{
_stprintf( szBuffer, _T("%d"), dwProxyPort );
maParams.maHTTPProxyPort = (sal_Unicode *)szBuffer;
}
if ( ERROR_SUCCESS == RegReadValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("ReturnAddress"),
szBuffer,
sizeof(szBuffer) ) )
maEMailAddrED.SetText(OUString((sal_Unicode *)szBuffer));
DWORD fAllowContact = sal_False;
RegReadValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("AllowContact"),
&fAllowContact,
sizeof(fAllowContact) );
maContactCB.Check( (sal_Bool)fAllowContact );
DWORD uInternetConnection = 0;
RegReadValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("HTTPConnection"),
&uInternetConnection,
sizeof(uInternetConnection) );
maParams.miHTTPConnectionType = uInternetConnection;
return true;
}
bool ErrorRepSendDialog::SaveParams()
{
const _TCHAR *lpHTTPProxyServer = reinterpret_cast<LPCTSTR>(maParams.maHTTPProxyServer.getStr());
RegWriteValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("HTTPProxyServer"), REG_SZ,
lpHTTPProxyServer,
sizeof(TCHAR) * (_tcslen(lpHTTPProxyServer) + 1) );
_TCHAR* endptr = NULL;
DWORD dwProxyPort = _tcstoul( reinterpret_cast<LPCTSTR>(maParams.maHTTPProxyPort.getStr()), &endptr, 10 );
RegWriteValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("HTTPProxyPort"), REG_DWORD,
&dwProxyPort,
sizeof(DWORD) );
DWORD fAllowContact = IsContactAllowed();
RegWriteValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("AllowContact"), REG_DWORD,
&fAllowContact,
sizeof(DWORD) );
DWORD uInternetConnection = maParams.miHTTPConnectionType;
RegWriteValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("HTTPConnection"), REG_DWORD,
&uInternetConnection,
sizeof(DWORD) );
const _TCHAR *lpEmail = reinterpret_cast<LPCTSTR>(GetEMailAddress().getStr());
RegWriteValue(
HKEY_CURRENT_USER,
TEXT("SOFTWARE\\LibreOffice\\CrashReport"),
TEXT("ReturnAddress"), REG_SZ,
lpEmail,
sizeof(TCHAR) * (_tcslen(lpEmail) + 1) );
return true;
}
bool ErrorRepSendDialog::SendReport()
{
TCHAR szTempPath[MAX_PATH];
TCHAR szFileName[MAX_PATH];
GetTempPath( SAL_N_ELEMENTS(szTempPath), szTempPath );
GetTempFileName( szTempPath, TEXT("DSC"), 0, szFileName );
FILE *fp = _tfopen( szFileName, _T("wb") );
if ( fp )
{
OString strUTF8(OUStringToOString(GetUsing(),
RTL_TEXTENCODING_UTF8));
fwrite( strUTF8.getStr(), 1, strUTF8.getLength(), fp );
fclose( fp );
}
SetEnvironmentVariable( TEXT("ERRORREPORT_SUBJECT"), reinterpret_cast<LPCTSTR>(GetDocType().getStr()) );
SetEnvironmentVariable( TEXT("ERRORREPORT_BODYFILE"), szFileName );
_TCHAR szBuffer[1024];
TCHAR szPath[MAX_PATH];
LPTSTR lpFilePart;
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
if ( SearchPath( NULL, TEXT("crashrep.exe"), NULL, MAX_PATH, szPath, &lpFilePart ) )
{
ZeroMemory( &StartupInfo, sizeof(StartupInfo) );
StartupInfo.cb = sizeof(StartupInfo.cb);
sntprintf( szBuffer, SAL_N_ELEMENTS(szBuffer),
_T("%s -noui -load -send"),
szPath );
if (
CreateProcess(
NULL,
szBuffer,
NULL,
NULL,
sal_False,
0,
NULL, NULL, &StartupInfo, &ProcessInfo )
)
{
DWORD dwExitCode;
WaitForSingleObject( ProcessInfo.hProcess, INFINITE );
if ( GetExitCodeProcess( ProcessInfo.hProcess, &dwExitCode ) && 0 == dwExitCode )
return true;
}
}
DeleteFile( szFileName );
return false;
}
} // namespace DocRecovery
} // namespace svx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#define RECOVERY_CMDPART_DO_EMERGENCY_SAVE OUString( "/doEmergencySave" ) #define RECOVERY_CMDPART_DO_EMERGENCY_SAVE OUString( "/doEmergencySave" )
#define RECOVERY_CMDPART_DO_RECOVERY OUString( "/doAutoRecovery" ) #define RECOVERY_CMDPART_DO_RECOVERY OUString( "/doAutoRecovery" )
#define RECOVERY_CMDPART_DO_CRASHREPORT OUString( "/doCrashReport" )
#define RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE OUString( "vnd.sun.star.autorecovery:/doPrepareEmergencySave") #define RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE OUString( "vnd.sun.star.autorecovery:/doPrepareEmergencySave")
#define RECOVERY_CMD_DO_EMERGENCY_SAVE OUString( "vnd.sun.star.autorecovery:/doEmergencySave" ) #define RECOVERY_CMD_DO_EMERGENCY_SAVE OUString( "vnd.sun.star.autorecovery:/doEmergencySave" )
...@@ -612,9 +611,7 @@ class RecoveryDialog : public IExtendedTabPage ...@@ -612,9 +611,7 @@ class RecoveryDialog : public IExtendedTabPage
FixedLine m_aBottomFL; FixedLine m_aBottomFL;
PushButton m_aNextBtn; PushButton m_aNextBtn;
CancelButton m_aCancelBtn; CancelButton m_aCancelBtn;
OUString m_aNextStr;
OUString m_aTitleRecoveryInProgress; OUString m_aTitleRecoveryInProgress;
OUString m_aTitleRecoveryReport;
OUString m_aRecoveryOnlyFinish; OUString m_aRecoveryOnlyFinish;
OUString m_aRecoveryOnlyFinishDescr; OUString m_aRecoveryOnlyFinishDescr;
...@@ -637,7 +634,6 @@ class RecoveryDialog : public IExtendedTabPage ...@@ -637,7 +634,6 @@ class RecoveryDialog : public IExtendedTabPage
bool m_bWaitForCore; bool m_bWaitForCore;
bool m_bUserDecideNext; bool m_bUserDecideNext;
bool m_bWasRecoveryStarted; bool m_bWasRecoveryStarted;
bool m_bRecoveryOnly;
//------------------------------------------- //-------------------------------------------
// member // member
...@@ -748,169 +744,6 @@ class BrokenRecoveryDialog : public ModalDialog ...@@ -748,169 +744,6 @@ class BrokenRecoveryDialog : public ModalDialog
/** @short TODO */ /** @short TODO */
void impl_askForSavePath(); void impl_askForSavePath();
}; };
class ErrorRepWelcomeDialog : public IExtendedTabPage
{
private:
Window maTitleWin;
FixedText maTitleFT;
FixedLine maTitleFL;
FixedText maDescrFT;
FixedLine maBottomFL;
PushButton maPrevBtn;
OKButton maNextBtn;
CancelButton maCancelBtn;
DECL_LINK( PrevBtnHdl, void* );
DECL_LINK( NextBtnHdl, void* );
DECL_LINK( CancelBtnHdl, void* );
public:
ErrorRepWelcomeDialog( Window* _pParent, sal_Bool _bAllowBack = sal_True );
virtual ~ErrorRepWelcomeDialog();
/** @short TODO*/
virtual short execute();
//---------------------------------------
/** @short TODO*/
virtual void setDefButton();
};
struct ErrorRepParams
{
ErrorRepParams()
#ifdef WNT
: miHTTPConnectionType( 0 )
#else
: miHTTPConnectionType( 1 )
#endif
, mbAllowContact( false )
{}
OUString maHTTPProxyServer;
OUString maHTTPProxyPort;
int miHTTPConnectionType;
bool mbAllowContact;
OUString maReturnAddress;
OUString maSubject;
OUString maBody;
};
class ErrorDescriptionEdit : public MultiLineEdit
{
private:
DECL_LINK( ModifyHdl, void* );
public:
ErrorDescriptionEdit( Window* pParent, const ResId& rResId );
virtual ~ErrorDescriptionEdit();
};
class ErrorRepSendDialog : public IExtendedTabPage
{
private:
Window maTitleWin;
FixedText maTitleFT;
FixedLine maTitleFL;
FixedText maDescrFT;
FixedText maDocTypeFT;
Edit maDocTypeED;
FixedText maUsingFT;
ErrorDescriptionEdit maUsingML;
PushButton maShowRepBtn;
PushButton maOptBtn;
CheckBox maContactCB;
FixedText maEMailAddrFT;
Edit maEMailAddrED;
FixedLine maBottomFL;
PushButton maPrevBtn;
OKButton maNextBtn;
CancelButton maCancelBtn;
ErrorRepParams maParams;
DECL_LINK( ShowRepBtnHdl, void* );
DECL_LINK( OptBtnHdl, void* );
DECL_LINK( ContactCBHdl, void* );
DECL_LINK( PrevBtnHdl, void* );
DECL_LINK( SendBtnHdl, void* );
DECL_LINK( CancelBtnHdl, void* );
void initControls();
public:
ErrorRepSendDialog( Window* _pParent );
virtual ~ErrorRepSendDialog();
OUString GetDocType( void ) const;
OUString GetUsing( void ) const;
bool IsContactAllowed( void ) const;
OUString GetEMailAddress( void ) const;
bool ReadParams();
bool SaveParams();
bool SendReport();
/** @short TODO*/
virtual short execute();
//---------------------------------------
/** @short TODO*/
virtual void setDefButton();
};
class ErrorRepOptionsDialog : public ModalDialog
{
private:
FixedLine maProxyFL;
RadioButton maSystemBtn;
RadioButton maDirectBtn;
RadioButton maManualBtn;
FixedText maProxyServerFT;
Edit maProxyServerEd;
FixedText maProxyPortFT;
Edit maProxyPortEd;
FixedText maDescriptionFT;
FixedLine maButtonsFL;
OKButton maOKBtn;
CancelButton maCancelBtn;
ErrorRepParams& mrParams;
DECL_LINK( CancelBtnHdl, void* );
DECL_LINK( OKBtnHdl, void * );
DECL_LINK( ManualBtnHdl, void * );
public:
ErrorRepOptionsDialog( Window* _pParent, ErrorRepParams& rParams );
virtual ~ErrorRepOptionsDialog();
};
class ErrorRepEdit : public ExtMultiLineEdit
{
public:
ErrorRepEdit( Window* pParent, const ResId& rResId );
virtual ~ErrorRepEdit();
};
class ErrorRepPreviewDialog : public ModalDialog
{
private:
ErrorRepEdit maContentML;
OKButton maOKBtn;
long mnMinHeight;
public:
ErrorRepPreviewDialog( Window* _pParent );
virtual ~ErrorRepPreviewDialog();
virtual void Resize();
};
} // namespace DocRecovery } // namespace DocRecovery
} // namespace svx } // namespace svx
......
...@@ -127,9 +127,6 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo ...@@ -127,9 +127,6 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo
void impl_doRecovery(); void impl_doRecovery();
void impl_showAllRecoveredDocs(); void impl_showAllRecoveredDocs();
void impl_doCrashReport();
}; };
} // namespace svx } // namespace svx
......
...@@ -57,7 +57,6 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo ...@@ -57,7 +57,6 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo
E_JOB_UNKNOWN, E_JOB_UNKNOWN,
E_DO_EMERGENCY_SAVE, E_DO_EMERGENCY_SAVE,
E_DO_RECOVERY, E_DO_RECOVERY,
E_DO_CRASHREPORT
}; };
//------------------------------------------- //-------------------------------------------
...@@ -131,8 +130,6 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo ...@@ -131,8 +130,6 @@ class RecoveryUI : public ::cppu::WeakImplHelper2< css::lang::XServiceInfo
void impl_showAllRecoveredDocs(); void impl_showAllRecoveredDocs();
void impl_doCrashReport();
}; };
RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& xContext) RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& xContext)
...@@ -191,10 +188,6 @@ css::uno::Any SAL_CALL RecoveryUI::dispatchWithReturnValue(const css::util::URL& ...@@ -191,10 +188,6 @@ css::uno::Any SAL_CALL RecoveryUI::dispatchWithReturnValue(const css::util::URL&
impl_doRecovery(); impl_doRecovery();
break; break;
case RecoveryUI::E_DO_CRASHREPORT :
impl_doCrashReport();
break;
default : default :
break; break;
} }
...@@ -261,21 +254,6 @@ static OUString GetUnsentURL() ...@@ -261,21 +254,6 @@ static OUString GetUnsentURL()
//=============================================== //===============================================
static bool new_crash_pending()
{
OUString aUnsentURL = GetUnsentURL();
File aFile( aUnsentURL );
if ( FileBase::E_None == aFile.open( osl_File_OpenFlag_Read ) )
{
aFile.close();
return true;
}
return false;
}
//===============================================
static bool delete_pending_crash() static bool delete_pending_crash()
{ {
OUString aUnsentURL = GetUnsentURL(); OUString aUnsentURL = GetUnsentURL();
...@@ -289,12 +267,8 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL) ...@@ -289,12 +267,8 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL)
{ {
if (aURL.Path.equals(RECOVERY_CMDPART_DO_EMERGENCY_SAVE)) if (aURL.Path.equals(RECOVERY_CMDPART_DO_EMERGENCY_SAVE))
m_eJob = RecoveryUI::E_DO_EMERGENCY_SAVE; m_eJob = RecoveryUI::E_DO_EMERGENCY_SAVE;
else else if (aURL.Path.equals(RECOVERY_CMDPART_DO_RECOVERY))
if (aURL.Path.equals(RECOVERY_CMDPART_DO_RECOVERY))
m_eJob = RecoveryUI::E_DO_RECOVERY; m_eJob = RecoveryUI::E_DO_RECOVERY;
else
if (aURL.Path.equals(RECOVERY_CMDPART_DO_CRASHREPORT))
m_eJob = RecoveryUI::E_DO_CRASHREPORT;
} }
return m_eJob; return m_eJob;
...@@ -325,11 +299,6 @@ sal_Bool RecoveryUI::impl_doEmergencySave() ...@@ -325,11 +299,6 @@ sal_Bool RecoveryUI::impl_doEmergencySave()
//=============================================== //===============================================
void RecoveryUI::impl_doRecovery() void RecoveryUI::impl_doRecovery()
{ {
bool bRecoveryOnly( false );
bool bCrashRepEnabled(officecfg::Office::Recovery::CrashReporter::Enabled::get(m_xContext));
bRecoveryOnly = !bCrashRepEnabled;
// create core service, which implements the real "emergency save" algorithm. // create core service, which implements the real "emergency save" algorithm.
svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xContext, false); svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xContext, false);
css::uno::Reference< css::frame::XStatusListener > xCore(pCore); css::uno::Reference< css::frame::XStatusListener > xCore(pCore);
...@@ -342,13 +311,6 @@ void RecoveryUI::impl_doRecovery() ...@@ -342,13 +311,6 @@ void RecoveryUI::impl_doRecovery()
svxdr::IExtendedTabPage* pPage3 = 0; svxdr::IExtendedTabPage* pPage3 = 0;
xWizard->addTabPage(pPage1); xWizard->addTabPage(pPage1);
if ( !bRecoveryOnly && new_crash_pending() )
{
pPage2 = new svxdr::ErrorRepWelcomeDialog(xWizard.get());
pPage3 = new svxdr::ErrorRepSendDialog(xWizard.get());
xWizard->addTabPage(pPage2);
xWizard->addTabPage(pPage3);
}
// start the wizard // start the wizard
xWizard->Execute(); xWizard->Execute();
...@@ -364,28 +326,6 @@ void RecoveryUI::impl_doRecovery() ...@@ -364,28 +326,6 @@ void RecoveryUI::impl_doRecovery()
//=============================================== //===============================================
void RecoveryUI::impl_doCrashReport()
{
if ( new_crash_pending() )
{
svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery (m_pParentWindow );
svxdr::IExtendedTabPage* pPage1 = new svxdr::ErrorRepWelcomeDialog(pWizard, sal_False);
svxdr::IExtendedTabPage* pPage2 = new svxdr::ErrorRepSendDialog (pWizard );
pWizard->addTabPage(pPage1);
pWizard->addTabPage(pPage2);
// start the wizard
pWizard->Execute();
delete pPage2 ;
delete pPage1 ;
delete pWizard;
delete_pending_crash();
}
}
//===============================================
void RecoveryUI::impl_showAllRecoveredDocs() void RecoveryUI::impl_showAllRecoveredDocs()
{ {
css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext ); css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext );
......
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