Skip to content

Commit

Permalink
Remove template widgets when starting new task
Browse files Browse the repository at this point in the history
  • Loading branch information
annejan committed Nov 17, 2015
1 parent 1fa596d commit 4e7ac13
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
39 changes: 25 additions & 14 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ void MainWindow::executeWrapper(QString app, QString args, QString input) {
wrapperRunning = true;
process->setWorkingDirectory(passStore);
process->setEnvironment(env);
clearTemplateWidgets();
ui->textBrowser->clear();
ui->textBrowser->setTextColor(Qt::black);
enableUiElements(false);
Expand Down Expand Up @@ -710,12 +711,7 @@ void MainWindow::readyRead(bool finished = false) {
}
output = tokens.join("\n");
} else {
while(ui->formLayout->count() > 0){
QLayoutItem *item = ui->formLayout->takeAt(0);
delete item->widget();
delete item;
}
ui->verticalLayoutPassword->setSpacing(0);
clearTemplateWidgets();
}
if (useAutoclearPanel) {
autoclearPass = output;
Expand Down Expand Up @@ -780,15 +776,13 @@ void MainWindow::clearClipboard()
*/
void MainWindow::clearPanel()
{
if (true) { // TODO when ??
while(ui->formLayout->count() > 0){
QLayoutItem *item = ui->formLayout->takeAt(0);
delete item->widget();
delete item;
}
QString output = "***" + tr("Password and Content hidden") + "***";
ui->textBrowser->setHtml(output);
while(ui->formLayout->count() > 0){
QLayoutItem *item = ui->formLayout->takeAt(0);
delete item->widget();
delete item;
}
QString output = "***" + tr("Password and Content hidden") + "***";
ui->textBrowser->setHtml(output);
}

/**
Expand Down Expand Up @@ -1678,6 +1672,10 @@ QString MainWindow::generatePassword() {
return passwd;
}

/**
* @brief MainWindow::waitFor
* @param seconds
*/
void MainWindow::waitFor(int seconds)
{
QDateTime current = QDateTime::currentDateTime();
Expand All @@ -1692,3 +1690,16 @@ void MainWindow::waitFor(int seconds)
Util::qSleep(100);
}
}

/**
* @brief MainWindow::clearTemplateWidgets
*/
void MainWindow::clearTemplateWidgets()
{
while(ui->formLayout->count() > 0){
QLayoutItem *item = ui->formLayout->takeAt(0);
delete item->widget();
delete item;
}
ui->verticalLayoutPassword->setSpacing(0);
}
1 change: 1 addition & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ private slots:
void destroyTrayIcon();
bool removeDir(const QString & dirName);
void waitFor(int);
void clearTemplateWidgets();
};

#endif // MAINWINDOW_H

0 comments on commit 4e7ac13

Please sign in to comment.