From 5f5e7c5455d52826b0bd50f64fcffb7695ce970d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sat, 29 Jun 2013 12:56:53 +0200 Subject: Initial TQt conversion --- src/valuewidget.cpp | 100 ++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'src/valuewidget.cpp') diff --git a/src/valuewidget.cpp b/src/valuewidget.cpp index 1455a9e..fdbba3a 100644 --- a/src/valuewidget.cpp +++ b/src/valuewidget.cpp @@ -17,11 +17,11 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -34,16 +34,16 @@ namespace KBibTeX { - QDialog::DialogCode ValueWidget::execute( const QString& title, BibTeX::EntryField::FieldType fieldType, BibTeX::Value *value, bool isReadOnly, QWidget *parent, const char *name ) + TQDialog::DialogCode ValueWidget::execute( const TQString& title, BibTeX::EntryField::FieldType fieldType, BibTeX::Value *value, bool isReadOnly, TQWidget *parent, const char *name ) { - KDialogBase * dlg = new KDialogBase( parent, name, TRUE, QString( i18n( "Edit field '%1'" ) ).arg( title ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, TRUE ); + KDialogBase * dlg = new KDialogBase( parent, name, TRUE, TQString( i18n( "Edit field '%1'" ) ).arg( title ), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, TRUE ); ValueWidget* valueWidget = new ValueWidget( fieldType, value, isReadOnly, dlg, "kbibtexvaluewidget" ); dlg->setMainWidget( valueWidget ); connect( dlg, SIGNAL( okClicked() ), valueWidget, SLOT( apply() ) ); - QDialog::DialogCode result = ( QDialog::DialogCode )dlg->exec(); - if ( isReadOnly ) result = QDialog::Rejected; + TQDialog::DialogCode result = ( TQDialog::DialogCode )dlg->exec(); + if ( isReadOnly ) result = TQDialog::Rejected; delete( valueWidget ); delete( dlg ); @@ -51,8 +51,8 @@ namespace KBibTeX return result; } - ValueWidget::ValueWidget( BibTeX::EntryField::FieldType fieldType, BibTeX::Value *value, bool isReadOnly, QWidget *parent, const char *name ) - : QWidget( parent, name ), m_fieldType( fieldType ), m_value( value ), m_newValueCounter( 0 ), m_isReadOnly( isReadOnly ) + ValueWidget::ValueWidget( BibTeX::EntryField::FieldType fieldType, BibTeX::Value *value, bool isReadOnly, TQWidget *parent, const char *name ) + : TQWidget( parent, name ), m_fieldType( fieldType ), m_value( value ), m_newValueCounter( 0 ), m_isReadOnly( isReadOnly ) { setupGUI(); reset(); @@ -65,12 +65,12 @@ namespace KBibTeX // nothing } - void ValueWidget::applyList( QStringList& list ) + void ValueWidget::applyList( TQStringList& list ) { if ( m_fieldType == BibTeX::EntryField::ftKeywords ) { BibTeX::KeywordContainer *container = new BibTeX::KeywordContainer(); - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) container->keywords.append( new BibTeX::Keyword( *it ) ); m_value->items.append( container ); } @@ -78,13 +78,13 @@ namespace KBibTeX { Settings * settings = Settings::self(); BibTeX::PersonContainer *container = new BibTeX::PersonContainer(); - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) container->persons.append( new BibTeX::Person( *it, settings->editing_FirstNameFirst ) ); m_value->items.append( container ); } else { - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) m_value->items.append( new BibTeX::PlainText( *it ) ); } @@ -95,15 +95,15 @@ namespace KBibTeX { if ( m_isReadOnly ) return; - QStringList list; + TQStringList list; m_value->items.clear(); - QListViewItem *item = m_listViewValue->firstChild(); + TQListViewItem *item = m_listViewValue->firstChild(); while ( item != NULL ) { - QCheckListItem * checkItem = dynamic_cast( item ); - QString text = checkItem->text( 0 ); + TQCheckListItem * checkItem = dynamic_cast( item ); + TQString text = checkItem->text( 0 ); - if ( checkItem->state() == QCheckListItem::On ) + if ( checkItem->state() == TQCheckListItem::On ) { if ( !list.isEmpty() ) applyList( list ); m_value->items.append( new BibTeX::MacroKey( text ) ); @@ -121,21 +121,21 @@ namespace KBibTeX { m_listViewValue->clear(); - QCheckListItem *after = NULL; - for ( QValueList::ConstIterator it = m_value->items.begin(); it != m_value->items.end(); ++it ) + TQCheckListItem *after = NULL; + for ( TQValueList::ConstIterator it = m_value->items.begin(); it != m_value->items.end(); ++it ) { BibTeX::MacroKey *macroKey = dynamic_cast( *it ); - QCheckListItem *item = new QCheckListItem( m_listViewValue, after, ( *it )->text(), QCheckListItem::CheckBox ); + TQCheckListItem *item = new TQCheckListItem( m_listViewValue, after, ( *it )->text(), TQCheckListItem::CheckBox ); after = item; - item->setState( macroKey != NULL ? QCheckListItem::On : QCheckListItem::Off ); + item->setState( macroKey != NULL ? TQCheckListItem::On : TQCheckListItem::Off ); item->setRenameEnabled( 0, !m_isReadOnly ); } } void ValueWidget::slotAdd() { - QCheckListItem * item = new QCheckListItem( m_listViewValue, m_listViewValue->lastItem(), QString( i18n( "May only contain ASCII characters, in case of doubt keep English form", "NewValue%1" ) ).arg( m_newValueCounter++ ), QCheckListItem::CheckBox ); - item->setState( QCheckListItem::Off ); + TQCheckListItem * item = new TQCheckListItem( m_listViewValue, m_listViewValue->lastItem(), TQString( i18n( "May only contain ASCII characters, in case of doubt keep English form", "NewValue%1" ) ).arg( m_newValueCounter++ ), TQCheckListItem::CheckBox ); + item->setState( TQCheckListItem::Off ); item->setRenameEnabled( 0, !m_isReadOnly ); m_listViewValue->setSelected( item, TRUE ); slotEdit(); @@ -143,17 +143,17 @@ namespace KBibTeX void ValueWidget::slotEdit() { - QListViewItem * item = m_listViewValue->selectedItem(); + TQListViewItem * item = m_listViewValue->selectedItem(); if ( item != NULL ) item->startRename( 0 ); } void ValueWidget::slotToggle() { - QListViewItem * item = m_listViewValue->selectedItem(); + TQListViewItem * item = m_listViewValue->selectedItem(); if ( item != NULL ) { - QCheckListItem * checkItem = dynamic_cast( item ); + TQCheckListItem * checkItem = dynamic_cast( item ); if ( checkItem != NULL ) checkItem->setOn( !checkItem->isOn() ); } @@ -161,7 +161,7 @@ namespace KBibTeX void ValueWidget::slotDelete() { - QListViewItem * item = m_listViewValue->selectedItem(); + TQListViewItem * item = m_listViewValue->selectedItem(); if ( item != NULL ) delete item; updateGUI(); @@ -169,7 +169,7 @@ namespace KBibTeX void ValueWidget::slotUp() { - QListViewItem * item = m_listViewValue->selectedItem(); + TQListViewItem * item = m_listViewValue->selectedItem(); if ( item != NULL && item -> itemAbove() != NULL ) { item->itemAbove() ->moveItem( item ); @@ -179,7 +179,7 @@ namespace KBibTeX void ValueWidget::slotDown() { - QListViewItem * item = m_listViewValue->selectedItem(); + TQListViewItem * item = m_listViewValue->selectedItem(); if ( item != NULL && item -> itemBelow() != NULL ) { item->moveItem( item->itemBelow() ); @@ -199,15 +199,15 @@ namespace KBibTeX void ValueWidget::setupGUI() { - QGridLayout * layout = new QGridLayout( this, 8, 2, 0, KDialog::spacingHint() ); + TQGridLayout * layout = new TQGridLayout( this, 8, 2, 0, KDialog::spacingHint() ); layout->setRowStretch( 7, 1 ); - QLabel *label = new QLabel( i18n( "Checked entries are string keys, unchecked entries are quoted text." ), this ); + TQLabel *label = new TQLabel( i18n( "Checked entries are string keys, unchecked entries are quoted text." ), this ); layout->addWidget( label, 0, 0 ); - m_listViewValue = new QListView( this ); + m_listViewValue = new TQListView( this ); layout->addMultiCellWidget( m_listViewValue, 1, 7, 0, 0 ); - m_listViewValue->setDefaultRenameAction( m_isReadOnly ? QListView::Reject : QListView::Accept ); + m_listViewValue->setDefaultRenameAction( m_isReadOnly ? TQListView::Reject : TQListView::Accept ); m_listViewValue->addColumn( i18n( "Text" ) ); m_listViewValue->setSorting( -1, TRUE ); m_listViewValue->setAllColumnsShowFocus( TRUE ); @@ -215,38 +215,38 @@ namespace KBibTeX m_listViewValue->header() ->setStretchEnabled( TRUE, 0 ); m_listViewValue->setEnabled( !m_isReadOnly ); connect( m_listViewValue, SIGNAL( selectionChanged() ), this, SLOT( updateGUI() ) ); - connect( m_listViewValue, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( updateGUI() ) ); - connect( m_listViewValue, SIGNAL( currentChanged( QListViewItem * ) ), this, SLOT( updateGUI() ) ); + connect( m_listViewValue, SIGNAL( clicked( TQListViewItem * ) ), this, SLOT( updateGUI() ) ); + connect( m_listViewValue, SIGNAL( currentChanged( TQListViewItem * ) ), this, SLOT( updateGUI() ) ); - m_pushButtonAdd = new QPushButton( i18n( "Add" ), this ); + m_pushButtonAdd = new TQPushButton( i18n( "Add" ), this ); layout->addWidget( m_pushButtonAdd, 1, 1 ); - m_pushButtonAdd->setIconSet( QIconSet( SmallIcon( "add" ) ) ); + m_pushButtonAdd->setIconSet( TQIconSet( SmallIcon( "add" ) ) ); m_pushButtonAdd->setEnabled( !m_isReadOnly ); connect( m_pushButtonAdd, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); - m_pushButtonEdit = new QPushButton( i18n( "Edit" ), this ); + m_pushButtonEdit = new TQPushButton( i18n( "Edit" ), this ); layout->addWidget( m_pushButtonEdit, 2, 1 ); - m_pushButtonEdit->setIconSet( QIconSet( SmallIcon( "edit" ) ) ); + m_pushButtonEdit->setIconSet( TQIconSet( SmallIcon( "edit" ) ) ); connect( m_pushButtonEdit, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); - m_pushButtonToggle = new QPushButton( i18n( "Toggle" ), this ); + m_pushButtonToggle = new TQPushButton( i18n( "Toggle" ), this ); layout->addWidget( m_pushButtonToggle, 3, 1 ); - m_pushButtonToggle->setIconSet( QIconSet( SmallIcon( "flag" ) ) ); + m_pushButtonToggle->setIconSet( TQIconSet( SmallIcon( "flag" ) ) ); connect( m_pushButtonToggle, SIGNAL( clicked() ), this, SLOT( slotToggle() ) ); - m_pushButtonDelete = new QPushButton( i18n( "Delete" ), this ); + m_pushButtonDelete = new TQPushButton( i18n( "Delete" ), this ); layout->addWidget( m_pushButtonDelete, 4, 1 ); - m_pushButtonDelete->setIconSet( QIconSet( SmallIcon( "editdelete" ) ) ); + m_pushButtonDelete->setIconSet( TQIconSet( SmallIcon( "editdelete" ) ) ); connect( m_pushButtonDelete, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); - m_pushButtonUp = new QPushButton( i18n( "Up" ), this ); + m_pushButtonUp = new TQPushButton( i18n( "Up" ), this ); layout->addWidget( m_pushButtonUp, 5, 1 ); - m_pushButtonUp->setIconSet( QIconSet( SmallIcon( "up" ) ) ); + m_pushButtonUp->setIconSet( TQIconSet( SmallIcon( "up" ) ) ); connect( m_pushButtonUp, SIGNAL( clicked() ), this, SLOT( slotUp() ) ); - m_pushButtonDown = new QPushButton( i18n( "Down" ), this ); + m_pushButtonDown = new TQPushButton( i18n( "Down" ), this ); layout->addWidget( m_pushButtonDown, 6, 1 ); - m_pushButtonDown->setIconSet( QIconSet( SmallIcon( "down" ) ) ); + m_pushButtonDown->setIconSet( TQIconSet( SmallIcon( "down" ) ) ); connect( m_pushButtonDown, SIGNAL( clicked() ), this, SLOT( slotDown() ) ); } -- cgit v1.2.3