diff options
author | Slávek Banko <[email protected]> | 2013-06-29 12:56:53 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2013-07-04 03:11:35 +0200 |
commit | 5f5e7c5455d52826b0bd50f64fcffb7695ce970d (patch) | |
tree | c8ee8792d3fb139365abbf70c2255f1e69d2aa34 /src/fieldlistview.cpp | |
parent | 251c9a439759c830d34c70683d0fc9454d703010 (diff) | |
download | kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.tar.gz kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.zip |
Initial TQt conversion
Diffstat (limited to 'src/fieldlistview.cpp')
-rw-r--r-- | src/fieldlistview.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/src/fieldlistview.cpp b/src/fieldlistview.cpp index 62ba8a6..edb21a4 100644 --- a/src/fieldlistview.cpp +++ b/src/fieldlistview.cpp @@ -17,15 +17,15 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include <qstring.h> -#include <qregexp.h> -#include <qlayout.h> -#include <qheader.h> -#include <qtimer.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qpushbutton.h> -#include <qcheckbox.h> +#include <ntqstring.h> +#include <ntqregexp.h> +#include <ntqlayout.h> +#include <ntqheader.h> +#include <ntqtimer.h> +#include <ntqtooltip.h> +#include <ntqwhatsthis.h> +#include <ntqpushbutton.h> +#include <ntqcheckbox.h> #include <klistview.h> #include <klineedit.h> @@ -42,8 +42,8 @@ namespace KBibTeX { - FieldListView::FieldListView( const QString& caption, const QString& prefixNew, bool isReadOnly, QWidget *parent, const char *name ) - : QWidget( parent, name ), m_value( new BibTeX::Value() ), m_caption( caption ), m_prefixNew( prefixNew ), m_isReadOnly( isReadOnly ), m_enabled( TRUE ), m_isComplex( FALSE ), m_isModified( FALSE ), m_newValueCounter( 0 ), m_fieldType( BibTeX::EntryField::ftUnknown ) + FieldListView::FieldListView( const TQString& caption, const TQString& prefixNew, bool isReadOnly, TQWidget *parent, const char *name ) + : TQWidget( parent, name ), m_value( new BibTeX::Value() ), m_caption( caption ), m_prefixNew( prefixNew ), m_isReadOnly( isReadOnly ), m_enabled( TRUE ), m_isComplex( FALSE ), m_isModified( FALSE ), m_newValueCounter( 0 ), m_fieldType( BibTeX::EntryField::ftUnknown ) { setupGUI(); m_listViewElements->installEventFilter( this ); @@ -97,13 +97,13 @@ namespace KBibTeX Settings * settings = Settings::self(); m_listViewElements->renameLineEdit() ->setCompletionObject( settings->completion( m_fieldType ) ); - QToolTip::add( m_listViewElements, QString( i18n( "BibTeX field '%1'" ) ).arg( BibTeX::EntryField::fieldTypeToString( fieldType ) ) ); - QWhatsThis::add( m_listViewElements, QString( i18n( "BibTeX field '%1'" ) ).arg( BibTeX::EntryField::fieldTypeToString( fieldType ) ) ); + TQToolTip::add( m_listViewElements, TQString( i18n( "BibTeX field '%1'" ) ).arg( BibTeX::EntryField::fieldTypeToString( fieldType ) ) ); + TQWhatsThis::add( m_listViewElements, TQString( i18n( "BibTeX field '%1'" ) ).arg( BibTeX::EntryField::fieldTypeToString( fieldType ) ) ); m_value->items.clear(); } - QString FieldListView::caption() + TQString FieldListView::caption() { return m_caption; } @@ -118,16 +118,16 @@ namespace KBibTeX return m_isModified; } - bool FieldListView::eventFilter( QObject *o, QEvent * e ) + bool FieldListView::eventFilter( TQObject *o, TQEvent * e ) { if ( o == m_listViewElements->renameLineEdit() ) { - if ( e->type() == QEvent::Hide ) + if ( e->type() == TQEvent::Hide ) itemRenameDone(); } - else if ( e->type() == QEvent::AccelOverride ) + else if ( e->type() == TQEvent::AccelOverride ) { - QKeyEvent * ke = static_cast<QKeyEvent*>( e ); + TQKeyEvent * ke = static_cast<TQKeyEvent*>( e ); //override delete action if ( ke->key() == Key_Delete && ke->state() == NoButton ) { @@ -201,10 +201,10 @@ namespace KBibTeX { if ( isSimple() ) { - KListViewItem * item = new KListViewItem( m_listViewElements, m_listViewElements->lastItem(), QString( "%1%2" ).arg( m_prefixNew ).arg( ++m_newValueCounter ) ); + KListViewItem * item = new KListViewItem( m_listViewElements, m_listViewElements->lastItem(), TQString( "%1%2" ).arg( m_prefixNew ).arg( ++m_newValueCounter ) ); m_listViewElements->setSelected( item, TRUE ); updateGUI(); - QTimer::singleShot( 100, this, SLOT( slotEdit() ) ); + TQTimer::singleShot( 100, this, SLOT( slotEdit() ) ); } } @@ -220,7 +220,7 @@ namespace KBibTeX void FieldListView::slotDelete() { - QListViewItem * item = m_listViewElements->selectedItem(); + TQListViewItem * item = m_listViewElements->selectedItem(); if ( isSimple() && item != NULL ) { delete item; @@ -233,7 +233,7 @@ namespace KBibTeX void FieldListView::slotUp() { - QListViewItem * item = m_listViewElements->selectedItem(); + TQListViewItem * item = m_listViewElements->selectedItem(); if ( isSimple() && !m_listViewElements->isRenaming() && item != NULL && item -> itemAbove() != NULL ) { item->itemAbove() ->moveItem( item ); @@ -246,7 +246,7 @@ namespace KBibTeX void FieldListView::slotDown() { - QListViewItem * item = m_listViewElements->selectedItem(); + TQListViewItem * item = m_listViewElements->selectedItem(); if ( isSimple() && !m_listViewElements->isRenaming() && item != NULL && item -> itemBelow() != NULL ) { item->moveItem( item->itemBelow() ); @@ -259,7 +259,7 @@ namespace KBibTeX void FieldListView::slotComplex() { - if ( !m_listViewElements->isRenaming() && ValueWidget::execute( m_caption, m_fieldType, m_value, m_isReadOnly, this ) == QDialog::Accepted ) + if ( !m_listViewElements->isRenaming() && ValueWidget::execute( m_caption, m_fieldType, m_value, m_isReadOnly, this ) == TQDialog::Accepted ) { reset(); updateGUI(); @@ -268,13 +268,13 @@ namespace KBibTeX } } - void FieldListView::slotListViewDoubleClicked( QListViewItem * lvi ) + void FieldListView::slotListViewDoubleClicked( TQListViewItem * lvi ) { if ( lvi == NULL ) slotAdd(); } - void FieldListView::slotItemRenamed( QListViewItem * item, int /*col*/, const QString & text ) + void FieldListView::slotItemRenamed( TQListViewItem * item, int /*col*/, const TQString & text ) { if ( text.isEmpty() && isSimple() && item != NULL ) { @@ -290,7 +290,7 @@ namespace KBibTeX { Settings * settings = Settings::self(); - QGridLayout * layout = new QGridLayout( this, 8, 2, 0, KDialog::spacingHint() ); + TQGridLayout * layout = new TQGridLayout( this, 8, 2, 0, KDialog::spacingHint() ); layout->setRowStretch( 5, 1 ); m_listViewElements = new KListView( this ); @@ -298,7 +298,7 @@ namespace KBibTeX m_listViewElements->renameLineEdit() ->setCompletionObject( settings->completion( m_fieldType ) ); m_listViewElements->renameLineEdit() ->setCompletionMode( KGlobalSettings::CompletionPopup ); m_listViewElements->renameLineEdit() ->completionObject() ->setIgnoreCase( true ); - m_listViewElements->setDefaultRenameAction( QListView::Accept ); + m_listViewElements->setDefaultRenameAction( TQListView::Accept ); m_listViewElements->addColumn( m_caption ); m_listViewElements->setSorting( -1, TRUE ); m_listViewElements->setItemsRenameable( TRUE ); @@ -309,62 +309,62 @@ namespace KBibTeX m_listViewElements->header() ->setClickEnabled( FALSE ); m_listViewElements->header() ->setStretchEnabled( TRUE, 0 ); connect( m_listViewElements, SIGNAL( selectionChanged() ), this, SLOT( updateGUI() ) ); - connect( m_listViewElements, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( updateGUI() ) ); - connect( m_listViewElements, SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( slotListViewDoubleClicked( QListViewItem * ) ) ); - connect( m_listViewElements, SIGNAL( currentChanged( QListViewItem * ) ), this, SLOT( updateGUI() ) ); - connect( m_listViewElements, SIGNAL( itemRenamed( QListViewItem*, int, const QString& ) ), this, SLOT( slotItemRenamed( QListViewItem*, int, const QString& ) ) ); + connect( m_listViewElements, SIGNAL( clicked( TQListViewItem * ) ), this, SLOT( updateGUI() ) ); + connect( m_listViewElements, SIGNAL( doubleClicked( TQListViewItem * ) ), this, SLOT( slotListViewDoubleClicked( TQListViewItem * ) ) ); + connect( m_listViewElements, SIGNAL( currentChanged( TQListViewItem * ) ), this, SLOT( updateGUI() ) ); + connect( m_listViewElements, SIGNAL( itemRenamed( TQListViewItem*, int, const TQString& ) ), this, SLOT( slotItemRenamed( TQListViewItem*, int, const TQString& ) ) ); - m_pushButtonAdd = new QPushButton( i18n( "Add" ), this ); + m_pushButtonAdd = new TQPushButton( i18n( "Add" ), this ); layout->addWidget( m_pushButtonAdd, 0, 1 ); - m_pushButtonAdd->setIconSet( QIconSet( SmallIcon( "add" ) ) ); + m_pushButtonAdd->setIconSet( TQIconSet( SmallIcon( "add" ) ) ); connect( m_pushButtonAdd, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); - QToolTip::add( m_pushButtonAdd, QString( i18n( "Add new '%1' item (Ctrl+A)" ) ).arg( m_caption ) ); + TQToolTip::add( m_pushButtonAdd, TQString( i18n( "Add new '%1' item (Ctrl+A)" ) ).arg( m_caption ) ); - m_pushButtonEdit = new QPushButton( i18n( "Edit" ), this ); + m_pushButtonEdit = new TQPushButton( i18n( "Edit" ), this ); layout->addWidget( m_pushButtonEdit, 1, 1 ); - m_pushButtonEdit->setIconSet( QIconSet( SmallIcon( "edit" ) ) ); + m_pushButtonEdit->setIconSet( TQIconSet( SmallIcon( "edit" ) ) ); connect( m_pushButtonEdit, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); - QToolTip::add( m_pushButtonEdit, QString( i18n( "Edit current '%1' item (F2)" ) ).arg( m_caption ) ); + TQToolTip::add( m_pushButtonEdit, TQString( i18n( "Edit current '%1' item (F2)" ) ).arg( m_caption ) ); - m_pushButtonDelete = new QPushButton( i18n( "Delete" ), this ); + m_pushButtonDelete = new TQPushButton( i18n( "Delete" ), this ); layout->addWidget( m_pushButtonDelete, 2, 1 ); - m_pushButtonDelete->setIconSet( QIconSet( SmallIcon( "editdelete" ) ) ); + m_pushButtonDelete->setIconSet( TQIconSet( SmallIcon( "editdelete" ) ) ); connect( m_pushButtonDelete, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); - QToolTip::add( m_pushButtonDelete, QString( i18n( "Delete current '%1' item (Del)" ) ).arg( m_caption ) ); + TQToolTip::add( m_pushButtonDelete, TQString( i18n( "Delete current '%1' item (Del)" ) ).arg( m_caption ) ); - m_pushButtonUp = new QPushButton( i18n( "Up" ), this ); + m_pushButtonUp = new TQPushButton( i18n( "Up" ), this ); layout->addWidget( m_pushButtonUp, 3, 1 ); - m_pushButtonUp->setIconSet( QIconSet( SmallIcon( "up" ) ) ); + m_pushButtonUp->setIconSet( TQIconSet( SmallIcon( "up" ) ) ); connect( m_pushButtonUp, SIGNAL( clicked() ), this, SLOT( slotUp() ) ); - QToolTip::add( m_pushButtonUp, QString( i18n( "Move current '%1' item up (Ctrl+Up)" ) ).arg( m_caption ) ); + TQToolTip::add( m_pushButtonUp, TQString( i18n( "Move current '%1' item up (Ctrl+Up)" ) ).arg( m_caption ) ); - m_pushButtonDown = new QPushButton( i18n( "Down" ), this ); + m_pushButtonDown = new TQPushButton( i18n( "Down" ), this ); layout->addWidget( m_pushButtonDown, 4, 1 ); - m_pushButtonDown->setIconSet( QIconSet( SmallIcon( "down" ) ) ); + m_pushButtonDown->setIconSet( TQIconSet( SmallIcon( "down" ) ) ); connect( m_pushButtonDown, SIGNAL( clicked() ), this, SLOT( slotDown() ) ); - QToolTip::add( m_pushButtonDown, QString( i18n( "Move current '%1' item down (Ctrl+Down)" ) ).arg( m_caption ) ); + TQToolTip::add( m_pushButtonDown, TQString( i18n( "Move current '%1' item down (Ctrl+Down)" ) ).arg( m_caption ) ); - m_pushButtonComplexEdit = new QPushButton( i18n( "Complex..." ), this ); + m_pushButtonComplexEdit = new TQPushButton( i18n( "Complex..." ), this ); layout->addWidget( m_pushButtonComplexEdit, 6, 1 ); - m_pushButtonComplexEdit->setIconSet( QIconSet( SmallIcon( "leftjust" ) ) ); + m_pushButtonComplexEdit->setIconSet( TQIconSet( SmallIcon( "leftjust" ) ) ); connect( m_pushButtonComplexEdit, SIGNAL( clicked() ), this, SLOT( slotComplex() ) ); - QToolTip::add( m_pushButtonComplexEdit, QString( i18n( "Edit current '%1' item as a concatenated string (Ctrl+Alt+C)" ) ).arg( m_caption ) ); + TQToolTip::add( m_pushButtonComplexEdit, TQString( i18n( "Edit current '%1' item as a concatenated string (Ctrl+Alt+C)" ) ).arg( m_caption ) ); - m_checkBoxEtAl = new QCheckBox( i18n( "... and others (et al.)" ), this ); + m_checkBoxEtAl = new TQCheckBox( i18n( "... and others (et al.)" ), this ); layout->addMultiCellWidget( m_checkBoxEtAl, 7, 7, 0, 1 ); connect( m_checkBoxEtAl, SIGNAL( toggled( bool ) ), this, SLOT( apply() ) ); } void FieldListView::apply() { - QStringList elements; + TQStringList elements; Settings * settings = Settings::self(); m_value->items.clear(); - for ( QListViewItemIterator it( m_listViewElements ); it.current(); it++ ) + for ( TQListViewItemIterator it( m_listViewElements ); it.current(); it++ ) { - QString text = it.current() ->text( 0 ); + TQString text = it.current() ->text( 0 ); elements.append( text ); } @@ -378,7 +378,7 @@ namespace KBibTeX case BibTeX::EntryField::ftAuthor: case BibTeX::EntryField::ftEditor: { - for ( QStringList::ConstIterator it = elements.constBegin(); it != elements.constEnd(); ++it ) + for ( TQStringList::ConstIterator it = elements.constBegin(); it != elements.constEnd(); ++it ) { BibTeX::Person *person = new BibTeX::Person( *it, settings->editing_FirstNameFirst ); container->persons.append( person ); @@ -408,7 +408,7 @@ namespace KBibTeX m_checkBoxEtAl->setChecked( FALSE ); m_isComplex = FALSE; - for ( QValueList<BibTeX::ValueItem*>::ConstIterator it = m_value->items.constBegin(); !m_isComplex && it != m_value->items.constEnd(); ++it ) + for ( TQValueList<BibTeX::ValueItem*>::ConstIterator it = m_value->items.constBegin(); !m_isComplex && it != m_value->items.constEnd(); ++it ) { BibTeX::MacroKey *macroKey = dynamic_cast<BibTeX::MacroKey *>( *it ); m_isComplex = macroKey != NULL; @@ -420,17 +420,17 @@ namespace KBibTeX case BibTeX::EntryField::ftAuthor: case BibTeX::EntryField::ftEditor: { - for ( QValueList<BibTeX::ValueItem*>::ConstIterator it = m_value->items.constBegin(); it != m_value->items.constEnd(); ++it ) + for ( TQValueList<BibTeX::ValueItem*>::ConstIterator it = m_value->items.constBegin(); it != m_value->items.constEnd(); ++it ) { BibTeX::PersonContainer *container = dynamic_cast<BibTeX::PersonContainer *>( *it ); if ( container != NULL ) - for ( QValueList<BibTeX::Person*>::ConstIterator pit = container->persons.constBegin(); pit != container->persons.constEnd(); ++pit ) + for ( TQValueList<BibTeX::Person*>::ConstIterator pit = container->persons.constBegin(); pit != container->persons.constEnd(); ++pit ) { - QString text = ( *pit )->text(); + TQString text = ( *pit )->text(); if ( text == "others" ) m_checkBoxEtAl->setChecked( TRUE ); else - new QListViewItem( m_listViewElements, m_listViewElements->lastItem(), text ); + new TQListViewItem( m_listViewElements, m_listViewElements->lastItem(), text ); } } } |