Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

olineedit.cpp

Go to the documentation of this file.
00001 /*
00002   This file                  Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
00003     is part of the           Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>, Dawit Alemayehu <adawit@kde.org>
00004        Opie Project          Copyright (C) 1999 Preston Brown <pbrown@kde.org>, Patrick Ward <PAT_WARD@HP-USA-om5.om.hp.com>
00005                              Copyright (C) 1997 Sven Radej (sven.radej@iname.com)
00006               =.
00007             .=l.             Originally part of the KDE Project
00008            .>+-=
00009  _;:,     .>    :=|.         This program is free software; you can
00010 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00011 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00012 .="- .-=="i,     .._         License as published by the Free Software
00013  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00014      ._= =}       :          or (at your option) any later version.
00015     .%`+i>       _;_.
00016     .i_,=:_.      -<s.       This program is distributed in the hope that
00017      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00018     : ..    .:,     . . .    without even the implied warranty of
00019     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00020   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00021 ..}^=.=       =       ;      Library General Public License for more
00022 ++=   -.     .`     .:       details.
00023  :     =  ...= . :.=-
00024  -.   .:....=;==+<;          You should have received a copy of the GNU
00025   -_. . .   )=.  =           Library General Public License along with
00026     --        :-=`           this library; see the file COPYING.LIB.
00027                              If not, write to the Free Software Foundation,
00028                              Inc., 59 Temple Place - Suite 330,
00029                              Boston, MA 02111-1307, USA.
00030 
00031 */
00032 
00033 /* QT */
00034 
00035 #include <qapplication.h>
00036 #include <qclipboard.h>
00037 #include <qtimer.h>
00038 #include <qpopupmenu.h>
00039 
00040 /* OPIE */
00041 
00042 #include <opie2/ocompletionbox.h>
00043 #include <opie2/olineedit.h>
00044 #include <opie2/oglobalsettings.h>
00045 
00046 typedef QString KURL; //FIXME: Revise for Opie
00047 
00048 /*======================================================================================
00049  * OLineEditPrivate
00050  *======================================================================================*/
00051 
00052 class OLineEdit::OLineEditPrivate
00053 {
00054 public:
00055     OLineEditPrivate()
00056     {
00057         grabReturnKeyEvents = false;
00058         handleURLDrops = true;
00059         completionBox = 0L;
00060     }
00061     ~OLineEditPrivate()
00062     {
00063         delete completionBox;
00064     }
00065 
00066     bool grabReturnKeyEvents;
00067     bool handleURLDrops;
00068     OCompletionBox *completionBox;
00069 };
00070 
00071 
00072 /*======================================================================================
00073  * OLineEdit
00074  *======================================================================================*/
00075 
00076 OLineEdit::OLineEdit( const QString &string, QWidget *parent, const char *name )
00077     : QLineEdit( string, parent, name )
00078 {
00079     init();
00080 }
00081 
00082 OLineEdit::OLineEdit( QWidget *parent, const char *name )
00083     : QLineEdit( parent, name )
00084 {
00085     init();
00086 }
00087 
00088 OLineEdit::~OLineEdit ()
00089 {
00090     delete d;
00091 }
00092 
00093 void OLineEdit::init()
00094 {
00095     d = new OLineEditPrivate;
00096     possibleTripleClick = false;
00097     // Enable the context menu by default.
00098     setContextMenuEnabled( true );
00099     //OCursor::setAutoHideCursor( this, true, true );
00100     installEventFilter( this );
00101 }
00102 
00103 void OLineEdit::setCompletionMode( OGlobalSettings::Completion mode )
00104 {
00105     OGlobalSettings::Completion oldMode = completionMode();
00106     if ( oldMode != mode && oldMode == OGlobalSettings::CompletionPopup &&
00107          d->completionBox && d->completionBox->isVisible() )
00108         d->completionBox->hide();
00109 
00110     // If the widgets echo mode is not Normal, no completion
00111     // feature will be enabled even if one is requested.
00112     if ( echoMode() != QLineEdit::Normal )
00113         mode = OGlobalSettings::CompletionNone; // Override the request.
00114 
00115     OCompletionBase::setCompletionMode( mode );
00116 }
00117 
00118 void OLineEdit::setCompletedText( const QString& t, bool marked )
00119 {
00120     QString txt = text();
00121     if ( t != txt )
00122     {
00123         int curpos = marked ? txt.length() : t.length();
00124         validateAndSet( t, curpos, curpos, t.length() );
00125     }
00126 }
00127 
00128 void OLineEdit::setCompletedText( const QString& text )
00129 {
00130     OGlobalSettings::Completion mode = completionMode();
00131     bool marked = ( mode == OGlobalSettings::CompletionAuto ||
00132                     mode == OGlobalSettings::CompletionMan ||
00133                     mode == OGlobalSettings::CompletionPopup );
00134     setCompletedText( text, marked );
00135 }
00136 
00137 void OLineEdit::rotateText( OCompletionBase::KeyBindingType type )
00138 {
00139     OCompletion* comp = compObj();
00140     if ( comp &&
00141        (type == OCompletionBase::PrevCompletionMatch ||
00142         type == OCompletionBase::NextCompletionMatch ) )
00143     {
00144        QString input = (type == OCompletionBase::PrevCompletionMatch) ? comp->previousMatch() : comp->nextMatch();
00145        // Skip rotation if previous/next match is null or the same text
00146        if ( input.isNull() || input == displayText() )
00147             return;
00148        #if QT_VERSION >= 0x030000
00149        setCompletedText( input, hasSelectedText() );
00150        #else
00151        setCompletedText( input, hasMarkedText() );
00152        #endif
00153     }
00154 }
00155 
00156 void OLineEdit::makeCompletion( const QString& text )
00157 {
00158     OCompletion *comp = compObj();
00159     if ( !comp )
00160         return;  // No completion object...
00161 
00162     QString match = comp->makeCompletion( text );
00163     OGlobalSettings::Completion mode = completionMode();
00164     if ( mode == OGlobalSettings::CompletionPopup )
00165     {
00166         if ( match.isNull() )
00167         {
00168             if ( d->completionBox ) {
00169                 d->completionBox->hide();
00170                 d->completionBox->clear();
00171             }
00172         }
00173         else
00174             setCompletedItems( comp->allMatches() );
00175     }
00176     else
00177     {
00178         // all other completion modes
00179         // If no match or the same match, simply return without completing.
00180         if ( match.isNull() || match == text )
00181             return;
00182 
00183         setCompletedText( match );
00184     }
00185 }
00186 
00187 void OLineEdit::setReadOnly(bool readOnly)
00188 {
00189     QPalette p = palette();
00190     if (readOnly)
00191     {
00192         QColor color = p.color(QPalette::Disabled, QColorGroup::Background);
00193         p.setColor(QColorGroup::Base, color);
00194         p.setColor(QColorGroup::Background, color);
00195     }
00196     else
00197     {
00198         QColor color = p.color(QPalette::Normal, QColorGroup::Base);
00199         p.setColor(QColorGroup::Base, color);
00200         p.setColor(QColorGroup::Background, color);
00201     }
00202     setPalette(p);
00203 
00204     QLineEdit::setReadOnly (readOnly);
00205 }
00206 
00207 void OLineEdit::keyPressEvent( QKeyEvent *e )
00208 {
00209     qDebug( "OLineEdit::keyPressEvent()" );
00210     
00211     /*
00212     
00213     KKey key( e );
00214 
00215     if ( KStdAccel::copy().contains( key ) ) {
00216         copy();
00217         return;
00218     }
00219     else if ( KStdAccel::paste().contains( key ) ) {
00220         paste();
00221         return;
00222     }
00223     else if ( KStdAccel::cut().contains( key ) ) {
00224         cut();
00225         return;
00226     }
00227     else if ( KStdAccel::undo().contains( key ) ) {
00228         undo();
00229         return;
00230     }
00231     else if ( KStdAccel::redo().contains( key ) ) {
00232         redo();
00233         return;
00234     }
00235     else if ( KStdAccel::deleteWordBack().contains( key ) )
00236     {
00237         cursorWordBackward(TRUE);
00238         if ( hasSelectedText() )
00239             del();
00240 
00241         e->accept();
00242         return;
00243     }
00244     else if ( KStdAccel::deleteWordForward().contains( key ) )
00245     {
00246         // Workaround for QT bug where
00247         cursorWordForward(TRUE);
00248         if ( hasSelectedText() )
00249             del();
00250 
00251         e->accept();
00252         return;
00253     }
00254     */
00255     
00256     // Filter key-events if EchoMode is normal &
00257     // completion mode is not set to CompletionNone
00258     if ( echoMode() == QLineEdit::Normal &&
00259          completionMode() != OGlobalSettings::CompletionNone )
00260     {
00261         KeyBindingMap keys = getKeyBindings();
00262         OGlobalSettings::Completion mode = completionMode();
00263         bool noModifier = (e->state() == NoButton || e->state()== ShiftButton);
00264 
00265         if ( (mode == OGlobalSettings::CompletionAuto ||
00266               mode == OGlobalSettings::CompletionMan) && noModifier )
00267         {
00268             QString keycode = e->text();
00269             if ( !keycode.isNull() && keycode.unicode()->isPrint() )
00270             {
00271                 QLineEdit::keyPressEvent ( e );
00272                 QString txt = text();
00273                 int len = txt.length();
00274                 #if QT_VERSION >= 0x030000
00275                 if ( !hasSelectedText() && len && cursorPosition() == len )
00276                 #else
00277                 if ( !hasMarkedText() && len && cursorPosition() == len )
00278                 #endif
00279                 {
00280                     if ( emitSignals() )
00281                         emit completion( txt );
00282                     if ( handleSignals() )
00283                         makeCompletion( txt );
00284                     e->accept();
00285                 }
00286                 return;
00287             }
00288         }
00289 
00290         else if ( mode == OGlobalSettings::CompletionPopup && noModifier )
00291         {
00292             qDebug( "OLineEdit::keyPressEvent() - global settings = CompletionPopup & noModifier" );
00293 
00294             QString old_txt = text();
00295             QLineEdit::keyPressEvent ( e );
00296             QString txt = text();
00297             int len = txt.length();
00298             QString keycode = e->text();
00299 
00300 
00301             if ( txt != old_txt && len && cursorPosition() == len &&
00302                  ( (!keycode.isNull() && keycode.unicode()->isPrint()) ||
00303                    e->key() == Key_Backspace ) )
00304             {
00305                 if ( emitSignals() )
00306                     emit completion( txt ); // emit when requested...
00307                 if ( handleSignals() )
00308                     makeCompletion( txt );  // handle when requested...
00309                 e->accept();
00310             }
00311             else if (!len && d->completionBox && d->completionBox->isVisible())
00312                 d->completionBox->hide();
00313 
00314             return;
00315         }
00316 
00317         /*else if ( mode == OGlobalSettings::CompletionShell )
00318         {
00319             // Handles completion.
00320             KShortcut cut;
00321             if ( keys[TextCompletion].isNull() )
00322                 cut = KStdAccel::shortcut(KStdAccel::TextCompletion);
00323             else
00324                 cut = keys[TextCompletion];
00325 
00326             if ( cut.contains( key ) )
00327             {
00328                 // Emit completion if the completion mode is CompletionShell
00329                 // and the cursor is at the end of the string.
00330                 QString txt = text();
00331                 int len = txt.length();
00332                 if ( cursorPosition() == len && len != 0 )
00333                 {
00334                     if ( emitSignals() )
00335                         emit completion( txt );
00336                     if ( handleSignals() )
00337                         makeCompletion( txt );
00338                     return;
00339                 }
00340             }
00341             else if ( d->completionBox )
00342                 d->completionBox->hide();
00343         }
00344 
00345         // handle rotation
00346         if ( mode != OGlobalSettings::CompletionNone )
00347         {
00348             // Handles previous match
00349             KShortcut cut;
00350             if ( keys[PrevCompletionMatch].isNull() )
00351                 cut = KStdAccel::shortcut(KStdAccel::PrevCompletion);
00352             else
00353                 cut = keys[PrevCompletionMatch];
00354 
00355             if ( cut.contains( key ) )
00356             {
00357                 if ( emitSignals() )
00358                     emit textRotation( OCompletionBase::PrevCompletionMatch );
00359                 if ( handleSignals() )
00360                     rotateText( OCompletionBase::PrevCompletionMatch );
00361                 return;
00362             }
00363 
00364             // Handles next match
00365             if ( keys[NextCompletionMatch].isNull() )
00366                 cut = KStdAccel::key(KStdAccel::NextCompletion);
00367             else
00368                 cut = keys[NextCompletionMatch];
00369 
00370             if ( cut.contains( key ) )
00371             {
00372                 if ( emitSignals() )
00373                     emit textRotation( OCompletionBase::NextCompletionMatch );
00374                 if ( handleSignals() )
00375                     rotateText( OCompletionBase::NextCompletionMatch );
00376                 return;
00377             }
00378         }
00379 
00380         // substring completion
00381         if ( compObj() )
00382         {
00383             KShortcut cut;
00384             if ( keys[SubstringCompletion].isNull() )
00385                 cut = KStdAccel::shortcut(KStdAccel::SubstringCompletion);
00386             else
00387                 cut = keys[SubstringCompletion];
00388 
00389             if ( cut.contains( key ) )
00390             {
00391                 if ( emitSignals() )
00392                     emit substringCompletion( text() );
00393                 if ( handleSignals() )
00394                 {
00395                     setCompletedItems( compObj()->substringCompletion(text()));
00396                     e->accept();
00397                 }
00398                 return;
00399             }
00400         } */
00401     }   
00402 
00403     // Let QLineEdit handle any other keys events.
00404     QLineEdit::keyPressEvent ( e );
00405 }
00406 
00407 void OLineEdit::mouseDoubleClickEvent( QMouseEvent* e )
00408 {
00409     if ( e->button() == Qt::LeftButton  )
00410     {
00411         possibleTripleClick=true;
00412         QTimer::singleShot( QApplication::doubleClickInterval(),this,
00413                             SLOT(tripleClickTimeout()) );
00414     }
00415     QLineEdit::mouseDoubleClickEvent( e );
00416 }
00417 
00418 void OLineEdit::mousePressEvent( QMouseEvent* e )
00419 {
00420     if ( possibleTripleClick && e->button() == Qt::LeftButton )
00421     {
00422         selectAll();
00423         return;
00424     }
00425     QLineEdit::mousePressEvent( e );
00426 }
00427 
00428 void OLineEdit::tripleClickTimeout()
00429 {
00430     possibleTripleClick=false;
00431 }
00432 
00433 QPopupMenu *OLineEdit::createPopupMenu()
00434 {
00435     // Return if popup menu is not enabled !!
00436     if ( !m_bEnableMenu )
00437         return 0;
00438 
00439     #if QT_VERSION >= 0x030000
00440     QPopupMenu *popup = QLineEdit::createPopupMenu();
00441     #else
00442     QPopupMenu *popup = new QPopupMenu();
00443     #warning OLineEdit is not fully functional on Qt2
00444     #endif
00445 
00446     // completion object is present.
00447     if ( compObj() )
00448     {
00449         QPopupMenu *subMenu = new QPopupMenu( popup );
00450         connect( subMenu, SIGNAL( activated(int) ),
00451                  this, SLOT( completionMenuActivated(int) ) );
00452 
00453         popup->insertSeparator();
00454         //popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"),
00455         //                   subMenu );
00456 
00457         popup->insertItem( tr("Text Completion"), subMenu );
00458 
00459         subMenu->insertItem( tr("None"), NoCompletion );
00460         subMenu->insertItem( tr("Manual"), ShellCompletion );
00461         subMenu->insertItem( tr("Automatic"), AutoCompletion );
00462         subMenu->insertItem( tr("Dropdown List"), PopupCompletion );
00463         subMenu->insertItem( tr("Short Automatic"), SemiAutoCompletion );
00464 
00465         //subMenu->setAccel( KStdAccel::completion(), ShellCompletion );
00466         subMenu->setAccel( Key_Tab, ShellCompletion );
00467 
00468         OGlobalSettings::Completion mode = completionMode();
00469         subMenu->setItemChecked( NoCompletion,
00470                                  mode == OGlobalSettings::CompletionNone );
00471         subMenu->setItemChecked( ShellCompletion,
00472                                  mode == OGlobalSettings::CompletionShell );
00473         subMenu->setItemChecked( PopupCompletion,
00474                                  mode == OGlobalSettings::CompletionPopup );
00475         subMenu->setItemChecked( AutoCompletion,
00476                                  mode == OGlobalSettings::CompletionAuto );
00477         subMenu->setItemChecked( SemiAutoCompletion,
00478                                  mode == OGlobalSettings::CompletionMan );
00479         if ( mode != OGlobalSettings::completionMode() )
00480         {
00481             subMenu->insertSeparator();
00482             subMenu->insertItem( tr("Default"), Default );
00483         }
00484     }
00485     // ### do we really need this?  Yes, Please do not remove!  This
00486     // allows applications to extend the popup menu without having to
00487     // inherit from this class! (DA)
00488     emit aboutToShowContextMenu( popup );
00489 
00490     return popup;
00491 }
00492 
00493 void OLineEdit::completionMenuActivated( int id )
00494 {
00495     OGlobalSettings::Completion oldMode = completionMode();
00496 
00497     switch ( id )
00498     {
00499         case Default:
00500            setCompletionMode( OGlobalSettings::completionMode() ); break;
00501         case NoCompletion:
00502            setCompletionMode( OGlobalSettings::CompletionNone ); break;
00503         case AutoCompletion:
00504             setCompletionMode( OGlobalSettings::CompletionAuto ); break;
00505         case SemiAutoCompletion:
00506             setCompletionMode( OGlobalSettings::CompletionMan ); break;
00507         case ShellCompletion:
00508             setCompletionMode( OGlobalSettings::CompletionShell ); break;
00509         case PopupCompletion:
00510             setCompletionMode( OGlobalSettings::CompletionPopup ); break;
00511         default: return;
00512     }
00513 
00514     if ( oldMode != completionMode() )
00515     {
00516         if ( oldMode == OGlobalSettings::CompletionPopup &&
00517              d->completionBox && d->completionBox->isVisible() )
00518             d->completionBox->hide();
00519         emit completionModeChanged( completionMode() );
00520     }
00521 }
00522 
00523 /*void OLineEdit::dropEvent(QDropEvent *e)
00524 {
00525     KURL::List urlList;
00526     if( d->handleURLDrops && KURLDrag::decode( e, urlList ) )
00527     {
00528         QString dropText = text();
00529         KURL::List::ConstIterator it;
00530         for( it = urlList.begin() ; it != urlList.end() ; ++it )
00531         {
00532             if(!dropText.isEmpty())
00533                 dropText+=' ';
00534 
00535             dropText += (*it).prettyURL();
00536         }
00537 
00538         validateAndSet( dropText, dropText.length(), 0, 0);
00539 
00540         e->accept();
00541     }
00542     else
00543         QLineEdit::dropEvent(e);
00544 }*/
00545 
00546 bool OLineEdit::eventFilter( QObject* o, QEvent* ev )
00547 {
00548     if( o == this )
00549     {
00550         //OCursor::autoHideEventFilter( this, ev );
00551         if ( ev->type() == QEvent::AccelOverride )
00552         {
00553             QKeyEvent *e = static_cast<QKeyEvent *>( ev );
00554           //  if (overrideAccel (e))
00555           //  {
00556           //      e->accept();
00557           //      return true;
00558           //  }
00559         }
00560         else if( ev->type() == QEvent::KeyPress )
00561         {
00562             QKeyEvent *e = static_cast<QKeyEvent *>( ev );
00563 
00564             if( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter )
00565             {
00566                 bool trap = d->completionBox && d->completionBox->isVisible();
00567 
00568                 // Qt will emit returnPressed() itself if we return false
00569                 if ( d->grabReturnKeyEvents || trap )
00570                     emit QLineEdit::returnPressed();
00571 
00572                 emit returnPressed( displayText() );
00573 
00574                 if ( trap )
00575                     d->completionBox->hide();
00576 
00577                 // Eat the event if the user asked for it, or if a completionbox was visible
00578                 return d->grabReturnKeyEvents || trap;
00579             }
00580         }
00581     }
00582     return QLineEdit::eventFilter( o, ev );
00583 }
00584 
00585 
00586 void OLineEdit::setURLDropsEnabled(bool enable)
00587 {
00588     d->handleURLDrops=enable;
00589 }
00590 
00591 bool OLineEdit::isURLDropsEnabled() const
00592 {
00593     return d->handleURLDrops;
00594 }
00595 
00596 void OLineEdit::setTrapReturnKey( bool grab )
00597 {
00598     d->grabReturnKeyEvents = grab;
00599 }
00600 
00601 bool OLineEdit::trapReturnKey() const
00602 {
00603     return d->grabReturnKeyEvents;
00604 }
00605 
00606 /*void OLineEdit::setURL( const KURL& url )
00607 {
00608     QLineEdit::setText( url.prettyURL() );
00609 }*/
00610 
00611 void OLineEdit::makeCompletionBox()
00612 {
00613     if ( d->completionBox )
00614         return;
00615 
00616     d->completionBox = new OCompletionBox( this, "completion box" );
00617     if ( handleSignals() )
00618     {
00619         connect( d->completionBox, SIGNAL(highlighted(const QString&)),
00620                  SLOT(setText(const QString&)) );
00621         connect( d->completionBox, SIGNAL(userCancelled(const QString&)),
00622                  SLOT(setText(const QString&)) );
00623 
00624         // Nice lil' hacklet ;) KComboBox doesn't know when the completionbox
00625         // is created (childEvent() is even more hacky, IMHO), so we simply
00626         // forward the completionbox' activated signal from here.
00627         if ( parentWidget() && parentWidget()->inherits("KComboBox") )
00628             connect( d->completionBox, SIGNAL( activated(const QString&)),
00629                      parentWidget(), SIGNAL( activated(const QString&)));
00630     }
00631 }
00632 
00633 /*bool OLineEdit::overrideAccel (const QKeyEvent* e)
00634 {
00635   KShortcut scKey;
00636 
00637   KKey key( e );
00638   KeyBindingMap keys = getKeyBindings();
00639 
00640   if (keys[TextCompletion].isNull())
00641     scKey = KStdAccel::shortcut(KStdAccel::TextCompletion);
00642   else
00643     scKey = keys[TextCompletion];
00644 
00645   if (scKey.contains( key ))
00646     return true;
00647 
00648   if (keys[NextCompletionMatch].isNull())
00649     scKey = KStdAccel::shortcut(KStdAccel::NextCompletion);
00650   else
00651     scKey = keys[NextCompletionMatch];
00652 
00653   if (scKey.contains( key ))
00654     return true;
00655 
00656   if (keys[PrevCompletionMatch].isNull())
00657     scKey = KStdAccel::shortcut(KStdAccel::PrevCompletion);
00658    else
00659     scKey = keys[PrevCompletionMatch];
00660 
00661   if (scKey.contains( key ))
00662     return true;
00663 
00664   if (KStdAccel::deleteWordBack().contains( key ))
00665     return true;
00666   if (KStdAccel::deleteWordForward().contains( key ))
00667     return true;
00668 
00669   if (d->completionBox && d->completionBox->isVisible ())
00670     if (e->key () == Key_Backtab)
00671       return true;
00672 
00673   return false;
00674 }*/
00675 
00676 void OLineEdit::setCompletedItems( const QStringList& items )
00677 {
00678     QString txt = text();
00679     if ( !items.isEmpty() &&
00680          !(items.count() == 1 && txt == items.first()) )
00681     {
00682         if ( !d->completionBox )
00683             makeCompletionBox();
00684 
00685         if ( !txt.isEmpty() )
00686             d->completionBox->setCancelledText( txt );
00687         d->completionBox->setItems( items );
00688         d->completionBox->popup();
00689     }
00690     else
00691     {
00692         if ( d->completionBox && d->completionBox->isVisible() )
00693             d->completionBox->hide();
00694     }
00695 }
00696 
00697 OCompletionBox * OLineEdit::completionBox( bool create )
00698 {
00699     if ( create )
00700         makeCompletionBox();
00701 
00702     return d->completionBox;
00703 }
00704 
00705 void OLineEdit::setCompletionObject( OCompletion* comp, bool hsig )
00706 {
00707     OCompletion *oldComp = compObj();
00708     if ( oldComp && handleSignals() )
00709         disconnect( oldComp, SIGNAL( matches(const QStringList&)),
00710                     this, SLOT( setCompletedItems(const QStringList&)));
00711 
00712     if ( comp && hsig )
00713       connect( comp, SIGNAL( matches(const QStringList&)),
00714                this, SLOT( setCompletedItems(const QStringList&)));
00715 
00716     OCompletionBase::setCompletionObject( comp, hsig );
00717 }
00718 
00719 // QWidget::create() turns off mouse-Tracking which would break auto-hiding
00720 void OLineEdit::create( WId id, bool initializeWindow, bool destroyOldWindow )
00721 {
00722     QLineEdit::create( id, initializeWindow, destroyOldWindow );
00723     //OCursor::setAutoHideCursor( this, true, true );
00724 }
00725 
00726 void OLineEdit::clear()
00727 {
00728     setText( QString::null );
00729 }

Generated on Sat Nov 5 16:16:30 2005 for OPIE by  doxygen 1.4.2