summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 181f4bf..5848d0f 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -114,120 +114,120 @@ static const char * paste_xpm[] = {
114",5vvv4k)p_%[q.", 114",5vvv4k)p_%[q.",
115" ...$mljnn0qd.", 115" ...$mljnn0qd.",
116" 4.......,"}; 116" 4.......,"};
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 QTimer *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 ( timer, SIGNAL( timeout ( )), this, SLOT( newData ( )));
129 129
130 timer-> start ( 1000 ); 130 timer-> start ( 1000 );
131 131
132 m_menu = 0; 132 m_menu = 0;
133 m_dirty = true; 133 m_dirty = true;
134 m_lasttext = QString::null; 134 m_lasttext = QString::null;
135} 135}
136 136
137ClipboardApplet::~ClipboardApplet ( ) 137ClipboardApplet::~ClipboardApplet ( )
138{ 138{
139} 139}
140 140
141void ClipboardApplet::mousePressEvent ( QMouseEvent *) 141void ClipboardApplet::mousePressEvent ( QMouseEvent *)
142{ 142{
143 if ( m_dirty ) { 143 if ( m_dirty ) {
144 delete m_menu; 144 delete m_menu;
145 145
146 m_menu = new QPopupMenu ( this ); 146 m_menu = new QPopupMenu ( this );
147 m_menu-> setCheckable ( true ); 147 m_menu-> setCheckable ( true );
148 148
149 if ( m_history. count ( )) { 149 if ( m_history. count ( )) {
150 for ( unsigned int i = 0; i < m_history. count ( ); i++ ) { 150 for ( unsigned int i = 0; i < m_history. count ( ); i++ ) {
151 QString str = m_history [i]; 151 QString str = m_history [i];
152 152
153 if ( str. length ( ) > 20 ) 153 if ( str. length ( ) > 20 )
154 str = str. left ( 20 ) + "..."; 154 str = str. left ( 20 ) + "...";
155 155
156 m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i ); 156 m_menu-> insertItem ( QString ( "%1: %2" ). arg ( i + 1 ). arg ( str ), i );
157 m_menu-> setItemChecked ( i, false ); 157 m_menu-> setItemChecked ( i, false );
158 } 158 }
159 m_menu-> setItemChecked ( m_history. count ( ) - 1, true ); 159 m_menu-> setItemChecked ( m_history. count ( ) - 1, true );
160 m_menu-> insertSeparator ( ); 160 m_menu-> insertSeparator ( );
161 } 161 }
162 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 ); 162 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "cut" )), tr( "Cut" ), 100 );
163 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 ); 163 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "copy" )), tr( "Copy" ), 101 );
164 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 ); 164 m_menu-> insertItem ( QIconSet ( Resource::loadPixmap ( "paste" )), tr( "Paste" ), 102 );
165 165
166 connect ( m_menu, SIGNAL( activated ( int )), this, SLOT( action ( int ))); 166 connect ( m_menu, SIGNAL( activated ( int )), this, SLOT( action ( int )));
167 167
168 m_dirty = false; 168 m_dirty = false;
169 } 169 }
170 QPoint p = mapToGlobal ( QPoint ( 0, 0 )); 170 QPoint p = mapToGlobal ( QPoint ( 0, 0 ));
171 QSize s = m_menu-> sizeHint ( ); 171 QSize s = m_menu-> sizeHint ( );
172 172
173 m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( ))); 173 m_menu-> popup ( QPoint ( p. x ( ) + ( width ( ) / 2 ) - ( s. width ( ) / 2 ), p. y ( ) - s. height ( )));
174} 174}
175 175
176void ClipboardApplet::action(int id) 176void ClipboardApplet::action(int id)
177{ 177{
178 ushort unicode = 0; 178 ushort unicode = 0;
179 int scan = 0; 179 int scan = 0;
180 180
181 switch ( id ) { 181 switch ( id ) {
182 case 100: 182 case 100:
183 unicode = 'X' - '@'; 183 unicode = 'X' - '@';
184 scan = Key_X; // Cut 184 scan = Key_X; // Cut
185 break; 185 break;
186 case 101: 186 case 101:
187 unicode = 'C' - '@'; 187 unicode = 'C' - '@';
188 scan = Key_C; // Copy 188 scan = Key_C; // Copy
189 break; 189 break;
190 case 102: 190 case 102:
191 unicode = 'V' - '@'; 191 unicode = 'V' - '@';
192 scan = Key_V; // Paste 192 scan = Key_V; // Paste
193 break; 193 break;
194 194
195 default: 195 default:
196 if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) { 196 if (( id >= 0 ) && ( uint( id ) < m_history. count ( ))) {
197 QApplication::clipboard ( )-> setText ( m_history [id] ); 197 QApplication::clipboard ( )-> setText ( m_history [id] );
198 198
199 for ( uint i = 0; i < m_history. count ( ); i++ ) 199 for ( uint i = 0; i < m_history. count ( ); i++ )
200 m_menu-> setItemChecked ( i, i == uint( id )); 200 m_menu-> setItemChecked ( i, i == uint( id ));
201 201
202 unicode = 'V' - '@'; 202 unicode = 'V' - '@';
203 scan = Key_V; 203 scan = Key_V;
204 } 204 }
205 break; 205 break;
206 } 206 }
207 207
208 if ( scan ) { 208 if ( scan ) {
209 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); 209 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false );
210 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, true, false ); 210 qwsServer-> sendKeyEvent ( unicode, scan, ControlButton, false, false );
211 } 211 }
212} 212}
213 213
214void ClipboardApplet::paintEvent ( QPaintEvent* ) 214void ClipboardApplet::paintEvent ( QPaintEvent* )
215{ 215{
216 QPainter p ( this ); 216 QPainter p ( this );
217 p. drawPixmap ( 0, 1, m_clipboardPixmap ); 217 p. drawPixmap ( 0, 1, m_clipboardPixmap );
218} 218}
219 219
220void ClipboardApplet::newData ( ) 220void ClipboardApplet::newData ( )
221{ 221{
222 QCString type = "plain"; 222 QCString type = "plain";
223 QString txt = QApplication::clipboard ( )-> text ( type ); 223 QString txt = QApplication::clipboard ( )-> text ( type );
224 224
225 if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { 225 if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) {
226 m_history. append ( txt ); 226 m_history. append ( txt );
227 227
228 if ( m_history. count ( ) > 5 ) 228 if ( m_history. count ( ) > 5 )
229 m_history. remove ( m_history. begin ( )); 229 m_history. remove ( m_history. begin ( ));
230 230
231 m_dirty = true; 231 m_dirty = true;
232 } 232 }
233} 233}