summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-09-16 13:52:48 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-09-16 13:52:48 (GMT)
commit0fec4e68d2ceae34867224fd5c81176dc759876d (patch)
tree2dfabb08c4cfb3983a5d03b2faee2fe11885390a
parentb228ae5d9eb8c2679c285844f988692668d74e6c (diff)
Remove KDSignalBlocker, port to QSignalBlocker
KDSignalBlocker has been upstreamed to Qt as QSignalBlocker since Qt 5.3, so the Qt class instead.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/crypto/gui/signencryptemailconflictdialog.cpp6
-rw-r--r--src/smartcard/readerstatus.cpp1
-rw-r--r--src/systrayicon.cpp4
-rw-r--r--src/utils/clipboardmenu.cpp5
-rw-r--r--src/utils/kdsignalblocker.cpp68
-rw-r--r--src/utils/kdsignalblocker.h43
7 files changed, 7 insertions, 121 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index caf2141..2d9ae5a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -64,7 +64,6 @@ set(_kleopatra_SRCS
utils/filedialog.cpp
utils/kdpipeiodevice.cpp
utils/kdlogtextwidget.cpp
- utils/kdsignalblocker.cpp
utils/headerview.cpp
utils/scrollarea.cpp
utils/dragqueen.cpp
diff --git a/src/crypto/gui/signencryptemailconflictdialog.cpp b/src/crypto/gui/signencryptemailconflictdialog.cpp
index ad14efb..abd866a 100644
--- a/src/crypto/gui/signencryptemailconflictdialog.cpp
+++ b/src/crypto/gui/signencryptemailconflictdialog.cpp
@@ -42,7 +42,6 @@
#include <utils/gui-helper.h>
#include <utils/kleo_assert.h>
-#include <utils/kdsignalblocker.h>
#include <Libkleo/Stl_Util>
@@ -63,6 +62,7 @@
#include <QRadioButton>
#include <QPushButton>
#include <QPointer>
+#include <QSignalBlocker>
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
@@ -451,8 +451,8 @@ void SignEncryptEMailConflictDialog::setPresetProtocol(Protocol p)
if (p == d->presetProtocol) {
return;
}
- const KDSignalBlocker pgpBlocker(d->ui.pgpRB);
- const KDSignalBlocker cmsBlocker(d->ui.cmsRB);
+ const QSignalBlocker pgpBlocker(d->ui.pgpRB);
+ const QSignalBlocker cmsBlocker(d->ui.cmsRB);
really_check(d->ui.pgpRB, p == OpenPGP);
really_check(d->ui.cmsRB, p == CMS);
d->presetProtocol = p;
diff --git a/src/smartcard/readerstatus.cpp b/src/smartcard/readerstatus.cpp
index bf4c2ac..3bb5dff 100644
--- a/src/smartcard/readerstatus.cpp
+++ b/src/smartcard/readerstatus.cpp
@@ -35,7 +35,6 @@
#include "readerstatus.h"
#include <utils/gnupg-helper.h>
-#include <utils/kdsignalblocker.h>
#include <Libkleo/FileSystemWatcher>
#include <Libkleo/Stl_Util>
diff --git a/src/systrayicon.cpp b/src/systrayicon.cpp
index 788642c..debce7a 100644
--- a/src/systrayicon.cpp
+++ b/src/systrayicon.cpp
@@ -41,7 +41,6 @@
#include <smartcard/readerstatus.h>
-#include <utils/kdsignalblocker.h>
#include <utils/clipboardmenu.h>
#include <commands/importcertificatefromclipboardcommand.h>
@@ -63,6 +62,7 @@
#include <QApplication>
#include <QClipboard>
#include <QPointer>
+#include <QSignalBlocker>
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
@@ -101,7 +101,7 @@ private:
{
//work around a Qt bug (seen with Qt 4.4.0, Windows): QClipBoard->mimeData() triggers QClipboard::changed(),
//triggering slotEnableDisableActions again
- const KDSignalBlocker blocker(QApplication::clipboard());
+ const QSignalBlocker blocker(QApplication::clipboard());
openCertificateManagerAction.setEnabled(!q->mainWindow() || !q->mainWindow()->isVisible());
setInitialPinAction.setEnabled(anyCardHasNullPin);
learnCertificatesAction.setEnabled(anyCardCanLearnKeys);
diff --git a/src/utils/clipboardmenu.cpp b/src/utils/clipboardmenu.cpp
index ba74f20..b744801 100644
--- a/src/utils/clipboardmenu.cpp
+++ b/src/utils/clipboardmenu.cpp
@@ -20,8 +20,6 @@
#include "kdtoolsglobal.h"
#include "mainwindow.h"
-#include <utils/kdsignalblocker.h>
-
#include <commands/importcertificatefromclipboardcommand.h>
#include <commands/encryptclipboardcommand.h>
#include <commands/signclipboardcommand.h>
@@ -33,6 +31,7 @@
#include <QAction>
#include <QApplication>
#include <QClipboard>
+#include <QSignalBlocker>
using namespace Kleo;
@@ -119,7 +118,7 @@ void ClipboardMenu::slotDecryptVerifyClipboard()
void ClipboardMenu::slotEnableDisableActions()
{
- const KDSignalBlocker blocker(QApplication::clipboard());
+ const QSignalBlocker blocker(QApplication::clipboard());
mImportClipboardAction->setEnabled(ImportCertificateFromClipboardCommand::canImportCurrentClipboard());
mEncryptClipboardAction->setEnabled(EncryptClipboardCommand::canEncryptCurrentClipboard());
mOpenPGPSignClipboardAction->setEnabled(SignClipboardCommand::canSignCurrentClipboard());
diff --git a/src/utils/kdsignalblocker.cpp b/src/utils/kdsignalblocker.cpp
deleted file mode 100644
index c2f65e6..0000000
--- a/src/utils/kdsignalblocker.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-** Copyright (C) 2001-2009 Klaralvdalens Datakonsult AB. All rights reserved.
-**
-** This file is part of the KD Tools library.
-**
-** Licensees holding valid commercial KD Tools licenses may use this file in
-** accordance with the KD Tools Commercial License Agreement provided with
-** the Software.
-**
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 and version 3 as published by the
-** Free Software Foundation and appearing in the file LICENSE.GPL included.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** Contact info@kdab.net if any conditions of this licensing are not
-** clear to you.
-**
-**********************************************************************/
-
-#include <config-kleopatra.h>
-
-#include "kdsignalblocker.h"
-
-#include <QObject>
-
-/*!
- \class KDSignalBlocker
- \ingroup raii core
- \brief Exception-safe and convenient wrapper around QObject::blockSignals()
-
- All methods in this class are nothrow if QObject::blockSignals() and
- QObject::signalsBlocked() are nothrow, which they normally are.
-*/
-
-/*!
- Constructor. Blocks signals on \a o.
-
- \post o->signalsBlocked() == true
-*/
-KDSignalBlocker::KDSignalBlocker(QObject *o)
- : blocked(o->signalsBlocked()), object(o)
-{
- o->blockSignals(true);
-}
-
-/*!
- \overload
-
- \post o.signalsBlocked() == true
-*/
-KDSignalBlocker::KDSignalBlocker(QObject &o)
- : blocked(o.signalsBlocked()), object(&o)
-{
- o.blockSignals(true);
-}
-
-/*!
- Destructor. Unblocks signals (unless they were blocked before)
-
- \post o->signalsBlocked() is the same as just before this instance has been constructed.
-*/
-KDSignalBlocker::~KDSignalBlocker()
-{
- object->blockSignals(blocked);
-}
diff --git a/src/utils/kdsignalblocker.h b/src/utils/kdsignalblocker.h
deleted file mode 100644
index 970df89..0000000
--- a/src/utils/kdsignalblocker.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-** Copyright (C) 2001-2009 Klaralvdalens Datakonsult AB. All rights reserved.
-**
-** This file is part of the KD Tools library.
-**
-** Licensees holding valid commercial KD Tools licenses may use this file in
-** accordance with the KD Tools Commercial License Agreement provided with
-** the Software.
-**
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 and version 3 as published by the
-** Free Software Foundation and appearing in the file LICENSE.GPL included.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** Contact info@kdab.net if any conditions of this licensing are not
-** clear to you.
-**
-**********************************************************************/
-
-#ifndef __KDTOOLS__CORE__KDSIGNALBLOCKER_H__
-#define __KDTOOLS__CORE__KDSIGNALBLOCKER_H__
-
-#include <utils/kdtoolsglobal.h>
-
-class QObject;
-
-class KDSignalBlocker
-{
- Q_DISABLE_COPY(KDSignalBlocker)
-public:
- explicit KDSignalBlocker(QObject *o);
- explicit KDSignalBlocker(QObject &o);
- ~KDSignalBlocker();
-private:
- const bool blocked;
- QObject *const object;
-};
-
-#endif /* __KDTOOLS__CORE__KDSIGNALBLOCKER_H__ */
-