diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2015-05-06 05:29:36 +0200 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2015-05-06 05:29:36 +0200 |
commit | f983d6f704093e049a150f8b0514596e48949970 (patch) | |
tree | a58e7f37dcb9750f2707bdd4721a01b6264a87c2 | |
parent | 522a0bd62f447be28c2c28168f242b1fc3095c6e (diff) |
user input, filtering too soon breaks the treeview
-rw-r--r-- | main.cpp | 29 | ||||
-rw-r--r-- | mainwindow.cpp | 11 | ||||
-rw-r--r-- | mainwindow.h | 1 |
3 files changed, 26 insertions, 15 deletions
@@ -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(); diff --git a/mainwindow.cpp b/mainwindow.cpp index 6364fc0e..8e86b8e3 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -853,7 +853,7 @@ void MainWindow::setApp(SingleApplication *app) */ void MainWindow::messageAvailable(QString message) { - if (message == "show") { + if (message == "") { ui->lineEdit->selectAll(); ui->lineEdit->setFocus(); } else { @@ -864,3 +864,12 @@ void MainWindow::messageAvailable(QString message) show(); raise(); } + +/** + * @brief MainWindow::setText + * @param message + */ +void MainWindow::setText(QString text) +{ + ui->lineEdit->setText(text); +} diff --git a/mainwindow.h b/mainwindow.h index 95d3f2b3..9d247311 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -39,6 +39,7 @@ public: void setGpgExecutable(QString); void checkConfig(); void setApp(SingleApplication* app); + void setText(QString); private slots: void on_updateButton_clicked(); |