File indexing completed on 2024-12-01 03:41:21

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2020 Ahmad Samir <a.samirh78@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #ifndef WIDGETSOPENOREXECUTEFILEHANDLER_H
0009 #define WIDGETSOPENOREXECUTEFILEHANDLER_H
0010 
0011 #include "openorexecutefileinterface.h"
0012 
0013 namespace KIO
0014 {
0015 // TODO KF6: Make KIO::JobUiDelegate inherit from WidgetsOpenOrExecuteFileHandler
0016 // (or even merge the two classes)
0017 // so that setDelegate(new KIO::JobUiDelegate) invokes the dialog boxes on error
0018 // and when showing ExecutableFileOpenDialog.
0019 
0020 class WidgetsOpenOrExecuteFileHandler : public OpenOrExecuteFileInterface
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit WidgetsOpenOrExecuteFileHandler(QObject *parent = nullptr);
0025     ~WidgetsOpenOrExecuteFileHandler() override;
0026 
0027     void promptUserOpenOrExecute(KJob *job, const QString &mimetype) override;
0028 
0029     void setWindow(QWidget *window);
0030 
0031 private:
0032     // Note: no d pointer because it's not exported at this point
0033     QWidget *m_parentWidget = nullptr;
0034 };
0035 
0036 }
0037 
0038 #endif // WIDGETSOPENOREXECUTEFILEHANDLER_H