kclipboard.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2, as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KCLIPBOARD_H 00020 #define KCLIPBOARD_H 00021 00022 #include <qclipboard.h> 00023 #include <qmime.h> 00024 #include <qobject.h> 00025 #include <qstrlist.h> 00026 #include "kdelibs_export.h" 00027 00036 class KDECORE_EXPORT KClipboardSynchronizer : public QObject 00037 { 00038 Q_OBJECT 00039 00040 public: 00042 friend class KlipperWidget; 00043 friend class KApplication; 00044 00049 static KClipboardSynchronizer *self(); 00050 00058 static void setSynchronizing( bool sync ); 00059 00066 static bool isSynchronizing() 00067 { 00068 return s_sync; 00069 } 00070 00080 static void setReverseSynchronizing( bool enable ); 00081 00089 static bool isReverseSynchronizing() 00090 { 00091 return s_reverse_sync; 00092 } 00093 00094 00095 protected: 00096 ~KClipboardSynchronizer(); 00097 00098 private slots: 00099 void slotSelectionChanged(); 00100 void slotClipboardChanged(); 00101 00102 private: 00103 KClipboardSynchronizer( QObject *parent = 0, const char *name = 0L ); 00104 void setupSignals(); 00105 00106 static void setClipboard( QMimeSource* data, QClipboard::Mode mode ); 00107 00108 static KClipboardSynchronizer *s_self; 00109 static bool s_sync; 00110 static bool s_reverse_sync; 00111 static bool s_blocked; 00112 00113 class MimeSource; 00114 00115 private: 00116 // needed by klipper 00117 enum Configuration { Synchronize = 1 }; 00118 // called by KApplication upon kipc message, invoked by klipper 00119 static void newConfiguration( int config ); 00120 00121 }; 00122 00123 #endif // KCLIPBOARD_H