-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 @@ -107,53 +107,53 @@ static const char * paste_xpm[] = { "<1s224keee|b4 ", "}r2itmkeee]]44", "<9iitmkeeehkw.", "<lt-u4keeb)pn.", "<fu-umkebhp(0.", "<cugg4kbh)_(q.", "<cyyymk))p(%q.", ",5vvv4k)p_%[q.", " ...$mljnn0qd.", " 4.......,"}; ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { setFixedWidth ( 14 ); setFixedHeight ( 18 ); m_clipboardPixmap = QPixmap ( paste_xpm ); m_timer = new QTimer ( this ); connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); - m_timer-> start ( 1500 ); - m_menu = 0; m_dirty = true; m_lasttext = QString::null; + + m_timer-> start ( 0, true ); } ClipboardApplet::~ClipboardApplet ( ) { } void ClipboardApplet::shutdown ( ) { // the timer has to be stopped, or Qt/E will hang on quit() // see launcher/desktop.cpp m_timer-> stop ( ); } void ClipboardApplet::mousePressEvent ( QMouseEvent *) { if ( m_dirty ) { delete m_menu; m_menu = new QPopupMenu ( this ); m_menu-> setCheckable ( true ); if ( m_history. count ( )) { for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { @@ -207,36 +207,49 @@ void ClipboardApplet::action(int id) for ( uint i = 0; i < m_history. count ( ); i++ ) m_menu-> setItemChecked ( i, i == uint( id )); unicode = 'V' - '@'; scan = Key_V; } break; } if ( scan ) { qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false ); } } void ClipboardApplet::paintEvent ( QPaintEvent* ) { QPainter p ( this ); p. drawPixmap ( 0, 1, m_clipboardPixmap ); } void ClipboardApplet::newData ( ) { + static bool excllock = false; + + if ( excllock ) + return; + else + excllock = true; + + m_timer-> stop ( ); + QCString type = "plain"; QString txt = QApplication::clipboard ( )-> text ( type ); if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { m_history. append ( txt ); if ( m_history. count ( ) > 5 ) m_history. remove ( m_history. begin ( )); m_dirty = true; } + + m_timer-> start ( 1500, true ); + + excllock = false; } |