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