summaryrefslogtreecommitdiff
path: root/libopie2/qt3/opieui/olineedit.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/qt3/opieui/olineedit.cpp') (more/less context) (ignore 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
@@ -124,49 +124,49 @@ void OLineEdit::setCompletedText( const QString& t, bool marked )
validateAndSet( t, curpos, curpos, t.length() );
}
}
void OLineEdit::setCompletedText( const QString& text )
{
OGlobalSettings::Completion mode = completionMode();
bool marked = ( mode == OGlobalSettings::CompletionAuto ||
mode == OGlobalSettings::CompletionMan ||
mode == OGlobalSettings::CompletionPopup );
setCompletedText( text, marked );
}
void OLineEdit::rotateText( OCompletionBase::KeyBindingType type )
{
OCompletion* comp = compObj();
if ( comp &&
(type == OCompletionBase::PrevCompletionMatch ||
type == OCompletionBase::NextCompletionMatch ) )
{
QString input = (type == OCompletionBase::PrevCompletionMatch) ? comp->previousMatch() : comp->nextMatch();
// Skip rotation if previous/next match is null or the same text
if ( input.isNull() || input == displayText() )
return;
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
setCompletedText( input, hasSelectedText() );
#else
setCompletedText( input, hasMarkedText() );
#endif
}
}
void OLineEdit::makeCompletion( const QString& text )
{
OCompletion *comp = compObj();
if ( !comp )
return; // No completion object...
QString match = comp->makeCompletion( text );
OGlobalSettings::Completion mode = completionMode();
if ( mode == OGlobalSettings::CompletionPopup )
{
if ( match.isNull() )
{
if ( d->completionBox ) {
d->completionBox->hide();
d->completionBox->clear();
}
}
@@ -250,49 +250,49 @@ void OLineEdit::keyPressEvent( QKeyEvent *e )
e->accept();
return;
}
*/
// Filter key-events if EchoMode is normal &
// completion mode is not set to CompletionNone
if ( echoMode() == QLineEdit::Normal &&
completionMode() != OGlobalSettings::CompletionNone )
{
KeyBindingMap keys = getKeyBindings();
OGlobalSettings::Completion mode = completionMode();
bool noModifier = (e->state() == NoButton || e->state()== ShiftButton);
if ( (mode == OGlobalSettings::CompletionAuto ||
mode == OGlobalSettings::CompletionMan) && noModifier )
{
QString keycode = e->text();
if ( !keycode.isNull() && keycode.unicode()->isPrint() )
{
QLineEdit::keyPressEvent ( e );
QString txt = text();
int len = txt.length();
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
if ( !hasSelectedText() && len && cursorPosition() == len )
#else
if ( !hasMarkedText() && len && cursorPosition() == len )
#endif
{
if ( emitSignals() )
emit completion( txt );
if ( handleSignals() )
makeCompletion( txt );
e->accept();
}
return;
}
}
else if ( mode == OGlobalSettings::CompletionPopup && noModifier )
{
qDebug( "OLineEdit::keyPressEvent() - global settings = CompletionPopup & noModifier" );
QString old_txt = text();
QLineEdit::keyPressEvent ( e );
QString txt = text();
int len = txt.length();
QString keycode = e->text();
@@ -415,49 +415,49 @@ void OLineEdit::mouseDoubleClickEvent( QMouseEvent* e )
QLineEdit::mouseDoubleClickEvent( e );
}
void OLineEdit::mousePressEvent( QMouseEvent* e )
{
if ( possibleTripleClick && e->button() == Qt::LeftButton )
{
selectAll();
return;
}
QLineEdit::mousePressEvent( e );
}
void OLineEdit::tripleClickTimeout()
{
possibleTripleClick=false;
}
QPopupMenu *OLineEdit::createPopupMenu()
{
// Return if popup menu is not enabled !!
if ( !m_bEnableMenu )
return 0;
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
QPopupMenu *popup = QLineEdit::createPopupMenu();
#else
QPopupMenu *popup = new QPopupMenu();
#warning OLineEdit is not fully functional on Qt2
#endif
// completion object is present.
if ( compObj() )
{
QPopupMenu *subMenu = new QPopupMenu( popup );
connect( subMenu, SIGNAL( activated(int) ),
this, SLOT( completionMenuActivated(int) ) );
popup->insertSeparator();
//popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"),
// subMenu );
popup->insertItem( tr("Text Completion"), subMenu );
subMenu->insertItem( tr("None"), NoCompletion );
subMenu->insertItem( tr("Manual"), ShellCompletion );
subMenu->insertItem( tr("Automatic"), AutoCompletion );
subMenu->insertItem( tr("Dropdown List"), PopupCompletion );
subMenu->insertItem( tr("Short Automatic"), SemiAutoCompletion );