KIO

deleteortrashjob.h
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2022 Ahmad Samir <a.samirh78@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#ifndef DELETEORTRASHJOB_H
9#define DELETEORTRASHJOB_H
10
11#include <KIO/AskUserActionInterface>
12#include <kiowidgets_export.h>
13
14#include <KCompositeJob>
15
16#include <memory>
17
18namespace KIO
19{
20
21class DeleteOrTrashJobPrivate;
22
23/**
24 * @class DeleteOrTrashJob deleteortrashjob.h <KIO/DeleteOrTrashJob>
25 *
26 * This job asks the user for confirmation to delete or move to Trash
27 * a list of URLs; or if the job is constructed with
28 * AskUserActionInterface::EmptyTrash, to empty the Trash.
29 *
30 * A KIO::WidgetAskUserActionHandler will be used by default, unless a
31 * KJobUiDelegate that implements KIO::AskUserActionInterface is set with
32 * setUiDelegate().
33 *
34 * In the case of moving items to Trash, this job records the
35 * operation using KIO::FileUndoManager.
36 *
37 * To start the job after constructing it, you must call start().
38 *
39 * @since 5.100
40 */
41class KIOWIDGETS_EXPORT DeleteOrTrashJob : public KCompositeJob
42{
43 Q_OBJECT
44public:
45 /**
46 * Creates a DeleteOrTrashJob.
47 * @param urls the list of urls to delete, move to Trash, or an empty list
48 * in the case of AskUserActionInterface::EmptyTrash (in the latter case,
49 * the list of urls is ignored)
50 * @param deletionType one of AskUserActionInterface::DeletionType
51 * @param confirm one of AskUserActionInterface::ConfirmationType
52 * @param parent parent object, e.g. a QWidget for widget-based applications
53 */
54 explicit DeleteOrTrashJob(const QList<QUrl> &urls,
57 QObject *parent);
58
59 /**
60 * Destructor
61 *
62 * Note that jobs auto-delete themselves after emitting result
63 */
65
66 /**
67 * You must call this to actually start the job.
68 */
69 void start() override;
70
71private:
72 void slotResult(KJob *job) override;
73
74 friend DeleteOrTrashJobPrivate;
75 std::unique_ptr<DeleteOrTrashJobPrivate> d;
76};
77
78} // namespace KIO
79
80#endif // DELETEORTRASHJOB_H
ConfirmationType
Deletion confirmation type.
This job asks the user for confirmation to delete or move to Trash a list of URLs; or if the job is c...
~DeleteOrTrashJob() override
Destructor.
Q_SCRIPTABLE Q_NOREPLY void start()
A namespace for KIO globals.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:48:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.