Skip to content
Permalink
Browse files
Remove template widgets when starting new task
  • Loading branch information
annejan committed Nov 17, 2015
1 parent 1fa596d commit 4e7ac13c629a3f7484f93b15686120fcdc370bf2
Showing with 26 additions and 14 deletions.
  1. +25 −14 mainwindow.cpp
  2. +1 −0 mainwindow.h
@@ -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);
@@ -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;
@@ -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);
}

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

/**
* @brief MainWindow::waitFor
* @param seconds
*/
void MainWindow::waitFor(int seconds)
{
QDateTime current = QDateTime::currentDateTime();
@@ -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);
}
@@ -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.