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/settingsidsuggestions.cpp | |
parent | 251c9a439759c830d34c70683d0fc9454d703010 (diff) | |
download | kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.tar.gz kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.zip |
Initial TQt conversion
Diffstat (limited to 'src/settingsidsuggestions.cpp')
-rw-r--r-- | src/settingsidsuggestions.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/settingsidsuggestions.cpp b/src/settingsidsuggestions.cpp index 7d53327..af41919 100644 --- a/src/settingsidsuggestions.cpp +++ b/src/settingsidsuggestions.cpp @@ -17,12 +17,12 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include <qlayout.h> -#include <qcheckbox.h> -#include <qtimer.h> -#include <qvalidator.h> -#include <qheader.h> -#include <qlabel.h> +#include <ntqlayout.h> +#include <ntqcheckbox.h> +#include <ntqtimer.h> +#include <ntqvalidator.h> +#include <ntqheader.h> +#include <ntqlabel.h> #include <kinputdialog.h> #include <klistview.h> @@ -41,21 +41,21 @@ namespace KBibTeX { - QString SettingsIdSuggestions::exampleBibTeXEntry = "@Article{ dijkstra1983terminationdetect,\nauthor = {Edsger W. Dijkstra and W. H. J. Feijen and A. J. M. {van Gasteren}},\ntitle = {{Derivation of a Termination Detection Algorithm for Distributed Computations}},\njournal = {Information Processing Letters},\nvolume = 16,\nnumber = 5,\npages = {217--219},\nmonth = jun,\nyear = 1983\n}"; + TQString SettingsIdSuggestions::exampleBibTeXEntry = "@Article{ dijkstra1983terminationdetect,\nauthor = {Edsger W. Dijkstra and W. H. J. Feijen and A. J. M. {van Gasteren}},\ntitle = {{Derivation of a Termination Detection Algorithm for Distributed Computations}},\njournal = {Information Processing Letters},\nvolume = 16,\nnumber = 5,\npages = {217--219},\nmonth = jun,\nyear = 1983\n}"; - IdSuggestionsListViewItem::IdSuggestionsListViewItem( KListView *list, const QString& plainText, BibTeX::Entry *example ): KListViewItem( list ), m_original( plainText ), m_example( example ) + IdSuggestionsListViewItem::IdSuggestionsListViewItem( KListView *list, const TQString& plainText, BibTeX::Entry *example ): KListViewItem( list ), m_original( plainText ), m_example( example ) { KListViewItem::setText( 0, parse( plainText ) ); KListViewItem::setMultiLinesEnabled( TRUE ); } - IdSuggestionsListViewItem::IdSuggestionsListViewItem( KListView *list, KListViewItem *prev, const QString& plainText, BibTeX::Entry *example ): KListViewItem( list, prev ), m_original( plainText ), m_example( example ) + IdSuggestionsListViewItem::IdSuggestionsListViewItem( KListView *list, KListViewItem *prev, const TQString& plainText, BibTeX::Entry *example ): KListViewItem( list, prev ), m_original( plainText ), m_example( example ) { KListViewItem::setText( 0, parse( plainText ) ); KListViewItem::setMultiLinesEnabled( TRUE ); } - void IdSuggestionsListViewItem::setText( int col, const QString& text ) + void IdSuggestionsListViewItem::setText( int col, const TQString& text ) { if ( col == 0 ) KListViewItem::setText( 0, parse( text ) ); @@ -63,11 +63,11 @@ namespace KBibTeX KListViewItem::setText( col, text ); } - int IdSuggestionsListViewItem::width( const QFontMetrics & fm, const QListView *, int c ) const + int IdSuggestionsListViewItem::width( const TQFontMetrics & fm, const TQListView *, int c ) const { int max = 100; - QStringList lines = QStringList::split( '\n', text( c ) ); - for ( QStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) + TQStringList lines = TQStringList::split( '\n', text( c ) ); + for ( TQStringList::Iterator it = lines.begin(); it != lines.end(); ++it ) { int w = fm.width( *it ); if ( w > max ) max = w; @@ -76,26 +76,26 @@ namespace KBibTeX return max + 36; } - QString IdSuggestionsListViewItem::originalText() const + TQString IdSuggestionsListViewItem::originalText() const { return m_original; } - QString IdSuggestionsListViewItem::parse( const QString&plainText ) + TQString IdSuggestionsListViewItem::parse( const TQString&plainText ) { m_original = plainText; - QString result = IdSuggestions::formatStrToHuman( plainText ); + TQString result = IdSuggestions::formatStrToHuman( plainText ); if ( m_example != NULL ) { - result.append( QString( i18n( "\nExample: %1" ) ).arg( IdSuggestions::formatId( m_example, plainText ) ) ); + result.append( TQString( i18n( "\nExample: %1" ) ).arg( IdSuggestions::formatId( m_example, plainText ) ) ); } return result; } - SettingsIdSuggestions::SettingsIdSuggestions( QWidget *parent, const char *name ) - : QWidget( parent, name ) + SettingsIdSuggestions::SettingsIdSuggestions( TQWidget *parent, const char *name ) + : TQWidget( parent, name ) { - m_validator = new QRegExpValidator( QRegExp( "[^\\s]+" ), this ); + m_validator = new TQRegExpValidator( TQRegExp( "[^\\s]+" ), this ); setupGUI(); BibTeX::FileImporter *importer = new BibTeX::FileImporterBibTeX( false ); @@ -119,7 +119,7 @@ namespace KBibTeX settings->idSuggestions_default = -1; settings->idSuggestions_forceDefault = m_checkBoxForceDefault->isChecked(); int i = 0; - for ( QListViewItemIterator it( m_listIdSuggestions ); it.current(); ++i, ++it ) + for ( TQListViewItemIterator it( m_listIdSuggestions ); it.current(); ++i, ++it ) { IdSuggestionsListViewItem *item = dynamic_cast<IdSuggestionsListViewItem*>( *it ); settings->idSuggestions_formatStrList.append( item->originalText() ); @@ -127,7 +127,7 @@ namespace KBibTeX settings->idSuggestions_default = i; } settings->idSuggestions_smallWords.clear(); - for ( QListViewItemIterator it( m_listSmallWords ); it.current(); ++it ) + for ( TQListViewItemIterator it( m_listSmallWords ); it.current(); ++it ) settings->idSuggestions_smallWords << it.current()->text( 0 ); } @@ -141,7 +141,7 @@ namespace KBibTeX m_checkBoxForceDefault->setChecked( settings->idSuggestions_forceDefault ); m_checkBoxForceDefault->setEnabled( settings->idSuggestions_default >= 0 ); int i = 0; - for ( QStringList::ConstIterator it = settings->idSuggestions_formatStrList.begin(); it != settings->idSuggestions_formatStrList.end(); ++i, ++it ) + for ( TQStringList::ConstIterator it = settings->idSuggestions_formatStrList.begin(); it != settings->idSuggestions_formatStrList.end(); ++i, ++it ) { prev = new IdSuggestionsListViewItem( m_listIdSuggestions, prev, *it, m_example ); prev->setPixmap( 0, SmallIcon( "filter" ) ); @@ -153,7 +153,7 @@ namespace KBibTeX m_defaultSuggestionItem->setPixmap( 0, SmallIcon( "favorites" ) ); m_listSmallWords->clear(); - for ( QStringList::ConstIterator it = settings->idSuggestions_smallWords.begin(); it != settings->idSuggestions_smallWords.end(); ++it ) + for ( TQStringList::ConstIterator it = settings->idSuggestions_smallWords.begin(); it != settings->idSuggestions_smallWords.end(); ++it ) new KListViewItem( m_listSmallWords, *it ); m_lineEditSmallWords->setText( "" ); slotListSmallWordsChanged(); @@ -171,7 +171,7 @@ namespace KBibTeX IdSuggestionsListViewItem * item = new IdSuggestionsListViewItem( m_listIdSuggestions, "a|Y|T", m_example ); item->setPixmap( 0, SmallIcon( "filter" ) ); m_listIdSuggestions->setSelected( item, TRUE ); - QTimer::singleShot( 100, this, SLOT( slotEditIdSuggestion() ) ); + TQTimer::singleShot( 100, this, SLOT( slotEditIdSuggestion() ) ); } void SettingsIdSuggestions::slotEditIdSuggestion() @@ -179,8 +179,8 @@ namespace KBibTeX IdSuggestionsListViewItem * item = static_cast<IdSuggestionsListViewItem*>( m_listIdSuggestions->selectedItem() ); if ( item != NULL ) { - QString formatStr = item->originalText(); - if ( IdSuggestionsWidget::execute( formatStr, this ) == QDialog::Accepted ) + TQString formatStr = item->originalText(); + if ( IdSuggestionsWidget::execute( formatStr, this ) == TQDialog::Accepted ) { item->setText( 0, formatStr ); emit configChanged(); @@ -210,7 +210,7 @@ namespace KBibTeX if ( item != NULL && item -> itemAbove() != NULL ) { IdSuggestionsListViewItem *itemAbove = dynamic_cast<IdSuggestionsListViewItem*>( item->itemAbove() ); - QString text = item->originalText(); + TQString text = item->originalText(); item->setText( 0, itemAbove->originalText( ) ); itemAbove->setText( 0, text ); m_listIdSuggestions->setCurrentItem( itemAbove ); @@ -237,7 +237,7 @@ namespace KBibTeX if ( item != NULL && item -> itemBelow() != NULL ) { IdSuggestionsListViewItem *itemBelow = dynamic_cast<IdSuggestionsListViewItem*>( item->itemBelow() ); - QString text = item->originalText(); + TQString text = item->originalText(); item->setText( 0, itemBelow->originalText( ) ); itemBelow->setText( 0, text ); m_listIdSuggestions->setCurrentItem( itemBelow ); @@ -263,7 +263,7 @@ namespace KBibTeX if ( m_defaultSuggestionItem != NULL ) m_defaultSuggestionItem->setPixmap( 0, SmallIcon( "filter" ) ); - QListViewItem *item = m_listIdSuggestions->selectedItem(); + TQListViewItem *item = m_listIdSuggestions->selectedItem(); if ( item == m_defaultSuggestionItem ) m_defaultSuggestionItem = NULL; else @@ -274,11 +274,11 @@ namespace KBibTeX m_checkBoxForceDefault->setEnabled( m_defaultSuggestionItem != NULL ); } - void SettingsIdSuggestions::slotEditSmallWordsChanged( const QString &newWord ) + void SettingsIdSuggestions::slotEditSmallWordsChanged( const TQString &newWord ) { bool result = !newWord.isEmpty(); - for ( QListViewItemIterator it( m_listSmallWords ); result && it.current(); ++it ) + for ( TQListViewItemIterator it( m_listSmallWords ); result && it.current(); ++it ) result &= it.current()->text( 0 ) != newWord; m_buttonAddSmallWord->setEnabled( result ); @@ -294,10 +294,10 @@ namespace KBibTeX void SettingsIdSuggestions::slotDeleteSmallWord() { bool changed = false; - QListViewItemIterator it( m_listSmallWords, QListViewItemIterator::Selected ); + TQListViewItemIterator it( m_listSmallWords, TQListViewItemIterator::Selected ); while ( it.current() ) { - QListViewItem *cur = it.current(); + TQListViewItem *cur = it.current(); ++it; delete cur; changed = true; @@ -309,13 +309,13 @@ namespace KBibTeX void SettingsIdSuggestions::slotListSmallWordsChanged() { - QListViewItemIterator it( m_listSmallWords, QListViewItemIterator::Selected ); + TQListViewItemIterator it( m_listSmallWords, TQListViewItemIterator::Selected ); m_buttonDeleteSmallWord->setEnabled( it.current() != NULL ); } void SettingsIdSuggestions::updateGUI() { - QListViewItem *item = m_listIdSuggestions->selectedItem(); + TQListViewItem *item = m_listIdSuggestions->selectedItem(); bool selected = item != NULL; m_buttonEditIdSuggestion->setEnabled( selected ); m_buttonDeleteIdSuggestion->setEnabled( selected ); @@ -326,7 +326,7 @@ namespace KBibTeX void SettingsIdSuggestions::setupGUI() { - QGridLayout * gridLayout = new QGridLayout( this, 13, 2, 0, KDialog::spacingHint(), "gridLayout" ); + TQGridLayout * gridLayout = new TQGridLayout( this, 13, 2, 0, KDialog::spacingHint(), "gridLayout" ); gridLayout->setRowStretch( 6, 2 ); gridLayout->setRowSpacing( 8, KDialog::spacingHint() ); gridLayout->setRowStretch( 12, 1 ); @@ -339,46 +339,46 @@ namespace KBibTeX m_listIdSuggestions->setFullWidth( true ); gridLayout->addMultiCellWidget( m_listIdSuggestions, 0, 6, 0, 0 ); connect( m_listIdSuggestions, SIGNAL( selectionChanged() ), this, SLOT( updateGUI() ) ); - connect( m_listIdSuggestions, SIGNAL( currentChanged( QListViewItem * ) ), this, SLOT( updateGUI() ) ); - connect( m_listIdSuggestions, SIGNAL( doubleClicked( QListViewItem*, const QPoint &, int ) ), this, SLOT( slotEditIdSuggestion() ) ); + connect( m_listIdSuggestions, SIGNAL( currentChanged( TQListViewItem * ) ), this, SLOT( updateGUI() ) ); + connect( m_listIdSuggestions, SIGNAL( doubleClicked( TQListViewItem*, const TQPoint &, int ) ), this, SLOT( slotEditIdSuggestion() ) ); m_buttonNewIdSuggestion = new KPushButton( i18n( "id suggestion", "New" ), this ); - m_buttonNewIdSuggestion->setIconSet( QIconSet( SmallIcon( "add" ) ) ); + m_buttonNewIdSuggestion->setIconSet( TQIconSet( SmallIcon( "add" ) ) ); gridLayout->addWidget( m_buttonNewIdSuggestion, 0, 1 ); connect( m_buttonNewIdSuggestion, SIGNAL( clicked() ), this, SLOT( slotNewIdSuggestion() ) ); m_buttonEditIdSuggestion = new KPushButton( i18n( "id suggestion", "Edit" ), this ); - m_buttonEditIdSuggestion->setIconSet( QIconSet( SmallIcon( "edit" ) ) ); + m_buttonEditIdSuggestion->setIconSet( TQIconSet( SmallIcon( "edit" ) ) ); gridLayout->addWidget( m_buttonEditIdSuggestion, 1, 1 ); connect( m_buttonEditIdSuggestion, SIGNAL( clicked() ), this, SLOT( slotEditIdSuggestion() ) ); m_buttonDeleteIdSuggestion = new KPushButton( i18n( "id suggestion", "Delete" ), this ); - m_buttonDeleteIdSuggestion->setIconSet( QIconSet( SmallIcon( "editdelete" ) ) ); + m_buttonDeleteIdSuggestion->setIconSet( TQIconSet( SmallIcon( "editdelete" ) ) ); gridLayout->addWidget( m_buttonDeleteIdSuggestion, 2, 1 ); connect( m_buttonDeleteIdSuggestion, SIGNAL( clicked() ), this, SLOT( slotDeleteIdSuggestion() ) ); m_buttonMoveUpIdSuggestion = new KPushButton( i18n( "id suggestion", "Up" ), this ); - m_buttonMoveUpIdSuggestion->setIconSet( QIconSet( SmallIcon( "up" ) ) ); + m_buttonMoveUpIdSuggestion->setIconSet( TQIconSet( SmallIcon( "up" ) ) ); gridLayout->addWidget( m_buttonMoveUpIdSuggestion, 3, 1 ); connect( m_buttonMoveUpIdSuggestion, SIGNAL( clicked() ), this, SLOT( slotMoveUpIdSuggestion() ) ); m_buttonMoveDownIdSuggestion = new KPushButton( i18n( "id suggestion", "Down" ), this ); - m_buttonMoveDownIdSuggestion->setIconSet( QIconSet( SmallIcon( "down" ) ) ); + m_buttonMoveDownIdSuggestion->setIconSet( TQIconSet( SmallIcon( "down" ) ) ); gridLayout->addWidget( m_buttonMoveDownIdSuggestion, 4, 1 ); connect( m_buttonMoveDownIdSuggestion, SIGNAL( clicked() ), this, SLOT( slotMoveDownIdSuggestion() ) ); m_buttonToggleDefault = new KPushButton( i18n( "Toogle default" ), this ); - m_buttonToggleDefault->setIconSet( QIconSet( SmallIcon( "favorites" ) ) ); + m_buttonToggleDefault->setIconSet( TQIconSet( SmallIcon( "favorites" ) ) ); gridLayout->addWidget( m_buttonToggleDefault, 5, 1 ); connect( m_buttonToggleDefault, SIGNAL( clicked() ), this, SLOT( slotToggleDefault() ) ); - m_checkBoxForceDefault = new QCheckBox( i18n( "Use default id suggestion when editing new entries" ), this ); + m_checkBoxForceDefault = new TQCheckBox( i18n( "Use default id suggestion when editing new entries" ), this ); gridLayout->addMultiCellWidget( m_checkBoxForceDefault, 7, 7, 0, 1 ); - QLabel *label = new QLabel( i18n( "Small Words:" ), this ); + TQLabel *label = new TQLabel( i18n( "Small Words:" ), this ); gridLayout->addMultiCellWidget( label, 9, 9, 0, 1 ); m_lineEditSmallWords = new KLineEdit( this ); label->setBuddy( m_lineEditSmallWords ); gridLayout->addWidget( m_lineEditSmallWords, 10, 0 ); - connect( m_lineEditSmallWords, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotEditSmallWordsChanged( const QString & ) ) ); + connect( m_lineEditSmallWords, SIGNAL( textChanged( const TQString & ) ), this, SLOT( slotEditSmallWordsChanged( const TQString & ) ) ); m_buttonAddSmallWord = new KPushButton( i18n( "Add" ), this ); m_buttonAddSmallWord->setEnabled( false ); - m_buttonAddSmallWord->setIconSet( QIconSet( SmallIcon( "add" ) ) ); + m_buttonAddSmallWord->setIconSet( TQIconSet( SmallIcon( "add" ) ) ); gridLayout->addWidget( m_buttonAddSmallWord, 10, 1 ); connect( m_buttonAddSmallWord, SIGNAL( clicked() ), this, SLOT( slotAddSmallWord() ) ); @@ -387,11 +387,11 @@ namespace KBibTeX m_listSmallWords->header()->setClickEnabled( true ); m_listSmallWords->setFullWidth( true ); connect( m_listSmallWords, SIGNAL( selectionChanged() ), this, SLOT( slotListSmallWordsChanged() ) ); - connect( m_listSmallWords, SIGNAL( currentChanged( QListViewItem * ) ), this, SLOT( slotListSmallWordsChanged() ) ); + connect( m_listSmallWords, SIGNAL( currentChanged( TQListViewItem * ) ), this, SLOT( slotListSmallWordsChanged() ) ); gridLayout->addMultiCellWidget( m_listSmallWords, 11, 12, 0, 0 ); m_buttonDeleteSmallWord = new KPushButton( i18n( "Delete" ), this ); m_buttonDeleteSmallWord->setEnabled( false ); - m_buttonDeleteSmallWord->setIconSet( QIconSet( SmallIcon( "editdelete" ) ) ); + m_buttonDeleteSmallWord->setIconSet( TQIconSet( SmallIcon( "editdelete" ) ) ); gridLayout->addWidget( m_buttonDeleteSmallWord, 11, 1 ); connect( m_buttonDeleteSmallWord, SIGNAL( clicked() ), this, SLOT( slotDeleteSmallWord() ) ); } |