diff options
Diffstat (limited to 'kword/KWEditPersonnalExpression.cpp')
-rw-r--r-- | kword/KWEditPersonnalExpression.cpp | 192 |
1 files changed, 96 insertions, 96 deletions
diff --git a/kword/KWEditPersonnalExpression.cpp b/kword/KWEditPersonnalExpression.cpp index d11449af..59b79f97 100644 --- a/kword/KWEditPersonnalExpression.cpp +++ b/kword/KWEditPersonnalExpression.cpp @@ -25,77 +25,77 @@ #include <kdebug.h> #include <kstandarddirs.h> -#include <qfile.h> -#include <qpushbutton.h> -#include <qcombobox.h> -#include <qlineedit.h> -#include <qlabel.h> -#include <qlayout.h> - -KWEditPersonnalExpression::KWEditPersonnalExpression( QWidget *parent, const char *name ) - : KDialogBase( parent, name , true, i18n("Edit Personal Expression"), Ok|Cancel, Ok, true ) +#include <tqfile.h> +#include <tqpushbutton.h> +#include <tqcombobox.h> +#include <tqlineedit.h> +#include <tqlabel.h> +#include <tqlayout.h> + +KWEditPersonnalExpression::KWEditPersonnalExpression( TQWidget *tqparent, const char *name ) + : KDialogBase( tqparent, name , true, i18n("Edit Personal Expression"), Ok|Cancel, Ok, true ) { resize( 412, 339 ); - QWidget *page = new QWidget( this ); + TQWidget *page = new TQWidget( this ); setMainWidget(page); - QGridLayout* form1Layout = new QGridLayout( page, 1, 1, 0, KDialog::spacingHint(), "form1Layout"); + TQGridLayout* form1Layout = new TQGridLayout( page, 1, 1, 0, KDialog::spacingHint(), "form1Layout"); - QHBoxLayout *horlayout1 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "horlayout1"); + TQHBoxLayout *hortqlayout1 = new TQHBoxLayout( 0, 0, KDialog::spacingHint(), "hortqlayout1"); - QLabel *groupnameLabel = new QLabel(i18n("Group name:"), page, "groupnameLabel" ); - horlayout1->addWidget( groupnameLabel ); + TQLabel *groupnameLabel = new TQLabel(i18n("Group name:"), page, "groupnameLabel" ); + hortqlayout1->addWidget( groupnameLabel ); - m_groupLineEdit = new QLineEdit( page, "groupLineEdit" ); - horlayout1->addWidget( m_groupLineEdit ); + m_groupLineEdit = new TQLineEdit( page, "groupLineEdit" ); + hortqlayout1->addWidget( m_groupLineEdit ); - form1Layout->addLayout( horlayout1, 0, 1 ); + form1Layout->addLayout( hortqlayout1, 0, 1 ); - QGroupBox *expressionGroupBox = new QGroupBox( page, "expressionGroupBox" ); - expressionGroupBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 1, 0, expressionGroupBox->sizePolicy().hasHeightForWidth() ) ); + TQGroupBox *expressionGroupBox = new TQGroupBox( page, "expressionGroupBox" ); + expressionGroupBox->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)5, 1, 0, expressionGroupBox->sizePolicy().hasHeightForWidth() ) ); expressionGroupBox->setTitle( i18n( "Expressions" ) ); expressionGroupBox->setColumnLayout(0, Qt::Vertical ); - expressionGroupBox->layout()->setSpacing( KDialog::spacingHint() ); - expressionGroupBox->layout()->setMargin( KDialog::marginHint() ); - QVBoxLayout *expressionGroupBoxLayout = new QVBoxLayout( expressionGroupBox->layout() ); - expressionGroupBoxLayout->setAlignment( Qt::AlignTop ); + expressionGroupBox->tqlayout()->setSpacing( KDialog::spacingHint() ); + expressionGroupBox->tqlayout()->setMargin( KDialog::marginHint() ); + TQVBoxLayout *expressionGroupBoxLayout = new TQVBoxLayout( expressionGroupBox->tqlayout() ); + expressionGroupBoxLayout->tqsetAlignment( TQt::AlignTop ); - m_ExpressionsList = new QListBox( expressionGroupBox, "listOfExpressions" ); - m_ExpressionsList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 1, 0, m_ExpressionsList->sizePolicy().hasHeightForWidth() ) ); + m_ExpressionsList = new TQListBox( expressionGroupBox, "listOfExpressions" ); + m_ExpressionsList->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)7, 1, 0, m_ExpressionsList->sizePolicy().hasHeightForWidth() ) ); expressionGroupBoxLayout->addWidget( m_ExpressionsList ); - m_expressionLineEdit = new QLineEdit( expressionGroupBox, "expressionLineEdit" ); + m_expressionLineEdit = new TQLineEdit( expressionGroupBox, "expressionLineEdit" ); expressionGroupBoxLayout->addWidget( m_expressionLineEdit ); - QHBoxLayout *horlayout2 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "horlayout2"); - QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); - horlayout2->addItem( spacer ); + TQHBoxLayout *hortqlayout2 = new TQHBoxLayout( 0, 0, KDialog::spacingHint(), "hortqlayout2"); + TQSpacerItem* spacer = new TQSpacerItem( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum ); + hortqlayout2->addItem( spacer ); - m_addExpression = new QPushButton( i18n("&New"), expressionGroupBox, "m_addExpression" ); - horlayout2->addWidget( m_addExpression ); + m_addExpression = new TQPushButton( i18n("&New"), expressionGroupBox, "m_addExpression" ); + hortqlayout2->addWidget( m_addExpression ); - m_delExpression = new QPushButton( i18n("&Delete"), expressionGroupBox, "m_delExpression" ); - horlayout2->addWidget( m_delExpression ); - expressionGroupBoxLayout->addLayout( horlayout2 ); + m_delExpression = new TQPushButton( i18n("&Delete"), expressionGroupBox, "m_delExpression" ); + hortqlayout2->addWidget( m_delExpression ); + expressionGroupBoxLayout->addLayout( hortqlayout2 ); form1Layout->addWidget( expressionGroupBox, 1, 1 ); - QVBoxLayout *vertlayout = new QVBoxLayout( 0, 0, KDialog::spacingHint(), "vertlayout"); + TQVBoxLayout *verttqlayout = new TQVBoxLayout( 0, 0, KDialog::spacingHint(), "verttqlayout"); - m_groupList = new QListBox( page, "groupList" ); + m_groupList = new TQListBox( page, "groupList" ); m_groupList->insertItem( "group1" ); - m_groupList->setMaximumSize( QSize( 200, 32767 ) ); - vertlayout->addWidget( m_groupList ); + m_groupList->setMaximumSize( TQSize( 200, 32767 ) ); + verttqlayout->addWidget( m_groupList ); - QHBoxLayout *horlayout3 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "horlayout3"); + TQHBoxLayout *hortqlayout3 = new TQHBoxLayout( 0, 0, KDialog::spacingHint(), "hortqlayout3"); - m_addGroup = new QPushButton( i18n("New"), page, "m_addGroup" ); - horlayout3->addWidget( m_addGroup ); + m_addGroup = new TQPushButton( i18n("New"), page, "m_addGroup" ); + hortqlayout3->addWidget( m_addGroup ); - m_delGroup = new QPushButton(i18n("Delete"), page, "m_delGroup" ); - horlayout3->addWidget( m_delGroup ); - vertlayout->addLayout( horlayout3 ); + m_delGroup = new TQPushButton(i18n("Delete"), page, "m_delGroup" ); + hortqlayout3->addWidget( m_delGroup ); + verttqlayout->addLayout( hortqlayout3 ); - form1Layout->addMultiCellLayout( vertlayout, 0, 1, 0, 0 ); + form1Layout->addMultiCellLayout( verttqlayout, 0, 1, 0, 0 ); loadFile(); if(listExpression.count() == 0) @@ -103,16 +103,16 @@ KWEditPersonnalExpression::KWEditPersonnalExpression( QWidget *parent, const cha else initGroupList(); - connect(m_groupList,SIGNAL(selectionChanged()), this,SLOT(slotGroupSelected())); - connect(m_ExpressionsList,SIGNAL(selectionChanged()), this,SLOT(slotExpressionSelected())); + connect(m_groupList,TQT_SIGNAL(selectionChanged()), this,TQT_SLOT(slotGroupSelected())); + connect(m_ExpressionsList,TQT_SIGNAL(selectionChanged()), this,TQT_SLOT(slotExpressionSelected())); if(m_groupList->count() > 0) m_groupList->setSelected(0, true); - connect(m_groupLineEdit,SIGNAL(textChanged(const QString&)), this,SLOT(slotUpdateGroupName(const QString&))); - connect(m_expressionLineEdit,SIGNAL(textChanged(const QString&)), this,SLOT(slotUpdateExpression(const QString&))); - connect(m_addExpression, SIGNAL( clicked() ), this,SLOT( slotAddExpression() )); - connect(m_delExpression, SIGNAL( clicked() ), this,SLOT( slotRemoveExpression() )); - connect(m_addGroup, SIGNAL( clicked() ), this,SLOT( slotAddGroup())); - connect(m_delGroup, SIGNAL( clicked() ), this,SLOT( slotRemoveGroup() )); + connect(m_groupLineEdit,TQT_SIGNAL(textChanged(const TQString&)), this,TQT_SLOT(slotUpdateGroupName(const TQString&))); + connect(m_expressionLineEdit,TQT_SIGNAL(textChanged(const TQString&)), this,TQT_SLOT(slotUpdateExpression(const TQString&))); + connect(m_addExpression, TQT_SIGNAL( clicked() ), this,TQT_SLOT( slotAddExpression() )); + connect(m_delExpression, TQT_SIGNAL( clicked() ), this,TQT_SLOT( slotRemoveExpression() )); + connect(m_addGroup, TQT_SIGNAL( clicked() ), this,TQT_SLOT( slotAddGroup())); + connect(m_delGroup, TQT_SIGNAL( clicked() ), this,TQT_SLOT( slotRemoveGroup() )); updateWidget(); setFocus(); @@ -129,8 +129,8 @@ void KWEditPersonnalExpression::slotGroupSelected() m_groupLineEdit->blockSignals(true); m_delExpression->setEnabled(m_groupList->currentItem()!=-1); m_groupLineEdit->setText(m_groupList->currentText()); - list::Iterator it= listExpression.find(m_groupList->currentText()); - QStringList lst(it.data()); + list::Iterator it= listExpression.tqfind(m_groupList->currentText()); + TQStringList lst(it.data()); m_ExpressionsList->blockSignals(true); m_ExpressionsList->clear(); m_ExpressionsList->insertStringList(lst); @@ -141,14 +141,14 @@ void KWEditPersonnalExpression::slotGroupSelected() m_groupLineEdit->blockSignals(false); } -void KWEditPersonnalExpression::slotUpdateGroupName(const QString &newGroupName) +void KWEditPersonnalExpression::slotUpdateGroupName(const TQString &newGroupName) { if ( m_groupList->currentItem()==-1 ) return; m_addGroup->setEnabled( true ); - list::Iterator it= listExpression.find(m_groupList->currentText()); - QStringList lst(it.data()); + list::Iterator it= listExpression.tqfind(m_groupList->currentText()); + TQStringList lst(it.data()); listExpression.insert(newGroupName,lst); listExpression.remove(m_groupList->currentText()); m_groupList->blockSignals(true); @@ -157,17 +157,17 @@ void KWEditPersonnalExpression::slotUpdateGroupName(const QString &newGroupName) m_bChanged=true; } -void KWEditPersonnalExpression::slotUpdateExpression(const QString &newExpression) +void KWEditPersonnalExpression::slotUpdateExpression(const TQString &newExpression) { if(newExpression.isEmpty() || m_groupList->currentItem()==-1 || m_ExpressionsList->currentText().isEmpty()) return; - list::Iterator it= listExpression.find(m_groupList->currentText()); - QStringList lst = it.data(); - QStringList::Iterator it2=lst.find(m_ExpressionsList->currentText()); - lst.insert(it2,QString(newExpression)); + list::Iterator it= listExpression.tqfind(m_groupList->currentText()); + TQStringList lst = it.data(); + TQStringList::Iterator it2=lst.tqfind(m_ExpressionsList->currentText()); + lst.insert(it2,TQString(newExpression)); lst.remove(it2); - listExpression.replace(m_groupList->currentText(),lst); + listExpression.tqreplace(m_groupList->currentText(),lst); lst.remove(m_ExpressionsList->currentText()); m_ExpressionsList->blockSignals(true); @@ -178,13 +178,13 @@ void KWEditPersonnalExpression::slotUpdateExpression(const QString &newExpressio void KWEditPersonnalExpression::loadFile() { - QString file=locateLocal("data","kword/expression/perso.xml"); + TQString file=locateLocal("data","kword/expression/perso.xml"); init( file ); } void KWEditPersonnalExpression::initGroupList() { - QStringList lst; + TQStringList lst; m_groupList->clear(); list::Iterator it; for( it = listExpression.begin(); it != listExpression.end(); ++it ) @@ -192,40 +192,40 @@ void KWEditPersonnalExpression::initGroupList() m_groupList->insertStringList(lst); } -void KWEditPersonnalExpression::init(const QString& filename ) +void KWEditPersonnalExpression::init(const TQString& filename ) { - QFile file( filename ); + TQFile file( filename ); if ( !file.open( IO_ReadOnly ) ) return; kdDebug() << "KWEditPersonnalExpression::init parsing " << filename << endl; - QDomDocument doc; + TQDomDocument doc; doc.setContent( &file ); file.close(); - QString group = ""; - QStringList list; - QDomNode n = doc.documentElement().firstChild(); + TQString group = ""; + TQStringList list; + TQDomNode n = doc.documentElement().firstChild(); for( ; !n.isNull(); n = n.nextSibling() ) { if ( n.isElement() ) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); if ( e.tagName() == "Type" ) { list.clear(); group = i18n( e.namedItem( "TypeName" ).toElement().text().utf8() ); - QDomNode n2 = e.firstChild(); + TQDomNode n2 = e.firstChild(); for( ; !n2.isNull(); n2 = n2.nextSibling() ) { if ( n2.isElement() ) { - QDomElement e2 = n2.toElement(); + TQDomElement e2 = n2.toElement(); if ( e2.tagName() == "Expression" ) { - QString text = i18n( e2.namedItem( "Text" ).toElement().text().utf8() ); + TQString text = i18n( e2.namedItem( "Text" ).toElement().text().utf8() ); list<<text; } } @@ -246,13 +246,13 @@ void KWEditPersonnalExpression::slotOk() } void KWEditPersonnalExpression::slotAddExpression() { - list::Iterator it= listExpression.find(m_groupList->currentText()); - QStringList lst(it.data()); - QString newWord = i18n("empty"); - if ( lst.contains( newWord )) + list::Iterator it= listExpression.tqfind(m_groupList->currentText()); + TQStringList lst(it.data()); + TQString newWord = i18n("empty"); + if ( lst.tqcontains( newWord )) return; lst<< newWord; - listExpression.replace(m_groupList->currentText(),lst); + listExpression.tqreplace(m_groupList->currentText(),lst); m_ExpressionsList->blockSignals(true); m_ExpressionsList->insertItem(newWord); @@ -269,13 +269,13 @@ void KWEditPersonnalExpression::slotAddExpression() { } void KWEditPersonnalExpression::slotRemoveExpression() { - QString text=m_ExpressionsList->currentText (); + TQString text=m_ExpressionsList->currentText (); if(!text.isEmpty()) { - list::Iterator it= listExpression.find(m_groupList->currentText()); - QStringList lst(it.data()); + list::Iterator it= listExpression.tqfind(m_groupList->currentText()); + TQStringList lst(it.data()); lst.remove(text); - listExpression.replace(m_groupList->currentText(),lst); + listExpression.tqreplace(m_groupList->currentText(),lst); m_ExpressionsList->blockSignals(true); m_ExpressionsList->clear(); @@ -290,7 +290,7 @@ void KWEditPersonnalExpression::slotRemoveExpression() { } void KWEditPersonnalExpression::slotAddGroup() { - listExpression.insert(i18n("new group"),QStringList()); + listExpression.insert(i18n("new group"),TQStringList()); initGroupList(); m_groupList->setCurrentItem(m_groupList->count() -1); updateWidget(); @@ -298,7 +298,7 @@ void KWEditPersonnalExpression::slotAddGroup() { } void KWEditPersonnalExpression::slotRemoveGroup() { - QString group=m_groupList->currentText(); + TQString group=m_groupList->currentText(); if(group.isEmpty()) return; listExpression.remove( group ); @@ -329,35 +329,35 @@ void KWEditPersonnalExpression::updateExpression() void KWEditPersonnalExpression::saveFile() { - QDomDocument doc( "KWordExpression" ); - QDomElement begin = doc.createElement( "KWordExpression" ); + TQDomDocument doc( "KWordExpression" ); + TQDomElement begin = doc.createElement( "KWordExpression" ); doc.appendChild( begin ); - QStringList lst; + TQStringList lst; list::Iterator it; for( it = listExpression.begin(); it != listExpression.end(); ++it ) { lst=it.data(); if ( !lst.isEmpty() ) { - QDomElement type = doc.createElement( "Type" ); + TQDomElement type = doc.createElement( "Type" ); begin.appendChild( type ); - QDomElement typeName = doc.createElement( "TypeName" ); + TQDomElement typeName = doc.createElement( "TypeName" ); type.appendChild( typeName ); typeName.appendChild( doc.createTextNode(it.key() ) ); for( uint i=0;i<lst.count();i++ ) { - QDomElement expr = doc.createElement( "Expression" ); + TQDomElement expr = doc.createElement( "Expression" ); type.appendChild( expr ); - QDomElement text = doc.createElement( "Text" ); + TQDomElement text = doc.createElement( "Text" ); expr.appendChild( text ); text.appendChild( doc.createTextNode(lst[i] ) ); } } } - QCString s = doc.toCString(); + TQCString s = doc.toCString(); - QFile file( locateLocal("data","kword/expression/perso.xml") ); + TQFile file( locateLocal("data","kword/expression/perso.xml") ); if ( !file.open( IO_WriteOnly ) ) { kdDebug()<<"Error \n"; |