File indexing completed on 2025-01-26 04:52:43

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     core/command.h
0003 
0004     This file is part of KleopatraClient, the Kleopatra interface library
0005     SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "kleopatraclientcore_export.h"
0013 
0014 #include <QObject>
0015 #include <QWidget> // only for WId, doesn't prevent linking against QtCore-only
0016 
0017 class QString;
0018 class QByteArray;
0019 class QVariant;
0020 
0021 namespace KleopatraClientCopy
0022 {
0023 
0024 class KLEOPATRACLIENTCORE_EXPORT Command : public QObject
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit Command(QObject *parent = nullptr);
0029     ~Command() override;
0030 
0031     void setParentWId(WId wid);
0032     WId parentWId() const;
0033 
0034     void setServerLocation(const QString &location);
0035     QString serverLocation() const;
0036 
0037     bool waitForFinished();
0038     bool waitForFinished(unsigned long ms);
0039 
0040     bool error() const;
0041     bool wasCanceled() const;
0042     QString errorString() const;
0043 
0044     qint64 serverPid() const;
0045 
0046 public Q_SLOTS:
0047     void start();
0048     void cancel();
0049 
0050 Q_SIGNALS:
0051     void started();
0052     void finished();
0053 
0054 protected:
0055     void setOptionValue(const char *name, const QVariant &value, bool critical = true);
0056     void setOption(const char *name, bool critical = true);
0057     void unsetOption(const char *name);
0058 
0059     QVariant optionValue(const char *name) const;
0060     bool isOptionSet(const char *name) const;
0061     bool isOptionCritical(const char *name) const;
0062 
0063     void setFilePaths(const QStringList &filePaths);
0064     QStringList filePaths() const;
0065 
0066     void setRecipients(const QStringList &recipients, bool informative);
0067     QStringList recipients() const;
0068     bool areRecipientsInformative() const;
0069 
0070     void setSenders(const QStringList &senders, bool informative);
0071     QStringList senders() const;
0072     bool areSendersInformative() const;
0073 
0074     void setInquireData(const char *what, const QByteArray &data);
0075     void unsetInquireData(const char *what);
0076     QByteArray inquireData(const char *what) const;
0077     bool isInquireDataSet(const char *what) const;
0078 
0079     QByteArray receivedData() const;
0080 
0081     void setCommand(const char *command);
0082     QByteArray command() const;
0083 
0084 protected:
0085     class Private;
0086     Private *d;
0087     Command(Private *p, QObject *parent);
0088 };
0089 
0090 }