1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public |
6 | License version 2, as published by the Free Software Foundation. |
7 | |
8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
16 | Boston, MA 02110-1301, USA. |
17 | */ |
18 | |
19 | #ifndef KCLIPBOARD_H |
20 | #define KCLIPBOARD_H |
21 | |
22 | #include <kdeui_export.h> |
23 | |
24 | #include <QtCore/QObject> |
25 | #include <QtGui/QClipboard> |
26 | |
27 | class QMimeData; |
28 | |
29 | /** |
30 | * This class is only for internal use. |
31 | * |
32 | * @short Allowing to automatically synchronize the X11 Clipboard and Selection buffers. |
33 | * @author Carsten Pfeiffer <pfeiffer@kde.org> |
34 | */ |
35 | class KDEUI_EXPORT KClipboardSynchronizer : public QObject |
36 | { |
37 | Q_OBJECT |
38 | |
39 | public: |
40 | friend class KlipperWidget; |
41 | |
42 | /** |
43 | * Returns the KClipboardSynchronizer singleton object. |
44 | * @return the KClipboardSynchronizer singleton object. |
45 | */ |
46 | static KClipboardSynchronizer *self(); |
47 | |
48 | /** |
49 | * Configures KClipboardSynchronizer to synchronize the Selection to Clipboard whenever |
50 | * it changes. |
51 | * |
52 | * Default is false. |
53 | * @see isSynchronizing |
54 | */ |
55 | static void setSynchronizing( bool sync ); |
56 | |
57 | /** |
58 | * Checks whether Clipboard and Selection will be synchronized upon changes. |
59 | * @returns whether Clipboard and Selection will be synchronized upon |
60 | * changes. |
61 | * @see setSynchronizing |
62 | */ |
63 | static bool isSynchronizing(); |
64 | |
65 | /** |
66 | * Configures KClipboardSynchronizer to copy the Clipboard buffer to the Selection |
67 | * buffer whenever the Clipboard changes. |
68 | * |
69 | * |
70 | * @param enable true to enable implicit selection, false otherwise. |
71 | * Default is true. |
72 | * @see selectionSetting |
73 | */ |
74 | static void setReverseSynchronizing( bool enable ); |
75 | |
76 | /** |
77 | * Checks whether the Clipboard buffer will be copied to the Selection |
78 | * buffer upon changes. |
79 | * @returns whether the Clipboard buffer will be copied to the Selection |
80 | * buffer upon changes. |
81 | * @see setSelectionSetting |
82 | */ |
83 | static bool isReverseSynchronizing(); |
84 | |
85 | protected: |
86 | ~KClipboardSynchronizer(); |
87 | |
88 | private: |
89 | // needed by klipper |
90 | enum Configuration { Synchronize = 1 }; |
91 | |
92 | explicit KClipboardSynchronizer( QObject *parent = 0 ); |
93 | |
94 | class Private; |
95 | Private* const d; |
96 | |
97 | Q_PRIVATE_SLOT(d, void _k_slotSelectionChanged()) |
98 | Q_PRIVATE_SLOT(d, void _k_slotClipboardChanged()) |
99 | Q_PRIVATE_SLOT(d, void _k_slotNotifyChange(int, int)) |
100 | }; |
101 | |
102 | #endif // KCLIPBOARD_H |
103 | |