summaryrefslogtreecommitdiff
authorsandman <sandman>2002-07-28 00:44:43 (UTC)
committer sandman <sandman>2002-07-28 00:44:43 (UTC)
commit72081cbfef03a69ed6f9ca7826854b6cf10dc2fe (patch) (unidiff)
tree43e67bdc7cbb972f431b3912e2f068df3d2c97bf
parent4baf36396739502c5471950e29f18954cca4517b (diff)
downloadopie-72081cbfef03a69ed6f9ca7826854b6cf10dc2fe.zip
opie-72081cbfef03a69ed6f9ca7826854b6cf10dc2fe.tar.gz
opie-72081cbfef03a69ed6f9ca7826854b6cf10dc2fe.tar.bz2
Workaround for a weird Qt/E bug, resulting in qpe hanging if clipboard
applet is loaded and qpe is terminated via shutdown applet.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp15
-rw-r--r--core/applets/clipboardapplet/clipboard.h4
-rw-r--r--core/launcher/desktop.cpp6
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
@@ -117,32 +117,41 @@ static const char * paste_xpm[] = {
117 117
118 118
119ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) 119ClipboardApplet::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 QTimer *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 ( timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); 128 connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( )));
129 connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( )));
129 130
130 timer-> start ( 1000 ); 131 m_timer-> start ( 1500 );
131 132
132 m_menu = 0; 133 m_menu = 0;
133 m_dirty = true; 134 m_dirty = true;
134 m_lasttext = QString::null; 135 m_lasttext = QString::null;
135} 136}
136 137
137ClipboardApplet::~ClipboardApplet ( ) 138ClipboardApplet::~ClipboardApplet ( )
138{ 139{
139} 140}
140 141
142void ClipboardApplet::shutdown ( )
143{
144 // the timer has to be stopped, or Qt/E will hang on quit()
145 // see launcher/desktop.cpp
146
147 m_timer-> stop ( );
148}
149
141void ClipboardApplet::mousePressEvent ( QMouseEvent *) 150void ClipboardApplet::mousePressEvent ( QMouseEvent *)
142{ 151{
143 if ( m_dirty ) { 152 if ( m_dirty ) {
144 delete m_menu; 153 delete m_menu;
145 154
146 m_menu = new QPopupMenu ( this ); 155 m_menu = new QPopupMenu ( this );
147 m_menu-> setCheckable ( true ); 156 m_menu-> setCheckable ( true );
148 157
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
@@ -19,35 +19,39 @@
19**********************************************************************/ 19**********************************************************************/
20#ifndef __CLIPBOARD_APPLET_H__ 20#ifndef __CLIPBOARD_APPLET_H__
21#define __CLIPBOARD_APPLET_H__ 21#define __CLIPBOARD_APPLET_H__
22 22
23#include <qwidget.h> 23#include <qwidget.h>
24#include <qpixmap.h> 24#include <qpixmap.h>
25#include <qstringlist.h> 25#include <qstringlist.h>
26 26
27class QTimer;
28
27class ClipboardApplet : public QWidget 29class ClipboardApplet : public QWidget
28{ 30{
29 Q_OBJECT 31 Q_OBJECT
30public: 32public:
31 ClipboardApplet ( QWidget *parent = 0, const char *name=0 ); 33 ClipboardApplet ( QWidget *parent = 0, const char *name=0 );
32 ~ClipboardApplet ( ); 34 ~ClipboardApplet ( );
33 35
34protected: 36protected:
35 void mousePressEvent ( QMouseEvent *); 37 void mousePressEvent ( QMouseEvent *);
36 void paintEvent ( QPaintEvent* ); 38 void paintEvent ( QPaintEvent* );
37 39
38private slots: 40private slots:
39 void action ( int ); 41 void action ( int );
40 void newData ( ); 42 void newData ( );
43 void shutdown ( );
41 44
42private: 45private:
43 QPopupMenu * m_menu; 46 QPopupMenu * m_menu;
44 QStringList m_history; 47 QStringList m_history;
45 bool m_dirty; 48 bool m_dirty;
46 QString m_lasttext; 49 QString m_lasttext;
50 QTimer * m_timer;
47 51
48 QPixmap m_clipboardPixmap; 52 QPixmap m_clipboardPixmap;
49}; 53};
50 54
51 55
52#endif // __CLIPBOARD_APPLET_H__ 56#endif // __CLIPBOARD_APPLET_H__
53 57
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
@@ -681,16 +681,22 @@ void DesktopApplication::shutdown( ShutdownImpl::Type t )
681 case ShutdownImpl::RebootSystem: 681 case ShutdownImpl::RebootSystem:
682 execlp("shutdown", "shutdown", "-r", "now", (void*)0); 682 execlp("shutdown", "shutdown", "-r", "now", (void*)0);
683 break; 683 break;
684 case ShutdownImpl::RestartDesktop: 684 case ShutdownImpl::RestartDesktop:
685 restart(); 685 restart();
686 break; 686 break;
687 case ShutdownImpl::TerminateDesktop: 687 case ShutdownImpl::TerminateDesktop:
688 prepareForTermination(FALSE); 688 prepareForTermination(FALSE);
689
690 // This is a workaround for a Qt bug
691 // clipboard applet has to stop its poll timer, or Qt/E
692 // will hang on quit() right before it emits aboutToQuit()
693 emit aboutToQuit ( );
694
689 quit(); 695 quit();
690 break; 696 break;
691 } 697 }
692} 698}
693 699
694void DesktopApplication::restart() 700void DesktopApplication::restart()
695{ 701{
696 prepareForTermination(TRUE); 702 prepareForTermination(TRUE);