KIO

jobuidelegate.h
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
4 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
5 SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org>
6 SPDX-FileCopyrightText: 2013 Dawit Alemayehu <adawit@kde.org>
7 SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
8
9 SPDX-License-Identifier: LGPL-2.0-or-later
10*/
11
12#ifndef KIO_JOBUIDELEGATE_H
13#define KIO_JOBUIDELEGATE_H
14
15#include <KDialogJobUiDelegate>
16#include <kio/askuseractioninterface.h>
17#include <kio/global.h>
18#include <kio/jobuidelegateextension.h>
19#include <kio/renamedialog.h>
20#include <kio/skipdialog.h>
21
22class KJob;
23class KDirOperator;
24class KIOWidgetJobUiDelegateFactory;
25
26namespace KIO
27{
28class JobUiDelegatePrivate;
29
30class FileUndoManager;
31
32class Job;
33
34/**
35 * @class KIO::JobUiDelegate jobuidelegate.h <KIO/JobUiDelegate>
36 *
37 * A UI delegate tuned to be used with KIO Jobs.
38 */
39class KIOWIDGETS_EXPORT JobUiDelegate : public KDialogJobUiDelegate, public JobUiDelegateExtension
40{
41 Q_OBJECT
42 // Allow the factory to construct. Everyone else needs to go through the factory or derive!
43 friend class ::KIOWidgetJobUiDelegateFactory;
44 // KIO internals don't need to derive either
45 friend class KIO::FileUndoManager;
46
47protected:
48 friend class ::KDirOperator;
49
50 /**
51 * Constructs a new KIO Job UI delegate.
52 * @param flags allows to enable automatic error/warning handling
53 * @param window the window associated with this delegate, see setWindow.
54 * @param ifaces Interface instances such as OpenWithHandlerInterface to replace the default interfaces
55 * @since 5.98
56 */
57 explicit JobUiDelegate(KJobUiDelegate::Flags flags = AutoHandlingDisabled, QWidget *window = nullptr, const QList<QObject *> &ifaces = {});
58
59public:
60 /**
61 * Destroys the KIO Job UI delegate.
62 */
63 ~JobUiDelegate() override;
64
65public:
66 /**
67 * Associate this job with a window given by @p window.
68 * @param window the window to associate to
69 * @see window()
70 */
71 void setWindow(QWidget *window) override;
72
73 /**
74 * Unregister the given window from kded.
75 * This is normally done automatically when the window is destroyed.
76 *
77 * This method is useful for instance when keeping a hidden window
78 * around to make it faster to reuse later.
79 * @since 5.2
80 */
81 static void unregisterWindow(QWidget *window);
82
83 /**
84 * Ask for confirmation before deleting/trashing @p urls.
85 *
86 * Note that this method is not called automatically by KIO jobs. It's the application's
87 * responsibility to ask the user for confirmation before calling KIO::del() or KIO::trash().
88 *
89 * @param urls the urls about to be deleted/trashed
90 * @param deletionType the type of deletion (Delete for real deletion, Trash otherwise)
91 * @param confirmation see ConfirmationType. Normally set to DefaultConfirmation.
92 * Note: the window passed to setWindow is used as the parent for the message box.
93 * @return true if confirmed
94 */
95 bool askDeleteConfirmation(const QList<QUrl> &urls, DeletionType deletionType, ConfirmationType confirmationType) override;
96
97 /**
98 * Creates a clipboard updater
99 */
100 ClipboardUpdater *createClipboardUpdater(Job *job, ClipboardUpdaterMode mode) override;
101 /**
102 * Update URL in clipboard, if present
103 */
104 void updateUrlInClipboard(const QUrl &src, const QUrl &dest) override;
105
106private:
107 std::unique_ptr<JobUiDelegatePrivate> const d;
108};
109}
110
111#endif
This widget works as a network transparent filebrowser.
FileUndoManager: makes it possible to undo kio jobs.
An abstract class defining interaction with users from KIO jobs:
DeletionType
The type of deletion: real deletion, moving the files to the trash or emptying the trash Used by askD...
ConfirmationType
ForceConfirmation: always ask the user for confirmation DefaultConfirmation: don't ask the user if he...
A UI delegate tuned to be used with KIO Jobs.
~JobUiDelegate() override
Destroys the KIO Job UI delegate.
The base class for all jobs.
Definition job_base.h:45
A namespace for KIO globals.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:45:23 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.