diff options
Diffstat (limited to 'kword/mailmerge/KWClassicSerialDataSource.cpp')
-rw-r--r-- | kword/mailmerge/KWClassicSerialDataSource.cpp | 244 |
1 files changed, 122 insertions, 122 deletions
diff --git a/kword/mailmerge/KWClassicSerialDataSource.cpp b/kword/mailmerge/KWClassicSerialDataSource.cpp index 0b3f446f..d539f692 100644 --- a/kword/mailmerge/KWClassicSerialDataSource.cpp +++ b/kword/mailmerge/KWClassicSerialDataSource.cpp @@ -22,19 +22,19 @@ #include "KWClassicSerialDataSource.moc" #include "KWMailMergeDataBase.h" #include <kinputdialog.h> -#include <qlabel.h> -#include <qhbox.h> -#include <qlayout.h> -#include <qvbox.h> -#include <qpushbutton.h> -#include <qlineedit.h> -#include <qvalidator.h> +#include <tqlabel.h> +#include <tqhbox.h> +#include <tqlayout.h> +#include <tqvbox.h> +#include <tqpushbutton.h> +#include <tqlineedit.h> +#include <tqvalidator.h> #include <klocale.h> #include <kdebug.h> -#include <qtoolbutton.h> -#include <qtooltip.h> +#include <tqtoolbutton.h> +#include <tqtooltip.h> #include <kiconloader.h> -#include <qheader.h> +#include <tqheader.h> #include "KWDocument.h" #include "defs.h" @@ -46,8 +46,8 @@ * ******************************************************************/ -KWClassicSerialDataSource::KWClassicSerialDataSource(KInstance *inst,QObject *parent) - : KWMailMergeDataSource(inst,parent) +KWClassicSerialDataSource::KWClassicSerialDataSource(KInstance *inst,TQObject *tqparent) + : KWMailMergeDataSource(inst,tqparent) // : doc( doc_ ) { } @@ -56,7 +56,7 @@ KWClassicSerialDataSource::~KWClassicSerialDataSource() { } -QString KWClassicSerialDataSource::getValue( const QString &name, int record ) const +TQString KWClassicSerialDataSource::getValue( const TQString &name, int record ) const { int num = record; /* if ( num == -1 ) @@ -68,7 +68,7 @@ QString KWClassicSerialDataSource::getValue( const QString &name, int record ) c return db[ num ][ name ]; } -void KWClassicSerialDataSource::setValue( const QString &name, const QString &value, int record ) +void KWClassicSerialDataSource::setValue( const TQString &name, const TQString &value, int record ) { int num = record; /* if ( num == -1 ) @@ -86,7 +86,7 @@ void KWClassicSerialDataSource::appendRecord() db.append( record ); } -void KWClassicSerialDataSource::addEntry( const QString &name ) +void KWClassicSerialDataSource::addEntry( const TQString &name ) { sampleRecord[ name ] = i18n( "No Value" ); Db::Iterator it = db.begin(); @@ -94,7 +94,7 @@ void KWClassicSerialDataSource::addEntry( const QString &name ) ( *it )[ name ] = sampleRecord[ name ]; } -void KWClassicSerialDataSource::removeEntry( const QString &name ) +void KWClassicSerialDataSource::removeEntry( const TQString &name ) { sampleRecord.remove( name ); Db::Iterator it = db.begin(); @@ -107,63 +107,63 @@ void KWClassicSerialDataSource::removeRecord( int i ) if ( (i < 0) || (i > (int)db.count() - 1) ) return; - kdDebug()<<QString("Removing record %1").arg(i)<<endl; + kdDebug()<<TQString("Removing record %1").tqarg(i)<<endl; Db::Iterator it = db.at( i); db.remove( it ); } -void KWClassicSerialDataSource::save( QDomDocument &doc, QDomElement &parent) +void KWClassicSerialDataSource::save( TQDomDocument &doc, TQDomElement &tqparent) { - QDomElement def=doc.createElement(QString::fromLatin1("DEFINITION")); - parent.appendChild(def); + TQDomElement def=doc.createElement(TQString::tqfromLatin1("DEFINITION")); + tqparent.appendChild(def); for (DbRecord::Iterator it=sampleRecord.begin();it!=sampleRecord.end();++it) { - QDomElement defEnt=doc.createElement(QString::fromLatin1("FIELD")); - defEnt.setAttribute(QString::fromLatin1("name"),it.key()); + TQDomElement defEnt=doc.createElement(TQString::tqfromLatin1("FIELD")); + defEnt.setAttribute(TQString::tqfromLatin1("name"),it.key()); def.appendChild(defEnt); } - QDomElement cont=doc.createElement(QString::fromLatin1("CONTENT")); - parent.appendChild(cont); + TQDomElement cont=doc.createElement(TQString::tqfromLatin1("CONTENT")); + tqparent.appendChild(cont); for (Db::Iterator dbI=db.begin();dbI!=db.end();++dbI) { - QDomElement rec=doc.createElement(QString::fromLatin1("RECORD")); + TQDomElement rec=doc.createElement(TQString::tqfromLatin1("RECORD")); cont.appendChild(rec); for (DbRecord::Iterator it=sampleRecord.begin();it!=sampleRecord.end();++it) { - QDomElement recEnt=doc.createElement(QString::fromLatin1("ITEM")); - recEnt.setAttribute(QString::fromLatin1("name"),it.key()); - recEnt.setAttribute(QString::fromLatin1("data"),(*dbI)[it.key()]); + TQDomElement recEnt=doc.createElement(TQString::tqfromLatin1("ITEM")); + recEnt.setAttribute(TQString::tqfromLatin1("name"),it.key()); + recEnt.setAttribute(TQString::tqfromLatin1("data"),(*dbI)[it.key()]); rec.appendChild(recEnt); } } } -void KWClassicSerialDataSource::load( QDomElement& parentElem ) +void KWClassicSerialDataSource::load( TQDomElement& tqparentElem ) { db.clear(); sampleRecord.clear(); - QDomNode defNd=parentElem.namedItem("DEFINITION"); + TQDomNode defNd=tqparentElem.namedItem("DEFINITION"); if (defNd.isNull()) return; - QDomElement def=defNd.toElement(); - for (QDomElement defEnt=def.firstChild().toElement();!defEnt.isNull();defEnt=defEnt.nextSibling().toElement()) + TQDomElement def=defNd.toElement(); + for (TQDomElement defEnt=def.firstChild().toElement();!defEnt.isNull();defEnt=defEnt.nextSibling().toElement()) { - sampleRecord[defEnt.attribute(QString::fromLatin1("name"))]=i18n( "No Value" ); + sampleRecord[defEnt.attribute(TQString::tqfromLatin1("name"))]=i18n( "No Value" ); } - QDomNode contNd=parentElem.namedItem("CONTENT"); + TQDomNode contNd=tqparentElem.namedItem("CONTENT"); if (contNd.isNull()) return; - for (QDomNode rec=contNd.firstChild();!rec.isNull();rec=rec.nextSibling()) + for (TQDomNode rec=contNd.firstChild();!rec.isNull();rec=rec.nextSibling()) { appendRecord(); - for (QDomElement recEnt=rec.firstChild().toElement();!recEnt.isNull();recEnt=recEnt.nextSibling().toElement()) + for (TQDomElement recEnt=rec.firstChild().toElement();!recEnt.isNull();recEnt=recEnt.nextSibling().toElement()) { - setValue(recEnt.attribute(QString::fromLatin1("name")), - recEnt.attribute(QString::fromLatin1("data")),db.count()-1); + setValue(recEnt.attribute(TQString::tqfromLatin1("name")), + recEnt.attribute(TQString::tqfromLatin1("data")),db.count()-1); } } } -bool KWClassicSerialDataSource::showConfigDialog(QWidget *par,int action) +bool KWClassicSerialDataSource::showConfigDialog(TQWidget *par,int action) { if (action==KWSLCreate) { @@ -171,7 +171,7 @@ bool KWClassicSerialDataSource::showConfigDialog(QWidget *par,int action) sampleRecord.clear(); } KWClassicMailMergeEditor *dia=new KWClassicMailMergeEditor( par, this ); - bool ret=(dia->exec()==QDialog::Accepted); + bool ret=(dia->exec()==TQDialog::Accepted); delete dia; return ret; } @@ -183,17 +183,17 @@ bool KWClassicSerialDataSource::showConfigDialog(QWidget *par,int action) * ******************************************************************/ -KWClassicMailMergeEditorListItem::KWClassicMailMergeEditorListItem( QListView *parent ) - : QListViewItem( parent ) +KWClassicMailMergeEditorListItem::KWClassicMailMergeEditorListItem( TQListView *tqparent ) + : TQListViewItem( tqparent ) { - editWidget = new QLineEdit( listView()->viewport() ); + editWidget = new TQLineEdit( listView()->viewport() ); listView()->addChild( editWidget ); } -KWClassicMailMergeEditorListItem::KWClassicMailMergeEditorListItem( QListView *parent, QListViewItem *after ) - : QListViewItem( parent, after ) +KWClassicMailMergeEditorListItem::KWClassicMailMergeEditorListItem( TQListView *tqparent, TQListViewItem *after ) + : TQListViewItem( tqparent, after ) { - editWidget = new QLineEdit( listView()->viewport() ); + editWidget = new TQLineEdit( listView()->viewport() ); listView()->addChild( editWidget ); } @@ -202,26 +202,26 @@ KWClassicMailMergeEditorListItem::~KWClassicMailMergeEditorListItem() delete editWidget; } -void KWClassicMailMergeEditorListItem::setText( int i, const QString &text ) +void KWClassicMailMergeEditorListItem::setText( int i, const TQString &text ) { - QListViewItem::setText( i, text ); + TQListViewItem::setText( i, text ); if ( i == 1 ) editWidget->setText( text ); } -QString KWClassicMailMergeEditorListItem::text( int i ) const +TQString KWClassicMailMergeEditorListItem::text( int i ) const { if ( i == 1 ) return editWidget->text(); - return QListViewItem::text( i ); + return TQListViewItem::text( i ); } void KWClassicMailMergeEditorListItem::setup() { - setHeight( QMAX( listView()->fontMetrics().height(), - editWidget->sizeHint().height() ) ); - if ( listView()->columnWidth( 1 ) < editWidget->sizeHint().width() ) - listView()->setColumnWidth( 1, editWidget->sizeHint().width() ); + setHeight( TQMAX( listView()->fontMetrics().height(), + editWidget->tqsizeHint().height() ) ); + if ( listView()->columnWidth( 1 ) < editWidget->tqsizeHint().width() ) + listView()->setColumnWidth( 1, editWidget->tqsizeHint().width() ); } void KWClassicMailMergeEditorListItem::update() @@ -238,24 +238,24 @@ void KWClassicMailMergeEditorListItem::update() * ******************************************************************/ -KWClassicMailMergeEditorList::KWClassicMailMergeEditorList( QWidget *parent, KWClassicSerialDataSource *db_ ) - : QListView( parent ), db( db_ ) +KWClassicMailMergeEditorList::KWClassicMailMergeEditorList( TQWidget *tqparent, KWClassicSerialDataSource *db_ ) + : TQListView( tqparent ), db( db_ ) { setSorting( -1 ); addColumn( i18n( "Name" ) ); addColumn( i18n( "Value" ) ); header()->setMovingEnabled( FALSE ); - connect( header(), SIGNAL( sizeChange( int, int, int ) ), - this, SLOT( columnSizeChange( int, int, int ) ) ); -// connect( header(), SIGNAL( sectionClicked( int ) ), -// this, SLOT( sectionClicked( int ) ) ); - disconnect( header(), SIGNAL( sectionClicked( int ) ), - this, SLOT( changeSortColumn( int ) ) ); + connect( header(), TQT_SIGNAL( sizeChange( int, int, int ) ), + this, TQT_SLOT( columnSizeChange( int, int, int ) ) ); +// connect( header(), TQT_SIGNAL( sectionClicked( int ) ), +// this, TQT_SLOT( sectionClicked( int ) ) ); + disconnect( header(), TQT_SIGNAL( sectionClicked( int ) ), + this, TQT_SLOT( changeSortColumn( int ) ) ); currentRecord = -1; } -void KWClassicMailMergeEditorList::invalidateCurrentRecord() +void KWClassicMailMergeEditorList::tqinvalidateCurrentRecord() { currentRecord=-1; } @@ -265,10 +265,10 @@ KWClassicMailMergeEditorList::~KWClassicMailMergeEditorList() if ( currentRecord == -1 ) return; - QListViewItemIterator lit( this ); - QMap< QString, QString >::ConstIterator it = db->getRecordEntries().begin(); + TQListViewItemIterator lit( this ); + TQMap< TQString, TQString >::ConstIterator it = db->getRecordEntries().begin(); for ( ; it != db->getRecordEntries().end(); ++it ) { - QListViewItem *item = 0; + TQListViewItem *item = 0; item = lit.current(); ++lit; if ( currentRecord != -1 && item ) @@ -289,7 +289,7 @@ void KWClassicMailMergeEditorList::sectionClicked( int ) void KWClassicMailMergeEditorList::updateItems() { - QListViewItemIterator it( this ); + TQListViewItemIterator it( this ); for ( ; it.current(); ++it ) ( (KWClassicMailMergeEditorListItem*)it.current() )->update(); } @@ -300,11 +300,11 @@ void KWClassicMailMergeEditorList::displayRecord( int i ) return; bool create = !firstChild(); - QListViewItemIterator lit( this ); - QMap< QString, QString >::ConstIterator it = db->getRecordEntries().begin(); - QListViewItem *after = 0; + TQListViewItemIterator lit( this ); + TQMap< TQString, TQString >::ConstIterator it = db->getRecordEntries().begin(); + TQListViewItem *after = 0; for ( ; it != db->getRecordEntries().end(); ++it ) { - QListViewItem *item = 0; + TQListViewItem *item = 0; if ( create ) { item = new KWClassicMailMergeEditorListItem( this, after ); item->setText( 0, it.key() ); @@ -329,72 +329,72 @@ void KWClassicMailMergeEditorList::displayRecord( int i ) * ******************************************************************/ -KWClassicMailMergeEditor::KWClassicMailMergeEditor( QWidget *parent, KWClassicSerialDataSource *db_ ) - : KDialogBase( Plain, i18n( "Mail Merge - Editor" ), Ok | Cancel, Ok, parent, "", true ), db( db_ ) +KWClassicMailMergeEditor::KWClassicMailMergeEditor( TQWidget *tqparent, KWClassicSerialDataSource *db_ ) + : KDialogBase( Plain, i18n( "Mail Merge - Editor" ), Ok | Cancel, Ok, tqparent, "", true ), db( db_ ) { back = plainPage(); - QVBoxLayout *l = new QVBoxLayout( back ); + TQVBoxLayout *l = new TQVBoxLayout( back ); l->setAutoAdd(true); l->setSpacing( KDialog::spacingHint() ); - QHBox *toolbar = new QHBox( back ); + TQHBox *toolbar = new TQHBox( back ); - first = new QToolButton( toolbar ); + first = new TQToolButton( toolbar ); first->setIconSet( SmallIconSet( "start" ) ); - first->setFixedSize( first->sizeHint() ); - connect(first, SIGNAL(clicked()), this, SLOT(firstRecord())); + first->setFixedSize( first->tqsizeHint() ); + connect(first, TQT_SIGNAL(clicked()), this, TQT_SLOT(firstRecord())); - back_ = new QToolButton( toolbar ); + back_ = new TQToolButton( toolbar ); back_->setIconSet( SmallIconSet( "back" ) ); - back_->setFixedSize( back_->sizeHint() ); - connect(back_, SIGNAL(clicked()), this, SLOT(prevRecord())); + back_->setFixedSize( back_->tqsizeHint() ); + connect(back_, TQT_SIGNAL(clicked()), this, TQT_SLOT(prevRecord())); - records = new QSpinBox( 1, db->getNumRecords(), 1, toolbar ); - records->setMaximumHeight( records->sizeHint().height() ); - connect( records, SIGNAL( valueChanged( int ) ), - this, SLOT( changeRecord( int ) ) ); + records = new TQSpinBox( 1, db->getNumRecords(), 1, toolbar ); + records->setMaximumHeight( records->tqsizeHint().height() ); + connect( records, TQT_SIGNAL( valueChanged( int ) ), + this, TQT_SLOT( changeRecord( int ) ) ); - forward = new QToolButton( toolbar ); + forward = new TQToolButton( toolbar ); forward->setIconSet( SmallIconSet( "forward" ) ); - forward->setFixedSize( forward->sizeHint() ); - connect(forward, SIGNAL(clicked()), this, SLOT(nextRecord())); + forward->setFixedSize( forward->tqsizeHint() ); + connect(forward, TQT_SIGNAL(clicked()), this, TQT_SLOT(nextRecord())); - finish = new QToolButton( toolbar ); + finish = new TQToolButton( toolbar ); finish->setIconSet( SmallIconSet( "finish" ) ); - finish->setFixedSize( finish->sizeHint() ); - connect(finish, SIGNAL(clicked()), this, SLOT(lastRecord())); + finish->setFixedSize( finish->tqsizeHint() ); + connect(finish, TQT_SIGNAL(clicked()), this, TQT_SLOT(lastRecord())); - QWidget *sep = new QWidget( toolbar ); + TQWidget *sep = new TQWidget( toolbar ); sep->setMaximumWidth( 10 ); - newRecord = new QToolButton( toolbar ); + newRecord = new TQToolButton( toolbar ); newRecord->setIconSet( SmallIconSet( "sl_addrecord" ) ); - newRecord->setFixedSize( newRecord->sizeHint() ); - connect( newRecord, SIGNAL( clicked() ), - this, SLOT( addRecord() ) ); - QToolTip::add( newRecord, i18n( "Add record" ) ); + newRecord->setFixedSize( newRecord->tqsizeHint() ); + connect( newRecord, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( addRecord() ) ); + TQToolTip::add( newRecord, i18n( "Add record" ) ); - newEntry = new QToolButton( toolbar ); + newEntry = new TQToolButton( toolbar ); newEntry->setIconSet( SmallIconSet( "sl_addentry" ) ); - newEntry->setFixedSize( newEntry->sizeHint() ); - connect( newEntry, SIGNAL( clicked() ), - this, SLOT( addEntry() ) ); - QToolTip::add( newEntry, i18n( "Add entry" ) ); + newEntry->setFixedSize( newEntry->tqsizeHint() ); + connect( newEntry, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( addEntry() ) ); + TQToolTip::add( newEntry, i18n( "Add entry" ) ); - deleteRecord = new QToolButton( toolbar ); + deleteRecord = new TQToolButton( toolbar ); deleteRecord->setIconSet( SmallIconSet( "sl_delrecord" ) ); - deleteRecord->setFixedSize( deleteRecord->sizeHint() ); - connect( deleteRecord, SIGNAL( clicked() ), - this, SLOT( removeRecord() ) ); - QToolTip::add( deleteRecord, i18n( "Remove record" ) ); + deleteRecord->setFixedSize( deleteRecord->tqsizeHint() ); + connect( deleteRecord, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( removeRecord() ) ); + TQToolTip::add( deleteRecord, i18n( "Remove record" ) ); - deleteEntry = new QToolButton( toolbar ); + deleteEntry = new TQToolButton( toolbar ); deleteEntry->setIconSet( SmallIconSet( "sl_delentry" ) ); - deleteEntry->setFixedSize( deleteEntry->sizeHint() ); - connect( deleteEntry, SIGNAL( clicked() ), - this, SLOT( removeEntry() ) ); - QToolTip::add( deleteEntry, i18n( "Remove entry" ) ); + deleteEntry->setFixedSize( deleteEntry->tqsizeHint() ); + connect( deleteEntry, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( removeEntry() ) ); + TQToolTip::add( deleteEntry, i18n( "Remove entry" ) ); dbList = new KWClassicMailMergeEditorList( back, db ); @@ -412,7 +412,7 @@ KWClassicMailMergeEditor::KWClassicMailMergeEditor( QWidget *parent, KWClassicSe deleteRecord->setEnabled(false); records->setEnabled(true); } - setInitialSize( QSize( 600, 400 ) ); + setInitialSize( TQSize( 600, 400 ) ); updateButton(); } @@ -451,7 +451,7 @@ void KWClassicMailMergeEditor::updateButton() } -void KWClassicMailMergeEditor::resizeEvent( QResizeEvent *e ) +void KWClassicMailMergeEditor::resizeEvent( TQResizeEvent *e ) { KDialogBase::resizeEvent( e ); // back->resize( size() ); @@ -465,9 +465,9 @@ void KWClassicMailMergeEditor::changeRecord( int i ) void KWClassicMailMergeEditor::addEntry() { bool ok; - QString value=KInputDialog::getText( i18n("Add Entry"), + TQString value=KInputDialog::getText( i18n("Add Entry"), i18n("Enter entry name:"), - QString::null, + TQString(), &ok, this); if ((ok) && !value.isEmpty()) @@ -503,7 +503,7 @@ void KWClassicMailMergeEditor::addRecord() void KWClassicMailMergeEditor::removeEntry() { - QListViewItem * item = dbList->selectedItem (); + TQListViewItem * item = dbList->selectedItem (); if ( item ) { db->removeEntry( item->text(0) ); @@ -512,7 +512,7 @@ void KWClassicMailMergeEditor::removeEntry() dbList->updateItems(); updateButton(); } -#if defined( Q_CC_GNU ) +#if defined( TQ_CC_GNU ) #warning reimplement #endif /* @@ -521,7 +521,7 @@ void KWClassicMailMergeEditor::removeEntry() KWMailMergeVariableInsertDia *dia = new KWMailMergeVariableInsertDia( this, db ); - if ( dia->exec() == QDialog::Accepted ) { + if ( dia->exec() == TQDialog::Accepted ) { dbList->clear(); db->removeEntry( dia->getName() ); changeRecord( records->value() + 1 ); @@ -537,7 +537,7 @@ void KWClassicMailMergeEditor::removeRecord() return; db->removeRecord( records->value() - 1 ); - dbList->invalidateCurrentRecord(); + dbList->tqinvalidateCurrentRecord(); if ( db->getNumRecords() > 0 ) { records->setRange( records->minValue(), records->maxValue() - 1 ); records->setValue( 1 ); @@ -561,9 +561,9 @@ void KWClassicMailMergeEditor::removeRecord() } extern "C" { - KWORD_MAILMERGE_EXPORT KWMailMergeDataSource *create_kwmailmerge_classic(KInstance *inst,QObject *parent) + KWORD_MAILMERGE_EXPORT KWMailMergeDataSource *create_kwmailmerge_classic(KInstance *inst,TQObject *tqparent) { - return new KWClassicSerialDataSource(inst,parent); + return new KWClassicSerialDataSource(inst,tqparent); } } |