From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kget/safedelete.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 kget/safedelete.cpp (limited to 'kget/safedelete.cpp') diff --git a/kget/safedelete.cpp b/kget/safedelete.cpp new file mode 100644 index 00000000..c4cb6915 --- /dev/null +++ b/kget/safedelete.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +#include + +#include "safedelete.h" + +bool SafeDelete::deleteFile( const KURL& url ) +{ + if ( url.isLocalFile() ) + { + QFileInfo info( url.path() ); + if ( info.isDir() ) + { + KMessageBox::information(0L, + i18n("Not deleting\n%1\nas it is a " + "directory.").arg( url.prettyURL() ), + i18n("Not Deleted")); + return false; + } + + KIO::NetAccess::del( url, 0L ); + return true; + } + + else + KMessageBox::information( 0L, + i18n("Not deleting\n%1\nas it is not a local" + " file.").arg( url.prettyURL() ), + i18n("Not Deleted") ); + + return false; +} -- cgit v1.2.1