LCOV - code coverage report
Current view: top level - desktop/source/app - lockfile2.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 20 5.0 %
Date: 2015-06-13 12:38:46 Functions: 2 3 66.7 %
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             : 
      21             : #include <vcl/layout.hxx>
      22             : #include "desktopresid.hxx"
      23             : #include "desktop.hrc"
      24             : #include <tools/config.hxx>
      25             : #include "lockfile.hxx"
      26             : 
      27             : 
      28             : namespace desktop {
      29             : 
      30           0 : bool Lockfile_execWarning( Lockfile * that )
      31             : {
      32             :     // read information from lock
      33           0 :     OUString aLockname = that->m_aLockname;
      34           0 :     Config aConfig(aLockname);
      35           0 :     aConfig.SetGroup( LOCKFILE_GROUP );
      36           0 :     OString aHost  = aConfig.ReadKey( LOCKFILE_HOSTKEY );
      37           0 :     OString aUser  = aConfig.ReadKey( LOCKFILE_USERKEY );
      38           0 :     OString aTime  = aConfig.ReadKey( LOCKFILE_TIMEKEY );
      39             : 
      40             :     // display warning and return response
      41             :     ScopedVclPtrInstance<MessageDialog> aBox(nullptr, DesktopResId(STR_QUERY_USERDATALOCKED),
      42           0 :                                              VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
      43             :     // set box title
      44           0 :     OUString aTitle = OUString( DesktopResId( STR_TITLE_USERDATALOCKED ));
      45           0 :     aBox->SetText( aTitle );
      46             :     // insert values...
      47           0 :     OUString aMsgText = aBox->get_primary_text();
      48           0 :     aMsgText = aMsgText.replaceFirst(
      49           0 :         "$u", OStringToOUString( aUser, RTL_TEXTENCODING_ASCII_US) );
      50           0 :     aMsgText = aMsgText.replaceFirst(
      51           0 :         "$h", OStringToOUString( aHost, RTL_TEXTENCODING_ASCII_US) );
      52           0 :     aMsgText = aMsgText.replaceFirst(
      53           0 :         "$t", OStringToOUString( aTime, RTL_TEXTENCODING_ASCII_US) );
      54           0 :     aBox->set_primary_text(aMsgText);
      55             :     // do it
      56           0 :     return aBox->Execute( ) == RET_YES;
      57             : }
      58             : 
      59         348 : }
      60             : 
      61             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11