summaryrefslogtreecommitdiff
path: root/core/applets/clipboardapplet/clipboard.cpp
Unidiff
Diffstat (limited to 'core/applets/clipboardapplet/clipboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 4fc8076..57a4088 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -13,48 +13,49 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "clipboard.h" 21#include "clipboard.h"
22 22
23#include <opie2/otaskbarapplet.h> 23#include <opie2/otaskbarapplet.h>
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26 26
27#include <qpainter.h> 27#include <qpainter.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qwindowsystem_qws.h> 29#include <qwindowsystem_qws.h>
30#include <qapplication.h> 30#include <qapplication.h>
31#include <qclipboard.h> 31#include <qclipboard.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34//=========================================================================== 34//===========================================================================
35 35
36 36
37using namespace Opie::Ui;
37ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) 38ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
38{ 39{
39 setFixedWidth ( AppLnk::smallIconSize() ); 40 setFixedWidth ( AppLnk::smallIconSize() );
40 setFixedHeight ( AppLnk::smallIconSize() ); 41 setFixedHeight ( AppLnk::smallIconSize() );
41 42
42 QImage img = Resource::loadImage( "paste"); 43 QImage img = Resource::loadImage( "paste");
43 img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 44 img = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
44 45
45 m_clipboardPixmap.convertFromImage( img ); 46 m_clipboardPixmap.convertFromImage( img );
46 47
47 m_timer = new QTimer ( this ); 48 m_timer = new QTimer ( this );
48 49
49 connect ( QApplication::clipboard ( ), SIGNAL( dataChanged()), this, SLOT( newData())); 50 connect ( QApplication::clipboard ( ), SIGNAL( dataChanged()), this, SLOT( newData()));
50 connect ( m_timer, SIGNAL( timeout()), this, SLOT( newData())); 51 connect ( m_timer, SIGNAL( timeout()), this, SLOT( newData()));
51 connect ( qApp, SIGNAL( aboutToQuit()), this, SLOT( shutdown())); 52 connect ( qApp, SIGNAL( aboutToQuit()), this, SLOT( shutdown()));
52 53
53 m_menu = 0; 54 m_menu = 0;
54 m_dirty = true; 55 m_dirty = true;
55 m_lasttext = QString::null; 56 m_lasttext = QString::null;
56 57
57 m_timer-> start ( 0, true ); 58 m_timer-> start ( 0, true );
58} 59}
59 60
60ClipboardApplet::~ClipboardApplet ( ) 61ClipboardApplet::~ClipboardApplet ( )
@@ -162,28 +163,26 @@ void ClipboardApplet::newData ( )
162 if ( excllock ) 163 if ( excllock )
163 return; 164 return;
164 else 165 else
165 excllock = true; 166 excllock = true;
166 167
167 m_timer-> stop ( ); 168 m_timer-> stop ( );
168 169
169 QCString type = "plain"; 170 QCString type = "plain";
170 QString txt = QApplication::clipboard ( )-> text ( type ); 171 QString txt = QApplication::clipboard ( )-> text ( type );
171 172
172 if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { 173 if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) {
173 m_history. append ( txt ); 174 m_history. append ( txt );
174 175
175 if ( m_history. count ( ) > 5 ) 176 if ( m_history. count ( ) > 5 )
176 m_history. remove ( m_history. begin ( )); 177 m_history. remove ( m_history. begin ( ));
177 178
178 m_dirty = true; 179 m_dirty = true;
179 } 180 }
180 181
181 m_timer-> start ( 1500, true ); 182 m_timer-> start ( 1500, true );
182 183
183 excllock = false; 184 excllock = false;
184} 185}
185 186
186Q_EXPORT_INTERFACE() 187EXPORT_OPIE_APPLET_v1( ClipboardApplet )
187{ 188
188 Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ClipboardApplet> );
189}