Fix positional arguments
This commit is contained in:
parent
140bbfd29c
commit
52ab6e64fa
2 changed files with 11 additions and 3 deletions
11
main.cpp
11
main.cpp
|
@ -72,12 +72,10 @@ int main(int argc, char *argv[])
|
||||||
QCommandLineOption desktopOption(QStringList() << "d" << "desktop" << "Desktop Mode");
|
QCommandLineOption desktopOption(QStringList() << "d" << "desktop" << "Desktop Mode");
|
||||||
parser.addOption(desktopOption);
|
parser.addOption(desktopOption);
|
||||||
parser.process(app);
|
parser.process(app);
|
||||||
parser.addHelpOption();
|
|
||||||
|
|
||||||
if (parser.isSet(desktopOption)) {
|
if (parser.isSet(desktopOption)) {
|
||||||
DesktopView view;
|
DesktopView view;
|
||||||
view.show();
|
view.show();
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +90,16 @@ int main(int argc, char *argv[])
|
||||||
// Handle urls
|
// Handle urls
|
||||||
if (!parser.positionalArguments().isEmpty()) {
|
if (!parser.positionalArguments().isEmpty()) {
|
||||||
QStringList arguments = parser.positionalArguments();
|
QStringList arguments = parser.positionalArguments();
|
||||||
|
QUrl url(arguments.first());
|
||||||
|
if (!url.isValid())
|
||||||
|
url = QUrl::fromLocalFile(arguments.first());
|
||||||
|
|
||||||
|
if (url.isValid())
|
||||||
engine.rootContext()->setContextProperty("arg", arguments.first());
|
engine.rootContext()->setContextProperty("arg", arguments.first());
|
||||||
|
else
|
||||||
|
engine.rootContext()->setContextProperty("arg", "");
|
||||||
|
} else {
|
||||||
|
engine.rootContext()->setContextProperty("arg", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.load(url);
|
engine.load(url);
|
||||||
|
|
|
@ -72,6 +72,7 @@ Item {
|
||||||
|
|
||||||
isDesktopView: true
|
isDesktopView: true
|
||||||
iconSize: globalSettings.desktopIconSize
|
iconSize: globalSettings.desktopIconSize
|
||||||
|
focus: true
|
||||||
|
|
||||||
model: folderModel
|
model: folderModel
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue