-rw-r--r-- | core/applets/clipboardapplet/clipboard.cpp | 15 | ||||
-rw-r--r-- | core/applets/clipboardapplet/clipboard.h | 4 | ||||
-rw-r--r-- | core/launcher/desktop.cpp | 6 |
3 files changed, 22 insertions, 3 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp index 5848d0f..4fbdf6f 100644 --- a/core/applets/clipboardapplet/clipboard.cpp +++ b/core/applets/clipboardapplet/clipboard.cpp @@ -121,14 +121,15 @@ ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( setFixedWidth ( 14 ); setFixedHeight ( 18 ); m_clipboardPixmap = QPixmap ( paste_xpm ); - QTimer *timer = new QTimer ( this ); + m_timer = new QTimer ( this ); connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); - connect ( timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); + connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); + connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); - timer-> start ( 1000 ); + m_timer-> start ( 1500 ); m_menu = 0; m_dirty = true; m_lasttext = QString::null; @@ -137,8 +138,16 @@ ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( 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; diff --git a/core/applets/clipboardapplet/clipboard.h b/core/applets/clipboardapplet/clipboard.h index 84743d9..ec87d39 100644 --- a/core/applets/clipboardapplet/clipboard.h +++ b/core/applets/clipboardapplet/clipboard.h @@ -23,8 +23,10 @@ #include <qwidget.h> #include <qpixmap.h> #include <qstringlist.h> +class QTimer; + class ClipboardApplet : public QWidget { Q_OBJECT public: @@ -37,14 +39,16 @@ protected: private slots: void action ( int ); void newData ( ); + void shutdown ( ); private: QPopupMenu * m_menu; QStringList m_history; bool m_dirty; QString m_lasttext; + QTimer * m_timer; QPixmap m_clipboardPixmap; }; diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index e58b08c..f90da1a 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp @@ -685,8 +685,14 @@ void DesktopApplication::shutdown( ShutdownImpl::Type t ) restart(); break; case ShutdownImpl::TerminateDesktop: prepareForTermination(FALSE); + + // This is a workaround for a Qt bug + // clipboard applet has to stop its poll timer, or Qt/E + // will hang on quit() right before it emits aboutToQuit() + emit aboutToQuit ( ); + quit(); break; } } |