summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <brouwer@annejan.com>2015-07-07 01:11:52 +0200
committerAnne Jan Brouwer <brouwer@annejan.com>2015-07-07 01:11:52 +0200
commit28af9a55c39e44305b7f6234d83597ad75ea6775 (patch)
tree15992491a7fef5b476e3ffe4e23079c7714a6923
parentb13216157165c801ba493588df0a409178db9519 (diff)
cleanup
-rw-r--r--mainwindow.cpp19
-rw-r--r--mainwindow.h1
-rw-r--r--util.cpp19
-rw-r--r--util.h1
4 files changed, 21 insertions, 19 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp
index d9afc336..31dd48cf 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -941,21 +941,6 @@ void MainWindow::on_editButton_clicked()
}
/**
- * @brief MainWindow::qSleep
- * @param ms
- */\
-void MainWindow::qSleep(int ms)
-{
-#ifdef Q_OS_WIN
- Sleep(uint(ms));
-#else
- struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
- nanosleep(&ts, NULL);
-#endif
-}
-
-
-/**
* @brief MainWindow::listKeys
* @param keystring
* @param secret
@@ -964,7 +949,7 @@ void MainWindow::qSleep(int ms)
QList<UserInfo> MainWindow::listKeys(QString keystring, bool secret)
{
while (!process->atEnd() || !execQueue->isEmpty()) {
- qSleep(100);
+ Util::qSleep(100);
}
QList<UserInfo> users;
currentAction = GPG_INTERNAL;
@@ -1359,7 +1344,7 @@ void MainWindow::addFolder()
void MainWindow::editPassword()
{
while (!process->atEnd() || !execQueue->isEmpty()) {
- qSleep(100);
+ Util::qSleep(100);
}
// TODO move to editbutton stuff possibly?
currentDir = getDir(ui->treeView->currentIndex(), false);
diff --git a/mainwindow.h b/mainwindow.h
index ff234afd..4df8cbc4 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -71,7 +71,6 @@ private slots:
void showContextMenu(const QPoint& pos);
void addFolder();
void editPassword();
- void qSleep(int);
private:
QApplication *QtPass;
diff --git a/util.cpp b/util.cpp
index a140613c..ecc86007 100644
--- a/util.cpp
+++ b/util.cpp
@@ -4,7 +4,9 @@
#include <QString>
#include <QDir>
#include "util.h"
-
+#ifdef Q_OS_WIN
+#include <windows.h>
+#endif
QProcessEnvironment Util::_env;
bool Util::_envInitialised;
@@ -112,3 +114,18 @@ bool Util::checkConfig(QString passStore, QString passExecutable, QString gpgExe
{
return !QFile(passStore + ".gpg-id").exists() || (!QFile(passExecutable).exists() && !QFile(gpgExecutable).exists());
}
+
+
+/**
+ * @brief Util::qSleep
+ * @param ms
+ */\
+void Util::qSleep(int ms)
+{
+#ifdef Q_OS_WIN
+ Sleep(uint(ms));
+#else
+ struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
+ nanosleep(&ts, NULL);
+#endif
+}
diff --git a/util.h b/util.h
index f3587858..53e1af98 100644
--- a/util.h
+++ b/util.h
@@ -11,6 +11,7 @@ public:
static QString findPasswordStore();
static QString normalizeFolderPath(QString);
static bool checkConfig(QString, QString, QString);
+ static void qSleep(int);
private:
static void initialiseEnvironment();