diff options
Diffstat (limited to 'kdevdesigner/designer/popupmenueditor.cpp')
-rw-r--r-- | kdevdesigner/designer/popupmenueditor.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/kdevdesigner/designer/popupmenueditor.cpp b/kdevdesigner/designer/popupmenueditor.cpp index da6289dd..629d40fe 100644 --- a/kdevdesigner/designer/popupmenueditor.cpp +++ b/kdevdesigner/designer/popupmenueditor.cpp @@ -84,13 +84,13 @@ bool PopupMenuEditorItemPtrDrag::decode( TQDropEvent * e, PopupMenuEditorItem ** TQDataStream stream( data, IO_ReadOnly ); if ( !data.size() ) - return FALSE; + return false; TQ_LONG p = 0; stream >> p; *i = ( PopupMenuEditorItem *) p; - return TRUE; + return true; } // PopupMenuEditorItem Implementation ----------------------------------- @@ -100,12 +100,12 @@ PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditor * menu, TQObject * par a( 0 ), s( 0 ), m( menu ), - separator( FALSE ), - removable( FALSE ) + separator( false ), + removable( false ) { init(); a = new TQAction( this ); - TQObject::connect( a, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( selfDestruct() ) ); + TQObject::connect( a, TQ_SIGNAL( destroyed() ), this, TQ_SLOT( selfDestruct() ) ); } @@ -115,12 +115,12 @@ PopupMenuEditorItem::PopupMenuEditorItem( TQAction * action, PopupMenuEditor * m a( action ), s( 0 ), m( menu ), - separator( FALSE ), - removable( TRUE ) + separator( false ), + removable( true ) { init(); - if ( /*a->name() == "qt_separator_action" ||*/ ::tqqt_cast<QSeparatorAction*>(a) ) - separator = TRUE; + if ( /*a->name() == "qt_separator_action" ||*/ ::tqt_cast<QSeparatorAction*>(a) ) + separator = true; if ( a && !a->childrenListObject().isEmpty() ) a->installEventFilter( this ); } @@ -135,7 +135,7 @@ PopupMenuEditorItem::PopupMenuEditorItem( PopupMenuEditorItem * item, PopupMenuE removable( item->removable ) { init(); - if ( ::tqqt_cast<TQActionGroup*>(a) ) + if ( ::tqt_cast<TQActionGroup*>(a) ) a->installEventFilter( this ); } @@ -147,13 +147,13 @@ PopupMenuEditorItem::~PopupMenuEditorItem() void PopupMenuEditorItem::init() { if ( a ) { - TQObject::connect( a, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( selfDestruct() ) ); + TQObject::connect( a, TQ_SIGNAL( destroyed() ), this, TQ_SLOT( selfDestruct() ) ); if ( m && !isSeparator() ) { s = new PopupMenuEditor( m->formWindow(), m ); TQString n = "PopupMenuEditor"; - m->formWindow()->unify( TQT_TQOBJECT(s), n, TRUE ); + m->formWindow()->unify( s, n, true ); s->setName( n ); - MetaDataBase::addEntry( TQT_TQOBJECT(s) ); + MetaDataBase::addEntry( s ); } } } @@ -175,12 +175,12 @@ void PopupMenuEditorItem::setVisible( bool enable ) bool PopupMenuEditorItem::isVisible() const { - TQActionGroup *g = ::tqqt_cast<TQActionGroup*>(a); + TQActionGroup *g = ::tqt_cast<TQActionGroup*>(a); if ( g ) return ( g->isVisible() && g->usesDropDown() ); else if ( a ) return a->isVisible(); - return FALSE; + return false; } void PopupMenuEditorItem::showMenu( int x, int y ) @@ -212,7 +212,7 @@ int PopupMenuEditorItem::count() const { if ( s ) { return s->count(); - } else if ( ::tqqt_cast<TQActionGroup*>(a) ) { + } else if ( ::tqt_cast<TQActionGroup*>(a) ) { const TQObjectList l = a->childrenListObject(); if ( !l.isEmpty() ) return l.count(); @@ -222,21 +222,21 @@ int PopupMenuEditorItem::count() const bool PopupMenuEditorItem::eventFilter( TQObject * o, TQEvent * event ) { - if ( ! ::tqqt_cast<TQActionGroup*>( o ) ) - return FALSE; + if ( ! ::tqt_cast<TQActionGroup*>( o ) ) + return false; if ( event->type() == TQEvent::ChildInserted ) { TQChildEvent * ce = ( TQChildEvent * ) event; - TQObject * c = TQT_TQOBJECT(ce->child()); - TQAction * action = ::tqqt_cast<TQAction*>( c ); + TQObject * c = ce->child(); + TQAction * action = ::tqt_cast<TQAction*>( c ); if ( s->find( action ) != -1 ) // avoid duplicates - return FALSE; - TQActionGroup * actionGroup = ::tqqt_cast<TQActionGroup*>( c ); + return false; + TQActionGroup * actionGroup = ::tqt_cast<TQActionGroup*>( c ); if ( actionGroup ) s->insert( actionGroup ); else if ( action ) s->insert( action ); } - return FALSE; + return false; } void PopupMenuEditorItem::selfDestruct() @@ -293,7 +293,7 @@ PopupMenuEditor::PopupMenuEditor( FormWindow * fw, PopupMenuEditor * menu, PopupMenuEditor::~PopupMenuEditor() { - itemList.setAutoDelete( TRUE ); + itemList.setAutoDelete( true ); } void PopupMenuEditor::init() @@ -303,8 +303,8 @@ void PopupMenuEditor::init() addItem.action()->setMenuText( i18n("new item") ); addSeparator.action()->setMenuText( i18n("new separator") ); - setAcceptDrops( TRUE ); - setFocusPolicy( TQ_StrongFocus ); + setAcceptDrops( true ); + setFocusPolicy( TQWidget::StrongFocus ); lineEdit = new TQLineEdit( this ); lineEdit->hide(); @@ -357,11 +357,11 @@ void PopupMenuEditor::insert( TQActionGroup * actionGroup, int index ) PopupMenuEditorItem *i = new PopupMenuEditorItem( (TQAction *)actionGroup, this, 0, TQString( actionGroup->name() ) + "Menu" ); TQActionGroup *g = 0; - TQObjectList *l = actionGroup->queryList( TQACTION_OBJECT_NAME_STRING, 0, FALSE, FALSE ); + TQObjectList *l = actionGroup->queryList( "TQAction", 0, false, false ); TQObjectListIterator it( *l ); insert( i, index ); for ( ; it.current(); ++it ) { - g = ::tqqt_cast<TQActionGroup*>(it.current()); + g = ::tqt_cast<TQActionGroup*>(it.current()); if ( g ) { if ( dropdown ) i->s->insert( g ); @@ -566,7 +566,7 @@ void PopupMenuEditor::setAccelerator( int key, TQt::ButtonState state, int index if ( n < 4 ) keys[n] = key | shift | ctrl | alt | meta; a->setAccel( TQKeySequence( keys[0], keys[1], keys[2], keys[3] ) ); - MetaDataBase::setPropertyChanged( a, "accel", TRUE ); + MetaDataBase::setPropertyChanged( a, "accel", true ); resizeToContents(); } @@ -625,7 +625,7 @@ PopupMenuEditorItem * PopupMenuEditor::createItem( TQAction * a ) a = ae->newActionEx(); PopupMenuEditorItem * i = new PopupMenuEditorItem( a, this ); TQString n = TQString( a->name() ) + "Item"; - formWindow()->unify( i, n, FALSE ); + formWindow()->unify( i, n, false ); i->setName( n ); AddActionToPopupCommand * cmd = new AddActionToPopupCommand( i18n( "Add Item" ), formWnd, this, i ); @@ -714,7 +714,7 @@ void PopupMenuEditor::setFocusAt( const TQPoint & pos ) bool PopupMenuEditor::eventFilter( TQObject * o, TQEvent * e ) { - if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(lineEdit) && e->type() == TQEvent::FocusOut ) { + if ( o == lineEdit && e->type() == TQEvent::FocusOut ) { leaveEditMode( 0 ); update(); } @@ -730,7 +730,7 @@ void PopupMenuEditor::paintEvent( TQPaintEvent * ) rect().width() - borderSize * 2, rect().height() - borderSize * 2 ); reg -= mid; p.setClipRegion( reg ); - style().tqdrawPrimitive( TQStyle::PE_PanelPopup, &p, rect(), colorGroup() ); + style().drawPrimitive( TQStyle::PE_PanelPopup, &p, rect(), colorGroup() ); p.restore(); drawItems( &p ); } @@ -748,7 +748,7 @@ void PopupMenuEditor::mouseDoubleClickEvent( TQMouseEvent * ) setFocusAt( mousePressPos ); if ( currentItem() == &addSeparator ) { PopupMenuEditorItem * i = createItem( new QSeparatorAction( 0 ) ); - i->setSeparator( TRUE ); + i->setSeparator( true ); return; } if ( currentField == 0 ) { @@ -761,7 +761,7 @@ void PopupMenuEditor::mouseDoubleClickEvent( TQMouseEvent * ) void PopupMenuEditor::mouseMoveEvent( TQMouseEvent * e ) { - if ( e->state() & Qt::LeftButton ) { + if ( e->state() & TQt::LeftButton ) { if ( ( e->pos() - mousePressPos ).manhattanLength() > 3 ) { draggedItem = itemAt( mousePressPos.y() ); if ( draggedItem == &addItem ) { @@ -772,7 +772,7 @@ void PopupMenuEditor::mouseMoveEvent( TQMouseEvent * e ) // FIXME: start rename after drop } else if ( draggedItem == &addSeparator ) { draggedItem = createItem( new QSeparatorAction( 0 ) ); - draggedItem->setSeparator( TRUE ); + draggedItem->setSeparator( true ); } PopupMenuEditorItemPtrDrag * d = @@ -780,7 +780,7 @@ void PopupMenuEditor::mouseMoveEvent( TQMouseEvent * e ) hideSubMenu(); - draggedItem->setVisible( FALSE ); + draggedItem->setVisible( false ); resizeToContents(); // If the item is dropped in the same list, @@ -792,7 +792,7 @@ void PopupMenuEditor::mouseMoveEvent( TQMouseEvent * e ) d->dragCopy(); // dragevents and stuff happens if ( draggedItem ) { // item was not dropped - draggedItem->setVisible( TRUE ); + draggedItem->setVisible( true ); draggedItem = 0; if ( hasFocus() ) { hideSubMenu(); @@ -800,7 +800,7 @@ void PopupMenuEditor::mouseMoveEvent( TQMouseEvent * e ) showSubMenu(); } } else { // item was dropped - itemList.takeNode( node )->setVisible( TRUE ); + itemList.takeNode( node )->setVisible( true ); if ( currentIndex > 0 && currentIndex > idx ) --currentIndex; // the drop might happen in another menu, so we'll resize @@ -847,7 +847,7 @@ void PopupMenuEditor::dropEvent( TQDropEvent * e ) // Hide the sub menu of the current item, but do it later if ( currentIndex < (int)itemList.count() ) { PopupMenuEditor *s = itemList.at( currentIndex )->s; - TQTimer::singleShot( 0, s, TQT_SLOT( hide() ) ); + TQTimer::singleShot( 0, s, TQ_SLOT( hide() ) ); } draggedItem = 0; @@ -857,16 +857,16 @@ void PopupMenuEditor::dropEvent( TQDropEvent * e ) PopupMenuEditorItemPtrDrag::decode( e, &i ); } else { if ( e->provides( "application/x-designer-actiongroup" ) ) { - TQActionGroup * g = ::tqqt_cast<QDesignerActionGroup*>(ActionDrag::action()); + TQActionGroup * g = ::tqt_cast<QDesignerActionGroup*>(ActionDrag::action()); if ( g->usesDropDown() ) { i = new PopupMenuEditorItem( g, this ); TQString n = TQString( g->name() ) + "Item"; - formWindow()->unify( i, n, FALSE ); + formWindow()->unify( i, n, false ); i->setName( n ); - TQObjectList *l = g->queryList( TQACTION_OBJECT_NAME_STRING, 0, FALSE, FALSE ); + TQObjectList *l = g->queryList( "TQAction", 0, false, false ); TQObjectListIterator it( *l ); for ( ; it.current(); ++it ) { - g = ::tqqt_cast<TQActionGroup*>(it.current()); + g = ::tqt_cast<TQActionGroup*>(it.current()); if ( g ) i->s->insert( g ); else @@ -877,18 +877,18 @@ void PopupMenuEditor::dropEvent( TQDropEvent * e ) dropInPlace( g, e->pos().y() ); } } else if ( e->provides( "application/x-designer-actions" ) ) { - TQAction *a = ::tqqt_cast<QDesignerAction*>(ActionDrag::action()); + TQAction *a = ::tqt_cast<QDesignerAction*>(ActionDrag::action()); i = new PopupMenuEditorItem( a, this ); } } if ( i ) { dropInPlace( i, e->pos().y() ); - TQTimer::singleShot( 0, this, TQT_SLOT( resizeToContents() ) ); + TQTimer::singleShot( 0, this, TQ_SLOT( resizeToContents() ) ); } - TQTimer::singleShot( 0, this, TQT_SLOT( showSubMenu() ) ); - TQTimer::singleShot( 0, this, TQT_SLOT( setFocus() ) ); + TQTimer::singleShot( 0, this, TQ_SLOT( showSubMenu() ) ); + TQTimer::singleShot( 0, this, TQ_SLOT( setFocus() ) ); dropLine->hide(); e->accept(); } @@ -1012,12 +1012,12 @@ void PopupMenuEditor::focusInEvent( TQFocusEvent * ) void PopupMenuEditor::focusOutEvent( TQFocusEvent * ) { TQWidget * fw = tqApp->focusWidget(); - if ( !fw || ( !::tqqt_cast<PopupMenuEditor*>(fw) && fw != lineEdit ) ) { + if ( !fw || ( !::tqt_cast<PopupMenuEditor*>(fw) && fw != lineEdit ) ) { hideSubMenu(); - if ( fw && ::tqqt_cast<MenuBarEditor*>(fw) ) + if ( fw && ::tqt_cast<MenuBarEditor*>(fw) ) return; TQWidget * w = this; - while ( w && w != fw && ::tqqt_cast<PopupMenuEditor*>(w) ) { // hide all popups + while ( w && w != fw && ::tqt_cast<PopupMenuEditor*>(w) ) { // hide all popups w->hide(); w = ((PopupMenuEditor *)w)->parentEditor(); } @@ -1034,7 +1034,7 @@ void PopupMenuEditor::drawItem( TQPainter * p, PopupMenuEditorItem * i, p->fillRect( r, colorGroup().brush( TQColorGroup::Background ) ); if ( i->isSeparator() ) { - style().tqdrawPrimitive( TQStyle::PE_Separator, p, + style().drawPrimitive( TQStyle::PE_Separator, p, TQRect( r.x(), r.y() + 2, r.width(), 1 ), colorGroup(), TQStyle::Style_Sunken | f ); return; @@ -1042,7 +1042,7 @@ void PopupMenuEditor::drawItem( TQPainter * p, PopupMenuEditorItem * i, const TQAction * a = i->action(); if ( a->isToggleAction() && a->isOn() ) { - style().tqdrawPrimitive( TQStyle::PE_CheckMark, p, + style().drawPrimitive( TQStyle::PE_CheckMark, p, TQRect( x , y, iconWidth, h ), colorGroup(), f ); } else { @@ -1064,7 +1064,7 @@ void PopupMenuEditor::drawItem( TQPainter * p, PopupMenuEditorItem * i, TQPainter::AlignLeft | TQPainter::AlignVCenter, a->accel() ); if ( i->count() ) // Item has submenu - style().tqdrawPrimitive( TQStyle::PE_ArrowRight, p, + style().drawPrimitive( TQStyle::PE_ArrowRight, p, TQRect( r.width() - arrowWidth, r.y(), arrowWidth, r.height() ), colorGroup(), f ); } @@ -1243,8 +1243,8 @@ void PopupMenuEditor::dropInPlace( TQActionGroup * g, int y ) if (l.isEmpty()) return; for ( int i = 0; i < (int)l.count(); ++i ) { - TQAction *a = ::tqqt_cast<TQAction*>(l.at(i)); - TQActionGroup *g = ::tqqt_cast<TQActionGroup*>(l.at(i)); + TQAction *a = ::tqt_cast<TQAction*>(l.at(i)); + TQActionGroup *g = ::tqt_cast<TQActionGroup*>(l.at(i)); if ( g ) dropInPlace( g, y ); else if ( a ) @@ -1416,10 +1416,10 @@ void PopupMenuEditor::leaveEditMode( TQKeyEvent * e ) a->setMenuText( menuText ); i = createItem( a ); TQString n = constructName( i ); - formWindow()->unify( a, n, TRUE ); + formWindow()->unify( a, n, true ); a->setName( n ); MetaDataBase::addEntry( a ); - MetaDataBase::setPropertyChanged( a, "menuText", TRUE ); + MetaDataBase::setPropertyChanged( a, "menuText", true ); ActionEditor *ae = (ActionEditor*)formWindow()->mainWindow()->child( 0, "ActionEditor" ); if ( ae ) ae->updateActionName( a ); @@ -1449,13 +1449,13 @@ TQString PopupMenuEditor::constructName( PopupMenuEditorItem *item ) TQString s; TQString name = item->action()->menuText(); TQWidget *e = parentEditor(); - PopupMenuEditor *p = ::tqqt_cast<PopupMenuEditor*>(e); + PopupMenuEditor *p = ::tqt_cast<PopupMenuEditor*>(e); if ( p ) { int idx = p->find( item->m ); PopupMenuEditorItem * i = ( idx > -1 ? p->at( idx ) : 0 ); s = ( i ? TQString( i->action()->name() ).remove( "Action" ) : TQString( "" ) ); } else { - MenuBarEditor *b = ::tqqt_cast<MenuBarEditor*>(e); + MenuBarEditor *b = ::tqt_cast<MenuBarEditor*>(e); if ( b ) { int idx = b->findItem( item->m ); MenuBarEditorItem * i = ( idx > -1 ? b->item( idx ) : 0 ); |