File indexing completed on 2024-04-21 04:58:02

0001 /*  This file is part of the KDE project
0002     SPDX-FileCopyrightText: 2000 Alexander Neundorf <neundorf@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KSHELLCMDEXECUTOR_H
0008 #define KSHELLCMDEXECUTOR_H
0009 
0010 #include <QTextEdit>
0011 
0012 namespace KDESu
0013 {
0014 class PtyProcess;
0015 }
0016 class QSocketNotifier;
0017 
0018 class KShellCommandExecutor: public QTextEdit
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit KShellCommandExecutor(const QString &command, QWidget *parent = nullptr);
0023     ~KShellCommandExecutor() override;
0024     int exec();
0025 Q_SIGNALS:
0026     void finished();
0027 public Q_SLOTS:
0028     void slotFinished();
0029 protected:
0030     KDESu::PtyProcess *m_shellProcess;
0031     QString m_command;
0032     QSocketNotifier *m_readNotifier;
0033     QSocketNotifier *m_writeNotifier;
0034 protected Q_SLOTS:
0035     void readDataFromShell();
0036     void writeDataToShell();
0037 };
0038 
0039 #endif // KSHELLCMDEXECUTOR_H