| Summary: | Store finished downloads in a different location | ||
|---|---|---|---|
| Product: | [Applications] ktorrent | Reporter: | Iñaki Baz Castillo <ibc> |
| Component: | general | Assignee: | Joris Guisson <joris.guisson> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Iñaki Baz Castillo
2006-07-31 16:38:04 UTC
We'll see, we could add an option like this. SVN commit 647847 by guisson:
Added option to move finished downloads to a different directory.
BUG: 131592
M +1 -0 ChangeLog
M +9 -19 apps/ktorrent/ktorrentview.cpp
M +1 -1 ktorrent.kdevelop
M +2 -2 libktorrent/torrent/cache.h
M +4 -5 libktorrent/torrent/multifilecache.cpp
M +1 -1 libktorrent/torrent/multifilecache.h
M +15 -5 libktorrent/torrent/torrentcontrol.cpp
--- trunk/extragear/network/ktorrent/ChangeLog #647846:647847
@@ -11,6 +11,7 @@
- Make sure FileView remembers it's state
- Sleep time of upload and download is now configurable through a CPU usage
slider in the settings
+- Added option to move finished downloads to a different directory
Changes in 2.1.2
- Fix 2 security vulnerabilities (thanks to Bryan Burns from Juniper Networks
--- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrentview.cpp #647846:647847
@@ -32,7 +32,8 @@
#include <interfaces/torrentinterface.h>
#include <torrent/globals.h>
#include <util/log.h>
-
+#include <util/functions.h>
+
#include <groups/group.h>
#include <groups/torrentdrag.h>
@@ -614,7 +615,7 @@
if (tc)
{
if(tc->getStats().multi_file_torrent)
- new KRun(KURL::fromPathOrURL(tc->getDataDir() + tc->getStats().torrent_name), 0, true, true);
+ new KRun(KURL::fromPathOrURL(tc->getStats().output_path), 0, true, true);
else
new KRun(KURL::fromPathOrURL(tc->getDataDir()), 0, true, true);
}
@@ -645,25 +646,14 @@
if (tc)
{
QString dn;
- TorrentStats s = tc->getStats();
-
- if(s.multi_file_torrent)
- {
- dn = KFileDialog::getExistingDirectory(s.output_path, this, i18n("Choose download location for %1").arg(tc->getStats().torrent_name));
+ dn = KFileDialog::getExistingDirectory(QString::null, this, i18n("Choose download location for %1").arg(tc->getStats().torrent_name));
- if(dn.isNull() || dn.isEmpty())
- continue;
+ if(dn.isNull() || dn.isEmpty())
+ continue;
- if(!dn.endsWith("/"))
- dn += "/";
-
- dn += s.torrent_name;
- }
- else
- {
- dn = KFileDialog::getSaveFileName(s.output_path, QString::null, this, i18n("Choose download location for %1").arg(tc->getStats().torrent_name));
- }
-
+ if(!dn.endsWith(bt::DirSeparator()))
+ dn += bt::DirSeparator();
+
if(!dn.isEmpty())
tc->changeOutputDir(dn);
}
--- trunk/extragear/network/ktorrent/ktorrent.kdevelop #647846:647847
@@ -49,7 +49,7 @@
<ktorrent>/home/joris/ktorrent/newstuff/debug/./plugins/infowidget</ktorrent>
</cwd>
<globaldebugarguments>--nofork</globaldebugarguments>
- <globalcwd>/home/ivan/working/ktorrent/debug</globalcwd>
+ <globalcwd>/home/joris</globalcwd>
<useglobalprogram>true</useglobalprogram>
<autoinstall>false</autoinstall>
<autokdesu>false</autokdesu>
--- trunk/extragear/network/ktorrent/libktorrent/torrent/cache.h #647846:647847
@@ -67,9 +67,9 @@
/**
* Changes output path. All data files should already been moved.
* This just modifies the datadir variable.
- * @param outputpath The output file/directory path.
+ * @param outputpath New output path
*/
- virtual void changeOutputPath(const QString& outputpath) = 0;
+ virtual void changeOutputPath(const QString & outputpath) = 0;
/**
* Load a chunk into memory. If something goes wrong,
--- trunk/extragear/network/ktorrent/libktorrent/torrent/multifilecache.cpp #647846:647847
@@ -168,13 +168,12 @@
void MultiFileCache::changeOutputPath(const QString & outputpath)
{
deleteDataFiles();
-
- this->output_dir = outputpath;
- if(!output_dir.endsWith("/"))
- output_dir += "/";
+ output_dir = outputpath;
+ if (!output_dir.endsWith(bt::DirSeparator()))
+ output_dir += bt::DirSeparator();
- datadir = outputpath.left(outputpath.findRev(bt::DirSeparator()) + 1);
+ datadir = output_dir;
create();
}
--- trunk/extragear/network/ktorrent/libktorrent/torrent/multifilecache.h #647846:647847
@@ -53,7 +53,7 @@
virtual void close();
virtual void open();
virtual QString getOutputPath() const;
- virtual void changeOutputPath(const QString& outputpath);
+ virtual void changeOutputPath(const QString & outputpath);
virtual void preallocateDiskSpace(PreallocationThread* prealloc);
virtual bool hasMissingFiles(QStringList & sl);
virtual void deleteDataFiles();
--- trunk/extragear/network/ktorrent/libktorrent/torrent/torrentcontrol.cpp #647846:647847
@@ -290,7 +290,6 @@
if(!outdir.endsWith(bt::DirSeparator()))
outdir += bt::DirSeparator();
- outdir += stats.output_path.mid(stats.output_path.findRev(bt::DirSeparator()) + 1);
changeOutputDir(outdir);
}
}
@@ -804,10 +803,21 @@
try
{
bt::Move(stats.output_path, new_dir);
- cman->changeOutputPath(new_dir);
- outputdir = new_dir.left(new_dir.findRev(bt::DirSeparator()) + 1);
- stats.output_path = outputdir;
- istats.custom_output_name = true;
+ if (istats.custom_output_name)
+ {
+ int slash_pos = stats.output_path.findRev(bt::DirSeparator(),-2);
+ QString ldir = stats.output_path.mid(slash_pos + 1);
+ cman->changeOutputPath(new_dir + ldir);
+ outputdir = stats.output_path = new_dir + ldir;
+ istats.custom_output_name = true;
+ }
+ else
+ {
+ QString nd = new_dir + tor->getNameSuggestion();
+ cman->changeOutputPath(nd);
+ outputdir = stats.output_path = nd;
+ istats.custom_output_name = true;
+ }
saveStats();
In which version is available this patch? Ops, sorry, I didn't see this option in my Ktorrent 2.2 XD Thanks, this options is very very useful for me. |