File indexing completed on 2024-06-23 05:14:19

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     utils/types.h
0003 
0004     This file is part of Kleopatra, the KDE keymanager
0005     SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include <utils/pimpl_ptr.h>
0013 
0014 #include <memory>
0015 
0016 class QWidget;
0017 
0018 namespace Kleo
0019 {
0020 enum DecryptVerifyOperation {
0021     Decrypt,
0022     Verify,
0023     DecryptVerify,
0024     // VerifyOpaque,
0025     // VerifyDetached,
0026 };
0027 
0028 enum VerificationMode {
0029     Opaque,
0030     Detached,
0031 };
0032 
0033 enum Policy {
0034     NoPolicy,
0035     Allow,
0036     Force,
0037     Deny,
0038 };
0039 
0040 class ExecutionContext
0041 {
0042 public:
0043     virtual ~ExecutionContext()
0044     {
0045     }
0046     virtual void applyWindowID(QWidget *widget) const = 0;
0047 };
0048 
0049 class ExecutionContextUser
0050 {
0051 public:
0052     ExecutionContextUser();
0053     explicit ExecutionContextUser(const std::shared_ptr<const ExecutionContext> &ec);
0054     virtual ~ExecutionContextUser();
0055 
0056     void setExecutionContext(const std::shared_ptr<const ExecutionContext> &ec);
0057     std::shared_ptr<const ExecutionContext> executionContext() const;
0058 
0059 protected:
0060     void bringToForeground(QWidget *wid, bool stayOnTop = false);
0061     void applyWindowID(QWidget *wid);
0062 
0063 private:
0064     class Private;
0065     kdtools::pimpl_ptr<Private> d;
0066 };
0067 
0068 }