Skip to content

Commit 1fa596d

Browse files
author
Anne Jan Brouwer
committed
reset the timer, should I (needlessly) do this for the clipboard too?
1 parent 76dacca commit 1fa596d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

mainwindow.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ MainWindow::MainWindow(QWidget *parent) :
4949
QApplication::quit();
5050
}
5151
QtPass = NULL;
52+
autoclearTimer = NULL;
5253
QTimer::singleShot(10, this, SLOT(focusInput()));
5354

5455
}
@@ -718,7 +719,15 @@ void MainWindow::readyRead(bool finished = false) {
718719
}
719720
if (useAutoclearPanel) {
720721
autoclearPass = output;
721-
QTimer::singleShot(1000*autoclearPanelSeconds, this, SLOT(clearPanel()));
722+
if (autoclearTimer != NULL) {
723+
autoclearTimer->stop();
724+
725+
}
726+
autoclearTimer = new QTimer(this);
727+
autoclearTimer->setSingleShot(true);
728+
autoclearTimer->setInterval(1000*autoclearPanelSeconds);
729+
connect(autoclearTimer, SIGNAL(timeout()), this, SLOT(clearPanel()));
730+
autoclearTimer->start();
722731
}
723732
}
724733
output.replace(QRegExp("<"), "&lt;");

mainwindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <QProcess>
88
#include <QQueue>
99
#include <QSettings>
10+
#include <QTimer>
1011
#include "storemodel.h"
1112
#include "trayicon.h"
1213
#if SINGLE_APP
@@ -107,6 +108,7 @@ private slots:
107108
QProcess fusedav;
108109
QString clippedPass;
109110
QString autoclearPass;
111+
QTimer *autoclearTimer;
110112
actionType currentAction;
111113
QString lastDecrypt;
112114
bool wrapperRunning;

0 commit comments

Comments
 (0)