KIO

openwith.h
1/*
2 SPDX-FileCopyrightText: 1997 Torben Weis <weis@stud.uni-frankfurt.de>
3 SPDX-FileCopyrightText: 1999 Dirk Mueller <mueller@kde.org>
4 Portions SPDX-FileCopyrightText: 1999 Preston Brown <pbrown@kde.org>
5 SPDX-FileCopyrightText: 2007 Pino Toscano <pino@kde.org>
6 SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org>
7
8 SPDX-License-Identifier: LGPL-2.0-or-later
9*/
10
11#pragma once
12
13#include <QString>
14
15#include <KService>
16
17#include "kiocore_export.h"
18
19namespace KIO
20{
21
22/**
23 * Core class for open with style dialog handling. This only implements core functionality. For an actual open with
24 * implementation see KOpenWithDialog. For a way to trigger open with dialogs see OpenUrlJob and OpenWithHandlerInterface.
25 */
26class KIOCORE_EXPORT OpenWith
27{
28public:
29 struct [[nodiscard]] AcceptResult {
30 /// Whether the accept was successful (if not error is set)
31 bool accept;
32 /// The error message if the acccept failed
33 QString error;
34 /// Whether the sycoca needs rebuilding (e.g. call KBuildSycocaProgressDialog::rebuildKSycoca)
35 bool rebuildSycoca = false;
36 };
37 /**
38 * Accept an openwith request with the provided arguments as context.
39 * This function may have side effects to do with accepting, such as setting the default application for the
40 * mimetype if @p remember is true.
41 * @returns an AcceptResult
42 */
43 static AcceptResult accept(KService::Ptr &service,
44 const QString &typedExec,
45 bool remember,
46 const QString &mimeType,
47 bool openInTerminal,
48 bool lingerTerminal,
49 bool saveNewApps);
50};
51
52} // namespace KIO
Core class for open with style dialog handling.
Definition openwith.h:27
A namespace for KIO globals.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.