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 : 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 0 : QueryBox aBox( NULL, DesktopResId( QBX_USERDATALOCKED ) );
42 : // set box title
43 0 : OUString aTitle = OUString( DesktopResId( STR_TITLE_USERDATALOCKED ));
44 0 : aBox.SetText( aTitle );
45 : // insert values...
46 0 : OUString aMsgText = aBox.GetMessText( );
47 0 : aMsgText = aMsgText.replaceFirst(
48 0 : "$u", OStringToOUString( aUser, RTL_TEXTENCODING_ASCII_US) );
49 0 : aMsgText = aMsgText.replaceFirst(
50 0 : "$h", OStringToOUString( aHost, RTL_TEXTENCODING_ASCII_US) );
51 0 : aMsgText = aMsgText.replaceFirst(
52 0 : "$t", OStringToOUString( aTime, RTL_TEXTENCODING_ASCII_US) );
53 0 : aBox.SetMessText(aMsgText);
54 : // do it
55 0 : return aBox.Execute( ) == RET_YES;
56 : }
57 :
58 : }
59 :
60 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|