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