diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kget/safedelete.cpp | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
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
Diffstat (limited to 'kget/safedelete.cpp')
-rw-r--r-- | kget/safedelete.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
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 <klocale.h> +#include <kmessagebox.h> +#include <kurl.h> +#include <kio/netaccess.h> + +#include <qfileinfo.h> + +#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; +} |