Kaydet (Commit) af19a3cc authored tarafından Arkadiy Illarionov's avatar Arkadiy Illarionov Kaydeden (comit) Stephan Bergmann

Resolves: tdf#122114 remove support for ~/.recently-used file

Change-Id: Ie91f0bf21e6f5c3f7a7aa4ae3d1dff6cc8e15a86
Reviewed-on: https://gerrit.libreoffice.org/69597
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 87f262da
......@@ -622,7 +622,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
) \
emboleobj \
package2 \
$(if $(USING_X11),recentfile) \
$(call gb_Helper_optional,SCRIPTING,scriptframe) \
sdbc2 \
sofficeapp \
......
......@@ -240,7 +240,6 @@ merge frm::ITextSelectionListener with frm::ORichTextPeer
merge frm::OFormComponents with frm::ODatabaseForm
merge ftp::CurlInput with InsertData
merge gio::Seekable with gio::OutputStream
merge i_xml_parser_event_handler with (anonymous namespace)::recently_used_file_filter
merge oglcanvas::IBufferContext with oglcanvas::(anonymous namespace)::BufferContextImpl
merge old_SdrDownCompat with SdIOCompat
merge oox::SequenceSeekableStream with oox::SequenceInputStream
......
......@@ -109,12 +109,6 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl)
if (cdc.Class("BitmapInfoAccess").GlobalNamespace()) {
return true;
}
// in this case, the code is taking the address of the member function
// shell/source/unix/sysshell/recently_used_file_handler.cxx
if (cdc.Struct("recently_used_item").AnonymousNamespace().GlobalNamespace())
{
return true;
}
// the unotools and svl config code stuff is doing weird stuff with a reference-counted statically allocated pImpl class
if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/unotools/")) {
return true;
......
......@@ -171,10 +171,6 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
if (aFunctionName == "osl_thread_priority_init_Impl") {
return true;
}
// a pointer to this function is taken and passed to an underlying API, shell/source/unix/sysshell/recently_used_file_handler.cxx
if (aFunctionName == "(anonymous namespace)::recently_used_item::set_nothing") {
return true;
}
// a pointer to this function is taken and passed to an underlying API, cppu/source/uno/lbenv.cxx
if (aFunctionName == "defenv_dispose") {
return true;
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_Library_Library,recentfile))
$(eval $(call gb_Library_set_include,recentfile,\
-I$(SRCDIR)/shell/inc \
$$(INCLUDE) \
))
$(eval $(call gb_Library_use_externals,recentfile,\
boost_headers \
expat \
))
$(eval $(call gb_Library_use_libraries,recentfile,\
sal \
))
$(eval $(call gb_Library_use_static_libraries,recentfile,\
shell_xmlparser \
))
$(eval $(call gb_Library_add_exception_objects,recentfile,\
shell/source/unix/sysshell/recently_used_file \
shell/source/unix/sysshell/recently_used_file_handler \
))
# vim: set shiftwidth=4 tabstop=4 noexpandtab:
......@@ -91,12 +91,6 @@ $(eval $(call gb_Module_add_targets,shell,\
Library_syssh \
))
ifeq ($(USING_X11),TRUE)
$(eval $(call gb_Module_add_targets,shell,\
Library_recentfile \
))
endif
ifneq ($(OS),WNT)
$(eval $(call gb_Module_add_targets,shell,\
......
System helpers - launching URI, recently used files, system integration, external mailer support etc.
System helpers - launching URI, system integration, external mailer support etc.
/* -*- 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 "recently_used_file.hxx"
#include <rtl/ustring.hxx>
#include <sal/log.hxx>
#include <osl/process.h>
#include <osl/security.hxx>
#include <osl/thread.h>
#include <osl/file.hxx>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
const char SLASH[] = "/";
namespace {
void ensure_final_slash(/*inout*/ OUString& path)
{
if (!path.isEmpty() &&
(SLASH[0] != path.pData->buffer[path.getLength() - 1]))
path += SLASH;
}
} // namespace private
recently_used_file::recently_used_file() :
file_(nullptr)
{
osl::Security sec;
OUString homedir_url;
if (!sec.getHomeDir(homedir_url))
throw "Cannot determine user home directory";
OUString homedir;
osl::FileBase::getSystemPathFromFileURL(homedir_url, homedir);
OUString rufn = homedir;
ensure_final_slash(rufn);
rufn += ".recently-used";
OString tmp =
OUStringToOString(rufn, osl_getThreadTextEncoding());
int fd = open(tmp.getStr(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
if (fd != -1) {
file_ = fdopen(fd, "w+");
if (file_ == nullptr) {
close(fd);
}
}
if (nullptr == file_)
throw "I/O error opening ~/.recently-used";
if (lockf(fileno(file_), F_LOCK, 0) != 0)
{
fclose(file_);
throw "Cannot lock ~/.recently-used";
}
}
recently_used_file::~recently_used_file()
{
int ret = lockf(fileno(file_), F_ULOCK, 0);
SAL_WARN_IF(ret != 0, "shell", "cannot unlock recently unused file");
fclose(file_);
}
void recently_used_file::reset() const
{
rewind(file_);
}
void recently_used_file::truncate()
{
if (ftruncate(fileno(file_), 0) == -1)
throw "I/O error: ftruncate failed";
}
size_t recently_used_file::read(char* buffer, size_t size) const
{
size_t r = fread(buffer, sizeof(char), size, file_);
if ((r < size) && ferror(file_))
throw "I/O error: read failed";
return r;
}
void recently_used_file::write(const char* buffer, size_t size) const
{
if (size != fwrite(buffer, sizeof(char), size, file_))
throw "I/O error: write failed";
}
bool recently_used_file::eof() const
{
return feof(file_);
}
/* 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 .
*/
#ifndef INCLUDED_SHELL_SOURCE_UNIX_SYSSHELL_RECENTLY_USED_FILE_HXX
#define INCLUDED_SHELL_SOURCE_UNIX_SYSSHELL_RECENTLY_USED_FILE_HXX
#include <stdio.h>
#include <unistd.h>
// simple wrapper around the recently_used_file
class recently_used_file
{
public:
recently_used_file();
~recently_used_file();
// set file pointer to the start of file
void reset() const;
void truncate();
size_t read(
char* buffer,
size_t size) const;
void write(const char* buffer, size_t size) const;
bool eof() const;
private:
FILE* file_;
};
#endif // INCLUDED_SHELL_SOURCE_UNIX_SYSSHELL_RECENTLY_USED_FILE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -12977,9 +12977,6 @@ shell/source/unix/exec/shellexec.cxx
shell/source/unix/exec/shellexec.hxx
shell/source/unix/exec/shellexecentry.cxx
shell/source/unix/misc/uri-encode.c
shell/source/unix/sysshell/recently_used_file.cxx
shell/source/unix/sysshell/recently_used_file.hxx
shell/source/unix/sysshell/recently_used_file_handler.cxx
shell/source/win32/SysShExec.cxx
shell/source/win32/SysShExec.hxx
shell/source/win32/SysShentry.cxx
......
......@@ -118,7 +118,6 @@ profile libreoffice-soffice INSTDIR-program/soffice.bin {
owner @{HOME}/.config/soffice.binrc.lock rwk,
owner @{HOME}/.cache/fontconfig/** rw,
owner @{HOME}/.config/gtk-???/bookmarks r, #Make bookmarks work
owner @{HOME}/.recently-used rwk,
owner /tmp/psp[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]* rw, #/tmp/psp1534203998 (printing to file)
owner /{,var/}run/user/*/dconf/user rw,
......
......@@ -206,21 +206,7 @@ void X11SalInstance::AfterAppInit()
pSalDisplay->SetupInput();
}
extern "C" { static void thisModule() {} }
void X11SalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService)
{
typedef void (*PFUNC_ADD_TO_RECENTLY_USED_LIST)(const OUString&, const OUString&, const OUString&);
PFUNC_ADD_TO_RECENTLY_USED_LIST add_to_recently_used_file_list = nullptr;
osl::Module module;
module.loadRelative( &thisModule, "librecentfile.so" );
if (module.is())
add_to_recently_used_file_list = reinterpret_cast<PFUNC_ADD_TO_RECENTLY_USED_LIST>(module.getFunctionSymbol("add_to_recently_used_file_list"));
if (add_to_recently_used_file_list)
add_to_recently_used_file_list(rFileUrl, rMimeType, rDocumentService);
}
void X11SalInstance::AddToRecentDocumentList(const OUString&, const OUString&, const OUString&) {}
void X11SalInstance::PostPrintersChanged()
{
......
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