1 | /**************************************************************************** |
2 | ** Copyright (C) 2001-2012 Klaralvdalens Datakonsult AB. All rights reserved. |
3 | ** |
4 | ** This file is part of the KD Tools library. |
5 | ** |
6 | ** Licensees holding valid commercial KD Tools licenses may use this file in |
7 | ** accordance with the KD Tools Commercial License Agreement provided with |
8 | ** the Software. |
9 | ** |
10 | ** |
11 | ** This file may be distributed and/or modified under the terms of the GNU |
12 | ** Lesser General Public License version 2 and version 3 as published by the |
13 | ** Free Software Foundation and appearing in the file LICENSE.LGPL included. |
14 | ** |
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
17 | ** |
18 | ** Contact info@kdab.net if any conditions of this licensing are not |
19 | ** clear to you. |
20 | ** |
21 | **********************************************************************/ |
22 | |
23 | #ifndef __KDTOOLS__CORE__KDSIGNALBLOCKER_H__ |
24 | #define __KDTOOLS__CORE__KDSIGNALBLOCKER_H__ |
25 | |
26 | #include <qglobal.h> |
27 | |
28 | QT_BEGIN_NAMESPACE |
29 | class QObject; |
30 | QT_END_NAMESPACE |
31 | |
32 | namespace Akonadi { |
33 | |
34 | class KDSignalBlocker { |
35 | Q_DISABLE_COPY(KDSignalBlocker) |
36 | public: |
37 | explicit KDSignalBlocker(QObject *o); |
38 | explicit KDSignalBlocker(QObject &o); |
39 | ~KDSignalBlocker(); |
40 | |
41 | void unblock(); |
42 | void reblock(); |
43 | private: |
44 | const bool wasBlocked; |
45 | QObject *const object; |
46 | }; |
47 | |
48 | } |
49 | |
50 | #endif /* __KDTOOLS__CORE__KDSIGNALBLOCKER_H__ */ |
51 | |