aboutsummaryrefslogtreecommitdiff
path: root/lumina-fileinfo/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-fileinfo/main.cpp')
-rw-r--r--lumina-fileinfo/main.cpp52
1 files changed, 40 insertions, 12 deletions
diff --git a/lumina-fileinfo/main.cpp b/lumina-fileinfo/main.cpp
index 1028bbde..f8ba3620 100644
--- a/lumina-fileinfo/main.cpp
+++ b/lumina-fileinfo/main.cpp
@@ -3,7 +3,7 @@
#include <QDebug>
#include <QFile>
-#include "dialog.h"
+#include "MainUI.h"
#include <LuminaUtils.h>
#include <LuminaThemes.h>
@@ -14,18 +14,46 @@ int main(int argc, char ** argv)
LUtils::LoadTranslation(&a, "lumina-fileinfo");
LuminaThemeEngine theme(&a);
- Dialog w;
- QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) );
+
+ //Read the input variables
+ QString path = "";
+ QString flag = "";
if (argc==2) {
- w.LoadDesktopFile(QString(argv[1]).simplified());
- } else if (argc==3) {
- w.Initialise(QString(argv[1]).simplified());
- w.LoadDesktopFile(QString(argv[2]).simplified());
- } else {
- w.MissingInputs();
+ path = QString::fromLocal8Bit(argv[1]);
+ }else if (argc==3) {
+ flag = QString::fromLocal8Bit(argv[1]);
+ path = QString::fromLocal8Bit(argv[2]);
+ }
+ //Check the input variables
+ // - path
+ if(!path.isEmpty()){ path = LUtils::PathToAbsolute(path); }
+ // - flag
+ if(!flag.isEmpty()){
+ if(flag=="-application"){
+ flag = "APP"; //for internal use
+ }else if(flag=="-link"){
+ flag = "LINK"; //for internal use
+ }else{
+ //Invalid flag - clear the path as well
+ path.clear();
+ }
}
- w.show();
+ if(!path.isEmpty()){
+ //if(!QFile::exists(path)){ LUtils::writeFile(path,QStringList()); } //create an empty file
+ MainUI w;
+ QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) );
+ w.LoadFile(path, flag);
+ w.show();
+ int retCode = a.exec();
+ return retCode;
+ }else{
+ //Show an error text and exit
+ QStringList msg;
+ msg << "ERROR: Invalid input arguments";
+ msg << "Usage: \"lumina-fileinfo [-application | -link] <file>";
+ qDebug() << msg.join("\n");
+ return 1;
+ }
+
- int retCode = a.exec();
- return retCode;
} \ No newline at end of file
bgstack15