/* SPDX-FileCopyrightText: 1997 Torben Weis SPDX-FileCopyrightText: 1999 Dirk Mueller Portions SPDX-FileCopyrightText: 1999 Preston Brown SPDX-FileCopyrightText: 2007 Pino Toscano SPDX-FileCopyrightText: 2023 Harald Sitter SPDX-License-Identifier: LGPL-2.0-or-later */ #pragma once #include #include #include "kiocore_export.h" namespace KIO { /** * Core class for open with style dialog handling. This only implements core functionality. For an actual open with * implementation see KOpenWithDialog. For a way to trigger open with dialogs see OpenUrlJob and OpenWithHandlerInterface. */ class KIOCORE_EXPORT OpenWith { public: struct [[nodiscard]] AcceptResult { /// Whether the accept was successful (if not error is set) bool accept; /// The error message if the acccept failed QString error; /// Whether the sycoca needs rebuilding (e.g. call KBuildSycocaProgressDialog::rebuildKSycoca) bool rebuildSycoca = false; }; /** * Accept an openwith request with the provided arguments as context. * This function may have side effects to do with accepting, such as setting the default application for the * mimetype if @p remember is true. * @returns an AcceptResult */ static AcceptResult accept(KService::Ptr &service, const QString &typedExec, bool remember, const QString &mimeType, bool openInTerminal, bool lingerTerminal, bool saveNewApps); }; } // namespace KIO