forked from blue/squawk
Downloads folder now is movable
This commit is contained in:
parent
d8b5ccb2da
commit
73b1b58a96
16 changed files with 141 additions and 12 deletions
|
@ -53,3 +53,26 @@ QString Shared::resolvePath(QString path)
|
|||
QVariant dpv = settings.value("downloadsPath");
|
||||
return path.replace(squawk, dpv.toString() + "/");
|
||||
}
|
||||
|
||||
QString Shared::squawkifyPath(QString path)
|
||||
{
|
||||
QSettings settings;
|
||||
QString current = settings.value("downloadsPath").toString();
|
||||
|
||||
if (path.startsWith(current)) {
|
||||
path.replace(0, current.size() + 1, "squawk://");
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
bool Shared::isSubdirectoryOfSettings(const QString& path)
|
||||
{
|
||||
|
||||
QSettings settings;
|
||||
QDir oldPath(settings.value("downloadsPath").toString());
|
||||
QDir newPath(path);
|
||||
|
||||
return newPath.canonicalPath().startsWith(oldPath.canonicalPath());
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
namespace Shared {
|
||||
|
||||
QString downloadsPathCheck();
|
||||
QString downloadsPathCheck(QString path);
|
||||
QString defaultDownloadsPath();
|
||||
|
||||
QString getAbsoluteWritablePath(const QString& path);
|
||||
QString resolvePath(QString path);
|
||||
QString squawkifyPath(QString path);
|
||||
bool isSubdirectoryOfSettings(const QString& path);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue