summaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2015-05-06 05:29:36 +0200
committerAnne Jan Brouwer <brouwer@annejan.com>2015-05-06 05:29:36 +0200
commit081b67946cdbeec06c60ca8fd7f26c29c7a02ccd (patch)
treea58e7f37dcb9750f2707bdd4721a01b6264a87c2 /main.cpp
parent8e87bc3fed9d20ca9b884cfe9f17cb3b6449ee7a (diff)
user input, filtering too soon breaks the treeview
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/main.cpp b/main.cpp
index 9a23a72d..d9b7336e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -4,27 +4,27 @@
int main(int argc, char *argv[])
{
+ QString text = "";
+ for (int i = 1; i < argc; ++i) {
+ if (i > 1) {
+ text += " ";
+ }
+ text += argv[i];
+ }
#if SINGLE_APP
- SingleApplication app(argc, argv, "ijhackQtPass");
+ QString name = qgetenv("USER");
+ if (name.isEmpty())
+ name = qgetenv("USERNAME");
+ //qDebug() << name;
+ SingleApplication app(argc, argv, name + "QtPass");
if (app.isRunning()) {
- if (argc == 1 ) {
- app.sendMessage("show");
- } else if (argc >= 2) {
- QString text = "";
- for (int i = 1; i < argc; ++i) {
- text += argv[i];
- if (argc >= (i - 2)) {
- text += " ";
- }
- app.sendMessage(text);
- }
- }
+ app.sendMessage(text);
return 0;
}
#else
QApplication app(argc, argv);
#endif
-
+
QCoreApplication::setOrganizationName("IJHack");
QCoreApplication::setOrganizationDomain("ijhack.org");
QCoreApplication::setApplicationName("QtPass");
@@ -42,6 +42,7 @@ int main(int argc, char *argv[])
app.setWindowIcon(QIcon(":artwork/icon.png"));
w.setApp(&app);
w.checkConfig();
+ w.setText(text);
w.show();
return app.exec();