-rw-r--r-- | core/applets/clipboardapplet/clipboard.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp index 4fbdf6f..3099a84 100644 --- a/core/applets/clipboardapplet/clipboard.cpp +++ b/core/applets/clipboardapplet/clipboard.cpp | |||
@@ -119,29 +119,29 @@ static const char * paste_xpm[] = { | |||
119 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) | 119 | ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) |
120 | { | 120 | { |
121 | setFixedWidth ( 14 ); | 121 | setFixedWidth ( 14 ); |
122 | setFixedHeight ( 18 ); | 122 | setFixedHeight ( 18 ); |
123 | m_clipboardPixmap = QPixmap ( paste_xpm ); | 123 | m_clipboardPixmap = QPixmap ( paste_xpm ); |
124 | 124 | ||
125 | m_timer = new QTimer ( this ); | 125 | m_timer = new QTimer ( this ); |
126 | 126 | ||
127 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); | 127 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); |
128 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); | 128 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); |
129 | connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); | 129 | connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); |
130 | 130 | ||
131 | m_timer-> start ( 1500 ); | ||
132 | |||
133 | m_menu = 0; | 131 | m_menu = 0; |
134 | m_dirty = true; | 132 | m_dirty = true; |
135 | m_lasttext = QString::null; | 133 | m_lasttext = QString::null; |
134 | |||
135 | m_timer-> start ( 0, true ); | ||
136 | } | 136 | } |
137 | 137 | ||
138 | ClipboardApplet::~ClipboardApplet ( ) | 138 | ClipboardApplet::~ClipboardApplet ( ) |
139 | { | 139 | { |
140 | } | 140 | } |
141 | 141 | ||
142 | void ClipboardApplet::shutdown ( ) | 142 | void ClipboardApplet::shutdown ( ) |
143 | { | 143 | { |
144 | // the timer has to be stopped, or Qt/E will hang on quit() | 144 | // the timer has to be stopped, or Qt/E will hang on quit() |
145 | // see launcher/desktop.cpp | 145 | // see launcher/desktop.cpp |
146 | 146 | ||
147 | m_timer-> stop ( ); | 147 | m_timer-> stop ( ); |
@@ -219,24 +219,37 @@ void ClipboardApplet::action(int id) | |||
219 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); | 219 | qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | void ClipboardApplet::paintEvent ( QPaintEvent* ) | 223 | void ClipboardApplet::paintEvent ( QPaintEvent* ) |
224 | { | 224 | { |
225 | QPainter p ( this ); | 225 | QPainter p ( this ); |
226 | p. drawPixmap ( 0, 1, m_clipboardPixmap ); | 226 | p. drawPixmap ( 0, 1, m_clipboardPixmap ); |
227 | } | 227 | } |
228 | 228 | ||
229 | void ClipboardApplet::newData ( ) | 229 | void ClipboardApplet::newData ( ) |
230 | { | 230 | { |
231 | static bool excllock = false; | ||
232 | |||
233 | if ( excllock ) | ||
234 | return; | ||
235 | else | ||
236 | excllock = true; | ||
237 | |||
238 | m_timer-> stop ( ); | ||
239 | |||
231 | QCString type = "plain"; | 240 | QCString type = "plain"; |
232 | QString txt = QApplication::clipboard ( )-> text ( type ); | 241 | QString txt = QApplication::clipboard ( )-> text ( type ); |
233 | 242 | ||
234 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { | 243 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { |
235 | m_history. append ( txt ); | 244 | m_history. append ( txt ); |
236 | 245 | ||
237 | if ( m_history. count ( ) > 5 ) | 246 | if ( m_history. count ( ) > 5 ) |
238 | m_history. remove ( m_history. begin ( )); | 247 | m_history. remove ( m_history. begin ( )); |
239 | 248 | ||
240 | m_dirty = true; | 249 | m_dirty = true; |
241 | } | 250 | } |
251 | |||
252 | m_timer-> start ( 1500, true ); | ||
253 | |||
254 | excllock = false; | ||
242 | } | 255 | } |