tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / desktop / source / deployment / inc / lockfile.hxx
blob982a0c2f05fc63a39de4bdd39e1b3f355ad10d2f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 /* Information:
21 * This class implements a mechanism to lock a users installation directory,
22 * which is necessary because instances of staroffice could be running on
23 * different hosts while using the same directory thus causing data
24 * inconsistency.
25 * When an existing lock is detected, the user will be asked whether he wants
26 * to continue anyway, thus removing the lock and replacing it with a new one
28 * ideas:
29 * - store information about user and host and time in the lockfile and display
30 * these when asking whether to remove the lockfile.
31 * - periodically check the lockfile and warn the user when it gets replaced
35 #pragma once
37 #include <rtl/ustring.hxx>
39 #include "dp_misc_api.hxx"
41 #define LOCKFILE_GROUP "Lockdata"
42 #define LOCKFILE_USERKEY "User"
43 #define LOCKFILE_HOSTKEY "Host"
44 #define LOCKFILE_STAMPKEY "Stamp"
45 #define LOCKFILE_TIMEKEY "Time"
46 #define LOCKFILE_IPCKEY "IPCServer"
48 namespace desktop {
50 class Lockfile;
51 bool Lockfile_execWarning( Lockfile const * that );
53 class DESKTOP_DEPLOYMENTMISC_DLLPUBLIC Lockfile
55 public:
57 // constructs a new lockfile object
58 Lockfile( bool bIPCserver = true );
60 // separating GUI code:
61 typedef bool (* fpExecWarning)( Lockfile const * that );
63 // checks the lockfile, asks user when lockfile is
64 // found (iff gui) and returns false when we may not continue
65 bool check( fpExecWarning execWarning );
67 // removes the lockfile
68 ~Lockfile();
70 private:
71 bool m_bIPCserver;
72 // full qualified name (file://-url) of the lockfile
73 OUString m_aLockname;
74 // flag whether the d'tor should delete the lock
75 bool m_bRemove;
76 bool m_bIsLocked;
77 // ID
78 OUString m_aId;
79 OUString m_aDate;
80 // access to data in file
81 void syncToFile() const;
82 bool isStale() const;
83 friend bool Lockfile_execWarning( Lockfile const * that );
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */