1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_desktop.hxx"
26
27 #include "vcl/msgbox.hxx"
28 #include "desktopresid.hxx"
29 #include "desktop.hrc"
30 #include "tools/config.hxx"
31 #include "lockfile.hxx"
32
33
34 namespace desktop {
35
Lockfile_execWarning(Lockfile * that)36 bool Lockfile_execWarning( Lockfile * that )
37 {
38 // read information from lock
39 String aLockname = that->m_aLockname;
40 Config aConfig(aLockname);
41 aConfig.SetGroup(that->Group());
42 ByteString aHost = aConfig.ReadKey( that->Hostkey() );
43 ByteString aUser = aConfig.ReadKey( that->Userkey() );
44 ByteString aStamp = aConfig.ReadKey( that->Stampkey() );
45 ByteString aTime = aConfig.ReadKey( that->Timekey() );
46
47 // display warning and return response
48 QueryBox aBox( NULL, DesktopResId( QBX_USERDATALOCKED ) );
49 // set box title
50 String aTitle = String( DesktopResId( STR_TITLE_USERDATALOCKED ));
51 aBox.SetText( aTitle );
52 // insert values...
53 String aMsgText = aBox.GetMessText( );
54 aMsgText.SearchAndReplaceAscii(
55 "$u", String( aUser, RTL_TEXTENCODING_ASCII_US) );
56 aMsgText.SearchAndReplaceAscii(
57 "$h", String( aHost, RTL_TEXTENCODING_ASCII_US) );
58 aMsgText.SearchAndReplaceAscii(
59 "$t", String( aTime, RTL_TEXTENCODING_ASCII_US) );
60 aBox.SetMessText(aMsgText);
61 // do it
62 return aBox.Execute( ) == RET_YES;
63 }
64
65 }
66
67