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/msgbox.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 : String aLockname = that->m_aLockname;
34 0 : Config aConfig(aLockname);
35 0 : aConfig.SetGroup( LOCKFILE_GROUP );
36 0 : rtl::OString aHost = aConfig.ReadKey( LOCKFILE_HOSTKEY );
37 0 : rtl::OString aUser = aConfig.ReadKey( LOCKFILE_USERKEY );
38 0 : rtl::OString aStamp = aConfig.ReadKey( LOCKFILE_STAMPKEY );
39 0 : rtl::OString aTime = aConfig.ReadKey( LOCKFILE_TIMEKEY );
40 :
41 : // display warning and return response
42 0 : QueryBox aBox( NULL, DesktopResId( QBX_USERDATALOCKED ) );
43 : // set box title
44 0 : String aTitle = String( DesktopResId( STR_TITLE_USERDATALOCKED ));
45 0 : aBox.SetText( aTitle );
46 : // insert values...
47 0 : String aMsgText = aBox.GetMessText( );
48 : aMsgText.SearchAndReplaceAscii(
49 0 : "$u", rtl::OStringToOUString( aUser, RTL_TEXTENCODING_ASCII_US) );
50 : aMsgText.SearchAndReplaceAscii(
51 0 : "$h", rtl::OStringToOUString( aHost, RTL_TEXTENCODING_ASCII_US) );
52 : aMsgText.SearchAndReplaceAscii(
53 0 : "$t", rtl::OStringToOUString( aTime, RTL_TEXTENCODING_ASCII_US) );
54 0 : aBox.SetMessText(aMsgText);
55 : // do it
56 0 : return aBox.Execute( ) == RET_YES;
57 : }
58 :
59 : }
60 :
61 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|