Diffstat (limited to 'libopie2/qt3/opieui/olineedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/qt3/opieui/olineedit.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libopie2/qt3/opieui/olineedit.cpp b/libopie2/qt3/opieui/olineedit.cpp index 9cb0cff..6f66fc7 100644 --- a/libopie2/qt3/opieui/olineedit.cpp +++ b/libopie2/qt3/opieui/olineedit.cpp @@ -402,98 +402,98 @@ void OLineEdit::keyPressEvent( QKeyEvent *e ) // Let QLineEdit handle any other keys events. QLineEdit::keyPressEvent ( e ); } void OLineEdit::mouseDoubleClickEvent( QMouseEvent* e ) { if ( e->button() == Qt::LeftButton ) { possibleTripleClick=true; QTimer::singleShot( QApplication::doubleClickInterval(),this, SLOT(tripleClickTimeout()) ); } 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 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 ) ) ); + 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 ); //subMenu->setAccel( KStdAccel::completion(), ShellCompletion ); subMenu->setAccel( Key_Tab, ShellCompletion ); OGlobalSettings::Completion mode = completionMode(); subMenu->setItemChecked( NoCompletion, mode == OGlobalSettings::CompletionNone ); subMenu->setItemChecked( ShellCompletion, mode == OGlobalSettings::CompletionShell ); subMenu->setItemChecked( PopupCompletion, mode == OGlobalSettings::CompletionPopup ); subMenu->setItemChecked( AutoCompletion, mode == OGlobalSettings::CompletionAuto ); subMenu->setItemChecked( SemiAutoCompletion, mode == OGlobalSettings::CompletionMan ); if ( mode != OGlobalSettings::completionMode() ) { subMenu->insertSeparator(); subMenu->insertItem( tr("Default"), Default ); } } // ### do we really need this? Yes, Please do not remove! This // allows applications to extend the popup menu without having to // inherit from this class! (DA) emit aboutToShowContextMenu( popup ); return popup; } void OLineEdit::completionMenuActivated( int id ) { OGlobalSettings::Completion oldMode = completionMode(); switch ( id ) { case Default: @@ -571,159 +571,159 @@ bool OLineEdit::eventFilter( QObject* o, QEvent* ev ) emit returnPressed( displayText() ); if ( trap ) d->completionBox->hide(); // Eat the event if the user asked for it, or if a completionbox was visible return d->grabReturnKeyEvents || trap; } } } return QLineEdit::eventFilter( o, ev ); } void OLineEdit::setURLDropsEnabled(bool enable) { d->handleURLDrops=enable; } bool OLineEdit::isURLDropsEnabled() const { return d->handleURLDrops; } void OLineEdit::setTrapReturnKey( bool grab ) { d->grabReturnKeyEvents = grab; } bool OLineEdit::trapReturnKey() const { return d->grabReturnKeyEvents; } /*void OLineEdit::setURL( const KURL& url ) { QLineEdit::setText( url.prettyURL() ); }*/ void OLineEdit::makeCompletionBox() { if ( d->completionBox ) return; d->completionBox = new OCompletionBox( this, "completion box" ); if ( handleSignals() ) { - connect( d->completionBox, SIGNAL(highlighted( const QString& )), - SLOT(setText( const QString& )) ); - connect( d->completionBox, SIGNAL(userCancelled( const QString& )), - SLOT(setText( const QString& )) ); + connect( d->completionBox, SIGNAL(highlighted(const QString&)), + SLOT(setText(const QString&)) ); + connect( d->completionBox, SIGNAL(userCancelled(const QString&)), + SLOT(setText(const QString&)) ); // Nice lil' hacklet ;) KComboBox doesn't know when the completionbox // is created (childEvent() is even more hacky, IMHO), so we simply // forward the completionbox' activated signal from here. if ( parentWidget() && parentWidget()->inherits("KComboBox") ) - connect( d->completionBox, SIGNAL( activated( const QString& )), - parentWidget(), SIGNAL( activated( const QString & ))); + connect( d->completionBox, SIGNAL( activated(const QString&)), + parentWidget(), SIGNAL( activated(const QString&))); } } /*bool OLineEdit::overrideAccel (const QKeyEvent* e) { KShortcut scKey; KKey key( e ); KeyBindingMap keys = getKeyBindings(); if (keys[TextCompletion].isNull()) scKey = KStdAccel::shortcut(KStdAccel::TextCompletion); else scKey = keys[TextCompletion]; if (scKey.contains( key )) return true; if (keys[NextCompletionMatch].isNull()) scKey = KStdAccel::shortcut(KStdAccel::NextCompletion); else scKey = keys[NextCompletionMatch]; if (scKey.contains( key )) return true; if (keys[PrevCompletionMatch].isNull()) scKey = KStdAccel::shortcut(KStdAccel::PrevCompletion); else scKey = keys[PrevCompletionMatch]; if (scKey.contains( key )) return true; if (KStdAccel::deleteWordBack().contains( key )) return true; if (KStdAccel::deleteWordForward().contains( key )) return true; if (d->completionBox && d->completionBox->isVisible ()) if (e->key () == Key_Backtab) return true; return false; }*/ void OLineEdit::setCompletedItems( const QStringList& items ) { QString txt = text(); if ( !items.isEmpty() && !(items.count() == 1 && txt == items.first()) ) { if ( !d->completionBox ) makeCompletionBox(); if ( !txt.isEmpty() ) d->completionBox->setCancelledText( txt ); d->completionBox->setItems( items ); d->completionBox->popup(); } else { if ( d->completionBox && d->completionBox->isVisible() ) d->completionBox->hide(); } } OCompletionBox * OLineEdit::completionBox( bool create ) { if ( create ) makeCompletionBox(); return d->completionBox; } void OLineEdit::setCompletionObject( OCompletion* comp, bool hsig ) { OCompletion *oldComp = compObj(); if ( oldComp && handleSignals() ) - disconnect( oldComp, SIGNAL( matches( const QStringList& )), - this, SLOT( setCompletedItems( const QStringList& ))); + disconnect( oldComp, SIGNAL( matches(const QStringList&)), + this, SLOT( setCompletedItems(const QStringList&))); if ( comp && hsig ) - connect( comp, SIGNAL( matches( const QStringList& )), - this, SLOT( setCompletedItems( const QStringList& ))); + connect( comp, SIGNAL( matches(const QStringList&)), + this, SLOT( setCompletedItems(const QStringList&))); OCompletionBase::setCompletionObject( comp, hsig ); } // QWidget::create() turns off mouse-Tracking which would break auto-hiding void OLineEdit::create( WId id, bool initializeWindow, bool destroyOldWindow ) { QLineEdit::create( id, initializeWindow, destroyOldWindow ); //OCursor::setAutoHideCursor( this, true, true ); } void OLineEdit::clear() { setText( QString::null ); } |