Fix uri
This commit is contained in:
parent
5b748d35e7
commit
becd1c3e39
4 changed files with 23 additions and 18 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
@ -91,6 +92,17 @@ void Application::openWindow(const QString &path)
|
||||||
w->load(QUrl("qrc:/qml/main.qml"));
|
w->load(QUrl("qrc:/qml/main.qml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList Application::formatUriList(const QStringList &list)
|
||||||
|
{
|
||||||
|
QStringList val = list;
|
||||||
|
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
val.append(QDir::currentPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
bool Application::parseCommandLineArgs()
|
bool Application::parseCommandLineArgs()
|
||||||
{
|
{
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
|
@ -113,13 +125,7 @@ bool Application::parseCommandLineArgs()
|
||||||
if (parser.isSet(desktopOption)) {
|
if (parser.isSet(desktopOption)) {
|
||||||
Desktop desktop;
|
Desktop desktop;
|
||||||
} else {
|
} else {
|
||||||
QStringList paths = parser.positionalArguments();
|
openFiles(formatUriList(parser.positionalArguments()));
|
||||||
|
|
||||||
if (paths.isEmpty()) {
|
|
||||||
paths.append(QDir::currentPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
openFiles(paths);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QDBusInterface iface("com.cutefish.FileManager",
|
QDBusInterface iface("com.cutefish.FileManager",
|
||||||
|
@ -131,13 +137,7 @@ bool Application::parseCommandLineArgs()
|
||||||
// Empty Dialog
|
// Empty Dialog
|
||||||
iface.call("emptyTrash");
|
iface.call("emptyTrash");
|
||||||
} else {
|
} else {
|
||||||
QStringList paths = parser.positionalArguments();
|
iface.call("openFiles", formatUriList(parser.positionalArguments()));
|
||||||
|
|
||||||
if (paths.isEmpty()) {
|
|
||||||
paths.append(QDir::currentPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
iface.call("openFiles", paths);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void openWindow(const QString &path);
|
void openWindow(const QString &path);
|
||||||
|
QStringList formatUriList(const QStringList &list);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool parseCommandLineArgs();
|
bool parseCommandLineArgs();
|
||||||
|
|
|
@ -20,8 +20,6 @@ void DBusInterface::ShowFolders(const QStringList &uriList, const QString &start
|
||||||
{
|
{
|
||||||
Q_UNUSED(startUpId);
|
Q_UNUSED(startUpId);
|
||||||
|
|
||||||
qDebug() << uriList;
|
|
||||||
|
|
||||||
QProcess::startDetached("cutefish-filemanager", uriList);
|
QProcess::startDetached("cutefish-filemanager", uriList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,13 +293,19 @@ void FolderModel::setUrl(const QString &url)
|
||||||
if (url.isEmpty())
|
if (url.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QUrl &resolvedNewUrl = resolve(url);
|
QUrl resolvedNewUrl = resolve(url);
|
||||||
|
QFileInfo info(resolvedNewUrl.toLocalFile());
|
||||||
|
|
||||||
if (!QFile::exists(resolvedNewUrl.toLocalFile()) && !url.startsWith("trash:/")) {
|
if (!QFile::exists(resolvedNewUrl.toLocalFile()) && !url.startsWith("trash:/")) {
|
||||||
emit notification(tr("The file or folder %1 does not exist.").arg(url));
|
emit notification(tr("The file or folder %1 does not exist.").arg(url));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: selected ?
|
||||||
|
if (info.isFile()) {
|
||||||
|
resolvedNewUrl = QUrl::fromLocalFile(info.dir().path());
|
||||||
|
}
|
||||||
|
|
||||||
// Refresh this directory.
|
// Refresh this directory.
|
||||||
if (url == m_url) {
|
if (url == m_url) {
|
||||||
m_dirModel->dirLister()->updateDirectory(resolvedNewUrl);
|
m_dirModel->dirLister()->updateDirectory(resolvedNewUrl);
|
||||||
|
@ -309,7 +315,7 @@ void FolderModel::setUrl(const QString &url)
|
||||||
m_pathHistory.append(resolvedNewUrl);
|
m_pathHistory.append(resolvedNewUrl);
|
||||||
|
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_url = url;
|
m_url = resolvedNewUrl.toLocalFile();
|
||||||
m_dirModel->dirLister()->openUrl(resolvedNewUrl);
|
m_dirModel->dirLister()->openUrl(resolvedNewUrl);
|
||||||
clearDragImages();
|
clearDragImages();
|
||||||
m_dragIndexes.clear();
|
m_dragIndexes.clear();
|
||||||
|
|
Loading…
Reference in a new issue