LCOV - code coverage report
Current view: top level - vcl/unx/generic/dtrans - config.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 27 0.0 %
Date: 2014-04-14 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #include <cstdio>
      21             : #include <unotools/configitem.hxx>
      22             : 
      23             : #include "X11_selection.hxx"
      24             : 
      25             : #define SETTINGS_CONFIGNODE "VCL/Settings/Transfer"
      26             : #define SELECTION_PROPERTY "SelectionTimeout"
      27             : 
      28             : namespace x11
      29             : {
      30             : 
      31             : class DtransX11ConfigItem : public ::utl::ConfigItem
      32             : {
      33             :     sal_Int32           m_nSelectionTimeout;
      34             : 
      35             :     virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& rPropertyNames ) SAL_OVERRIDE;
      36             :     virtual void Commit() SAL_OVERRIDE;
      37             : public:
      38             :     DtransX11ConfigItem();
      39             :     virtual ~DtransX11ConfigItem();
      40             : 
      41           0 :     sal_Int32 getSelectionTimeout() const { return m_nSelectionTimeout; }
      42             : };
      43             : 
      44             : }
      45             : 
      46             : using namespace com::sun::star::lang;
      47             : using namespace com::sun::star::uno;
      48             : using namespace x11;
      49             : 
      50           0 : sal_Int32 SelectionManager::getSelectionTimeout()
      51             : {
      52           0 :     if( m_nSelectionTimeout < 1 )
      53             :     {
      54           0 :         DtransX11ConfigItem aCfg;
      55           0 :         m_nSelectionTimeout = aCfg.getSelectionTimeout();
      56             : #if OSL_DEBUG_LEVEL > 1
      57             :         fprintf( stderr, "initialized selection timeout to %" SAL_PRIdINT32 " seconds\n", m_nSelectionTimeout );
      58             : #endif
      59             :     }
      60           0 :     return m_nSelectionTimeout;
      61             : }
      62             : 
      63             : /*
      64             :  *  DtransX11ConfigItem constructor
      65             :  */
      66             : 
      67           0 : DtransX11ConfigItem::DtransX11ConfigItem() :
      68             :     ConfigItem( OUString( SETTINGS_CONFIGNODE ),
      69             :                 CONFIG_MODE_DELAYED_UPDATE ),
      70           0 :     m_nSelectionTimeout( 3 )
      71             : {
      72           0 :     Sequence< OUString > aKeys( 1 );
      73           0 :     aKeys.getArray()[0] = OUString( SELECTION_PROPERTY );
      74           0 :     Sequence< Any > aValues = GetProperties( aKeys );
      75             : #if OSL_DEBUG_LEVEL > 1
      76             :     fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY );
      77             : #endif
      78           0 :     Any* pValue = aValues.getArray();
      79           0 :     for( int i = 0; i < aValues.getLength(); i++, pValue++ )
      80             :     {
      81           0 :         if( pValue->getValueTypeClass() == TypeClass_STRING )
      82             :         {
      83           0 :             const OUString* pLine = (const OUString*)pValue->getValue();
      84           0 :             if( !pLine->isEmpty() )
      85             :             {
      86           0 :                 m_nSelectionTimeout = pLine->toInt32();
      87           0 :                 if( m_nSelectionTimeout < 1 )
      88           0 :                     m_nSelectionTimeout = 1;
      89             :             }
      90             : #if OSL_DEBUG_LEVEL > 1
      91             :             fprintf( stderr, "found SelectionTimeout \"%s\"\n",
      92             :                      OUStringToOString( *pLine, osl_getThreadTextEncoding() ).getStr() );
      93             : #endif
      94             :         }
      95             : #if OSL_DEBUG_LEVEL > 1
      96             :         else
      97             :             fprintf( stderr, "found SelectionTimeout of type \"%s\"\n",
      98             :                      OUStringToOString( pValue->getValueType().getTypeName(), osl_getThreadTextEncoding() ).getStr() );
      99             : #endif
     100           0 :     }
     101           0 : }
     102             : 
     103             : /*
     104             :  *  DtransX11ConfigItem destructor
     105             :  */
     106             : 
     107           0 : DtransX11ConfigItem::~DtransX11ConfigItem()
     108             : {
     109           0 : }
     110             : 
     111             : /*
     112             :  *  DtransX11ConfigItem::Commit
     113             :  */
     114             : 
     115           0 : void DtransX11ConfigItem::Commit()
     116             : {
     117             :     // for the clipboard service this is readonly, so
     118             :     // there is nothing to commit
     119           0 : }
     120             : 
     121             : /*
     122             :  *  DtransX11ConfigItem::Notify
     123             :  */
     124             : 
     125           0 : void DtransX11ConfigItem::Notify( const Sequence< OUString >& /*rPropertyNames*/ )
     126             : {
     127           0 : }
     128             : 
     129             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10