Summary: | KIO:del() should use Trash | ||
---|---|---|---|
Product: | [Unmaintained] kio | Reporter: | Jason Hihn <scorp1us> |
Component: | general | Assignee: | David Faure <faure> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Jason Hihn
2004-09-01 18:31:07 UTC
KIO::del() has to remain doing what it always did - after all Konqueror offers both "Move to Trash" and "Delete", so for the latter we need del(). Many other apps use del() to really delete (backup files etc.) However, given that I'm working on a new trash system, I am planning to provide an API for it, e.g. a KIO::trash( url list ). It will basically be a move( urls, "trash:/" ). Thanks for the BR, it confirms the need for an easy API for this. Will close when done. CVS commit by faure: Added convenience method KIO::trash( url or url list ), to encapsulate the trash implementation (it now moves to "trash:/"). Should also make it easy for apps to use it instead of del(). CCMAIL: 88615-done@bugs.kde.org M +12 -0 job.cpp 1.407 M +21 -0 job.h 1.101 M +1 -0 jobclasses.h 1.147 --- kdelibs/kio/kio/job.cpp #1.406:1.407 @@ -3593,4 +3593,16 @@ CopyJob *KIO::linkAs(const KURL& src, co } +CopyJob *KIO::trash(const KURL& src, bool showProgressInfo ) +{ + KURL::List srcList; + srcList.append( src ); + return new CopyJob( srcList, KURL( "trash:/" ), CopyJob::Move, false, showProgressInfo ); +} + +CopyJob *KIO::trash(const KURL::List& srcList, bool showProgressInfo ) +{ + return new CopyJob( srcList, KURL( "trash:/" ), CopyJob::Move, false, showProgressInfo ); +} + ////////// --- kdelibs/kio/kio/job.h #1.100:1.101 @@ -477,4 +477,25 @@ namespace KIO { /** + * Trash a file or directory. + * This is currently only supported for local files and directories. + * Use "KURL src; src.setPath( path );" to create a URL from a path. + * + * @param src file to delete + * @param showProgressInfo true to show progress information + * @return the job handling the operation + */ + CopyJob *trash( const KURL& src, bool showProgressInfo = true ); + + /** + * Trash a list of files or directories. + * This is currently only supported for local files and directories. + * + * @param src the files to delete + * @param showProgressInfo true to show progress information + * @return the job handling the operation + */ + CopyJob *trash( const KURL::List& src, bool showProgressInfo = true ); + + /** * Delete a file or directory. * --- kdelibs/kio/kio/jobclasses.h #1.146:1.147 @@ -1384,4 +1384,5 @@ namespace KIO { }; + /// @internal struct CopyInfo { |