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