KIO
Go to the documentation of this file.
25 #include <QApplication>
26 #include <QMimeSource>
34 return QApplication::type() != QApplication::Tty;
39 CopyJob* copyJob = qobject_cast<CopyJob*>(job);
40 FileCopyJob* fileCopyJob = qobject_cast<FileCopyJob*>(job);
42 if (!copyJob && !fileCopyJob) {
54 }
else if (fileCopyJob) {
55 newUrls << fileCopyJob->
destUrl();
58 QMimeData* mime =
new QMimeData();
60 QApplication::clipboard()->setMimeData(mime);
65 CopyJob* copyJob = qobject_cast<CopyJob*>(job);
66 FileCopyJob* fileCopyJob = qobject_cast<FileCopyJob*>(job);
68 if (!copyJob && !fileCopyJob) {
72 QClipboard* clipboard = QApplication::clipboard();
78 const int index = clipboardUrls.indexOf(url);
82 clipboardUrls.replace(index, dUrl);
86 }
else if (fileCopyJob) {
87 const int index = clipboardUrls.indexOf(fileCopyJob->
srcUrl());
89 clipboardUrls.replace(index, fileCopyJob->
destUrl());
95 QMimeData* mime =
new QMimeData();
97 clipboard->setMimeData(mime);
103 SimpleJob* simpleJob = qobject_cast<SimpleJob*>(job);
104 DeleteJob* deleteJob = qobject_cast<DeleteJob*>(job);
106 if (!simpleJob && !deleteJob) {
112 deletedUrls << simpleJob->
url();
113 }
else if (deleteJob) {
114 deletedUrls << deleteJob->
urls();
117 if (deletedUrls.isEmpty()) {
121 QClipboard* clipboard = QApplication::clipboard();
123 quint32 removedCount = 0;
125 Q_FOREACH(
const KUrl& url, deletedUrls) {
126 removedCount += clipboardUrls.removeAll(url);
129 if (removedCount > 0) {
130 QMimeData* mime =
new QMimeData();
131 if (!clipboardUrls.isEmpty()) {
134 clipboard->setMimeData(mime);
138 void ClipboardUpdater::slotResult(
KJob* job)
177 QClipboard* clipboard = QApplication::clipboard();
178 if (clipboard->mimeData()->hasUrls()) {
180 const int index = clipboardUrls.indexOf(srcUrl);
182 clipboardUrls.replace(index, destUrl);
183 QMimeData* mime =
new QMimeData();
185 clipboard->setMimeData(mime);
190 ClipboardUpdater::ClipboardUpdater(
Job* job,
Mode mode)
195 connect(job, SIGNAL(result(
KJob*)),
this, SLOT(slotResult(
KJob*)));
Mode
Possible image file access modes.
void addPath(const QString &txt)
KUrl srcUrl() const
Returns the source URL.
static void removeUrlsFromClipboard(KJob *job)
void populateMimeData(const KUrl::List &mostLocalUrls, QMimeData *mimeData, const KUrl::MetaDataMap &metaData=MetaDataMap(), MimeDataFlags flags=DefaultMimeDataFlags) const
KUrl::List urls() const
Returns the list of URLs.
A simple job (one url and one command).
KUrl destUrl() const
Returns the destination URL.
static KUrl::List fromMimeData(const QMimeData *mimeData, DecodeOptions decodeOptions, KUrl::MetaDataMap *metaData=0)
QString fileName(const DirectoryOptions &options=IgnoreTrailingSlash) const
const KUrl & url() const
Returns the SimpleJob's URL.
static bool canUseClipboard()
CopyJob is used to move, copy or symlink files and directories.
KUrl destUrl() const
Returns the destination URL.
static void updateUrlsInClipboard(KJob *job)
The base class for all jobs.
KUrl::List srcUrls() const
Returns the list of source URLs.
void setMode(Mode m)
Sets the mode.
static ClipboardUpdater * create(Job *job, Mode mode)
Returns an instance of clipboard updater if QApplication::type() does not return a tty.
static void update(const KUrl &srcUrl, const KUrl &destUrl)
Convenience function that allows renaming of a single url in the clipboard.
The FileCopyJob copies data from one place to another.
A namespace for KIO globals.
Updates the clipboard when it is affected by KIO operations.
static void overwriteUrlsInClipboard(KJob *job)
A more complex Job to delete files and directories.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jan 30 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.