summaryrefslogtreecommitdiffstats
path: root/tdenewstuff/downloaddialog.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-07 15:35:07 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-10-07 15:35:07 -0500
commit30c2b7e4bd6fa63d0f3431b8e82fefd81364726f (patch)
treedb230ec7e83392ce981cd80912a2b4fdf6f3a206 /tdenewstuff/downloaddialog.cpp
parente5f898219af927c9bac3aa9b0c9e9473a52dde15 (diff)
downloadtdelibs-30c2b7e4bd6fa63d0f3431b8e82fefd81364726f.tar.gz
tdelibs-30c2b7e4bd6fa63d0f3431b8e82fefd81364726f.zip
Autodetect downloaded mime type and compare against category; if wallpaper downloads something other than image abort
This relates to Bug 2127
Diffstat (limited to 'tdenewstuff/downloaddialog.cpp')
-rw-r--r--tdenewstuff/downloaddialog.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tdenewstuff/downloaddialog.cpp b/tdenewstuff/downloaddialog.cpp
index 9744275e..0eaa0e68 100644
--- a/tdenewstuff/downloaddialog.cpp
+++ b/tdenewstuff/downloaddialog.cpp
@@ -46,6 +46,7 @@
#include <tqtimer.h> // hack
#define OPENDESKTOP_REDIRECT_URL "opendesktop.org/content/download.php?content="
+#define OPENDESKTOP_REDIRECT_TEXT "If the download does not start in 3 seconds:</span><span class=\"defaulttext\">&nbsp;<a href=\""
using namespace KNS;
@@ -609,7 +610,7 @@ void DownloadDialog::slotInstallPhase2()
}
else
{
- m_s = new TDENewStuffGeneric(e->type(), this);
+ m_s = new TDENewStuffGeneric(m_filter, this);
m_entry = e;
KURL source = e->payload();
KURL dest = KURL(m_s->downloadDestination(e));
@@ -650,6 +651,12 @@ void DownloadDialog::slotJobResult( TDEIO::Job *job )
realURL = e->payload().protocol() + "://opendesktop.org" + realURL;
e->setPayload(realURL);
}
+ else if ((pos = mJobData.find(OPENDESKTOP_REDIRECT_TEXT)) > 0) {
+ pos = pos + strlen(OPENDESKTOP_REDIRECT_TEXT);
+ TQString realURL = mJobData.mid(pos);
+ realURL = realURL.mid(0, realURL.find("\">"));
+ e->setPayload(realURL);
+ }
}
slotInstallPhase2();