nss: upgrade to release 3.73
[LibreOffice.git] / vcl / unx / generic / dtrans / config.cxx
blob6b40fc16c5ea1d7d9f4f1de10a553842b733df58
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <o3tl/any.hxx>
21 #include <sal/log.hxx>
22 #include <unotools/configitem.hxx>
24 #include "X11_selection.hxx"
26 #define SETTINGS_CONFIGNODE "VCL/Settings/Transfer"
27 #define SELECTION_PROPERTY "SelectionTimeout"
29 namespace x11
32 namespace {
34 class DtransX11ConfigItem : public ::utl::ConfigItem
36 sal_Int32 m_nSelectionTimeout;
38 virtual void Notify( const css::uno::Sequence< OUString >& rPropertyNames ) override;
39 virtual void ImplCommit() override;
41 public:
42 DtransX11ConfigItem();
44 sal_Int32 getSelectionTimeout() const { return m_nSelectionTimeout; }
51 using namespace com::sun::star::lang;
52 using namespace com::sun::star::uno;
53 using namespace x11;
55 sal_Int32 SelectionManager::getSelectionTimeout()
57 if( m_nSelectionTimeout < 1 )
59 DtransX11ConfigItem aCfg;
60 m_nSelectionTimeout = aCfg.getSelectionTimeout();
61 #if OSL_DEBUG_LEVEL > 1
62 SAL_INFO("vcl.unx.dtrans", "initialized selection timeout to "
63 << m_nSelectionTimeout
64 << " seconds.");
65 #endif
67 return m_nSelectionTimeout;
71 * DtransX11ConfigItem constructor
74 DtransX11ConfigItem::DtransX11ConfigItem() :
75 ConfigItem( SETTINGS_CONFIGNODE,
76 ConfigItemMode::NONE ),
77 m_nSelectionTimeout( 3 )
79 Sequence<OUString> aKeys { SELECTION_PROPERTY };
80 const Sequence< Any > aValues = GetProperties( aKeys );
81 #if OSL_DEBUG_LEVEL > 1
82 SAL_INFO("vcl.unx.dtrans", "found "
83 << aValues.getLength()
84 << " properties for "
85 << SELECTION_PROPERTY);
86 #endif
87 for( Any const & value : aValues )
89 if( auto pLine = o3tl::tryAccess<OUString>(value) )
91 if( !pLine->isEmpty() )
93 m_nSelectionTimeout = pLine->toInt32();
94 if( m_nSelectionTimeout < 1 )
95 m_nSelectionTimeout = 1;
97 #if OSL_DEBUG_LEVEL > 1
98 SAL_INFO("vcl.unx.dtrans", "found SelectionTimeout \"" << *pLine << "\".");
99 #endif
101 #if OSL_DEBUG_LEVEL > 1
102 else
103 SAL_INFO("vcl.unx.dtrans", "found SelectionTimeout of type \""
104 << value.getValueType().getTypeName() << "\".");
105 #endif
109 void DtransX11ConfigItem::ImplCommit()
111 // for the clipboard service this is readonly, so
112 // there is nothing to commit
116 * DtransX11ConfigItem::Notify
119 void DtransX11ConfigItem::Notify( const Sequence< OUString >& /*rPropertyNames*/ )
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */