1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2013 Dawit Alemayehu <adawit@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KIO_CLIPBOARDUPDATER_P_H
9#define KIO_CLIPBOARDUPDATER_P_H
10
11#include <QObject>
12#include <jobuidelegateextension.h>
13
14class KJob;
15class QUrl;
16
17namespace KIO
18{
19class Job;
20class JobUiDelegate;
21
22/*!
23 * \internal
24 *
25 * Updates the clipboard when it is affected by KIO operations.
26 *
27 * UpdateContent updates clipboard urls that were modified. This mode should
28 * be the one preferred by default because it will not change the contents
29 * of the clipboard if the urls modified by the job are not found in the
30 * clipboard.
31 *
32 * OverwriteContent blindly replaces all urls in the clipboard with the ones
33 * from the job. This mode should not be used unless you are 100% certain that
34 * the urls in the clipboard are actually there for the purposes of carrying
35 * out the specified job. This mode for example is used by the KIO::pasteClipboard
36 * job when a user performs a cut+paste operation.
37 *
38 * This class also sets job as its parent object. As such, when job
39 * is deleted the instance of ClipboardUpdater you create will also be deleted
40 * as well.
41 */
42class ClipboardUpdater : public QObject
43{
44 Q_OBJECT
45
46public:
47 /*!
48 * Convenience function that allows renaming of a single url in the clipboard.
49 */
50 static void update(const QUrl &srcUrl, const QUrl &destUrl);
51
52 /*!
53 * Sets the mode.
54 */
55 void setMode(JobUiDelegateExtension::ClipboardUpdaterMode m);
56
57private Q_SLOTS:
58 void slotResult(KJob *job);
59
60private:
61 explicit ClipboardUpdater(Job *job, JobUiDelegateExtension::ClipboardUpdaterMode mode);
62 friend class JobUiDelegate;
63 JobUiDelegateExtension::ClipboardUpdaterMode m_mode;
64};
65}
66
67#endif
68

source code of kio/src/widgets/clipboardupdater_p.h