KIO
copyjob.cpp
Go to the documentation of this file.
189 // During the stat phase, this is initially equal to *m_currentStatSrc but it can be resolved to a local file equivalent (#188903).
226 void addCopyInfoFromUDSEntry(const UDSEntry& entry, const KUrl& srcUrl, bool srcIsDir, const KUrl& currentDest);
350 if ( fsType != KFileSystemType::Nfs && fsType != KFileSystemType::Smb && fsType != KFileSystemType::Ramfs ) {
369 if ( !sLocalPath.isEmpty() && kio_resolve_local_urls && destinationState != DEST_DOESNT_EXIST ) {
566 addCopyInfoFromUDSEntry(entry, static_cast<SimpleJob *>(job)->url(), m_bCurrentSrcIsDir, m_currentDest);
582 void CopyJobPrivate::addCopyInfoFromUDSEntry(const UDSEntry& entry, const KUrl& srcUrl, bool srcIsDir, const KUrl& currentDest)
638 kWarning(7007) << "kioslave bug: not enough slashes in UDS_URL" << path << "- looking for" << numberOfSlashes << "slashes";
688 * 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.
740 if (destinationState != DEST_DOESNT_EXIST) { // only resolve src if we could resolve dest (#218719)
789 // sourceStated(entry, m_currentSrcURL); // don't recurse, see #319747, use queued invokeMethod instead
790 QMetaObject::invokeMethod(q, "sourceStated", Qt::QueuedConnection, Q_ARG(KIO::UDSEntry, entry), Q_ARG(KUrl, m_currentSrcURL));
861 if ( m_currentSrcURL.directory() != dest.directory() ) // For the user, moving isn't renaming. Only renaming is.
939 emit q->copyingDone( q, (*it).uSource, (*it).uDest, (*it).mtime, true /* directory */, false /* renamed */ );
1005 SimpleJob * newJob = KIO::stat(existingDest, StatJob::DestinationSide, 2, KIO::HideProgressInfo);
1048 const time_t destmtime = (time_t) entry.numberValue( KIO::UDSEntry::UDS_MODIFICATION_TIME, -1 );
1148 emit q->copyingDone( q, (*it).uSource, (*it).uDest, (*it).mtime, true /* directory */, false /* renamed */ );
1155 emit q->copyingDone( q, (*it).uSource, (*it).uDest, (*it).mtime, true /* directory */, false /* renamed */ );
1212 for ( QSet<QString>::const_iterator it = m_parentDirs.constBegin() ; it != m_parentDirs.constEnd() ; ++it )
1269 SimpleJob * newJob = KIO::stat(existingFile, StatJob::DestinationSide, 2, KIO::HideProgressInfo);
1372 const time_t destmtime = (time_t) entry.numberValue( KIO::UDSEntry::UDS_MODIFICATION_TIME, -1 );
1477 KIO::Job* CopyJobPrivate::linkNextFile( const KUrl& uSource, const KUrl& uDest, JobFlags flags )
1488 KIO::SimpleJob *newJob = KIO::symlink( uSource.path(), uDest, flags|HideProgressInfo /*no GUI*/ );
1544 // Todo: not show "link" on remote dirs if the src urls are not from the same protocol+host+...
1608 // Copying a symlink - only on the same protocol/host/etc. (#5601, downloading an FTP file through its link),
1611 KIO::SimpleJob *newJob = KIO::symlink( (*it).linkDest, uDest, flags | HideProgressInfo /*no GUI*/ );
1619 //Observer::self()->slotCopying( this, m_currentSrcURL, uDest ); // should be slotLinking perhaps
1621 // NOTE: if we are moving stuff, the deletion of the source will be done in slotResultCopyingFiles
1625 KIO::FileCopyJob * moveJob = KIO::file_move( uSource, uDest, (*it).permissions, flags | HideProgressInfo/*no GUI*/ );
1647 KIO::FileCopyJob * copyJob = KIO::file_copy( uSource, uDest, permissions, flags | HideProgressInfo/*no GUI*/ );
1767 for (QSet<QString>::const_iterator it = d->m_parentDirs.constBegin() ; it != d->m_parentDirs.constEnd() ; ++it)
1787 //kDebug(7007) << "emit processedSize" << (unsigned long) (m_processedSize + m_fileProcessedSize);
1857 if ( m_currentSrcURL.isLocalFile() && m_currentSrcURL.url(KUrl::RemoveTrailingSlash) != dest.url(KUrl::RemoveTrailingSlash) &&
1858 m_currentSrcURL.url(KUrl::RemoveTrailingSlash).toLower() == dest.url(KUrl::RemoveTrailingSlash).toLower() &&
1863 kDebug(7007) << "Couldn't rename directly, dest already exists. Detected special case of lower/uppercase renaming in same dir, try with 2 rename calls";
1866 const QString _tmpPrefix = m_currentSrcURL.directory(KUrl::ObeyTrailingSlash|KUrl::AppendTrailingSlash);
1913 bool isDir = (err == ERR_DIR_ALREADY_EXIST); // ## technically, isDir means "source is dir", not "dest is dir" #######
1923 const QString newName = KIO::RenameDialog::suggestName(destDirectory, m_currentDestURL.fileName());
2063 kDebug(7007) << "Couldn't rename" << m_currentSrcURL << "to" << dest << ", reverting to normal way, starting with stat";
2074 emit q->copyingDone( q, *m_currentStatSrc, dest, -1 /*mtime unknown, and not needed*/, true, true );
2099 //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:94
QString i18n(const char *text)
When set, automatically overwrite the destination if it exists already.
Definition: jobclasses.h:67
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:93
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:2145
void emitResult()
Definition: copyjob.cpp:67
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
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
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:2084
Definition: copyjob.cpp:87
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
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:2783
Definition: copyjob.cpp:64
FileCopyJob * file_move(const KUrl &src, const KUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
Move a single file.
Definition: job.cpp:2495
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:90
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
Definition: copyjob.cpp:88
CopyJobState
States: STATE_STATING for the dest statCurrentSrc then does, for each src url: STATE_RENAMING if dire...
Definition: copyjob.cpp:86
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:2170
Type fileSystemType(const QString &path)
void setUnrestricted(bool unrestricted)
Do not apply any KIOSK restrictions to this job.
Definition: job.cpp:2749
KSharedConfigPtr config()
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
Definition: renamedialog.h:61
void addPath(const QString &txt)
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:199
FileCopyJob * file_copy(const KUrl &src, const KUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
Copy a single file.
Definition: job.cpp:2489
Definition: global.h:196
void setModificationTime(const QDateTime &mtime)
Sets the modification time of the file.
Definition: job.cpp:2092
void setWriteIntoExistingDirectories(bool overwriteAllDirs)
Reuse any directory that already exists, instead of the default behavior (interactive mode: showing a...
Definition: copyjob.cpp:2157
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:89
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
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
void setPass(const QString &pass)
CopyJob * link(const KUrl &src, const KUrl &destDir, JobFlags flags=DefaultFlags)
Create a link.
Definition: copyjob.cpp:2212
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:2135
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:2184
SimpleJob * symlink(const QString &target, const KUrl &dest, JobFlags flags=DefaultFlags)
Create or move a symlink.
Definition: job.cpp:738
Definition: renamedialog.h:61
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
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:2194
DeleteJob * del(const KUrl &src, JobFlags flags=DefaultFlags)
Delete a file or directory.
Definition: deletejob.cpp:492
Definition: copyjob.cpp:91
Definition: renamedialog.h:56
Definition: renamedialog.h:61
FileNameUsedForCopying
CopyJob * linkAs(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Create a link.
Definition: copyjob.cpp:2224
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
ListJob * listRecursive(const KUrl &url, JobFlags flags=DefaultFlags, bool includeHidden=true)
The same as the previous method, but recurses subdirectories.
Definition: job.cpp:2744
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:66
Definition: global.h:202
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:2162
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
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:2151
bool hasSubjobs()
Definition: copyjob.cpp:95
Definition: global.h:254
Definition: copyjob.cpp:92
Definition: copyjob.h:41
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)
Definition: copyjob.cpp:65
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:2140
Definition: job_p.h:37
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()
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)
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
CopyJob * trash(const KUrl &src, JobFlags flags=DefaultFlags)
Trash a file or directory.
Definition: copyjob.cpp:2231
KUrl mostLocalUrl(bool &local) const
Tries to give a local URL for this file item if possible.
Definition: kfileitem.cpp:1476
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
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-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.