KIO
copyjob.cpp
Go to the documentation of this file.
188 // During the stat phase, this is initially equal to *m_currentStatSrc but it can be resolved to a local file equivalent (#188903).
225 void addCopyInfoFromUDSEntry(const UDSEntry& entry, const KUrl& srcUrl, bool srcIsDir, const KUrl& currentDest);
371 if ( !sLocalPath.isEmpty() && kio_resolve_local_urls && destinationState != DEST_DOESNT_EXIST ) {
568 addCopyInfoFromUDSEntry(entry, static_cast<SimpleJob *>(job)->url(), m_bCurrentSrcIsDir, m_currentDest);
584 void CopyJobPrivate::addCopyInfoFromUDSEntry(const UDSEntry& entry, const KUrl& srcUrl, bool srcIsDir, const KUrl& currentDest)
640 kWarning(7007) << "kioslave bug: not enough slashes in UDS_URL" << path << "- looking for" << numberOfSlashes << "slashes";
690 * Imagine you copy the items a b and c into /d, but /d/b exists so the user uses "Rename" to put it in /foo/b instead.
742 if (destinationState != DEST_DOESNT_EXIST) { // only resolve src if we could resolve dest (#218719)
791 // sourceStated(entry, m_currentSrcURL); // don't recurse, see #319747, use queued invokeMethod instead
792 QMetaObject::invokeMethod(q, "sourceStated", Qt::QueuedConnection, Q_ARG(KIO::UDSEntry, entry), Q_ARG(KUrl, m_currentSrcURL));
863 if ( m_currentSrcURL.directory() != dest.directory() ) // For the user, moving isn't renaming. Only renaming is.
941 emit q->copyingDone( q, (*it).uSource, (*it).uDest, (*it).mtime, true /* directory */, false /* renamed */ );
1007 SimpleJob * newJob = KIO::stat(existingDest, StatJob::DestinationSide, 2, KIO::HideProgressInfo);
1050 const time_t destmtime = (time_t) entry.numberValue( KIO::UDSEntry::UDS_MODIFICATION_TIME, -1 );
1150 emit q->copyingDone( q, (*it).uSource, (*it).uDest, (*it).mtime, true /* directory */, false /* renamed */ );
1157 emit q->copyingDone( q, (*it).uSource, (*it).uDest, (*it).mtime, true /* directory */, false /* renamed */ );
1214 for ( QSet<QString>::const_iterator it = m_parentDirs.constBegin() ; it != m_parentDirs.constEnd() ; ++it )
1271 SimpleJob * newJob = KIO::stat(existingFile, StatJob::DestinationSide, 2, KIO::HideProgressInfo);
1374 const time_t destmtime = (time_t) entry.numberValue( KIO::UDSEntry::UDS_MODIFICATION_TIME, -1 );
1479 KIO::Job* CopyJobPrivate::linkNextFile( const KUrl& uSource, const KUrl& uDest, JobFlags flags )
1490 KIO::SimpleJob *newJob = KIO::symlink( uSource.path(), uDest, flags|HideProgressInfo /*no GUI*/ );
1546 // Todo: not show "link" on remote dirs if the src urls are not from the same protocol+host+...
1610 // Copying a symlink - only on the same protocol/host/etc. (#5601, downloading an FTP file through its link),
1613 KIO::SimpleJob *newJob = KIO::symlink( (*it).linkDest, uDest, flags | HideProgressInfo /*no GUI*/ );
1621 //Observer::self()->slotCopying( this, m_currentSrcURL, uDest ); // should be slotLinking perhaps
1623 // NOTE: if we are moving stuff, the deletion of the source will be done in slotResultCopyingFiles
1627 KIO::FileCopyJob * moveJob = KIO::file_move( uSource, uDest, (*it).permissions, flags | HideProgressInfo/*no GUI*/ );
1649 KIO::FileCopyJob * copyJob = KIO::file_copy( uSource, uDest, permissions, flags | HideProgressInfo/*no GUI*/ );
1769 for (QSet<QString>::const_iterator it = d->m_parentDirs.constBegin() ; it != d->m_parentDirs.constEnd() ; ++it)
1789 //kDebug(7007) << "emit processedSize" << (unsigned long) (m_processedSize + m_fileProcessedSize);
1859 if ( m_currentSrcURL.isLocalFile() && m_currentSrcURL.url(KUrl::RemoveTrailingSlash) != dest.url(KUrl::RemoveTrailingSlash) &&
1860 m_currentSrcURL.url(KUrl::RemoveTrailingSlash).toLower() == dest.url(KUrl::RemoveTrailingSlash).toLower() &&
1865 kDebug(7007) << "Couldn't rename directly, dest already exists. Detected special case of lower/uppercase renaming in same dir, try with 2 rename calls";
1868 const QString _tmpPrefix = m_currentSrcURL.directory(KUrl::ObeyTrailingSlash|KUrl::AppendTrailingSlash);
1915 bool isDir = (err == ERR_DIR_ALREADY_EXIST); // ## technically, isDir means "source is dir", not "dest is dir" #######
1925 const QString newName = KIO::RenameDialog::suggestName(destDirectory, m_currentDestURL.fileName());
2065 kDebug(7007) << "Couldn't rename" << m_currentSrcURL << "to" << dest << ", reverting to normal way, starting with stat";
2076 emit q->copyingDone( q, *m_currentStatSrc, dest, -1 /*mtime unknown, and not needed*/, true, true );
2101 //kDebug(7007) << "totalSize:" << (unsigned int) d->m_totalSize << "files:" << d->files.count() << "d->dirs:" << d->dirs.count();
An alternative URL (If different from the caption).
Definition: udsentry.h:190
Definition: copyjob.h:73
Definition: copyjob.cpp:93
QString i18n(const char *text)
When set, automatically overwrite the destination if it exists already.
Definition: jobclasses.h:67
QString & append(QChar ch)
QString directory(const DirectoryOptions &options=IgnoreTrailingSlash) const
static void emitFileRenamed(const QString &src, const QString &dst)
Definition: kdirnotify.cpp:37
static KDirWatch * self()
Definition: global.h:256
Definition: copyjob.cpp:92
Definition: skipdialog.h:29
void addMetaData(const QString &key, const QString &value)
Add key/value pair to the meta data that is sent to the slave.
Definition: job.cpp:264
void writePathEntry(const QString &pKey, const QString &path, WriteConfigFlags pFlags=Normal)
void setAutoSkip(bool autoSkip)
Skip copying or moving any file when the destination already exists, instead of the default behavior ...
Definition: copyjob.cpp:2147
void emitResult()
Definition: copyjob.cpp:66
void setUiDelegate(KJobUiDelegate *delegate)
void setPrefix(const QString &prefix)
static void setJobPriority(SimpleJob *job, int priority)
Changes the priority of job; jobs of the same priority run in the order in which they were created...
Definition: scheduler.cpp:805
bool remove()
int timeout
Definition: renamedialog.h:61
A ListJob is allows you to get the get the content of a directory.
Definition: jobclasses.h:936
Definition: skipdialog.h:29
Definition: global.h:235
int size() const
QString host() const
Definition: global.h:206
KStandardDirs * dirs()
Definition: global.h:214
SimpleJob * mkdir(const KUrl &url, int permissions=-1)
Creates a single directory.
Definition: job.cpp:697
int stat(const QString &path, KDE_struct_stat *buf)
int rename(const QString &in, const QString &out)
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
StatJob * stat(const KUrl &url, JobFlags flags=DefaultFlags)
Find all details for one file or directory.
Definition: job.cpp:924
void setSourceSize(KIO::filesize_t size)
If you know the size of the source file, call this method to inform this job.
Definition: job.cpp:2068
Definition: copyjob.cpp:86
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
iterator erase(iterator pos)
A KIO job that retrieves information about a file or directory.
Definition: jobclasses.h:440
static KFileItem cachedItemForUrl(const KUrl &url)
Return the KFileItem for the given URL, if we listed it recently and it's still in the cache - which ...
Definition: kdirlister.cpp:2788
Definition: copyjob.cpp:63
FileCopyJob * file_move(const KUrl &src, const KUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
Move a single file.
Definition: job.cpp:2479
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
A local file path if the ioslave display files sitting on the local filesystem (but in another hierar...
Definition: udsentry.h:166
Definition: copyjob.cpp:89
bool exists() const
int port() const
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
bool isEmpty() const
Definition: copyjob.cpp:87
CopyJobState
States: STATE_STATING for the dest statCurrentSrc then does, for each src url: STATE_RENAMING if dire...
Definition: copyjob.cpp:85
Definition: renamedialog.h:61
static bool canRenameToFile(const KUrl &url)
Returns whether the protocol can rename (i.e.
Definition: kprotocolmanager.cpp:1142
static void emitFilesAdded(const QString &directory)
Definition: kdirnotify.cpp:47
Definition: renamedialog.h:56
CopyJob * copyAs(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Copy a file or directory src into the destination dest, which is the destination name in any case...
Definition: copyjob.cpp:2172
void setUnrestricted(bool unrestricted)
Do not apply any KIOSK restrictions to this job.
Definition: job.cpp:2745
KSharedConfigPtr config()
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
bool stopDirScan(const QString &path)
void setPath(const QString &path)
Definition: copyjob.h:73
Show the progress info GUI, no Resume and no Overwrite.
Definition: jobclasses.h:46
Definition: jobclasses.h:447
QDateTime fromTime_t(uint seconds)
Definition: renamedialog.h:61
void addPath(const QString &txt)
int count(const T &value) const
void append(const T &value)
static void emitFilesRemoved(const QStringList &fileList)
Definition: kdirnotify.cpp:57
static SimpleJob * newJobNoUi(const KUrl &url, int command, const QByteArray &packedArgs)
Definition: job_p.h:201
QString & insert(int position, QChar ch)
FileCopyJob * file_copy(const KUrl &src, const KUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
Copy a single file.
Definition: job.cpp:2473
Definition: global.h:196
void setModificationTime(const QDateTime &mtime)
Sets the modification time of the file.
Definition: job.cpp:2076
void setWriteIntoExistingDirectories(bool overwriteAllDirs)
Reuse any directory that already exists, instead of the default behavior (interactive mode: showing a...
Definition: copyjob.cpp:2159
long long numberValue(uint field, long long defaultValue=0) const
Definition: udsentry.cpp:78
static bool supportsDeleting(const KUrl &url)
Returns whether the protocol can delete files/objects.
Definition: kprotocolmanager.cpp:1077
Definition: copyjob.cpp:88
QString encodeFileName(const QString &str)
Encodes (from the text displayed to the real filename) This translates '/' into a "unicode fraction s...
Definition: global.cpp:146
QString user() const
QString protocol() const
QString pass() const
bool isEmpty() const
virtual void slotResult(KJob *job)
QString buildErrorString(int errorCode, const QString &errorText)
Returns a translated error message for errorCode using the additional error information provided by e...
Definition: global.cpp:164
bool isEmpty() const
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
void setPass(const QString &pass)
typedef Iterator
CopyJob * link(const KUrl &src, const KUrl &destDir, JobFlags flags=DefaultFlags)
Create a link.
Definition: copyjob.cpp:2214
Definition: renamedialog.h:61
QString path(AdjustPathOption trailing=LeaveTrailingSlash) const
Definition: global.h:257
RenameDialog_Mode
M_OVERWRITE: We have an existing dest, show details about it and offer to overwrite it...
Definition: renamedialog.h:56
Definition: copyjob.h:73
Definition: global.h:165
Definition: renamedialog.h:61
void setDefaultPermissions(bool b)
By default the permissions of the copied files will be those of the source files. ...
Definition: copyjob.cpp:2137
Definition: global.h:207
Definition: renamedialog.h:56
CopyJob * move(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Moves a file or directory src to the given destination dest.
Definition: copyjob.cpp:2186
iterator end()
SimpleJob * symlink(const QString &target, const KUrl &dest, JobFlags flags=DefaultFlags)
Create or move a symlink.
Definition: job.cpp:738
Definition: renamedialog.h:61
virtual void close()
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
SimpleJob * setModificationTime(const KUrl &url, const QDateTime &mtime)
Changes the modification time on a file or directory.
Definition: job.cpp:724
int lstat(const QString &path, KDE_struct_stat *buf)
static ClipboardUpdater * create(Job *job, Mode mode)
Returns an instance of clipboard updater if QApplication::type() does not return a tty...
Definition: clipboardupdater.cpp:162
QString fileName() const
CopyJob * moveAs(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Moves a file or directory src to the given destination dest.
Definition: copyjob.cpp:2196
DeleteJob * del(const KUrl &src, JobFlags flags=DefaultFlags)
Delete a file or directory.
Definition: deletejob.cpp:492
Definition: copyjob.cpp:90
QString & replace(int position, int n, QChar after)
Definition: renamedialog.h:56
Definition: renamedialog.h:61
QString mid(int position, int n) const
FileNameUsedForCopying
CopyJob * linkAs(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Create a link.
Definition: copyjob.cpp:2226
QString dir(const QString &fileClass)
Returns the most recently used directory accociated with this file-class.
Definition: krecentdirs.cpp:68
Definition: renamedialog.h:56
QString errorString() const
Converts an error code and a non-i18n error message into an error message in the current language...
Definition: global.cpp:159
Access permissions (part of the mode returned by stat)
Definition: udsentry.h:171
QString fileName(const DirectoryOptions &options=IgnoreTrailingSlash) const
int count() const
ListJob * listRecursive(const KUrl &url, JobFlags flags=DefaultFlags, bool includeHidden=true)
The same as the previous method, but recurses subdirectories.
Definition: job.cpp:2740
Filename - as displayed in directory listings etc.
Definition: udsentry.h:163
Name of the file where the link points to Allows to check for a symlink (don't use S_ISLNK !) ...
Definition: udsentry.h:184
Definition: copyjob.cpp:65
Definition: global.h:202
typedef ConstIterator
CopyJob * copy(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Copy a file or directory src into the destination dest, which can be a file (including the final file...
Definition: copyjob.cpp:2164
static QString suggestName(const KUrl &baseURL, const QString &oldName)
Given a directory path and a filename (which usually exists already), this function returns a suggest...
Definition: renamedialog.cpp:419
int length() const
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
If set, contains the label to display instead of the 'real name' in UDS_NAME.
Definition: udsentry.h:211
void setAutoRename(bool autoRename)
Rename files automatically when the destination already exists, instead of the default behavior (inte...
Definition: copyjob.cpp:2153
bool hasSubjobs()
QString fromLatin1(const char *str, int size)
Definition: copyjob.cpp:94
Definition: global.h:254
Definition: copyjob.cpp:91
Definition: copyjob.h:41
bool setProperty(const char *name, const QVariant &value)
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
Definition: jobclasses.h:446
static bool supportsListing(const KUrl &url)
Returns whether the protocol can list files/objects.
Definition: kprotocolmanager.cpp:1032
void sync()
virtual void registerJob(KJob *job)
const_iterator constEnd() const
Definition: copyjob.cpp:64
const_iterator constBegin() const
bool isLocalFile() const
CopyMode operationMode() const
Returns the mode of the operation (copy, move, or link), depending on whether KIO::copy(), KIO::move() or KIO::link() was called.
Definition: copyjob.cpp:2142
Definition: job_p.h:39
static KProtocolInfo::FileNameUsedForCopying fileNameUsedForCopying(const KUrl &url)
This setting defines the strategy to use for generating a filename, when copying a file or directory ...
Definition: kprotocolmanager.cpp:1160
const KShortcut & end()
bool open()
int utime(const QString &filename, struct utimbuf *buf)
static bool canRenameFromFile(const KUrl &url)
Returns whether the protocol can rename (i.e.
Definition: kprotocolmanager.cpp:1132
bool restartDirScan(const QString &path)
iterator begin()
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
CopyJob * trash(const KUrl &src, JobFlags flags=DefaultFlags)
Trash a file or directory.
Definition: copyjob.cpp:2233
KUrl mostLocalUrl(bool &local) const
Tries to give a local URL for this file item if possible.
Definition: kfileitem.cpp:1470
A KFileItem is a generic class to handle a file, local or remote.
Definition: kfileitem.h:45
CopyJob is used to move, copy or symlink files and directories.
Definition: copyjob.h:65
QStringList list(const QString &fileClass)
Returns a list of directories associated with this file-class.
Definition: krecentdirs.cpp:60
singleShot
static void emitFileMoved(const QString &src, const QString &dst)
Definition: kdirnotify.cpp:42
Definition: renamedialog.h:56
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.