From c2f2d0a363a09f2e0bb9106ada09a9394dff6bb7 Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Mon, 20 Oct 2014 20:34:46 +0300 Subject: [PATCH] Don't show multiple unlock UI dialogs. Closes #2040. --- src/mainwindow.cpp | 8 +++++++- src/mainwindow.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 61602fa85..faddb452c 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -101,7 +101,7 @@ using namespace libtorrent; *****************************************************/ // Constructor -MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMainWindow(parent), m_posInitialized(false), force_exit(false) +MainWindow::MainWindow(QWidget *parent, const QStringList& torrentCmdLine) : QMainWindow(parent), m_posInitialized(false), force_exit(false), unlockDlgShowing(false) #ifdef Q_OS_WIN , has_python(false) #endif @@ -686,8 +686,14 @@ void MainWindow::setTabText(int index, QString text) const { } bool MainWindow::unlockUI() { + if (unlockDlgShowing) + return false; + else + unlockDlgShowing = true; + bool ok = false; QString clear_password = AutoExpandableDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok); + unlockDlgShowing = false; if (!ok) return false; Preferences* const pref = Preferences::instance(); QString real_pass_md5 = pref->getUILockPasswordMD5(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 7e05f3f58..89ff49abf 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -183,6 +183,7 @@ private: bool displaySpeedInTitle; bool force_exit; bool ui_locked; + bool unlockDlgShowing; LineEdit *search_filter; // Keyboard shortcuts QShortcut *switchSearchShortcut;