summaryrefslogtreecommitdiff
path: root/libopie2/qt3/opieui/olineedit.cpp
Unidiff
Diffstat (limited to 'libopie2/qt3/opieui/olineedit.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/qt3/opieui/olineedit.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/qt3/opieui/olineedit.cpp b/libopie2/qt3/opieui/olineedit.cpp
index 6f66fc7..b150987 100644
--- a/libopie2/qt3/opieui/olineedit.cpp
+++ b/libopie2/qt3/opieui/olineedit.cpp
@@ -136,25 +136,25 @@ void OLineEdit::setCompletedText( const QString& text )
136 136
137void OLineEdit::rotateText( OCompletionBase::KeyBindingType type ) 137void OLineEdit::rotateText( OCompletionBase::KeyBindingType type )
138{ 138{
139 OCompletion* comp = compObj(); 139 OCompletion* comp = compObj();
140 if ( comp && 140 if ( comp &&
141 (type == OCompletionBase::PrevCompletionMatch || 141 (type == OCompletionBase::PrevCompletionMatch ||
142 type == OCompletionBase::NextCompletionMatch ) ) 142 type == OCompletionBase::NextCompletionMatch ) )
143 { 143 {
144 QString input = (type == OCompletionBase::PrevCompletionMatch) ? comp->previousMatch() : comp->nextMatch(); 144 QString input = (type == OCompletionBase::PrevCompletionMatch) ? comp->previousMatch() : comp->nextMatch();
145 // Skip rotation if previous/next match is null or the same text 145 // Skip rotation if previous/next match is null or the same text
146 if ( input.isNull() || input == displayText() ) 146 if ( input.isNull() || input == displayText() )
147 return; 147 return;
148 #if QT_VERSION > 290 148 #if QT_VERSION >= 0x030000
149 setCompletedText( input, hasSelectedText() ); 149 setCompletedText( input, hasSelectedText() );
150 #else 150 #else
151 setCompletedText( input, hasMarkedText() ); 151 setCompletedText( input, hasMarkedText() );
152 #endif 152 #endif
153 } 153 }
154} 154}
155 155
156void OLineEdit::makeCompletion( const QString& text ) 156void OLineEdit::makeCompletion( const QString& text )
157{ 157{
158 OCompletion *comp = compObj(); 158 OCompletion *comp = compObj();
159 if ( !comp ) 159 if ( !comp )
160 return; // No completion object... 160 return; // No completion object...
@@ -262,25 +262,25 @@ void OLineEdit::keyPressEvent( QKeyEvent *e )
262 OGlobalSettings::Completion mode = completionMode(); 262 OGlobalSettings::Completion mode = completionMode();
263 bool noModifier = (e->state() == NoButton || e->state()== ShiftButton); 263 bool noModifier = (e->state() == NoButton || e->state()== ShiftButton);
264 264
265 if ( (mode == OGlobalSettings::CompletionAuto || 265 if ( (mode == OGlobalSettings::CompletionAuto ||
266 mode == OGlobalSettings::CompletionMan) && noModifier ) 266 mode == OGlobalSettings::CompletionMan) && noModifier )
267 { 267 {
268 QString keycode = e->text(); 268 QString keycode = e->text();
269 if ( !keycode.isNull() && keycode.unicode()->isPrint() ) 269 if ( !keycode.isNull() && keycode.unicode()->isPrint() )
270 { 270 {
271 QLineEdit::keyPressEvent ( e ); 271 QLineEdit::keyPressEvent ( e );
272 QString txt = text(); 272 QString txt = text();
273 int len = txt.length(); 273 int len = txt.length();
274 #if QT_VERSION > 290 274 #if QT_VERSION >= 0x030000
275 if ( !hasSelectedText() && len && cursorPosition() == len ) 275 if ( !hasSelectedText() && len && cursorPosition() == len )
276 #else 276 #else
277 if ( !hasMarkedText() && len && cursorPosition() == len ) 277 if ( !hasMarkedText() && len && cursorPosition() == len )
278 #endif 278 #endif
279 { 279 {
280 if ( emitSignals() ) 280 if ( emitSignals() )
281 emit completion( txt ); 281 emit completion( txt );
282 if ( handleSignals() ) 282 if ( handleSignals() )
283 makeCompletion( txt ); 283 makeCompletion( txt );
284 e->accept(); 284 e->accept();
285 } 285 }
286 return; 286 return;
@@ -427,25 +427,25 @@ void OLineEdit::mousePressEvent( QMouseEvent* e )
427 427
428void OLineEdit::tripleClickTimeout() 428void OLineEdit::tripleClickTimeout()
429{ 429{
430 possibleTripleClick=false; 430 possibleTripleClick=false;
431} 431}
432 432
433QPopupMenu *OLineEdit::createPopupMenu() 433QPopupMenu *OLineEdit::createPopupMenu()
434{ 434{
435 // Return if popup menu is not enabled !! 435 // Return if popup menu is not enabled !!
436 if ( !m_bEnableMenu ) 436 if ( !m_bEnableMenu )
437 return 0; 437 return 0;
438 438
439 #if QT_VERSION > 290 439 #if QT_VERSION >= 0x030000
440 QPopupMenu *popup = QLineEdit::createPopupMenu(); 440 QPopupMenu *popup = QLineEdit::createPopupMenu();
441 #else 441 #else
442 QPopupMenu *popup = new QPopupMenu(); 442 QPopupMenu *popup = new QPopupMenu();
443 #warning OLineEdit is not fully functional on Qt2 443 #warning OLineEdit is not fully functional on Qt2
444 #endif 444 #endif
445 445
446 // completion object is present. 446 // completion object is present.
447 if ( compObj() ) 447 if ( compObj() )
448 { 448 {
449 QPopupMenu *subMenu = new QPopupMenu( popup ); 449 QPopupMenu *subMenu = new QPopupMenu( popup );
450 connect( subMenu, SIGNAL( activated(int) ), 450 connect( subMenu, SIGNAL( activated(int) ),
451 this, SLOT( completionMenuActivated(int) ) ); 451 this, SLOT( completionMenuActivated(int) ) );