File indexing completed on 2024-09-15 09:24:59
0001 /* 0002 This file is part of the KDE project 0003 SPDX-FileCopyrightText: 1998, 1999 Torben Weis <weis@kde.org> 0004 SPDX-FileCopyrightText: 2006 David Faure <faure@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KRUN_P_H 0010 #define KRUN_P_H 0011 0012 #include <QEventLoopLocker> 0013 #include <QObject> 0014 #include <QPointer> 0015 #include <QTimer> 0016 #include <memory> 0017 class KProcess; 0018 0019 #include "executablefileopendialog_p.h" 0020 0021 namespace KIO 0022 { 0023 class ApplicationLauncherJob; 0024 class CommandLauncherJob; 0025 } 0026 0027 /** 0028 * @internal 0029 */ 0030 class Q_DECL_HIDDEN KRunPrivate 0031 { 0032 public: 0033 KRunPrivate(KRun *parent); 0034 0035 void init(const QUrl &url, QWidget *window, bool showProgressInfo, const QByteArray &asn); 0036 0037 // This helper method makes debugging easier: a single breakpoint for all 0038 // the code paths that start the timer - at least from KRun itself. 0039 void startTimer(); 0040 0041 #ifdef Q_OS_WIN 0042 static bool displayNativeOpenWithDialog(const QList<QUrl> &lst, QWidget *window, bool tempFiles, const QString &suggestedFileName, const QByteArray &asn); 0043 #endif 0044 bool runExternalBrowser(const QString &_exec); 0045 static qint64 runCommandLauncherJob(KIO::CommandLauncherJob *job, QWidget *widget); 0046 0047 void showPrompt(); 0048 /** 0049 * Check whether we need to show a prompt(before executing a script or desktop file) 0050 */ 0051 bool isPromptNeeded(); 0052 ExecutableFileOpenDialog::Mode promptMode(); 0053 void onDialogFinished(int result, bool isDontAskAgainSet); 0054 0055 KRun *const q; 0056 bool m_showingDialog; 0057 bool m_runExecutables; 0058 bool m_followRedirections; 0059 0060 // Don't exit the app while a KRun is running. 0061 QEventLoopLocker m_eventLoopLocker; 0062 0063 QString m_preferredService; 0064 QString m_externalBrowser; 0065 QString m_localPath; 0066 QString m_suggestedFileName; 0067 QPointer<QWidget> m_window; 0068 QByteArray m_asn; 0069 QUrl m_strURL; 0070 bool m_bFault; 0071 bool m_bAutoDelete; 0072 bool m_bProgressInfo; 0073 bool m_bFinished; 0074 KIO::Job *m_job; 0075 QTimer *m_timer; 0076 0077 /** 0078 * Used to indicate that the next action is to scan the file. 0079 * This action is invoked from slotTimeout. 0080 */ 0081 bool m_bScanFile; 0082 bool m_bIsDirectory; 0083 0084 /** 0085 * Used to indicate that the next action is to initialize. 0086 * This action is invoked from slotTimeout 0087 */ 0088 bool m_bInit; 0089 0090 /** 0091 * Used to indicate that the next action is to check whether we need to 0092 * show a prompt(before executing a script or desktop file). 0093 * This action is invoked from slotTimeout. 0094 */ 0095 bool m_bCheckPrompt; 0096 0097 bool m_externalBrowserEnabled; 0098 }; 0099 0100 #endif // KRUN_P_H