Skip to content

Commit

Permalink
user input, filtering too soon breaks the treeview
Browse files Browse the repository at this point in the history
  • Loading branch information
annejan committed May 6, 2015
1 parent 522a0bd commit f983d6f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
29 changes: 15 additions & 14 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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();
Expand Down
11 changes: 10 additions & 1 deletion mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
}
1 change: 1 addition & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum actionType { GPG, GIT, EDIT, DELETE, GPG_INTERNAL };
void setGpgExecutable(QString);
void checkConfig();
void setApp(SingleApplication* app);
void setText(QString);

private slots:
void on_updateButton_clicked();
Expand Down

0 comments on commit f983d6f

Please sign in to comment.