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

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     uiserver/uiserver.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 <QObject>
0013 
0014 #include <utils/pimpl_ptr.h>
0015 
0016 #include <cstdio>
0017 #include <memory>
0018 
0019 class QString;
0020 
0021 namespace Kleo
0022 {
0023 
0024 class AssuanCommandFactory;
0025 
0026 class UiServer : public QObject
0027 {
0028     Q_OBJECT
0029 public:
0030     explicit UiServer(const QString &socket, QObject *parent = nullptr);
0031     ~UiServer() override;
0032 
0033     static void setLogStream(FILE *file);
0034 
0035     bool registerCommandFactory(const std::shared_ptr<AssuanCommandFactory> &cmdFactory);
0036 
0037     bool waitForStopped(unsigned int ms = 0xFFFFFFFF);
0038 
0039     bool isStopped() const;
0040     bool isStopping() const;
0041 
0042     QString socketName() const;
0043 
0044 public Q_SLOTS:
0045     void start();
0046     void stop();
0047     void enableCryptoCommands(bool enable = true);
0048 
0049 Q_SIGNALS:
0050     void stopped();
0051     void startKeyManagerRequested();
0052     void startConfigDialogRequested();
0053 
0054 private:
0055     class Private;
0056     kdtools::pimpl_ptr<Private> d;
0057 };
0058 
0059 }