diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kword/KWMailMergeDataBase.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kword/KWMailMergeDataBase.cpp')
-rw-r--r-- | kword/KWMailMergeDataBase.cpp | 240 |
1 files changed, 120 insertions, 120 deletions
diff --git a/kword/KWMailMergeDataBase.cpp b/kword/KWMailMergeDataBase.cpp index 77c4b815..1a637e16 100644 --- a/kword/KWMailMergeDataBase.cpp +++ b/kword/KWMailMergeDataBase.cpp @@ -34,12 +34,12 @@ #include <kservice.h> #include <kmainwindow.h> -#include <qfile.h> -#include <qvbox.h> -#include <qspinbox.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qpushbutton.h> +#include <tqfile.h> +#include <tqvbox.h> +#include <tqspinbox.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqpushbutton.h> /****************************************************************** * @@ -48,8 +48,8 @@ ******************************************************************/ KWMailMergeDataBase::KWMailMergeDataBase( KWDocument *doc_ ) - : QObject(doc_,doc_->dcopObject()->objId()+".MailMergeDataBase"), - KWordMailMergeDatabaseIface(QCString(doc_->dcopObject()->objId()+".MailMergeDataBase")), + : TQObject(doc_,doc_->dcopObject()->objId()+".MailMergeDataBase"), + KWordMailMergeDatabaseIface(TQCString(doc_->dcopObject()->objId()+".MailMergeDataBase")), m_version(0), doc( doc_ ) { @@ -57,10 +57,10 @@ KWMailMergeDataBase::KWMailMergeDataBase( KWDocument *doc_ ) rejectdcopcall=false; } -QStringList KWMailMergeDataBase::availablePlugins() +TQStringList KWMailMergeDataBase::availablePlugins() { - QStringList tmp; - KTrader::OfferList pluginOffers=KTrader::self()->query(QString::fromLatin1("KWord/MailMergePlugin"),QString::null); + TQStringList tmp; + KTrader::OfferList pluginOffers=KTrader::self()->query(TQString::tqfromLatin1("KWord/MailMergePlugin"),TQString()); for (KTrader::OfferList::Iterator it=pluginOffers.begin();*it;++it) { tmp.append((*it)->property("X-KDE-InternalName").toString()); @@ -74,15 +74,15 @@ bool KWMailMergeDataBase::isConfigDialogShown() return rejectdcopcall; } -bool KWMailMergeDataBase::loadPlugin(const QString &name,const QString &command) +bool KWMailMergeDataBase::loadPlugin(const TQString &name,const TQString &command) { if (rejectdcopcall)return false; - QString constrain=QString("[X-KDE-InternalName] =='"+name+"'"); + TQString constrain=TQString("[X-KDE-InternalName] =='"+name+"'"); kdDebug()<<constrain<<endl; - KTrader::OfferList pluginOffers=KTrader::self()->query(QString::fromLatin1("KWord/MailMergePlugin"),constrain); + KTrader::OfferList pluginOffers=KTrader::self()->query(TQString::tqfromLatin1("KWord/MailMergePlugin"),constrain); KService::Ptr it=pluginOffers.first(); - QVariant verProp=it->property("X-KDE-PluginVersion"); + TQVariant verProp=it->property("X-KDE-PluginVersion"); int version=verProp.toInt(); if (it) @@ -116,9 +116,9 @@ KWMailMergeDataSource *KWMailMergeDataBase::openPluginFor(int type,int &version) { version=0; KWMailMergeDataSource *ret=0; - QString constrain=QString("'%1' in [X-KDE-Capabilities]").arg(((type==KWSLCreate)?KWSLCreate_text:KWSLOpen_text)); + TQString constrain=TQString("'%1' in [X-KDE-Capabilities]").tqarg(((type==KWSLCreate)?KWSLCreate_text:KWSLOpen_text)); kdDebug()<<constrain<<endl; - KTrader::OfferList pluginOffers=KTrader::self()->query(QString::fromLatin1("KWord/MailMergePlugin"),constrain); + KTrader::OfferList pluginOffers=KTrader::self()->query(TQString::tqfromLatin1("KWord/MailMergePlugin"),constrain); //Only for debugging for (KTrader::OfferList::Iterator it=pluginOffers.begin();*it;++it) @@ -136,9 +136,9 @@ KWMailMergeDataSource *KWMailMergeDataBase::openPluginFor(int type,int &version) { KWMailMergeChoosePluginDialog *dia=new KWMailMergeChoosePluginDialog(pluginOffers); - if (dia->exec()==QDialog::Accepted) + if (dia->exec()==TQDialog::Accepted) { - QVariant verProp=(*(pluginOffers.at(dia->currentPlugin())))->property("X-KDE-PluginVersion"); + TQVariant verProp=(*(pluginOffers.at(dia->currentPlugin())))->property("X-KDE-PluginVersion"); version=verProp.toInt(); ret=loadPlugin((*(pluginOffers.at(dia->currentPlugin())))->library()); @@ -148,7 +148,7 @@ KWMailMergeDataSource *KWMailMergeDataBase::openPluginFor(int type,int &version) return ret; } -KWMailMergeDataSource *KWMailMergeDataBase::loadPlugin(const QString& name) +KWMailMergeDataSource *KWMailMergeDataBase::loadPlugin(const TQString& name) { if (!name.isEmpty()) { @@ -157,23 +157,23 @@ KWMailMergeDataSource *KWMailMergeDataBase::loadPlugin(const QString& name) KLibLoader *loader = KLibLoader::self(); // try to load the library - QString libname=name; -// QString libname("lib%1"); - KLibrary *lib = loader->library(QFile::encodeName(libname)); + TQString libname=name; +// TQString libname("lib%1"); + KLibrary *lib = loader->library(TQFile::encodeName(libname)); if (lib) { // get the create_ function - QString factory=QString("create_%1").arg(name); - void *create = lib->symbol(QFile::encodeName(factory)); + TQString factory=TQString("create_%1").tqarg(name); + void *create = lib->symbol(TQFile::encodeName(factory)); if (create) { // create the module - KWMailMergeDataSource * (*func)(KInstance*,QObject*); - func = (KWMailMergeDataSource* (*)(KInstance*,QObject*)) create; + KWMailMergeDataSource * (*func)(KInstance*,TQObject*); + func = (KWMailMergeDataSource* (*)(KInstance*,TQObject*)) create; KWMailMergeDataSource *tmpsource =func(KWFactory::instance(),this); if (tmpsource) { - QDataStream tmpstream(tmpsource->info,IO_WriteOnly); + TQDataStream tmpstream(tmpsource->info,IO_WriteOnly); tmpstream<<name; } return tmpsource; @@ -190,7 +190,7 @@ bool KWMailMergeDataBase::isSampleRecord() { return (0>doc->mailMergeRecord()); } -QString KWMailMergeDataBase::getValue( const QString &name, int record ) const +TQString KWMailMergeDataBase::getValue( const TQString &name, int record ) const { if (plugin) { @@ -198,7 +198,7 @@ QString KWMailMergeDataBase::getValue( const QString &name, int record ) const return plugin->getValue(name,record); } else - return QString(""); + return TQString(""); } @@ -207,7 +207,7 @@ void KWMailMergeDataBase::refresh(bool force) if (plugin) plugin->refresh(force); } -const QMap< QString, QString > &KWMailMergeDataBase::getRecordEntries() const +const TQMap< TQString, TQString > &KWMailMergeDataBase::getRecordEntries() const { if (plugin) return plugin->getRecordEntries(); @@ -225,7 +225,7 @@ int KWMailMergeDataBase::getNumRecords() const } -void KWMailMergeDataBase::showConfigDialog(QWidget *par) +void KWMailMergeDataBase::showConfigDialog(TQWidget *par) { rejectdcopcall=true; KWMailMergeConfigDialog *dia=new KWMailMergeConfigDialog(par,this); @@ -235,7 +235,7 @@ void KWMailMergeDataBase::showConfigDialog(QWidget *par) } -bool KWMailMergeDataBase::askUserForConfirmationAndConfig(KWMailMergeDataSource *tmpPlugin,bool config,QWidget *par,int version) +bool KWMailMergeDataBase::askUserForConfirmationAndConfig(KWMailMergeDataSource *tmpPlugin,bool config,TQWidget *par,int version) { if (tmpPlugin) { @@ -249,7 +249,7 @@ bool KWMailMergeDataBase::askUserForConfirmationAndConfig(KWMailMergeDataSource { if (KMessageBox::warningContinueCancel(par, i18n("Do you really want to replace the current datasource?"), - QString::null,QString::null,QString::null,true)== KMessageBox::Cancel) + TQString(),TQString(),TQString(),true)== KMessageBox::Cancel) { delete tmpPlugin; tmpPlugin=0; @@ -267,45 +267,45 @@ bool KWMailMergeDataBase::askUserForConfirmationAndConfig(KWMailMergeDataSource return false; } } - tmpPlugin->setObjId(QCString(objId()+".MailMergePlugin")); + tmpPlugin->setObjId(TQCString(objId()+".MailMergePlugin")); return true; } -QDomElement KWMailMergeDataBase::save(QDomDocument &doc) const +TQDomElement KWMailMergeDataBase::save(TQDomDocument &doc) const { kdDebug()<<"KWMailMergeDataBase::save()"<<endl; - QDomElement parentElem=doc.createElement("MAILMERGE"); + TQDomElement tqparentElem=doc.createElement("MAILMERGE"); if (plugin) { kdDebug()<<"KWMailMergeDataBase::save() There is really something to save"<<endl; - QDomElement el=doc.createElement(QString::fromLatin1("PLUGIN")); + TQDomElement el=doc.createElement(TQString::tqfromLatin1("PLUGIN")); - QDataStream ds(plugin->info,IO_ReadOnly); - QString libname; + TQDataStream ds(plugin->info,IO_ReadOnly); + TQString libname; ds>>libname; el.setAttribute("library",libname); - parentElem.appendChild(el); + tqparentElem.appendChild(el); kdDebug()<<"KWMailMergeDataBase::save() Calling datasource save()"<<endl; - QDomElement el2=doc.createElement(QString::fromLatin1("DATASOURCE")); + TQDomElement el2=doc.createElement(TQString::tqfromLatin1("DATASOURCE")); plugin->save(doc,el2); - parentElem.appendChild(el2); + tqparentElem.appendChild(el2); } kdDebug()<<"KWMailMergeDataBase::save() leaving now"<<endl; - return parentElem; - // if (plugin) plugin->save(parentElem); // Not completely sure, perhaps the database itself has to save something too (JoWenn) + return tqparentElem; + // if (plugin) plugin->save(tqparentElem); // Not completely sure, perhaps the database itself has to save something too (JoWenn) } -void KWMailMergeDataBase::load( const QDomElement& parentElem ) +void KWMailMergeDataBase::load( const TQDomElement& tqparentElem ) { - QDomNode dn=parentElem.namedItem("PLUGIN"); + TQDomNode dn=tqparentElem.namedItem("PLUGIN"); if (dn.isNull()) return; - QDomElement el=dn.toElement(); + TQDomElement el=dn.toElement(); plugin=loadPlugin(el.attribute("library")); - dn=parentElem.namedItem("DATASOURCE"); + dn=tqparentElem.namedItem("DATASOURCE"); if (dn.isNull()) return; el=dn.toElement(); if (plugin) plugin->load(el); @@ -326,38 +326,38 @@ int KWMailMergeDataBase::version() { KWMailMergeChoosePluginDialog::KWMailMergeChoosePluginDialog( KTrader::OfferList offers ) : KDialogBase( Plain, i18n( "Mail Merge Setup" ), Ok | Cancel, Ok, - /*parent*/ 0, "", true ), pluginOffers( offers ) + /*tqparent*/ 0, "", true ), pluginOffers( offers ) { - QWidget *back = plainPage(); - QVBoxLayout *layout = new QVBoxLayout( back, 0, spacingHint() ); + TQWidget *back = plainPage(); + TQVBoxLayout *tqlayout = new TQVBoxLayout( back, 0, spacingHint() ); - QLabel *label = new QLabel( i18n( "&Available sources:" ), back ); - chooser = new QComboBox( false, back ); + TQLabel *label = new TQLabel( i18n( "&Available sources:" ), back ); + chooser = new TQComboBox( false, back ); label->setBuddy( chooser ); - descriptionLabel = new QLabel( back ); + descriptionLabel = new TQLabel( back ); descriptionLabel->hide(); - descriptionLabel->setAlignment( WordBreak ); - descriptionLabel->setFrameShape( QFrame::Box ); - descriptionLabel->setFrameShadow( QFrame::Sunken ); + descriptionLabel->tqsetAlignment( WordBreak ); + descriptionLabel->setFrameShape( TQFrame::Box ); + descriptionLabel->setFrameShadow( TQFrame::Sunken ); - QSize old_sizeHint; + TQSize old_tqsizeHint; for ( KTrader::OfferList::Iterator it = pluginOffers.begin(); *it; ++it ) { chooser->insertItem( (*it)->name() ); - old_sizeHint = descriptionLabel->sizeHint(); + old_tqsizeHint = descriptionLabel->tqsizeHint(); descriptionLabel->setText( (*it)->comment() ); - if (descriptionLabel->sizeHint().width()*descriptionLabel->sizeHint().height() > old_sizeHint.width()*old_sizeHint.height()) - descriptionLabel->setMinimumSize(descriptionLabel->sizeHint() ); + if (descriptionLabel->tqsizeHint().width()*descriptionLabel->tqsizeHint().height() > old_tqsizeHint.width()*old_tqsizeHint.height()) + descriptionLabel->setMinimumSize(descriptionLabel->tqsizeHint() ); } descriptionLabel->show(); - connect( chooser, SIGNAL( activated( int ) ), - this, SLOT( pluginChanged( int ) ) ); + connect( chooser, TQT_SIGNAL( activated( int ) ), + this, TQT_SLOT( pluginChanged( int ) ) ); - layout->addWidget( label ); - layout->addWidget( chooser ); - layout->addWidget( descriptionLabel ); - layout->addStretch( 1 ); + tqlayout->addWidget( label ); + tqlayout->addWidget( chooser ); + tqlayout->addWidget( descriptionLabel ); + tqlayout->addStretch( 1 ); pluginChanged( 0 ); } @@ -382,54 +382,54 @@ void KWMailMergeChoosePluginDialog::pluginChanged( int pos ) * ******************************************************************/ -KWMailMergeConfigDialog::KWMailMergeConfigDialog(QWidget *parent,KWMailMergeDataBase *db) - : KDialogBase(Plain, i18n( "Mail Merge Setup" ), Close, Close, parent, "", true ) +KWMailMergeConfigDialog::KWMailMergeConfigDialog(TQWidget *tqparent,KWMailMergeDataBase *db) + : KDialogBase(Plain, i18n( "Mail Merge Setup" ), Close, Close, tqparent, "", true ) { db_=db; - QWidget *back = plainPage(); - QVBoxLayout *layout=new QVBoxLayout(back); -// QVBox *back = new QVBox( page ); - layout->setSpacing( KDialog::spacingHint() ); + TQWidget *back = plainPage(); + TQVBoxLayout *tqlayout=new TQVBoxLayout(back); +// TQVBox *back = new TQVBox( page ); + tqlayout->setSpacing( KDialog::spacingHint() ); -// QVBox *row1 = new QVBox( back ); +// TQVBox *row1 = new TQVBox( back ); // row1->setSpacing( KDialog::spacingHint() ); - QLabel *l = new QLabel( i18n( "Datasource:" ),back ); -// l->setMaximumHeight( l->sizeHint().height() ); - layout->addWidget(l); + TQLabel *l = new TQLabel( i18n( "Datasource:" ),back ); +// l->setMaximumHeight( l->tqsizeHint().height() ); + tqlayout->addWidget(l); - QHBox *row1=new QHBox(back); - layout->addWidget(row1); + TQHBox *row1=new TQHBox(back); + tqlayout->addWidget(row1); row1->setSpacing( KDialog::spacingHint() ); - edit=new QPushButton(i18n("Edit Current..."),row1); - create=new QPushButton(i18n("Create New..."),row1); - open=new QPushButton(i18n("Open Existing..."),row1); + edit=new TQPushButton(i18n("Edit Current..."),row1); + create=new TQPushButton(i18n("Create New..."),row1); + open=new TQPushButton(i18n("Open Existing..."),row1); KSeparator *separator1 = new KSeparator(back); - layout->addWidget(separator1); + tqlayout->addWidget(separator1); - l = new QLabel( i18n( "Merging:" ),back ); - layout->addWidget(l); -// l->setMaximumHeight( l->sizeHint().height() ); - QHBox *row2=new QHBox(back); - layout->addWidget(row2); + l = new TQLabel( i18n( "Merging:" ),back ); + tqlayout->addWidget(l); +// l->setMaximumHeight( l->tqsizeHint().height() ); + TQHBox *row2=new TQHBox(back); + tqlayout->addWidget(row2); row2->setSpacing( KDialog::spacingHint() ); - preview=new QPushButton(i18n("Print Preview..."),row2); - document=new QPushButton(i18n("Create New Document"),row2); + preview=new TQPushButton(i18n("Print Preview..."),row2); + document=new TQPushButton(i18n("Create New Document"),row2); document->hide(); - (void) new QWidget(row2); - layout->addStretch(); + (void) new TQWidget(row2); + tqlayout->addStretch(); KSeparator *separator2 = new KSeparator(back); - layout->addWidget(separator2); + tqlayout->addWidget(separator2); enableDisableEdit(); - connect(edit,SIGNAL(clicked()), this, SLOT(slotEditClicked())); - connect(create,SIGNAL(clicked()),this,SLOT(slotCreateClicked())); - connect(open,SIGNAL(clicked()),this,SLOT(slotOpenClicked())); - connect(preview,SIGNAL(clicked()),this,SLOT(slotPreviewClicked())); - connect(document,SIGNAL(clicked()),this,SLOT(slotDocumentClicked())); + connect(edit,TQT_SIGNAL(clicked()), this, TQT_SLOT(slotEditClicked())); + connect(create,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotCreateClicked())); + connect(open,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotOpenClicked())); + connect(preview,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotPreviewClicked())); + connect(document,TQT_SIGNAL(clicked()),this,TQT_SLOT(slotDocumentClicked())); } void KWMailMergeConfigDialog::enableDisableEdit() @@ -450,14 +450,14 @@ void KWMailMergeConfigDialog::enableDisableEdit() void KWMailMergeConfigDialog::slotEditClicked() {db_->action=KWSLEdit; - if (db_->plugin) db_->plugin->showConfigDialog((QWidget*)parent(),KWSLEdit); + if (db_->plugin) db_->plugin->showConfigDialog((TQWidget*)tqparent(),KWSLEdit); } void KWMailMergeConfigDialog::slotCreateClicked() { db_->action=KWSLCreate; doNewActions(); -//done(QDialog::Accepted); +//done(TQDialog::Accepted); } void KWMailMergeConfigDialog::doNewActions() @@ -482,7 +482,7 @@ void KWMailMergeConfigDialog::slotOpenClicked() void KWMailMergeConfigDialog::slotPreviewClicked() { db_->action=KWSLMergePreview; - KMainWindow *mw=dynamic_cast<KMainWindow*>(((QWidget *)parent())->topLevelWidget()); + KMainWindow *mw=dynamic_cast<KMainWindow*>(((TQWidget *)tqparent())->tqtopLevelWidget()); if (mw) { KAction *ac=mw->actionCollection()->action(KStdAction::stdName(KStdAction::PrintPreview)); @@ -496,7 +496,7 @@ void KWMailMergeConfigDialog::slotPreviewClicked() void KWMailMergeConfigDialog::slotDocumentClicked() { db_->action=KWSLMergeDocument; - done(QDialog::Accepted); + done(TQDialog::Accepted); } KWMailMergeConfigDialog::~KWMailMergeConfigDialog() @@ -509,29 +509,29 @@ KWMailMergeConfigDialog::~KWMailMergeConfigDialog() * ******************************************************************/ -KWMailMergeVariableInsertDia::KWMailMergeVariableInsertDia( QWidget *parent, KWMailMergeDataBase *db ) +KWMailMergeVariableInsertDia::KWMailMergeVariableInsertDia( TQWidget *tqparent, KWMailMergeDataBase *db ) : KDialogBase( Plain, i18n( "Mail Merge - Variable Name" ), - Ok | Cancel, Ok, parent, "", true ) + Ok | Cancel, Ok, tqparent, "", true ) { m_db=db; - QWidget *page = plainPage(); + TQWidget *page = plainPage(); - QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); - layout->setAutoAdd( true ); + TQVBoxLayout *tqlayout = new TQVBoxLayout( page, marginHint(), spacingHint() ); + tqlayout->setAutoAdd( true ); - QLabel *l = new QLabel( i18n( "Name:" ), page ); - l->setMaximumHeight( l->sizeHint().height() ); - names = new QListBox( page ); + TQLabel *l = new TQLabel( i18n( "Name:" ), page ); + l->setMaximumHeight( l->tqsizeHint().height() ); + names = new TQListBox( page ); - QMap< QString, QString >::ConstIterator it = db->getRecordEntries().begin(); + TQMap< TQString, TQString >::ConstIterator it = db->getRecordEntries().begin(); for ( ; it != db->getRecordEntries().end(); ++it ) names->insertItem( m_db->version() ?it.data():it.key(), -1 ); - setInitialSize( QSize( 350, 400 ) ); - connect( names, SIGNAL( selectionChanged() ), - this, SLOT( slotSelectionChanged() ) ); - connect( names, SIGNAL( doubleClicked( QListBoxItem* ) ), - this, SLOT( slotOk() ) ); + setInitialSize( TQSize( 350, 400 ) ); + connect( names, TQT_SIGNAL( selectionChanged() ), + this, TQT_SLOT( slotSelectionChanged() ) ); + connect( names, TQT_SIGNAL( doubleClicked( TQListBoxItem* ) ), + this, TQT_SLOT( slotOk() ) ); setFocus(); enableButtonOK( names->currentItem() != -1 ); @@ -542,11 +542,11 @@ void KWMailMergeVariableInsertDia::slotSelectionChanged() enableButtonOK( names->currentItem() != -1 ); } -QString KWMailMergeVariableInsertDia::getName() const +TQString KWMailMergeVariableInsertDia::getName() const { if (m_db->version()>=1) { - QString description=names->text(names->currentItem()); - QMap< QString, QString >::ConstIterator it = m_db->getRecordEntries().begin(); + TQString description=names->text(names->currentItem()); + TQMap< TQString, TQString >::ConstIterator it = m_db->getRecordEntries().begin(); for ( ; it != m_db->getRecordEntries().end(); ++it ) if (description==it.data()) { return it.key(); |