File indexing completed on 2024-09-15 03:38:56
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2013 Dawit Alemayehu <adawit@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KIO_CLIPBOARDUPDATER_P_H 0009 #define KIO_CLIPBOARDUPDATER_P_H 0010 0011 #include <QObject> 0012 #include <jobuidelegateextension.h> 0013 0014 class KJob; 0015 class QUrl; 0016 0017 namespace KIO 0018 { 0019 class Job; 0020 class JobUiDelegate; 0021 0022 /** 0023 * Updates the clipboard when it is affected by KIO operations. 0024 * 0025 * UpdateContent updates clipboard urls that were modified. This mode should 0026 * be the one preferred by default because it will not change the contents 0027 * of the clipboard if the urls modified by the job are not found in the 0028 * clipboard. 0029 * 0030 * OverwriteContent blindly replaces all urls in the clipboard with the ones 0031 * from the job. This mode should not be used unless you are 100% certain that 0032 * the urls in the clipboard are actually there for the purposes of carrying 0033 * out the specified job. This mode for example is used by the KIO::pasteClipboard 0034 * job when a user performs a cut+paste operation. 0035 * 0036 * This class also sets @ref job as its parent object. As such, when @ref job 0037 * is deleted the instance of ClipboardUpdater you create will also be deleted 0038 * as well. 0039 */ 0040 class ClipboardUpdater : public QObject 0041 { 0042 Q_OBJECT 0043 0044 public: 0045 /** 0046 * Convenience function that allows renaming of a single url in the clipboard. 0047 */ 0048 static void update(const QUrl &srcUrl, const QUrl &destUrl); 0049 0050 /** 0051 * Sets the mode. 0052 */ 0053 void setMode(JobUiDelegateExtension::ClipboardUpdaterMode m); 0054 0055 private Q_SLOTS: 0056 void slotResult(KJob *job); 0057 0058 private: 0059 explicit ClipboardUpdater(Job *job, JobUiDelegateExtension::ClipboardUpdaterMode mode); 0060 friend class JobUiDelegate; 0061 JobUiDelegateExtension::ClipboardUpdaterMode m_mode; 0062 }; 0063 } 0064 0065 #endif