1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include "vcl/msgbox.hxx"
22 #include "desktopresid.hxx"
23 #include "desktop.hrc"
24 #include "tools/config.hxx"
25 #include "lockfile.hxx"
30 bool Lockfile_execWarning( Lockfile
* that
)
32 // read information from lock
33 String aLockname
= that
->m_aLockname
;
34 Config
aConfig(aLockname
);
35 aConfig
.SetGroup( LOCKFILE_GROUP
);
36 OString aHost
= aConfig
.ReadKey( LOCKFILE_HOSTKEY
);
37 OString aUser
= aConfig
.ReadKey( LOCKFILE_USERKEY
);
38 OString aTime
= aConfig
.ReadKey( LOCKFILE_TIMEKEY
);
40 // display warning and return response
41 QueryBox
aBox( NULL
, DesktopResId( QBX_USERDATALOCKED
) );
43 String aTitle
= String( DesktopResId( STR_TITLE_USERDATALOCKED
));
44 aBox
.SetText( aTitle
);
46 String aMsgText
= aBox
.GetMessText( );
47 aMsgText
.SearchAndReplaceAscii(
48 "$u", OStringToOUString( aUser
, RTL_TEXTENCODING_ASCII_US
) );
49 aMsgText
.SearchAndReplaceAscii(
50 "$h", OStringToOUString( aHost
, RTL_TEXTENCODING_ASCII_US
) );
51 aMsgText
.SearchAndReplaceAscii(
52 "$t", OStringToOUString( aTime
, RTL_TEXTENCODING_ASCII_US
) );
53 aBox
.SetMessText(aMsgText
);
55 return aBox
.Execute( ) == RET_YES
;
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */