diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kword/mailmerge | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kword/mailmerge')
36 files changed, 5541 insertions, 0 deletions
diff --git a/kword/mailmerge/KWClassicSerialDataSource.cpp b/kword/mailmerge/KWClassicSerialDataSource.cpp new file mode 100644 index 00000000..0b3f446f --- /dev/null +++ b/kword/mailmerge/KWClassicSerialDataSource.cpp @@ -0,0 +1,569 @@ +/* This file is part of the KDE project + Original file (mailmerge.cc): Copyright (C) 1998, 1999 Reginald Stadlbauer <[email protected]> + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "KWClassicSerialDataSource.h" +#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 <klocale.h> +#include <kdebug.h> +#include <qtoolbutton.h> +#include <qtooltip.h> +#include <kiconloader.h> +#include <qheader.h> +#include "KWDocument.h" +#include "defs.h" + +#define KWSLCPBarIcon( x ) BarIcon( x, db->KWInstance() ) + +/****************************************************************** + * + * Class: KWClassicSerialDataSource + * + ******************************************************************/ + +KWClassicSerialDataSource::KWClassicSerialDataSource(KInstance *inst,QObject *parent) + : KWMailMergeDataSource(inst,parent) +// : doc( doc_ ) +{ +} + +KWClassicSerialDataSource::~KWClassicSerialDataSource() +{ +} + +QString KWClassicSerialDataSource::getValue( const QString &name, int record ) const +{ + int num = record; +/* if ( num == -1 ) + num = doc->getMailMergeRecord(); Is this really needed ?*/ + + if ( num < 0 || num > (int)db.count() ) + return name; + + return db[ num ][ name ]; +} + +void KWClassicSerialDataSource::setValue( const QString &name, const QString &value, int record ) +{ + int num = record; +/* if ( num == -1 ) + num = doc->getMailMergeRecord(); Is this really needed?*/ + + if ( num < 0 || num > (int)db.count() ) + return; + + db[ num ][ name ] = value; +} + +void KWClassicSerialDataSource::appendRecord() +{ + DbRecord record( sampleRecord ); + db.append( record ); +} + +void KWClassicSerialDataSource::addEntry( const QString &name ) +{ + sampleRecord[ name ] = i18n( "No Value" ); + Db::Iterator it = db.begin(); + for ( ; it != db.end(); ++it ) + ( *it )[ name ] = sampleRecord[ name ]; +} + +void KWClassicSerialDataSource::removeEntry( const QString &name ) +{ + sampleRecord.remove( name ); + Db::Iterator it = db.begin(); + for ( ; it != db.end(); ++it ) + ( *it ).remove( name ); +} + +void KWClassicSerialDataSource::removeRecord( int i ) +{ + if ( (i < 0) || (i > (int)db.count() - 1) ) + return; + + kdDebug()<<QString("Removing record %1").arg(i)<<endl; + + Db::Iterator it = db.at( i); + db.remove( it ); +} + +void KWClassicSerialDataSource::save( QDomDocument &doc, QDomElement &parent) +{ + QDomElement def=doc.createElement(QString::fromLatin1("DEFINITION")); + parent.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()); + def.appendChild(defEnt); + } + QDomElement cont=doc.createElement(QString::fromLatin1("CONTENT")); + parent.appendChild(cont); + for (Db::Iterator dbI=db.begin();dbI!=db.end();++dbI) + { + QDomElement rec=doc.createElement(QString::fromLatin1("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()]); + rec.appendChild(recEnt); + } + } +} + +void KWClassicSerialDataSource::load( QDomElement& parentElem ) +{ + db.clear(); + sampleRecord.clear(); + QDomNode defNd=parentElem.namedItem("DEFINITION"); + if (defNd.isNull()) return; + QDomElement def=defNd.toElement(); + for (QDomElement defEnt=def.firstChild().toElement();!defEnt.isNull();defEnt=defEnt.nextSibling().toElement()) + { + sampleRecord[defEnt.attribute(QString::fromLatin1("name"))]=i18n( "No Value" ); + } + QDomNode contNd=parentElem.namedItem("CONTENT"); + if (contNd.isNull()) return; + for (QDomNode rec=contNd.firstChild();!rec.isNull();rec=rec.nextSibling()) + { + appendRecord(); + for (QDomElement recEnt=rec.firstChild().toElement();!recEnt.isNull();recEnt=recEnt.nextSibling().toElement()) + { + setValue(recEnt.attribute(QString::fromLatin1("name")), + recEnt.attribute(QString::fromLatin1("data")),db.count()-1); + } + } +} + +bool KWClassicSerialDataSource::showConfigDialog(QWidget *par,int action) +{ + if (action==KWSLCreate) + { + db.clear(); + sampleRecord.clear(); + } + KWClassicMailMergeEditor *dia=new KWClassicMailMergeEditor( par, this ); + bool ret=(dia->exec()==QDialog::Accepted); + delete dia; + return ret; +} + + +/****************************************************************** + * + * Class: KWClassicMailMergeEditorListItem + * + ******************************************************************/ + +KWClassicMailMergeEditorListItem::KWClassicMailMergeEditorListItem( QListView *parent ) + : QListViewItem( parent ) +{ + editWidget = new QLineEdit( listView()->viewport() ); + listView()->addChild( editWidget ); +} + +KWClassicMailMergeEditorListItem::KWClassicMailMergeEditorListItem( QListView *parent, QListViewItem *after ) + : QListViewItem( parent, after ) +{ + editWidget = new QLineEdit( listView()->viewport() ); + listView()->addChild( editWidget ); +} + +KWClassicMailMergeEditorListItem::~KWClassicMailMergeEditorListItem() +{ + delete editWidget; +} + +void KWClassicMailMergeEditorListItem::setText( int i, const QString &text ) +{ + QListViewItem::setText( i, text ); + if ( i == 1 ) + editWidget->setText( text ); +} + +QString KWClassicMailMergeEditorListItem::text( int i ) const +{ + if ( i == 1 ) + return editWidget->text(); + return QListViewItem::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() ); +} + +void KWClassicMailMergeEditorListItem::update() +{ + editWidget->resize( listView()->header()->cellSize( 1 ), height() ); + listView()->moveChild( editWidget, listView()->header()->cellPos( 1 ), + listView()->itemPos( this ) + listView()->contentsY() ); + editWidget->show(); +} + +/****************************************************************** + * + * Class: KWClassicMailMergeEditorList + * + ******************************************************************/ + +KWClassicMailMergeEditorList::KWClassicMailMergeEditorList( QWidget *parent, KWClassicSerialDataSource *db_ ) + : QListView( parent ), 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 ) ) ); + + currentRecord = -1; +} + +void KWClassicMailMergeEditorList::invalidateCurrentRecord() +{ + currentRecord=-1; +} + +KWClassicMailMergeEditorList::~KWClassicMailMergeEditorList() +{ + if ( currentRecord == -1 ) + return; + + QListViewItemIterator lit( this ); + QMap< QString, QString >::ConstIterator it = db->getRecordEntries().begin(); + for ( ; it != db->getRecordEntries().end(); ++it ) { + QListViewItem *item = 0; + item = lit.current(); + ++lit; + if ( currentRecord != -1 && item ) + db->setValue( it.key(), item->text( 1 ), currentRecord ); + } +} + +void KWClassicMailMergeEditorList::columnSizeChange( int c, int, int ) +{ + if ( c == 0 || c == 1 ) + updateItems(); +} + +void KWClassicMailMergeEditorList::sectionClicked( int ) +{ + updateItems(); +} + +void KWClassicMailMergeEditorList::updateItems() +{ + QListViewItemIterator it( this ); + for ( ; it.current(); ++it ) + ( (KWClassicMailMergeEditorListItem*)it.current() )->update(); +} + +void KWClassicMailMergeEditorList::displayRecord( int i ) +{ + if ( i < 0 || i >= db->getNumRecords() ) + return; + + bool create = !firstChild(); + QListViewItemIterator lit( this ); + QMap< QString, QString >::ConstIterator it = db->getRecordEntries().begin(); + QListViewItem *after = 0; + for ( ; it != db->getRecordEntries().end(); ++it ) { + QListViewItem *item = 0; + if ( create ) { + item = new KWClassicMailMergeEditorListItem( this, after ); + item->setText( 0, it.key() ); + after = item; + } else { + item = lit.current(); + ++lit; + if ( currentRecord != -1 && item ) + db->setValue( it.key(), item->text( 1 ), currentRecord ); + } + + if ( item ) + item->setText( 1, db->getValue( it.key(), i ) ); + } + updateItems(); + currentRecord = i; +} + +/****************************************************************** + * + * Class: KWClassicMailMergeEditor + * + ******************************************************************/ + +KWClassicMailMergeEditor::KWClassicMailMergeEditor( QWidget *parent, KWClassicSerialDataSource *db_ ) + : KDialogBase( Plain, i18n( "Mail Merge - Editor" ), Ok | Cancel, Ok, parent, "", true ), db( db_ ) +{ + back = plainPage(); + + QVBoxLayout *l = new QVBoxLayout( back ); + l->setAutoAdd(true); + l->setSpacing( KDialog::spacingHint() ); + + QHBox *toolbar = new QHBox( back ); + + first = new QToolButton( toolbar ); + first->setIconSet( SmallIconSet( "start" ) ); + first->setFixedSize( first->sizeHint() ); + connect(first, SIGNAL(clicked()), this, SLOT(firstRecord())); + + back_ = new QToolButton( toolbar ); + back_->setIconSet( SmallIconSet( "back" ) ); + back_->setFixedSize( back_->sizeHint() ); + connect(back_, SIGNAL(clicked()), this, SLOT(prevRecord())); + + records = new QSpinBox( 1, db->getNumRecords(), 1, toolbar ); + records->setMaximumHeight( records->sizeHint().height() ); + connect( records, SIGNAL( valueChanged( int ) ), + this, SLOT( changeRecord( int ) ) ); + + forward = new QToolButton( toolbar ); + forward->setIconSet( SmallIconSet( "forward" ) ); + forward->setFixedSize( forward->sizeHint() ); + connect(forward, SIGNAL(clicked()), this, SLOT(nextRecord())); + + finish = new QToolButton( toolbar ); + finish->setIconSet( SmallIconSet( "finish" ) ); + finish->setFixedSize( finish->sizeHint() ); + connect(finish, SIGNAL(clicked()), this, SLOT(lastRecord())); + + QWidget *sep = new QWidget( toolbar ); + sep->setMaximumWidth( 10 ); + + newRecord = new QToolButton( toolbar ); + newRecord->setIconSet( SmallIconSet( "sl_addrecord" ) ); + newRecord->setFixedSize( newRecord->sizeHint() ); + connect( newRecord, SIGNAL( clicked() ), + this, SLOT( addRecord() ) ); + QToolTip::add( newRecord, i18n( "Add record" ) ); + + newEntry = new QToolButton( toolbar ); + newEntry->setIconSet( SmallIconSet( "sl_addentry" ) ); + newEntry->setFixedSize( newEntry->sizeHint() ); + connect( newEntry, SIGNAL( clicked() ), + this, SLOT( addEntry() ) ); + QToolTip::add( newEntry, i18n( "Add entry" ) ); + + deleteRecord = new QToolButton( toolbar ); + deleteRecord->setIconSet( SmallIconSet( "sl_delrecord" ) ); + deleteRecord->setFixedSize( deleteRecord->sizeHint() ); + connect( deleteRecord, SIGNAL( clicked() ), + this, SLOT( removeRecord() ) ); + QToolTip::add( deleteRecord, i18n( "Remove record" ) ); + + deleteEntry = new QToolButton( toolbar ); + deleteEntry->setIconSet( SmallIconSet( "sl_delentry" ) ); + deleteEntry->setFixedSize( deleteEntry->sizeHint() ); + connect( deleteEntry, SIGNAL( clicked() ), + this, SLOT( removeEntry() ) ); + QToolTip::add( deleteEntry, i18n( "Remove entry" ) ); + + dbList = new KWClassicMailMergeEditorList( back, db ); + + if ( db->getNumRecords() > 0 ) { + records->setValue( 1 ); + dbList->displayRecord(0); +// dbList->updateItems(); + } else { + first->setEnabled(false); + back_->setEnabled(false); + forward->setEnabled(false); + finish->setEnabled(false); + newRecord->setEnabled(false); + deleteEntry->setEnabled(false); + deleteRecord->setEnabled(false); + records->setEnabled(true); + } + setInitialSize( QSize( 600, 400 ) ); + updateButton(); +} + +void KWClassicMailMergeEditor::firstRecord() +{ + records->setValue(1); + updateButton(); +} + +void KWClassicMailMergeEditor::prevRecord() +{ + records->setValue(records->value()-1); + updateButton(); +} + +void KWClassicMailMergeEditor::nextRecord() +{ + records->setValue(records->value()+1); + updateButton(); +} + +void KWClassicMailMergeEditor::lastRecord() +{ + records->setValue(records->maxValue()); + updateButton(); +} + + +void KWClassicMailMergeEditor::updateButton() +{ + int val = records->value(); + first->setEnabled( val > 1); + back_->setEnabled( val> 1 ); + forward->setEnabled( val < records->maxValue() ); + finish->setEnabled( val < records->maxValue()); + +} + +void KWClassicMailMergeEditor::resizeEvent( QResizeEvent *e ) +{ + KDialogBase::resizeEvent( e ); +// back->resize( size() ); +} + +void KWClassicMailMergeEditor::changeRecord( int i ) +{ + dbList->displayRecord( i - 1 ); +} + +void KWClassicMailMergeEditor::addEntry() +{ + bool ok; + QString value=KInputDialog::getText( i18n("Add Entry"), + i18n("Enter entry name:"), + QString::null, + &ok, + this); + if ((ok) && !value.isEmpty()) + { + if ( db->getNumRecords() == 0 ) + { + first->setEnabled(true); + back_->setEnabled(true); + forward->setEnabled(true); + finish->setEnabled(true); + newRecord->setEnabled(true); + deleteEntry->setEnabled(true); + deleteRecord->setEnabled(true); + records->setEnabled(true); + addRecord(); + } + dbList->clear(); + db->addEntry( value ); + changeRecord( records->value() ); + dbList->updateItems(); + } + updateButton(); +} + +void KWClassicMailMergeEditor::addRecord() +{ + db->appendRecord(); + records->setRange( records->minValue(), records->maxValue() + 1 ); + records->setValue( db->getNumRecords() ); + updateButton(); + +} + +void KWClassicMailMergeEditor::removeEntry() +{ + QListViewItem * item = dbList->selectedItem (); + if ( item ) + { + db->removeEntry( item->text(0) ); + dbList->clear(); + changeRecord( records->value() ); + dbList->updateItems(); + updateButton(); + } +#if defined( Q_CC_GNU ) +#warning reimplement +#endif +/* + if ( db->getNumRecords() == 0 ) + return; + + KWMailMergeVariableInsertDia + *dia = new KWMailMergeVariableInsertDia( this, db ); + if ( dia->exec() == QDialog::Accepted ) { + dbList->clear(); + db->removeEntry( dia->getName() ); + changeRecord( records->value() + 1 ); + dbList->updateItems(); + } + delete dia; +*/ +} + +void KWClassicMailMergeEditor::removeRecord() +{ + if ( db->getNumRecords() == 0 ) + return; + + db->removeRecord( records->value() - 1 ); + dbList->invalidateCurrentRecord(); + if ( db->getNumRecords() > 0 ) { + records->setRange( records->minValue(), records->maxValue() - 1 ); + records->setValue( 1 ); + dbList->clear(); + dbList->updateItems(); + } else + { + dbList->clear(); + records->setEnabled( FALSE ); + } + + if ( db->getNumRecords() == 0 ) + { + newRecord->setEnabled(false); + deleteEntry->setEnabled(false); + deleteRecord->setEnabled(false); + records->setEnabled(true); + } + + updateButton(); +} + +extern "C" { + KWORD_MAILMERGE_EXPORT KWMailMergeDataSource *create_kwmailmerge_classic(KInstance *inst,QObject *parent) + { + return new KWClassicSerialDataSource(inst,parent); + } + +} diff --git a/kword/mailmerge/KWClassicSerialDataSource.h b/kword/mailmerge/KWClassicSerialDataSource.h new file mode 100644 index 00000000..4f348dfe --- /dev/null +++ b/kword/mailmerge/KWClassicSerialDataSource.h @@ -0,0 +1,172 @@ +/* This file is part of the KDE project + Original file (KWMailMergeDataBase.h): Copyright (C) 1998, 1999 Reginald Stadlbauer <[email protected]> + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _SERIALLETTER_CLASSIC_PLUGIN_H_ +#define _SERIALLETTER_CLASSIC_PLUGIN_H_ + +#include <qdom.h> +#include <qlistview.h> +#include <kdialogbase.h> +#include <KoCustomVariablesDia.h> +#include "KWMailMergeDataSource.h" +#include <qspinbox.h> + +class QHBox; +class QVBox; +class QPushButton; +class QListBox; +class QLabel; +class QLineEdit; +class QToolButton; + +/****************************************************************** + * + * Class: KWClassicSerialDataSource + * + ******************************************************************/ +typedef QValueList< DbRecord > Db; + +class KWClassicSerialDataSource: public KWMailMergeDataSource +{ + Q_OBJECT + public: + KWClassicSerialDataSource(KInstance *inst,QObject *parent); + ~KWClassicSerialDataSource(); + + virtual void save( QDomDocument &doc,QDomElement&); + virtual void load( QDomElement& elem ); + virtual class QString getValue( const class QString &name, int record = -1 ) const; + virtual int getNumRecords() const { + return (int)db.count(); + } + virtual bool showConfigDialog(QWidget *,int); + virtual void refresh(bool){}; + + protected: + friend class KWClassicMailMergeEditor; + friend class KWClassicMailMergeEditorList; + + void setValue( const QString &name, const QString &value, int record = -1 ); + void appendRecord(); + void addEntry( const QString &name ); + void removeEntry( const QString &name ); + void removeRecord( int i ); + Db db; +}; + +/****************************************************************** + * + * Class: KWClassicMailMergeEditorListItem + * + ******************************************************************/ + +class KWClassicMailMergeEditorListItem : public QListViewItem +{ +public: + KWClassicMailMergeEditorListItem( QListView *parent ); + KWClassicMailMergeEditorListItem( QListView *parent, QListViewItem *after ); + virtual ~KWClassicMailMergeEditorListItem(); + + virtual void setText( int i, const QString &text ); + virtual QString text( int i ) const; + void setup(); + void update(); + +protected: + QLineEdit *editWidget; + +}; + +/****************************************************************** + * + * Class: KWClassicMailMergeEditorList + * + ******************************************************************/ + +class KWClassicMailMergeEditorList : public QListView +{ + Q_OBJECT + +public: + KWClassicMailMergeEditorList( QWidget *parent, KWClassicSerialDataSource *db_ ); + virtual ~KWClassicMailMergeEditorList(); + + void invalidateCurrentRecord(); + void updateItems(); + void displayRecord( int i ); + + void setSorting( int, bool increasing = TRUE ) { + QListView::setSorting( -1, increasing ); + } + +protected slots: + void columnSizeChange( int c, int os, int ns ); + void sectionClicked( int c ); + +protected: + KWClassicSerialDataSource *db; + int currentRecord; + +}; + +/****************************************************************** + * + * Class: KWClassicMailMergeEditor + * + ******************************************************************/ + +class KWClassicMailMergeEditor : public KDialogBase +{ + Q_OBJECT + +public: + KWClassicMailMergeEditor( QWidget *parent, KWClassicSerialDataSource *db_ ); + +protected: + void resizeEvent( QResizeEvent *e ); + void updateButton(); + + QSpinBox *records; + KWClassicMailMergeEditorList *dbList; + QWidget *back; + KWClassicSerialDataSource *db; + + QToolButton *first; + QToolButton *back_; + QToolButton *forward; + QToolButton *finish; + QToolButton *newRecord; + QToolButton *newEntry; + QToolButton *deleteRecord; + QToolButton *deleteEntry; + +protected slots: + void changeRecord( int i ); + void addEntry(); + void addRecord(); + void removeEntry(); + void removeRecord(); + void firstRecord(); + void prevRecord(); + void nextRecord(); + void lastRecord(); +}; + +#endif diff --git a/kword/mailmerge/Makefile.am b/kword/mailmerge/Makefile.am new file mode 100644 index 00000000..8d596413 --- /dev/null +++ b/kword/mailmerge/Makefile.am @@ -0,0 +1,22 @@ + +KDE_CXXFLAGS = $(USE_RTTI) +INCLUDES = $(KOFFICE_INCLUDES) -I$(top_srcdir)/lib/kformula $(KOTEXT_INCLUDES) -I$(top_srcdir)/kword $(all_includes) + +kde_module_LTLIBRARIES = kwmailmerge_classic.la + +## Plugin encapsulating the (old) internally stored style +kwmailmerge_classic_la_SOURCES = KWClassicSerialDataSource.cpp +kwmailmerge_classic_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kwmailmerge_classic_la_LIBADD = ../libkwmailmerge_interface.la $(LIB_KDEUI) $(LIB_KOTEXT) + +METASOURCES = AUTO + +services_DATA=kwserialletter_classic.desktop +servicesdir=$(kde_servicesdir) + +if include_sql +SQLDIRECTORY=sql +endif + +SUBDIRS = . kabc kspread $(SQLDIRECTORY) + diff --git a/kword/mailmerge/configure.in.in b/kword/mailmerge/configure.in.in new file mode 100644 index 00000000..9353bafd --- /dev/null +++ b/kword/mailmerge/configure.in.in @@ -0,0 +1,41 @@ +dnl only compile the sql plugin if qt was compiled with sql support + + +AC_MSG_CHECKING([for SQL support in QT]) + +LIBS_SAVE_KWSL="$LIBS" +CXXFLAGS_SAVE_KWSL="$CXXFLAGS" +CFLAGS_SAVE_KWSL="$CFLAGS" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_includes $all_includes" + +AC_TRY_COMPILE([ +#include <qglobal.h> +], +[ +#ifdef QT_NO_SQL +#error "No QT-SQL support" +#endif +], +ac_trycompile_kwsl_qtsql=yes, +ac_trycompile_kwsl_qtsql=no) + +CXXFLAGS="$CXXFLAGS_SAVE_KWSL" +LIBS="$LIBS_SAVE_KWSL" +AC_LANG_RESTORE + +if eval "test \"`echo $ac_trycompile_kwsl_qtsql`\" = yes"; then + SQLDIR=sql + AC_SUBST(SQLDIR) + AC_MSG_RESULT([QT supports SQL - compile qtsqlmailmerge]) +else + SQLDIR= + AC_SUBST(SQLDIR) + AC_MSG_RESULT([QT supports SQL -- qtsqlmailmerge will not be built]) +fi + +AM_CONDITIONAL(include_sql, test -n "$SQLDIR") diff --git a/kword/mailmerge/kabc/KWMailMergeKABC.cpp b/kword/mailmerge/kabc/KWMailMergeKABC.cpp new file mode 100644 index 00000000..a5df7e73 --- /dev/null +++ b/kword/mailmerge/kabc/KWMailMergeKABC.cpp @@ -0,0 +1,551 @@ +/* + This file is part of the KDE project + Copyright (C) 2003 Tobias Koenig <[email protected]> + Joseph Wenninger <[email protected]> + Ingo Kloecker <[email protected]> + Copyright (C) 2004 Tobias Koenig <[email protected]> + Joseph Wenninger <[email protected]> + Ingo Kloecker <[email protected]> + Dirk Schmidt <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include <kdebug.h> +#include <kglobal.h> +#include <klocale.h> +#include <kabc/distributionlist.h> +#include <kabc/stdaddressbook.h> + +#include "KWMailMergeKABC.h" +#include "KWMailMergeKABCConfig.h" + +KWMailMergeKABC::KWMailMergeKABC( KInstance *inst, QObject *parent ) + : KWMailMergeDataSource( inst, parent ) +{ + _addressBook = KABC::StdAddressBook::self(); + _iterator = _addressBook->begin(); + + + // init record list + // Using names from kaddressbook. + sampleRecord[ ("KAddressbook identifier") ] = KABC::Addressee::uidLabel(); + sampleRecord[ ("Name" ) ] = KABC::Addressee::nameLabel(); + sampleRecord[ ("Formatted name" ) ] = KABC::Addressee::formattedNameLabel(); + sampleRecord[ ("Family names" ) ] = KABC::Addressee::familyNameLabel(); + sampleRecord[ ("Given name" ) ] = KABC::Addressee::givenNameLabel(); + sampleRecord[ ("Additional names" ) ] = KABC::Addressee::additionalNameLabel(); + sampleRecord[ ("Honorific prefixes" ) ] = KABC::Addressee::prefixLabel(); + sampleRecord[ ("Honorific suffixes" ) ] = KABC::Addressee::suffixLabel(); + sampleRecord[ ("Nick name" ) ] = KABC::Addressee::nickNameLabel(); + sampleRecord[ ("Birthday" ) ] = KABC::Addressee::birthdayLabel(); + sampleRecord[ ("Home address: Street" ) ] = KABC::Addressee::homeAddressStreetLabel(); + sampleRecord[ ("Home address: Locality" ) ] = KABC::Addressee::homeAddressLocalityLabel(); + sampleRecord[ ("Home address: Region" ) ] = KABC::Addressee::homeAddressRegionLabel(); + sampleRecord[ ("Home address: Postal code" ) ] = KABC::Addressee::homeAddressPostalCodeLabel(); + sampleRecord[ ("Home address: Country" ) ] = KABC::Addressee::homeAddressCountryLabel(); + sampleRecord[ ("Home address: Label" ) ] = KABC::Addressee::homeAddressLabelLabel(); + sampleRecord[ ("Business address: Street" ) ] = KABC::Addressee::businessAddressStreetLabel(); + sampleRecord[ ("Business address: Locality" ) ] = KABC::Addressee::businessAddressLocalityLabel(); + sampleRecord[ ("Business address: Region" ) ] = KABC::Addressee::businessAddressRegionLabel(); + sampleRecord[ ("Business address: Postal code" ) ] = KABC::Addressee::businessAddressPostalCodeLabel(); + sampleRecord[ ("Business address: Country" ) ] = KABC::Addressee::businessAddressCountryLabel(); + sampleRecord[ ("Business address: Label" ) ] = KABC::Addressee::businessAddressLabelLabel(); + sampleRecord[ ("Home phone" ) ] = KABC::Addressee::homePhoneLabel(); + sampleRecord[ ("Business phone" ) ] = KABC::Addressee::businessPhoneLabel(); + sampleRecord[ ("Mobile phone" ) ] = KABC::Addressee::mobilePhoneLabel(); + sampleRecord[ ("Home fax" ) ] = KABC::Addressee::homeFaxLabel(); + sampleRecord[ ("Business fax" ) ] = KABC::Addressee::businessFaxLabel(); + sampleRecord[ ("Car phone" ) ] = KABC::Addressee::carPhoneLabel(); + sampleRecord[ ("ISDN" ) ] = KABC::Addressee::isdnLabel(); + sampleRecord[ ("Pager" ) ] = KABC::Addressee::pagerLabel(); + sampleRecord[ ("Email" ) ] = KABC::Addressee::emailLabel(); + sampleRecord[ ("Mailer" ) ] = KABC::Addressee::mailerLabel(); + sampleRecord[ ("Time zone" ) ] = KABC::Addressee::timeZoneLabel(); + sampleRecord[ ("Geographic position" ) ] = KABC::Addressee::geoLabel(); + sampleRecord[ ("Title" ) ] = KABC::Addressee::titleLabel(); + sampleRecord[ ("Role" ) ] = KABC::Addressee::roleLabel(); + sampleRecord[ ("Organization" ) ] = KABC::Addressee::organizationLabel(); + sampleRecord[ ("Note" ) ] = KABC::Addressee::noteLabel(); + sampleRecord[ ("productId" ) ] = KABC::Addressee::productIdLabel(); + sampleRecord[ ("Revision" ) ] = KABC::Addressee::revisionLabel(); + sampleRecord[ ("sortString" ) ] = KABC::Addressee::sortStringLabel(); + sampleRecord[ ("URL" ) ] = KABC::Addressee::urlLabel(); + sampleRecord[ ("Secrecy" ) ] = KABC::Addressee::secrecyLabel(); + sampleRecord[ ("Preferred address: Street" ) ] = QString( "preferedAddressStreet" ); + sampleRecord[ ("Preferred address: Locality" ) ] = QString( "preferedAddressLocality" ); + sampleRecord[ ("Preferred address: Region" ) ] = QString( "preferedAddressRegion" ); + sampleRecord[ ("Preferred address: Postal code" ) ] = QString( "preferedAddressPostalCode" ); + sampleRecord[ ("Preferred address: Country" ) ] = QString( "preferedAddressCountry" ); + sampleRecord[ ("Preferred address: Label" ) ] = QString( "preferedAddressLabel" ); +} + + +KWMailMergeKABC::~KWMailMergeKABC() +{ + ; +} + + +void KWMailMergeKABC::addEntry( const QString &uid ) +{ + _individualUIDs.append( uid ); + makeUIDsExclusive(); +} + + +void KWMailMergeKABC::addList( const QString &id ) +{ + _lists.append( id ); + parseList( id ); + makeUIDsExclusive(); +} + + +void KWMailMergeKABC::clear() +{ + _exclusiveUIDs.clear(); + _individualUIDs.clear(); + _listUIDs.clear(); + _lists.clear(); +} + + +int KWMailMergeKABC::getNumRecords() const +{ + kdDebug() << "KWMailMergeKABC::getNumRecords(): " << _exclusiveUIDs.count() << endl; + return _exclusiveUIDs.count(); +} + + +QString KWMailMergeKABC::getValue( const QString &name, int record ) const +{ + kdDebug() << "KWMailMergeKABC::getValue(" << name << ", " << record << ")" << endl; + if ( record < 0 ) + return name; + + // This doesn't ever happen, right? So why is it there? Dirk Schmidt + if ( record == -1 && _iterator == _addressBook->end() ) + return ""; + + // + // Set the iterator to the asked Addressee. + // + bool uidAvailable = false; + if ( record != -1 ) + { + int counter = 0; + + for ( _UIDIterator = _exclusiveUIDs.begin(); _UIDIterator != _exclusiveUIDs.end() + && counter < record; _UIDIterator++ ) + { + counter++; + } + + for ( _iterator = _addressBook->begin(); _iterator != _addressBook->end(); ++_iterator ) + { + + if( _iterator->uid() == *_UIDIterator ) + { + uidAvailable = true; + break; + } + } + } + + if( !uidAvailable ) + { + return ( i18n ( "KAddressbook entry '%1' not available." ).arg( *_UIDIterator ) ); + } + + + KABC::Addressee addr = *_iterator; + _iterator++; // Don't know why. Could be removed? Dirk Schmidt + + + // + // Return the asked variable. + // + if ( name == "KAddressbook identifier" ) + return addr.uid(); + if ( name == "Name" ) + return addr.name(); + if ( name == "Formatted name" ) + return addr.formattedName(); + if ( name == "Family names" ) + return addr.familyName(); + if ( name == "Given name" ) + return addr.givenName(); + if ( name == "Additional names" ) + return addr.additionalName(); + if ( name == "Honorific prefixes" ) + return addr.prefix(); + if ( name == "Honorific suffixes" ) + return addr.suffix(); + if ( name == "Nick name" ) + return addr.nickName(); + if ( name == "Birthday" ) + return KGlobal::locale()->formatDate( addr.birthday().date() ); + + if ( name == "Home address: Street" ) + { + KABC::Address a = addr.address( KABC::Address::Home ); + return a.street(); + } + if ( name == "Home address: Locality" ) + { + KABC::Address a = addr.address( KABC::Address::Home ); + return a.locality(); + } + if ( name == "Home address: Region" ) + { + KABC::Address a = addr.address( KABC::Address::Home ); + return a.region(); + } + if ( name == "Home address: Postal code" ) + { + KABC::Address a = addr.address( KABC::Address::Home ); + return a.postalCode(); + } + if ( name == "Home address: Country" ) + { + KABC::Address a = addr.address( KABC::Address::Home ); + return a.country(); + } + if ( name == "Home address: Label" ) + { + KABC::Address a = addr.address( KABC::Address::Home ); + return a.label(); + } + + if ( name == "Business address: Street" ) + { + KABC::Address a = addr.address( KABC::Address::Work ); + return a.street(); + } + if ( name == "Business address: Locality" ) + { + KABC::Address a = addr.address( KABC::Address::Work ); + return a.locality(); + } + if ( name == "Business address: Region" ) + { + KABC::Address a = addr.address( KABC::Address::Work ); + return a.region(); + } + if ( name == "Business address: Postal code" ) + { + KABC::Address a = addr.address( KABC::Address::Work ); + return a.postalCode(); + } + if ( name == "Business address: Country" ) + { + KABC::Address a = addr.address( KABC::Address::Work ); + return a.country(); + } + if ( name == "Business address: Label" ) + { + KABC::Address a = addr.address( KABC::Address::Work ); + return a.label(); + } + + if ( name == "Prefered address: Street" ) + { + KABC::Address a = addr.address( KABC::Address::Pref ); + return a.street(); + } + + if ( name == "Prefered address: Locality" ) + { + KABC::Address a = addr.address( KABC::Address::Pref ); + return a.locality(); + } + if ( name == "Prefered address: Region" ) + { + KABC::Address a = addr.address( KABC::Address::Pref ); + return a.region(); + } + if ( name == "Prefered address: Postal code" ) + { + KABC::Address a = addr.address( KABC::Address::Pref ); + return a.postalCode(); + } + if ( name == "Prefered address: Country" ) + { + KABC::Address a = addr.address( KABC::Address::Pref ); + return a.country(); + } + if ( name == "Prefered address: Label" ) + { + KABC::Address a = addr.address( KABC::Address::Pref ); + return a.label(); + } + + if ( name == "Home phone" ) + { + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Home ); + return phone.number(); + } + if ( name == "Business phone" ) + { + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Work ); + return phone.number(); + } + if ( name == "Mobile phone" ) + { + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Cell ); + return phone.number(); + } + if ( name == "Home fax" ) + { + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); + return phone.number(); + } + if ( name == "Business fax" ) + { + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); + return phone.number(); + } + if ( name == "Car phone" ) + { + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Car ); + return phone.number(); + } + if ( name == "ISDN" ) + { + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Isdn ); + return phone.number(); + } + if ( name == "Pager" ) + { + KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Pager ); + return phone.number(); + } + + if ( name == "Email" ) + return addr.preferredEmail(); + if ( name == "Mailer" ) + return addr.mailer(); + if ( name == "Time zone" ) + { + KABC::TimeZone zone = addr.timeZone(); + return QString::number( zone.offset() ); + } + if ( name == "Geographic position" ) + { + KABC::Geo geo = addr.geo(); + QString lat; + QString longi; + if( geo.latitude()<0 ) + lat = QString( i18n("%1 South") ).arg( -geo.latitude() ); + else + lat = QString( i18n("%1 North") ).arg( geo.latitude() ); + + if( geo.longitude()<0 ) + // There is something going wrong, because "W" is replaced by "q ". + // Needs fix. + longi = QString( i18n("%1 West") ).arg( -geo.longitude() ); + else + longi = QString( i18n("%1 East") ).arg( geo.longitude() ); + + return i18n( "Geographic coordinates", "%1, %2" ).arg ( lat, longi ); + } + + if ( name == "Title" ) + return addr.title(); + if ( name == "Role" ) + return addr.role(); + if ( name == "Organization" ) + return addr.organization(); + if ( name == "Note" ) + return addr.note(); + if ( name == "productId" ) + return addr.productId(); + if ( name == "Revision" ) + return KGlobal::locale()->formatDate( addr.revision().date() ); + if ( name == "sortString" ) + return addr.sortString(); + if ( name == "URL" ) + return addr.url().url(); + if ( name == "Secrecy" ) + { + KABC::Secrecy secrecy = addr.secrecy(); + return KABC::Secrecy::typeLabel( secrecy.type() ); + } + + return ( i18n("Unkown mail merge variable: %1").arg ( name ) ) ; +} + + +QStringList KWMailMergeKABC::lists() const +{ + return _lists; +} + + +void KWMailMergeKABC::load( QDomElement& parentElem ) +{ + clear(); + QDomNode contentNode=parentElem.namedItem("CONTENT"); + if( contentNode.isNull() ) + return; + for( QDomNode rec=contentNode.firstChild(); !rec.isNull(); rec=rec.nextSibling() ) + { + if( rec.nodeName()== "RECORD" ) + { + for( QDomElement recEnt=rec.firstChild().toElement(); !recEnt.isNull(); + recEnt=recEnt.nextSibling().toElement() ) + { + addEntry( recEnt.attribute( QString::fromLatin1("uid") ) ); + } + } + else if( rec.nodeName() == "LIST" ) + { + for( QDomElement recEnt=rec.firstChild().toElement(); !recEnt.isNull(); + recEnt=recEnt.nextSibling().toElement() ) + { + addList( recEnt.attribute( QString::fromLatin1("listid") ) ); + } + } + else + kdDebug() << "rec.nodeName(): " << rec.nodeName() << endl; + } +} + + +void KWMailMergeKABC::makeUIDsExclusive() +{ + _exclusiveUIDs = _individualUIDs + _listUIDs; + _exclusiveUIDs.sort(); + kdDebug() << "KWMailMergeKABC::makeUIDsExclusive(): before: " << _exclusiveUIDs.join(",") + << endl; + QString uid; + for( QStringList::Iterator it=_exclusiveUIDs.begin(); + it!=_exclusiveUIDs.end(); ++it ) + { + if( *it == uid ) + { + it = _exclusiveUIDs.remove( it ); + } + uid = *it; + } + kdDebug() << "KWMailMergeKABC::makeUIDsExclusive(): after: " << _exclusiveUIDs.join(",") + << endl; +} + + +void KWMailMergeKABC::parseList( const QString& listName ) +{ + if( listName.isEmpty() ) + return; + + kdDebug() << "KWMailMergeKABC::parseList: " << listName << endl; + KABC::DistributionListManager dlm ( _addressBook ); + dlm.load(); + + QStringList::Iterator listIt; + + KABC::DistributionList* list = dlm.list( listName ); + KABC::DistributionList::Entry::List entries = list->entries(); + + KABC::DistributionList::Entry::List::Iterator itemIt; + for ( itemIt = entries.begin(); itemIt != entries.end(); ++itemIt ) + { + kdDebug() << "WMailMergeKABC::parseList: Listentry UID: " << + (*itemIt).addressee.uid() << endl; + _listUIDs.append( (*itemIt).addressee.uid() ); + } +} + + +void KWMailMergeKABC::refresh( bool ) +{ + kdDebug() << "KWMailMergeKABC::refresh()" << endl; + _iterator = _addressBook->begin(); + _UIDIterator = _individualUIDs.begin(); + +} + + +void KWMailMergeKABC::save( QDomDocument& doc, QDomElement& parent) +{ + QDomElement cont=doc.createElement(QString::fromLatin1("CONTENT")); + parent.appendChild(cont); + + QValueList<QString>::ConstIterator it = _individualUIDs.begin(); + for( ; it != _individualUIDs.end(); ++it ) + { + QDomElement rec=doc.createElement(QString::fromLatin1("RECORD")); + cont.appendChild(rec); + QDomElement recEnt=doc.createElement(QString::fromLatin1("ITEM")); + recEnt.setAttribute(QString::fromLatin1("uid"),*it); + rec.appendChild(recEnt); + } + + it = _lists.begin(); + for( ; !(it == _lists.end()); ++it ) + { + QDomElement rec=doc.createElement(QString::fromLatin1("LIST")); + cont.appendChild(rec); + QDomElement recEnt=doc.createElement(QString::fromLatin1("ITEM")); + recEnt.setAttribute(QString::fromLatin1("listid"),*it); + rec.appendChild(recEnt); + } +} + +bool KWMailMergeKABC::showConfigDialog( QWidget* par, int action ) +{ + bool ret=false; + if (action == KWSLCreate ) + { + clear(); + } + + //if (action==KWSLOpen) + { + KWMailMergeKABCConfig *dia=new KWMailMergeKABCConfig( par, this ); + + ret=( dia->exec() == QDialog::Accepted ); + kdDebug() << "KWMailMergeKABCConfig::Accepted " << ret << endl; + delete dia; + } + refresh(false); + + return ret; +} + + +QStringList KWMailMergeKABC::singleRecords() const +{ + return _individualUIDs; +} + + + +extern "C" +{ + KWORD_MAILMERGE_EXPORT KWMailMergeDataSource *create_kwmailmerge_kabc( KInstance *inst, QObject *parent ) + { + return new KWMailMergeKABC( inst, parent ); + } +} + + + + +#include "KWMailMergeKABC.moc" + + diff --git a/kword/mailmerge/kabc/KWMailMergeKABC.h b/kword/mailmerge/kabc/KWMailMergeKABC.h new file mode 100644 index 00000000..2787ac6f --- /dev/null +++ b/kword/mailmerge/kabc/KWMailMergeKABC.h @@ -0,0 +1,185 @@ +/* + This file is part of the KDE project + Copyright (C) 2003 Tobias Koenig <[email protected]> + Copyright (C) 2004 Tobias Koenig <[email protected]> + Dirk Schmidt <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _KWMAILMERGE_KABC_H_ +#define _KWMAILMERGE_KABC_H_ + +#include <qdom.h> +#include <qguardedptr.h> + +#include <kabc/addressbook.h> + +#include "KWMailMergeDataSource.h" + +class KWMailMergeKABC: public KWMailMergeDataSource +{ + Q_OBJECT + +public: + KWMailMergeKABC( KInstance *inst, QObject *parent ); + ~KWMailMergeKABC(); + + /** + Saves the mail merge list to the kword document. + */ + virtual void save( QDomDocument&, QDomElement& ); + + /** + Loads the mail merge list stored in the kword document. + */ + virtual void load( QDomElement& ); + + /** + @param name The name of the value e.g. "Family name". + @param record The position of the the entry in mail merge list. + @return The value of the mail merge variable. + + If @p record equals -1, @p name is returned. + */ + virtual class QString getValue( const class QString &name, int record = -1 ) const; + + /** + @return The number of available contacts in mail merge list. + */ + virtual int getNumRecords() const; + + /** + Only for compatability reasons. + + @param force Hasn't any effect. + */ + virtual void refresh( bool force ); + + /** + Shows a KWMailMergeKABCConfig dialog for selecting entries from KAddressbook. + */ + virtual bool showConfigDialog( QWidget*, int action); + +protected: + friend class KWMailMergeKABCConfig; + + /** + Adds an entry from KABC::StdAddressBook::self() + to the mail merge list. + + To be called by KWMailMergeKABC::load() and + KWMailMergeKABCConfig::acceptSelection() only. + + @param uid The entry's KABC::Addressee::uid(). + */ + void addEntry( const QString &uid ); + + /** + Adds a distribution list to the mail merge list. + + To be called by KWMailMergeKABC::load() and + KWMailMergeKABCConfig::acceptSelection() only. + + @param id The DistributionList::name(). + */ + void addList( const QString &id ); + + /** + Removes all entries and distribution lists from the mail merge list. + */ + void clear(); + + /** + @return All selected DistributionList::name(). + + To be called by KWMailMergeKABCConfig::initSelectedLists() + */ + virtual QStringList lists() const; + + /** + @return The KABC::Addressee::uid() of all individually selected + entries in mail merge list. + + To be called by KWMailMergeKABCConfig::initSelectedAddressees() + */ + virtual QStringList singleRecords() const; + +private: + /** + The KABC::StdAddressBook::self(). + */ + KABC::AddressBook* _addressBook; + + /** + Just an Iterator. + */ + mutable KABC::AddressBook::ConstIterator _iterator; + + /** + Just an Iterator. + */ + mutable QStringList::ConstIterator _UIDIterator; + + /** + The "real" mail merge list. A list of QStrings. Each represents + the KABC::Addressee::uid() of a KAdressbook entry. + There is no UID twice in this list. + + Needed because selected contacts may appear in a selected + distribution list, too. And we don't want to print it multiple. + */ + QStringList _exclusiveUIDs; + + /** + This list contains all the KABC::Addressee::uid() selected + individually with the KWMailMergeKABCConfig dialog. + */ + QStringList _individualUIDs; + + /** + This list contains all the KABC::Addressee::uid() from the distribution + lists selected with the KWMailMergeKABCConfig dialog. + */ + QStringList _listUIDs; + + /** + This list contains all the DistributionList::name() selected with the + KWMailMergeKABCConfig dialog. + */ + QStringList _lists; + + + /** + Appends all KABC::Addressee::uid() of a distribution list to _listUIDs + and updates the mail merge list. + + To be used by KWMailMergeKABCConfig::addList( const QString &id ) + only. + + @param listName The DistributionList::name() of the distribution list. + */ + void parseList( const QString& listName ); + + /** + Removes duplicate entries in the mail merge list. + */ + void makeUIDsExclusive(); + +}; + +#endif + diff --git a/kword/mailmerge/kabc/KWMailMergeKABCConfig.cpp b/kword/mailmerge/kabc/KWMailMergeKABCConfig.cpp new file mode 100644 index 00000000..dee519c3 --- /dev/null +++ b/kword/mailmerge/kabc/KWMailMergeKABCConfig.cpp @@ -0,0 +1,546 @@ +/* + This file is part of the KDE project + Copyright (C) 2004 Dirk Schmidt <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + + +#include <qvbox.h> +#include <qlayout.h> +#include <qlineedit.h> + +#include <kapplication.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kinputdialog.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kpushbutton.h> +#include <krun.h> +#include <kabc/stdaddressbook.h> +#include <kabc/distributionlist.h> + +#include "addresspicker.h" +#include "KWMailMergeKABC.h" +#include "KWMailMergeKABCConfig.h" + + +KWMailMergeKABCConfig::KWMailMergeKABCConfig( QWidget *parent, KWMailMergeKABC *db_) + :KDialogBase( Plain, i18n( "Mail Merge - Editor" ), + Ok | Cancel, Ok, parent, "", true) +{ + _db = db_; + + (new QVBoxLayout(plainPage()))->setAutoAdd(true); + setMainWidget( _ui=new AddressPickerUI( plainPage() ) ); + + updateAvailable(); + initSelectedAddressees(); + initSelectedLists(); + initSlotSignalConnections(); +} + + +KWMailMergeKABCConfig::~KWMailMergeKABCConfig() +{ + ; +} + + +void KWMailMergeKABCConfig::acceptSelection() +{ + _db->clear(); + + QListViewItem* top = _ui->mSelectedView->firstChild(); + while(top) + { + kdDebug() << "acceptSelection(): " << top->text(0) << endl; + if( top->text(0) == i18n("Distribution Lists") ) + { + QListViewItem* item = top->firstChild(); + while(item) + { + kdDebug() << "acceptSelection(): " << item->text(0) << endl; + _db->addList( item->text(0) ); + item = item->nextSibling(); + } + } + else if( top->text(0) == i18n("Single Entries") ) + { + QListViewItem* item = top->firstChild(); + while(item) + { + kdDebug() << "acceptSelection(): " << item->text(0) << endl; + _db->addEntry( item->text(-1) ); + item = item->nextSibling(); + } + } + top = top->nextSibling(); + } + +} + + +void KWMailMergeKABCConfig::addSelectedContacts() +{ + QListViewItemIterator it( _ui->mAvailableView, QListViewItemIterator::Selected ); + QListViewItem* selected = _ui->mSelectedView->findItem( + i18n("Single Entries"), 0, Qt::ExactMatch ); + QListViewItem* selectedLists = _ui->mSelectedView->findItem( + i18n("Distribution Lists"), 0, Qt::ExactMatch ); + while ( it.current() ) + { + if( it.current()->depth() > 0 ) + { + QString uid = it.current()->text( -1 ); + kdDebug() << "addSelectedContacts(): uid :" << uid << endl; + if( !uid.isEmpty() ) + { + KWMailMergeKABCConfigListItem *item = + static_cast<KWMailMergeKABCConfigListItem*> ( it.current() ); + if( selected ) + { + selected->insertItem( item ); + selected->setOpen( true ); + destroyAvailableClones( uid ); + } + } + else if( it.current()->parent()->text(0) == i18n("Distribution Lists") ) + { + if( selectedLists ) + { + selectedLists->insertItem( it.current() ); + selectedLists->setOpen( true ); + } + } + } + ++it; + } + _ui->mSelectedView->selectAll( false ); +} + + +void KWMailMergeKABCConfig::destroyAvailableClones( const QString& uid ) +{ + if( uid.isEmpty() ) + return; + + QListViewItemIterator it( _ui->mAvailableView ); + + while ( it.current() ) + { + if( it.current()->depth() > 0) + { + if( it.current()->text(-1)== uid ) + { + delete it.current(); + } + } + ++it; + } +} + + +void KWMailMergeKABCConfig::filterChanged( const QString& txt ) +{ + kdDebug() << "KWMailMergeKABCConfig::filterChanged( " << txt << " )" << endl; + + bool showAll = txt.isEmpty(); + + QListViewItem* category = _ui->mAvailableView->firstChild(); + while(category) + { + if( category->text(0)!=i18n("Distribution Lists") ) + { + QListViewItem* item = category->firstChild(); + while(item) + { + if(showAll) + { + item->setVisible( true ); + } + else + { + item->setVisible( item->text(0).contains( txt, false ) ); + } + item = item->nextSibling(); + } + category->setOpen( !showAll ); + } + else + { + category->setVisible( showAll ); + } + category = category->nextSibling(); + } +} + + +void KWMailMergeKABCConfig::initSelectedAddressees() +{ + QStringList records = _db->singleRecords(); + + QListViewItem* category = _ui->mAvailableView->firstChild(); + QListViewItem* selected = _ui->mSelectedView->findItem( + i18n("Single Entries"), 0, Qt::ExactMatch ); + while ( category && (records.count()>0) ) + { + if( category->text(0) != i18n("Distribution Lists") ) + { + KWMailMergeKABCConfigListItem* item = + static_cast<KWMailMergeKABCConfigListItem*> ( category->firstChild() ); + while( item && (records.count()>0) ) + { + // Need some temporary item, because after selected->insertItem( item ) + // the item->nextSibling() is not the one we want. + KWMailMergeKABCConfigListItem* nextItem = + static_cast<KWMailMergeKABCConfigListItem*> ( item->nextSibling() ); + + for( QStringList::Iterator itRecords = records.begin(); + itRecords != records.end(); ++itRecords ) + { + QString uid = *itRecords; + if( item->text(-1) == uid ) + { + selected->insertItem( item ); + + // downsize records to speed up iterations + itRecords = records.remove( itRecords ); + --itRecords; + + destroyAvailableClones( uid ); + } + } + item = nextItem; + } + } + category = category->nextSibling(); + } +} + + +void KWMailMergeKABCConfig::initSelectedLists() +{ + QStringList lists = _db->lists(); + + kdDebug() << "::initSelectedLists()" << lists.join(",") << endl; + + QListViewItem* l = _ui->mAvailableView->findItem( + i18n("Distribution Lists"), 0, Qt::ExactMatch ); + QListViewItem* selected = _ui->mSelectedView->findItem( + i18n("Distribution Lists"), 0, Qt::ExactMatch ); + + QListViewItem* item = ( l->firstChild() ); + while( item && (lists.count()>0) ) + { + QListViewItem* nextItem = item->nextSibling(); + + for( QStringList::Iterator itLists = lists.begin(); + itLists != lists.end(); ++itLists ) + { + QString id = *itLists; + if( item->text(0) == id ) + { + selected->insertItem( item ); + itLists = lists.remove( itLists ); + --itLists; + } + } + item = nextItem; + } +} + + +void KWMailMergeKABCConfig::initSlotSignalConnections() +{ + connect( this, SIGNAL( okClicked() ), SLOT( acceptSelection() ) ); + connect( _ui->mAddButton, SIGNAL( clicked() ), SLOT( addSelectedContacts() ) ); + connect( _ui->mAddressBook, SIGNAL( clicked() ), SLOT( launchAddressbook() ) ); + + connect( _ui->mAvailableView, SIGNAL( doubleClicked( QListViewItem *, const QPoint &, int ) ), + SLOT( addSelectedContacts() ) ); + + connect( _ui->mFilterEdit, SIGNAL( textChanged(const QString &) ), + SLOT( filterChanged(const QString &) ) ); + connect( _ui->mRemoveButton, SIGNAL( clicked() ), SLOT( removeSelectedContacts() ) ); + connect( _ui->mSaveList, SIGNAL( clicked() ), SLOT( saveDistributionList() ) ); + connect( _ui->mSelectedView, SIGNAL( doubleClicked( QListViewItem *, const QPoint &, int ) ), + SLOT( removeSelectedContacts() ) ); +} + + +void KWMailMergeKABCConfig::launchAddressbook() const +{ + kapp->startServiceByDesktopName( "kaddressbook", QString() ); +} + + + +void KWMailMergeKABCConfig::removeContact( QListViewItem* item ) +{ + QStringList& categories = _usedCategories; + QListViewItem* availableLists = _ui->mAvailableView->findItem( + i18n("Distribution Lists"), 0, Qt::ExactMatch ); + if( item->depth() > 0 ) + { + if( !item->text( -1 ).isEmpty() ) // remove selected single entry here + { + KWMailMergeKABCConfigListItem* rightItem = + static_cast<KWMailMergeKABCConfigListItem*> ( item ); + + QStringList entryCategories = rightItem->addressee().categories(); + for ( QStringList::Iterator itEntryCat = entryCategories.begin(); + itEntryCat != entryCategories.end(); ++itEntryCat ) + { + int i = categories.findIndex(*itEntryCat); + if( i == -1 ) + { + QListViewItem* category = new QListViewItem( _ui->mAvailableView, + *itEntryCat ); + categories.append( *itEntryCat ); + + KWMailMergeKABCConfigListItem* leftItem = new KWMailMergeKABCConfigListItem( + category, rightItem->addressee() ); + } + else + { + KWMailMergeKABCConfigListItem* leftItem = new + KWMailMergeKABCConfigListItem( + _ui->mAvailableView->findItem( + *itEntryCat, 0, + Qt::ExactMatch), + rightItem->addressee() ); + } + } + if( entryCategories.isEmpty() ) + { + QString noCat = i18n("no category"); + KWMailMergeKABCConfigListItem* leftItem = new KWMailMergeKABCConfigListItem( + _ui->mAvailableView->findItem( + noCat, 0, Qt::ExactMatch), + rightItem->addressee() ); + } + delete item; + } + else if( item->parent()->text(0) == i18n("Distribution Lists") ) // remove a list + { + if( availableLists ) + availableLists->insertItem( item ); + } + } +} + +void KWMailMergeKABCConfig::removeSelectedContacts() +{ + QListViewItemIterator it( _ui->mSelectedView, QListViewItemIterator::Selected ); + + while( it.current() ) + { + kdDebug() << "removeSelectedContacts(): text: " << it.current()->text(-1) << endl; + removeContact( it.current() ); + ++it; + } + _ui->mAvailableView->selectAll( false ); +} + + +void KWMailMergeKABCConfig::saveDistributionList() +{ + KABC::DistributionListManager dlm( KABC::StdAddressBook::self() ); + dlm.load(); + + bool ok = false; + QString listName = KInputDialog::getText( i18n("New Distribution List"), + i18n("Please enter name:"), + QString::null, &ok, + this ); + if ( !ok || listName.isEmpty() ) + return; + + if ( dlm.list( listName ) ) + { + KMessageBox::information( 0, + i18n( "<qt>Distribution list with the given name <b>%1</b> " + "already exists. Please select a different name.</qt>" ) + .arg( listName ) ); + return; + } + KABC::DistributionList *distList = new KABC::DistributionList( &dlm, listName ); + + QListViewItem* newListItem = new QListViewItem( _ui->mSelectedView->findItem( + i18n("Distribution Lists"),0 , Qt::ExactMatch), listName ); + + QListViewItem* category = _ui->mSelectedView->firstChild(); + while(category) + { + if( category->text(0)==i18n("Single Entries") ) + { + KWMailMergeKABCConfigListItem* item = + static_cast<KWMailMergeKABCConfigListItem*> ( category->firstChild() ); + + while(item) + { + distList->insertEntry( item->addressee() ); + + KABC::Addressee addr = item->addressee(); + QString formattedName = addr.formattedName(); + QListViewItem* newItem = new QListViewItem( + newListItem, item->addressee().formattedName() ); + newItem->setEnabled( false ); + + item = static_cast<KWMailMergeKABCConfigListItem*>( item->nextSibling() ); + } + + QListViewItemIterator it ( category->firstChild() ); + while( it.current() ) + { + removeContact( it.current() ); + ++it; + } + } + category = category->nextSibling(); + } + + dlm.save(); + newListItem->setOpen( true ); +} + + +void KWMailMergeKABCConfig::updateAvailable() +{ + _ui->mAvailableView->clear(); + _ui->mAvailableView->setRootIsDecorated( true ); + + // + // First append the addressees. + // + QListViewItem* noCategory = new QListViewItem( _ui->mAvailableView, + i18n("no category") ); + + QStringList& categories = _usedCategories ; + categories.clear(); + + KABC::AddressBook *addressBook = KABC::StdAddressBook::self(); + for( KABC::AddressBook::Iterator itAddr = addressBook->begin(); + itAddr != addressBook->end(); ++itAddr ) + { + + QStringList entryCategories = itAddr->categories(); + for ( QStringList::Iterator itCat = entryCategories.begin(); + itCat != entryCategories.end(); ++itCat ) + { + int i = categories.findIndex(*itCat); + + // Create category, if not yet in listview and append item to it. + if( i == -1 ) + { + QListViewItem* category = new QListViewItem( _ui->mAvailableView, *itCat ); + categories.append( *itCat ); + + KWMailMergeKABCConfigListItem* item = new KWMailMergeKABCConfigListItem( + category, *itAddr ); + } + // Append item to existing category in listview. + else + { + KWMailMergeKABCConfigListItem* item = new KWMailMergeKABCConfigListItem( + _ui->mAvailableView->findItem( + *itCat, 0, Qt::ExactMatch), + *itAddr ); + } + + } + // If Addressee does not belong to any category, append it to "no category". + if( entryCategories.isEmpty() ) + { + KWMailMergeKABCConfigListItem* item = new KWMailMergeKABCConfigListItem( + noCategory, *itAddr ); + } + } + + // + // Now append the distribution lists + // + KABC::DistributionListManager dlm ( addressBook ); + dlm.load(); + + QStringList distributionLists = dlm.listNames(); + QListViewItem* distributionListsItem = new QListViewItem( _ui->mAvailableView, + i18n("Distribution Lists") ); + + QStringList::Iterator itDistributionLists; + + for( itDistributionLists = distributionLists.begin(); + itDistributionLists != distributionLists.end(); ++itDistributionLists ) + { + KABC::DistributionList* list = dlm.list( *itDistributionLists ); + + KABC::DistributionList::Entry::List entries = list->entries(); + + QListViewItem* listItem = new QListViewItem( distributionListsItem, + *itDistributionLists ); + + KABC::DistributionList::Entry::List::Iterator itList; + for ( itList = entries.begin(); itList != entries.end(); ++itList ) + { + // Create a normal QListViewItem and disable it, because this is not a + // distribution-list-editor. KAddressbook should be used instead. + QListViewItem* item = new QListViewItem( + listItem, (*itList).addressee.formattedName() ); + item->setEnabled( false ); + } + + } +} + + + +KWMailMergeKABCConfigListItem::KWMailMergeKABCConfigListItem( QListView *parent, + const KABC::Addressee& addressEntry ) : QListViewItem( parent ) +{ + setText( 0, addressEntry.formattedName() ); + _addressEntry = addressEntry; +} + +KWMailMergeKABCConfigListItem::KWMailMergeKABCConfigListItem( QListViewItem *parent, + const KABC::Addressee& addressEntry ) : QListViewItem( parent ) +{ + setText( 0, addressEntry.formattedName() ); + _addressEntry = addressEntry; +} + +KWMailMergeKABCConfigListItem::~KWMailMergeKABCConfigListItem() +{} + +KABC::Addressee KWMailMergeKABCConfigListItem::addressee() const +{ + return _addressEntry; +} + +QString KWMailMergeKABCConfigListItem::text( int column ) const +{ + if( column == -1 ) + { + return _addressEntry.uid(); + } + else + { + return QListViewItem::text( column ); + } +} + +#include "KWMailMergeKABCConfig.moc" diff --git a/kword/mailmerge/kabc/KWMailMergeKABCConfig.h b/kword/mailmerge/kabc/KWMailMergeKABCConfig.h new file mode 100644 index 00000000..335574b8 --- /dev/null +++ b/kword/mailmerge/kabc/KWMailMergeKABCConfig.h @@ -0,0 +1,149 @@ +/* + This file is part of the KDE project + Copyright (C) 2004 Dirk Schmidt <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _KWMAILMERGE_KABC_CONFIG_H_ +#define _KWMAILMERGE_KABC_CONFIG_H_ + +#include <kdialogbase.h> +#include <klistview.h> +#include <kabc/stdaddressbook.h> + +#include "KWMailMergeKABC.h" + + +class AddressPickerUI; +class KWMailMergeKABC; + +class KWMailMergeKABCConfig: public KDialogBase +{ + Q_OBJECT +public: + KWMailMergeKABCConfig( QWidget *parent, KWMailMergeKABC *db_ ); + virtual ~KWMailMergeKABCConfig(); + + +private slots: + + /** + Moves selected items from the left Listview to the right one. + */ + void addSelectedContacts(); + + /** + Moves selected items from the right Listview to the left one. + */ + void removeSelectedContacts(); + + /** + Executes KAddressbook as external application. + */ + void launchAddressbook() const; + + /** + Updates the parent's mail merge list from items in the right Listview. + */ + void acceptSelection(); + + /** + Hides items in the left listview, which are not matching @p txt. + */ + void filterChanged( const QString& txt ); + + /** + Saves the selected single entries to a new KABC::DistributionList in KAddressbook. + */ + void saveDistributionList(); +private: + /** + The addresspicker widget. + */ + AddressPickerUI *_ui; + + /** + Store all categories used in the addressbook, to avoid some iterator cycles. + */ + QStringList _usedCategories; + + /** + The mail merge list. + */ + KWMailMergeKABC *_db; + + /** + Removes duplicates in the left QListView, when moving an item to the right. + */ + void destroyAvailableClones( const QString& uid ); + + /** + Appends the previously selected entries to the right QListView. + */ + void initSelectedAddressees(); + + /** + Appends the previously selected distribution lists to the right QListView. + */ + void initSelectedLists(); + + /** + Just connects signals and slots. + */ + void initSlotSignalConnections(); + + /** + Moves @p item from the right Listview to the left one. + + Called by KWMailMergeKABCConfig::removeSelectedContacts(). + */ + void removeContact( QListViewItem* item ); + + /** + Appends all KAddressbook entries in KABC::StdAddressBook::self() and all + KABC::DistributionLists to the left QListView. + */ + void updateAvailable(); +}; + + +class KWMailMergeKABCConfigListItem : public QListViewItem +{ + +public: + KWMailMergeKABCConfigListItem( QListView *parent, const KABC::Addressee& addressEntry ); + KWMailMergeKABCConfigListItem( QListViewItem *parent, const KABC::Addressee& addressEntry ); + virtual ~KWMailMergeKABCConfigListItem(); + + /** + Returns the KABC::Addressee of a KWMailMergeKABCConfigListItem. + */ + KABC::Addressee addressee() const; + + /** + This is an overloaded member function of QListViewItem::text( int column ). + It Returns the KABC::Addressee::uid(), if column is set to -1. + Otherwise QListViewItem::text( int column ) is returned. + */ + QString text( int column ) const; + + +private: + KABC::Addressee _addressEntry; + +}; +#endif diff --git a/kword/mailmerge/kabc/Makefile.am b/kword/mailmerge/kabc/Makefile.am new file mode 100644 index 00000000..9231a371 --- /dev/null +++ b/kword/mailmerge/kabc/Makefile.am @@ -0,0 +1,17 @@ + +KDE_CXXFLAGS = $(USE_RTTI) +INCLUDES = $(KOFFICE_INCLUDES) -I$(top_srcdir)/lib/kformula \ + $(KOTEXT_INCLUDES) -I$(top_srcdir)/kword $(all_includes) + +kde_module_LTLIBRARIES = kwmailmerge_kabc.la + +## Plugin encapsulating the QT SQL database interface +kwmailmerge_kabc_la_SOURCES = KWMailMergeKABC.cpp KWMailMergeKABCConfig.cpp addresspicker.ui +kwmailmerge_kabc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kwmailmerge_kabc_la_LIBADD = ../../libkwmailmerge_interface.la $(LIB_KDEUI) $(LIB_KABC) + +METASOURCES = AUTO + +services_DATA=kwmailmerge_kabc.desktop +servicesdir=$(kde_servicesdir) + diff --git a/kword/mailmerge/kabc/addresspicker.ui b/kword/mailmerge/kabc/addresspicker.ui new file mode 100644 index 00000000..ec179c3b --- /dev/null +++ b/kword/mailmerge/kabc/addresspicker.ui @@ -0,0 +1,297 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>AddressPickerUI</class> +<widget class="QWidget"> + <property name="name"> + <cstring>AddressPickerUI</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>617</width> + <height>434</height> + </rect> + </property> + <property name="caption"> + <string>Address Selection</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>mAddButton</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>&Add >></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>mRemoveButton</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string><< &Remove</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QPushButton" row="2" column="2"> + <property name="name"> + <cstring>mSaveList</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Save as &Distribution List...</string> + </property> + <property name="toolTip" stdset="0"> + <string>Save selected single entries to a new distribution list.</string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>&Filter on:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>mFilterEdit</cstring> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>mFilterEdit</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="KListView" row="1" column="2"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <item> + <property name="text"> + <string>Distribution Lists</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Single Entries</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <property name="name"> + <cstring>mSelectedView</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="selectionMode" stdset="0"> + <enum>Extended</enum> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="showSortIndicator"> + <bool>true</bool> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>mAddressBook</cstring> + </property> + <property name="text"> + <string>Address B&ook</string> + </property> + <property name="toolTip" stdset="0"> + <string>Launch KAddressbook</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>&Address Book</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignCenter</set> + </property> + <property name="buddy" stdset="0"> + <cstring>mAvailableView</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>&Selected Addresses</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignCenter</set> + </property> + <property name="buddy" stdset="0"> + <cstring>mSelectedView</cstring> + </property> + </widget> + <widget class="KListView" row="1" column="0"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>mAvailableView</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="selectionMode" stdset="0"> + <enum>Extended</enum> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="showSortIndicator"> + <bool>true</bool> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistview.h</includehint> + <includehint>klistview.h</includehint> +</includehints> +</UI> diff --git a/kword/mailmerge/kabc/kwmailmerge_kabc.desktop b/kword/mailmerge/kabc/kwmailmerge_kabc.desktop new file mode 100644 index 00000000..77dd7d4a --- /dev/null +++ b/kword/mailmerge/kabc/kwmailmerge_kabc.desktop @@ -0,0 +1,105 @@ +[Desktop Entry] +Type=Service +ServiceTypes=KWord/MailMergePlugin + +Name=KDE Addressbook Plugin +Name[bg]=Приставка за адресника на KDE +Name[br]=Lugent Karned chomlec'hioù KDE +Name[ca]=Connector de llibreta d'adreces KDE +Name[cs]=Modul Knihy adres KDE +Name[cy]=Ategyn Llyfr Cyfeiriadau KDE +Name[da]=KDE's adressebog Plugin +Name[de]=KDE Adressbuch-Modul +Name[el]=Πρόσθετο βιβλίου διευθύνσεων του KDE +Name[eo]=KDE Adresaro-kromprogramo +Name[es]=Accesorio de la libreta de direcciones de KDE +Name[et]=KDE aadressiraamatu plugin +Name[eu]=KDE-ren helbide-liburuaren plugina +Name[fa]=وصلۀ کتاب نشانی KDE +Name[fi]=KDE:n osoitekirjan liitännäinen +Name[fr]=Module externe de carnet d'adresses de KDE +Name[fy]=Adresboekplugin foar KDE +Name[gl]=Plugin do Libro de Enderezos de KDE +Name[he]=תוסף של פנקס הכתובות של KDE +Name[hi]=केडीई पतापुस्तिका प्लगिन +Name[hr]=KDE dodatak adresara +Name[hu]=Illesztőmodul a KDE címjegyzékhez +Name[is]=KDE vistfanga íforrit +Name[it]=Plugin per la rubrica degli indirizzi KDE +Name[ja]=KDE アドレス帳プラグイン +Name[km]=កម្មវិធីជំនួយសៀវភៅអាសយដ្ឋាន KDE +Name[lv]=KDE adrešu grāmatiņas spraudnis +Name[ms]=Plugin Buku Alamat KDE +Name[nb]=Programtillegg for KDE-adresseboka +Name[nds]=Adressbook-Moduul för KDE +Name[ne]=KDE ठेगानापुस्तक प्लगइन +Name[nl]=Adresboekplugin voor KDE +Name[nn]=Programtillegg for KDE-adresseboka +Name[pl]=Wtyczka Książki adresowej KDE +Name[pt]='Plugin' do Livro de Endereços do KDE +Name[pt_BR]=Livro de Endereços do KDE +Name[ru]=Модуль адресной книги KDE +Name[se]=KDE:a čujuhusgirjemoduvla +Name[sk]=Modul pre KDE adresár +Name[sl]=Vstavek Adresar KDE +Name[sr]=Прикључак за KDE-ов адресар +Name[sr@Latn]=Priključak za KDE-ov adresar +Name[sv]=Insticksprogram för KDE:s adressbok +Name[ta]= KDE முகவரிப்புத்தகம் சொருகு +Name[tg]=Дарҷ кардани KDE Китоби Адресҳо +Name[tr]=KDE Adres Defteri Eklentisi +Name[uk]=Втулок адресної книги KDE +Name[uz]=KDE manzillar daftari plagini +Name[uz@cyrillic]=KDE манзиллар дафтари плагини +Name[wa]=Tchôke-divins calpin d' adresses KDE +Name[zh_CN]=KDE 地址簿插件 +Name[zh_TW]=KDE 通訊錄外掛程式 +Comment=This datasource type lets you use your KDE Address Book entries. +Comment[bg]=Този източник на данни се свързва директно с адресника на KDE и чете данните от там. +Comment[ca]=Aquest tipus de font de dades permet usar les entrades de la llibreta d'adreces del KDE. +Comment[cs]=Tento zdroj dat umožňuje využít položky z Knihy adres. +Comment[cy]=Mae'r math yma o ffynhonell ddata yn eich galluogi i ddefnyddio eich cofnodion Llyfr Cyfeiriadau KDE. +Comment[da]=Denne datakildetype lader dig bruge dine KDE adressebogsindgange. +Comment[de]=Dieser Quellentyp ermöglicht die Verwendung von KDE-Adressbucheinträgen. +Comment[el]=Αυτή η πηγή δεδομένων σας επιτρέπει να χρησιμοποιήσετε τις καταχωρήσεις σας από το βιβλίο διευθύνσεων του KDE. +Comment[es]=Este tipo de fuente de datos le permite usar las entradas de su libreta de direcciones de KDE. +Comment[et]=See andmeallika tüüp võimaldab kasutada KDE aadressiraamatu kirjeid. +Comment[eu]=Datu-iturburu honek zure KDE-ko helbide-liburuko sarrerak erabiltzeko aukera ematen dizu. +Comment[fa]=این نوع متن داده به شما اجازۀ استفاده از مدخلهای کتاب نشانی KDE را میدهد. +Comment[fi]=Tämän tietolähteen avulla voit käyttää KDE:n osoitekirjan tietoja. +Comment[fr]=Ce type de source de données vous permet d'utiliser votre carnet d'adresses KDE. +Comment[fy]=Mei dizze plugin ha jo taging ta jo KDE adresboek. +Comment[gl]=Este tipo de fonte de datos armacena os datos directamente no Libro de Enderezos de KDE. +Comment[he]=טיפוס מקור נתונים זה מאפשר לך להשתמש ברשומות שלך מתוך פנקס הכתובות של KDE. +Comment[hi]=यह डाटा स्रोत क़िस्म आपको केडीई पता पुस्तिका प्रविष्टियों को इस्तेमाल करने देती है. +Comment[hu]=Ez az adatforrástípus a KDE címjegyzék adatait teszi hozzáférhetővé. +Comment[is]=Þessi auðlindategund gerir þér kleyft að nota færslur frá KDE vistfangaskránni þinni. +Comment[it]=Questo tipo di fonte di dati permette di usare le voci della rubrica degli indirizzi di KDE. +Comment[ja]=KDE アドレス帳のデータを使用できるようにします。 +Comment[km]=ប្រភេទប្រភពទិន្នន័យនេះអនុញ្ញាតឲ្យអ្នកប្រើធាតុសៀវភៅអាសយដ្ឋាន KDE របស់អ្នក ។ +Comment[ms]=Jenis sumber data ini membenarkan anda menggunakan entri Buku Alamat KDE anda. +Comment[nb]=Med denne datakildetypen kan du få tilgang til oppføringene i KDE-adresseboka. +Comment[nds]=Mit dissen Datenborntyp laat sik KDE-Adressbookindrääg bruken. +Comment[ne]=यो डेटासंसाधनले तपाईंलाई तपाईंको KDE ठेगाना पुस्तक प्रविष्टिहरू प्रयोग गर्न दिन्छ । +Comment[nl]=Via deze plugin hebt u toegang tot uw KDE-adresboek. +Comment[nn]=Med denne datakjeldetypen kan du få tilgang til oppføringane i KDE-adresseboka. +Comment[pl]=To źródło danych pozwala Ci używać Twoich wpisów z Książki adresowej KDE. +Comment[pt]=Este tipo de fonte de dados armazena os dados directamente no Livro de Endereços do KDE. +Comment[pt_BR]=Este tipo de fonte de dados permite-lhe usar suas entradas do Livro de Endereços do KDE. +Comment[ru]=Источник данных, работающий с записями адресной книги KDE +Comment[se]=Dát dáhtagáldu diktá du geavahit KDE-čujuhusgirjemerkošiid. +Comment[sk]=Tento typ zdroja dát umožňuje používať záznamy z KDE adresára. +Comment[sl]=Ta tip vira podatkov vam omogoča uporabljati vnose vašega Adresarja KDE. +Comment[sr]=Овај тип извора података омогућава вам да користите ставке из KDE-овог адресара. +Comment[sr@Latn]=Ovaj tip izvora podataka omogućava vam da koristite stavke iz KDE-ovog adresara. +Comment[sv]=Den här typen av datakälla låter dig använda information från KDE:s adressbok +Comment[ta]=பலகத்தின் தோற்றத்தை நீங்கள் இங்கே வடிவமைக்கலாம். +Comment[tg]=Ин намуди манбаъи маълумот гузоштани шумо истифода кардан шуморо воридҳои Китоби Адресҳои KDE. +Comment[tr]=Bu veri kaynağı biçimi KDE Adres Defteri girdilerini kullanmanızı sağlar. +Comment[uk]=Цей тип джерела даних дає доступ до записів адресної книги KDE. +Comment[zh_CN]=该数据源类型允许您使用您的 KDE 地址簿条目。 +Comment[zh_TW]=這個資料來源類別讓您使用您的 KDE 通訊錄項目。 + +X-KDE-Library=kwmailmerge_kabc +X-KDE-Capabilities=open +X-KDE-InternalName=KABC diff --git a/kword/mailmerge/kspread/Makefile.am b/kword/mailmerge/kspread/Makefile.am new file mode 100644 index 00000000..d69e9469 --- /dev/null +++ b/kword/mailmerge/kspread/Makefile.am @@ -0,0 +1,16 @@ + +KDE_CXXFLAGS = $(USE_RTTI) +INCLUDES = $(KOFFICE_INCLUDES) $(KOTEXT_INCLUDES) \ + -I$(top_srcdir)/kspread -I$(top_srcdir)/kword $(all_includes) + +kde_module_LTLIBRARIES = kwmailmerge_kspread.la + +kwmailmerge_kspread_la_SOURCES = kwmailmerge_kspread.cpp kwmailmerge_kspread_config.cpp +kwmailmerge_kspread_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kwmailmerge_kspread_la_LIBADD = ../../libkwmailmerge_interface.la \ + $(top_builddir)/kspread/libkspreadcommon.la $(LIB_KDEUI) + +METASOURCES = AUTO + +services_DATA = kwmailmerge_kspread.desktop +servicesdir = $(kde_servicesdir) diff --git a/kword/mailmerge/kspread/kwmailmerge_kspread.cpp b/kword/mailmerge/kspread/kwmailmerge_kspread.cpp new file mode 100644 index 00000000..738cf6d7 --- /dev/null +++ b/kword/mailmerge/kspread/kwmailmerge_kspread.cpp @@ -0,0 +1,211 @@ +/* + This file is part of the KDE project + Copyright (C) 2004 Tobias Koenig <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include <kdebug.h> +#include <kglobal.h> +#include <klocale.h> + +#include <kspread_map.h> + +#include "kwmailmerge_kspread.h" +#include "kwmailmerge_kspread_config.h" + +using namespace KSpread; + +KWMailMergeKSpread::KWMailMergeKSpread( KInstance *instance, QObject *parent ) + : KWMailMergeDataSource( instance, parent ), _spreadSheetNumber( 1 ) +{ +} + +KWMailMergeKSpread::~KWMailMergeKSpread() +{ +} + +int KWMailMergeKSpread::getNumRecords() const +{ + return rows() - 2; +} + +QString KWMailMergeKSpread::getValue( const QString &name, int record ) const +{ + if ( record < 0 ) + return name; + + const Cell* cell = _sheet->cellAt( _columnMap[ name ], record + 2 ); + + if ( cell ) + return cellText( cell ); + else + return i18n( "Unkown mail merge variable: %1" ).arg( name ); +} + +void KWMailMergeKSpread::load( QDomElement& parentElem ) +{ + QDomNode contentNode = parentElem.namedItem( "CONTENT" ); + if ( contentNode.isNull() ) + return; + + QDomElement element = contentNode.toElement(); + if ( element.isNull() ) + return; + + _url = element.attribute( QString::fromLatin1( "URL" ) ); + _spreadSheetNumber = element.attribute( QString::fromLatin1( "SpreadSheetNumber" ) ).toInt(); + + initDocument(); +} + +void KWMailMergeKSpread::save( QDomDocument& doc, QDomElement& parent ) +{ + QDomElement content = doc.createElement( QString::fromLatin1( "CONTENT" ) ); + parent.appendChild( content ); + + content.setAttribute( "URL", _url.url() ); + content.setAttribute( "SpreadSheetNumber", _spreadSheetNumber ); +} + +void KWMailMergeKSpread::refresh( bool ) +{ +} + +bool KWMailMergeKSpread::showConfigDialog( QWidget *parent, int ) +{ + KWMailMergeKSpreadConfig dlg( parent, this ); + + int retval = dlg.exec(); + if ( retval ) + initDocument(); + + return retval; +} + +void KWMailMergeKSpread::initDocument() +{ + _document = new Doc(); + + connect( _document, SIGNAL( completed() ), SLOT( initSpreadSheets() ) ); + + _document->openURL( _url ); +} + +void KWMailMergeKSpread::initSpreadSheets() +{ + + _columnMap.clear(); + sampleRecord.clear(); + + QPtrListIterator<Sheet> it( _document->map()->sheetList() ); + int counter = 0; + for ( it.toFirst(); it.current(), counter < _spreadSheetNumber; ++it ) { + _sheet = it.current(); + counter++; + } + + if ( !_sheet ) { + kdError() << "No spread sheet available" << endl; + return; + } + + if ( rows() < 2 ) // empty table + return; + + int cols = columns(); + for ( int i = 1; i < cols; ++i ) { + const Cell* cell = _sheet->cellAt( i, 1 ); + + // init record list + sampleRecord[ cellText( cell ) ] = cellText( cell ); + _columnMap.insert( cellText( cell ), i ); + } +} + +int KWMailMergeKSpread::rows() const +{ + if ( !_sheet ) + return 0; + + int row = 1; + + for (; row < _sheet->maxRow(); ) { + const Cell* cell = _sheet->cellAt( 1, row ); + if ( cellText( cell ).isEmpty() ) + break; + + row++; + } + + return row; +} + +int KWMailMergeKSpread::columns() const +{ + if ( !_sheet ) + return 0; + + int col = 1; + + for (; col < _sheet->maxColumn(); ) { + const Cell* cell = _sheet->cellAt( col, 1 ); + if ( cellText( cell ).isEmpty() ) + break; + + col++; + } + + return col; +} + +QString KWMailMergeKSpread::cellText( const Cell *cell ) const +{ + QString text = QString::null; + + if ( !cell->isDefault() && !cell->isEmpty() ) { + if ( cell->isFormula() ) + text = cell->strOutText(); + else if ( !cell->link().isEmpty() ) + text = cell->link(); + else + text = cell->text(); + } +#if 0 + switch( cell->content() ) { + case Cell::Text: + case Cell::Formula: + text = cell->strOutText(); + break; + case Cell::RichText: + case Cell::VisualFormula: + text = cell->text(); // untested + break; + } + } +#endif + return text; +} + +extern "C" +{ + KWORD_MAILMERGE_EXPORT KWMailMergeDataSource *create_kwmailmerge_kspread( KInstance *instance, QObject *parent ) + { + return new KWMailMergeKSpread( instance, parent ); + } +} + +#include "kwmailmerge_kspread.moc" diff --git a/kword/mailmerge/kspread/kwmailmerge_kspread.desktop b/kword/mailmerge/kspread/kwmailmerge_kspread.desktop new file mode 100644 index 00000000..06dd45ec --- /dev/null +++ b/kword/mailmerge/kspread/kwmailmerge_kspread.desktop @@ -0,0 +1,101 @@ +[Desktop Entry] +Type=Service +ServiceTypes=KWord/MailMergePlugin + +Name=KSpread Table Source +Name[bg]=Източник на данни от KSpread +Name[ca]=Font de taula de KSpread +Name[cy]=Ffynhonell Dabl KSpread +Name[da]=KSpread-tabelkilde +Name[de]=KSpread-Tabelle +Name[el]=Πηγή πίνακα του KSpread +Name[eo]=KSpread tabelfonto +Name[es]=Origen de tablas de KSpread +Name[et]=KSpreadi tabel +Name[eu]=KSpread-en taula-iturburua +Name[fa]=متن جدول KSpread +Name[fi]=KSpread-taulukkolähde +Name[fr]=Source de tableaux KSpread +Name[fy]=KSpread Tabelboarne +Name[gl]=Fonte en Táboa de KSpread +Name[he]=מקור טבלאות של KSpread +Name[hi]=के-स्प्रेड तालिका स्रोत +Name[hr]=KSpread izvor tablice +Name[hu]=KSpread táblaforrás +Name[is]=KSpread töflu auðlind +Name[it]=Fonte tabella di KSpread +Name[ja]=KSpread テーブルソース +Name[km]=ប្រភពតារាងរបស់ KSpread +Name[lv]=KSpread tabulas avots +Name[ms]=Sumber Jadual KSpread +Name[nb]=KSpread Tabellkilde +Name[nds]=KSpread-Tabellenborn +Name[ne]=केडीई स्प्रिेड तालिका स्रोत +Name[nl]=KSpread Tabelbron +Name[nn]=KSpread-tabellkjelde +Name[pl]=Źródło tabeli KSpread +Name[pt]=Fonte de Tabela do KSpread +Name[pt_BR]=Tabela do KSpread +Name[ru]=Источник таблиц KSpread +Name[se]=KSpread-tabeallagáldu +Name[sk]=Zdroj tabuliek KSpread +Name[sl]=Vir tabel KSpread +Name[sr]=KSpread-ов извор табеле +Name[sr@Latn]=KSpread-ov izvor tabele +Name[sv]=Kspread-tabellkällfil +Name[ta]=கேஸ்பிரிட் அட்டவணை மூலம் +Name[tg]=Сарчашмаи ҷадвали KSpread +Name[tr]=KSpread Tablo Kaynağı +Name[uk]=Джерело таблиць KSpread +Name[uz]=KSpread jadvali manbasi +Name[uz@cyrillic]=KSpread жадвали манбаси +Name[zh_CN]=KSpread 表源 +Name[zh_TW]=KSpread 表格來源 +Comment=This datasource type lets you use your entries from a kspread file. +Comment[bg]=Този източник на данни чете данните директно от файл на KSpread. +Comment[ca]=Aquest tipus de font de dades permet usar les entrades d'un fitxer kspread. +Comment[cy]=Mae'r math yma o ffynhonell ddata yn eich galluogi i ddefnyddio eich cofnodion o ffeil kspread. +Comment[da]=Denne datakildetype lader dig bruge dine indgange fra en kspread-fil. +Comment[de]=Mit diesem Datenquellentyp können Sie Einträge aus einer KSpread-Tabelle verwenden. +Comment[el]=Αυτή η πηγή δεδομένων σας επιτρέπει να χρησιμοποιήσετε τις καταχωρήσεις σας από ένα αρχείο του KSpread. +Comment[es]=Este tipo de fuente de datos le permite usar las entradas de un archivo de kspread. +Comment[et]=See andmeallika tüüp võimaldab kasutada KSpreadi faili kirjeid. +Comment[eu]=Datu-iturburu honek kspread fitxategi bateko sarrerako erabiltzeko aukera ematen dizu. +Comment[fa]=این نوع متن داده به شما اجازۀ استفاده از مدخلهایتان از یک پروندۀ kspread را میدهد. +Comment[fi]=Tämän tietolähteen avulla voit käyttää tietoja KSPread-taulukosta. +Comment[fr]=Ce type de source de données vous permet d'utiliser vos saisies depuis un fichier KSpread. +Comment[fy]=Mei dit type gegevensboarne kinne jo, jo yngongen út in Kspreadtriem brûke. +Comment[gl]=Este tipo de fonte de datos permite utilizar datos dun ficheiro de KSpread. +Comment[he]=טיפוס מקור נתונים זה מאפשר לך להשתמש ברשומות שלך מתוך קובץ של kspread. +Comment[hi]=यह डाटा स्रोत क़िस्म आपको केडीई पता के-स्प्रेड फ़ाइल की प्रविष्टियों को इस्तेमाल करने देती है. +Comment[hr]=Ova vrsta izvora podataka omogućuje upotrebu unusa iz KSpread datoteke. +Comment[hu]=Ezzel az adatforrástípussal KSpread-fájlok adataihoz lehet hozzáférni. +Comment[is]=Þessi auðlindategund gerir þér kleyft að nota færslur frá kspread skrá. +Comment[it]=Questo tipo di fonte di dati permette di usare le voci di un file KSpread. +Comment[ja]=KSpread ファイルのデータを使用できるようにします。 +Comment[km]=ប្រភេទប្រភពទិន្នន័យនេះអនុញ្ញាតឲ្យអ្នកប្រើធាតុរបស់អ្នកពីឯកសារ kspread ។ +Comment[ms]=Jenis sumber data ini membenarkan anda menggunakan entri anda dari fail kspread. +Comment[nb]=Denne datakilden lar deg bruke data fra en kspread fil. +Comment[nds]=Mit dissen Datenborntyp laat sik Indrääg ut en KSpread-Datei bruken. +Comment[ne]=यो डेटासंसाधन प्रकारले तपाईंलाई केडीई स्प्रिेड फाइलबाट तपाईंको प्रविष्टिहरू प्रयोग गर्न दिन्छ । +Comment[nl]=Met dit type databron kunt u uw ingangen uit een Kspread-bestand gebruiken. +Comment[nn]=Med denne datakjeldetypen kan du få tilgang til oppføringane i ei KSpread-fil. +Comment[pl]=To źródło danych pozwala Ci używać Twoich wpisów z plików KSpread. +Comment[pt]=Este tipo de fonte de dados permite utilizar dados de um ficheiro do kspread. +Comment[pt_BR]=Este tipo de fonte de dados permite-lhe usar os dados de um arquivo KSpread. +Comment[ru]=Источник данных, работающий с таблицами KSpread +Comment[sk]=Tento typ zdroja dát umožňuje používať záznamy zo súboru kspread. +Comment[sl]=Ta vrsta podatkovnega izvora vam omogoča uporabo vnosov iz datoteke KSpread. +Comment[sr]=Овај тип извора података омогућава вам да користите ставке из KSpread-овог фајла. +Comment[sr@Latn]=Ovaj tip izvora podataka omogućava vam da koristite stavke iz KSpread-ovog fajla. +Comment[sv]=Den här typen av datakälla låter dig använda information från en Kspread-fil. +Comment[ta]=இந்த தகவல்மூலம் கேஸ்ப்ரெட் கோப்பில் இருந்து உங்கள் உள்ளீடுகளை பயன்படுத்த செய்கிறது. +Comment[tg]=Ин намуди манбаъи маълумот гузоштани шумо истифода кардан шуморо воридҳои аз файли kspread. +Comment[tr]=Bu veri kaynağı biçimi bir kspread dosyasındaki girdileri kullanmanızı sağlar. +Comment[uk]=Цей тип джерела даних дає доступ до записів файла kspread. +Comment[zh_CN]=该数据源类型允许您从 kspead 文件中使用您的条目。 +Comment[zh_TW]=這個資料來源類別讓您可以使用 kspread 檔案的項目。 + +X-KDE-Library=kwmailmerge_kspread +X-KDE-Capabilities=open +X-KDE-InternalName=KSpread diff --git a/kword/mailmerge/kspread/kwmailmerge_kspread.h b/kword/mailmerge/kspread/kwmailmerge_kspread.h new file mode 100644 index 00000000..2d639074 --- /dev/null +++ b/kword/mailmerge/kspread/kwmailmerge_kspread.h @@ -0,0 +1,106 @@ +/* + This file is part of the KDE project + Copyright (C) 2004 Tobias Koenig <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _KWMAILMERGE_KSPREAD_H_ +#define _KWMAILMERGE_KSPREAD_H_ + +#include <qdom.h> +#include <qmap.h> + +#include <kspread_doc.h> +#include <kspread_sheet.h> + +#include "KWMailMergeDataSource.h" + +class KWMailMergeKSpread: public KWMailMergeDataSource +{ + Q_OBJECT + + public: + KWMailMergeKSpread( KInstance *inst, QObject *parent ); + ~KWMailMergeKSpread(); + + /** + Saves the mail merge list to the kword document. + */ + virtual void save( QDomDocument&, QDomElement& ); + + /** + Loads the mail merge list stored in the kword document. + */ + virtual void load( QDomElement& ); + + /** + @param name The name of the value e.g. "Family name". + @param record The position of the the entry in mail merge list. + @return The value of the mail merge variable. + + If @p record equals -1, @p name is returned. + */ + virtual class QString getValue( const class QString &name, int record = -1 ) const; + + /** + @return The number of available contacts in mail merge list. + */ + virtual int getNumRecords() const; + + /** + Only for compatability reasons. + + @param force Hasn't any effect. + */ + virtual void refresh( bool force ); + + /** + Shows a KWMailMergeKSpreadConfig dialog for selecting entries from KAddressbook. + */ + virtual bool showConfigDialog( QWidget*, int action); + + + void setURL( const KURL &url ) { _url = url; } + KURL url() const { return _url; } + + void setSpreadSheetNumber( int number ) { _spreadSheetNumber = number; } + int spreadSheetNumber() const { return _spreadSheetNumber; } + + protected: + friend class KWMailMergeKSpreadConfig; + + private slots: + void initSpreadSheets(); + + private: + void initDocument(); + + int rows() const; + int columns() const; + + QString cellText( const KSpread::Cell* ) const; + + KSpread::Doc *_document; + KSpread::Sheet* _sheet; + KURL _url; + int _spreadSheetNumber; + + QMap<QString, int> _columnMap; +}; + +#endif + diff --git a/kword/mailmerge/kspread/kwmailmerge_kspread_config.cpp b/kword/mailmerge/kspread/kwmailmerge_kspread_config.cpp new file mode 100644 index 00000000..fc170780 --- /dev/null +++ b/kword/mailmerge/kspread/kwmailmerge_kspread_config.cpp @@ -0,0 +1,125 @@ +/* + This file is part of the KDE project + Copyright (C) 2004 Tobias Koenig <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + + +#include <qlabel.h> +#include <qlayout.h> + +#include <kcombobox.h> +#include <klineedit.h> +#include <klocale.h> +#include <kurlrequester.h> + +#include <kspread_map.h> + +#include "kwmailmerge_kspread.h" +#include "kwmailmerge_kspread_config.h" + +using namespace KSpread; + +KWMailMergeKSpreadConfig::KWMailMergeKSpreadConfig( QWidget *parent, KWMailMergeKSpread *object ) + : KDialogBase( Plain, i18n( "Mail Merge - Editor" ), + Ok | Cancel, Ok, parent, "", true ), + _document( 0 ), _initialPage( 1 ) +{ + _object = object; + + initGUI(); + + _urlRequester->setURL( _object->url().url() ); + _initialPage = _object->spreadSheetNumber(); + + connect( _urlRequester, SIGNAL( urlSelected( const QString& ) ), + SLOT( loadDocument() ) ); + + loadDocument(); + slotTextChanged( _urlRequester->lineEdit()->text() ); +} + + +KWMailMergeKSpreadConfig::~KWMailMergeKSpreadConfig() +{ +} + +void KWMailMergeKSpreadConfig::slotOk() +{ + _object->setURL( _urlRequester->url() ); + _object->setSpreadSheetNumber( _pageNumber->currentText().toInt() ); + + KDialogBase::slotOk(); +} + +void KWMailMergeKSpreadConfig::loadDocument() +{ + delete _document; + _document = 0; + + _pageNumber->setEnabled( false ); + + if ( !_urlRequester->url().isEmpty() ) { + _document = new Doc(); + connect( _document, SIGNAL( completed() ), SLOT( documentLoaded() ) ); + + _document->openURL( _urlRequester->url() ); + } +} + +void KWMailMergeKSpreadConfig::documentLoaded() +{ + _pageNumber->clear(); + + QPtrListIterator<Sheet> it( _document->map()->sheetList() ); + int counter = 1; + for ( it.toFirst(); it.current(); ++it ) { + _pageNumber->insertItem( QString::number( counter ) ); + counter++; + } + + _pageNumber->setEnabled( true ); + _pageNumber->setCurrentText( QString::number( _initialPage ) ); +} + +void KWMailMergeKSpreadConfig::initGUI() +{ + QFrame *page = plainPage(); + + QGridLayout *layout = new QGridLayout( page, 2, 2, marginHint(), spacingHint() ); + + QLabel *label = new QLabel( i18n( "URL:" ), page ); + layout->addWidget( label, 0, 0 ); + + _urlRequester = new KURLRequester( page ); + layout->addWidget( _urlRequester, 0, 1 ); + + label = new QLabel( i18n( "Page number:" ), page ); + layout->addWidget( label, 1, 0 ); + + _pageNumber = new KComboBox( page ); + _pageNumber->setEnabled( false ); + layout->addWidget( _pageNumber, 1, 1 ); + connect( _urlRequester->lineEdit() , SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged( const QString & ) ) ); +} + +void KWMailMergeKSpreadConfig::slotTextChanged( const QString & _text ) +{ + enableButtonOK( !_text.isEmpty() ); +} + +#include "kwmailmerge_kspread_config.moc" diff --git a/kword/mailmerge/kspread/kwmailmerge_kspread_config.h b/kword/mailmerge/kspread/kwmailmerge_kspread_config.h new file mode 100644 index 00000000..6aacff63 --- /dev/null +++ b/kword/mailmerge/kspread/kwmailmerge_kspread_config.h @@ -0,0 +1,61 @@ +/* + This file is part of the KDE project + Copyright (C) 2004 Tobias Koenig <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _KWMAILMERGE_KSPREAD_CONFIG_H_ +#define _KWMAILMERGE_KSPREAD_CONFIG_H_ + +#include <kdialogbase.h> + +#include "kwmailmerge_kspread.h" + +class KComboBox; +class KURLRequester; + +class KWMailMergeKSpread; + +class KWMailMergeKSpreadConfig: public KDialogBase +{ + Q_OBJECT + + public: + KWMailMergeKSpreadConfig( QWidget *parent, KWMailMergeKSpread *object ); + virtual ~KWMailMergeKSpreadConfig(); + + + protected slots: + virtual void slotOk(); + + void loadDocument(); + void documentLoaded(); + void slotTextChanged( const QString & _text ); + + private: + void initGUI(); + + KWMailMergeKSpread *_object; + KSpread::Doc *_document; + + KURLRequester *_urlRequester; + KComboBox *_pageNumber; + + int _initialPage; +}; + +#endif diff --git a/kword/mailmerge/kwserialletter_classic.desktop b/kword/mailmerge/kwserialletter_classic.desktop new file mode 100644 index 00000000..030c56b9 --- /dev/null +++ b/kword/mailmerge/kwserialletter_classic.desktop @@ -0,0 +1,122 @@ +[Desktop Entry] +Type=Service +ServiceTypes=KWord/MailMergePlugin + +Name=Internal Storage +Name[af]=Intern Stoorplek +Name[ar]=تخزين داخليّ +Name[az]=Daxili Ambar +Name[bg]=Вътрешно съхранение +Name[bs]=Interna pohrana +Name[ca]=Emmagatzemament intern +Name[cs]=Interní uložení +Name[cy]=Storfa Fewnol +Name[da]=Intern opbevaring +Name[de]=Interner Speicher +Name[el]=Εσωτερική αποθήκευση +Name[eo]=Interna memoro +Name[es]=Almacenamiento interno +Name[et]=Sisemine säilitamine +Name[eu]=Barneko biltegia +Name[fa]=ذخیرهسازی درونی +Name[fi]=Sisäinen tietovarasto +Name[fr]=Stockage interne +Name[fy]=Ynterne opslach +Name[gl]=Armacenamento Interno +Name[he]=איחסון פנימי +Name[hi]=आंतरिक भंडार +Name[hr]=Interna pohrana +Name[hu]=Belső tároló +Name[is]=Innbyggð geymsla +Name[it]=Memorizzazione interna +Name[ja]=内部ストレージ +Name[km]=កន្លែងផ្ទុកខាងក្នុង +Name[lo]=ສື່ເກັບຂໍ້ມູນພາຍໃນ +Name[lt]=Vidinė atmintinė +Name[lv]=Iekšējā glabātuve +Name[ms]=Storan Dalaman +Name[mt]=Ħażna interna +Name[nb]=Internt lagring +Name[nds]=Intern Spieker +Name[ne]=आन्तरिक भण्डारण +Name[nl]=Interne opslag +Name[nn]=Intern lagring +Name[pl]=Przechowywanie wewnętrzne +Name[pt]=Armazenamento na Internet +Name[pt_BR]=Armazenamento Interno +Name[ro]=Stocare internă +Name[ru]=Внутреннее хранилище +Name[se]=Siskkildas vurken +Name[sk]=Interný sklad +Name[sl]=Notranja shramba +Name[sr]=Интерни простор за смештај +Name[sr@Latn]=Interni prostor za smeštaj +Name[sv]=Internlagring +Name[ta]=உள்ளகச் சேமிப்பு +Name[tg]=Нигоҳдории Дарунӣ +Name[th]=สื่อเก็บข้อมูลภายใน +Name[tr]=İç Depo +Name[uk]=Внутрішнє сховище +Name[uz]=Ichki saqlash joyi +Name[uz@cyrillic]=Ички сақлаш жойи +Name[xh]=Indawo yokugcina Yangaphakathi +Name[zh_CN]=内部存储 +Name[zh_TW]=內部存儲器 +Comment=This datasource type stores the data directly in the KWord file +Comment[ar]=هذا النّوع من المصادر البيانيّة يُخزِّن البيانات مباشرة في ملف KWord +Comment[az]=Bu mənbə verilənləri düz KWord fayl içinə qeyd edir. +Comment[bg]=Този източник на данни запазва данните директно във файл на KWord +Comment[bs]=Ovaj tip izvora podataka spašava podatke direktno u KWord datoteku +Comment[ca]=Aquest tipus de font de dades guarda les dades directament en el fitxer KWord +Comment[cs]=Tento typ zdroje dat ukládá údaje přímo do souboru ve formátu KWordu +Comment[cy]=Mae'r math yma o ffynhonnell ddata yn cadw'r data yn uniongyrchol yn y ffeil KWord +Comment[da]=Denne datakildetype gemmer sine data direkte i KWord-filen +Comment[de]=Dieser Datenquellentyp speichert seine Daten direkt in die KWord-Datei +Comment[el]=Αυτός ο τύπος πηγής δεδομένων αποθηκεύει τα δεδομένα απευθείας σε ένα αρχείο KWord +Comment[eo]=Tiu datumfonta tipo konservas la datumojn rekte ne la KWord-dosiero +Comment[es]=Este tipo de fuente de datos almacena los datos directamente en el archivo de KWord +Comment[et]=See andmeallika tüüp hoiab andmeid otse KWordi failis +Comment[eu]=Datu-iturburu honek datuak zuzenean kspread fitxategi batean gordetzen ditu +Comment[fa]=این نوع متن داده، مستقیماً داده را در پروندۀ KWord ذخیره میکند +Comment[fi]=Tämä tietolähde tallentaa tiedot suoraan KWord-tiedostoon. +Comment[fr]=Ce type de source de données enregistre les données directement dans le document KWord +Comment[fy]=Dit type gegevensboarne bewarret de gegevens rjochtstreeeks op yn in KWord-triem. +Comment[gl]=Este tipo de fonte de datos armacena os datos directamente no ficheiro de KWord +Comment[he]=טיפוס מקור נתונים זה מאחסן את הנתונים ישירות בקובץ של KWord +Comment[hi]=यह डेटा स्रोत क़िस्म डेटा को सीधे ही के-वर्ड फ़ाइल में भंडारित करती है +Comment[hr]=Ova vrsta izvora podataka pohranjuje podatke izravno u KWord datoteku +Comment[hu]=Ennél az adatforrástípusnál az adatok közvetlenül a KWord fájlba kerülnek +Comment[is]=Þessi auðlindategund geymir gögnin í sjálfri KWord skránni +Comment[it]=Questo tipo di fonte di dati memorizza i dati direttamente nel documento KWord +Comment[ja]=このデータソースタイプは KWord ファイルに直接データを保持します +Comment[km]=ប្រភេទប្រភពទិន្នន័យនេះរក្សាទិន្នន័យដោយផ្ទាល់ក្នុងឯកសារ KWord +Comment[lt]=Šis duomenų šaltinio tipas išsaugo duomenis tiesiog KWord byloje +Comment[lv]=Šis datuavota tips saglabā datus pa taisno KWord failā +Comment[ms]=Jenis sumber data ini menyimpan data terus ke dalam fail KWord +Comment[mt]=Dan it-tip ta' sors jikteb l-informazzjoni direttament fid-dokument tal-KWord +Comment[nb]=Denne datakilden lagrer data rett i KWord-fila +Comment[nds]=Disse Datenborntyp sekert Daten direktemang na en KWord-Datei +Comment[ne]=यो डेटासंसाधन प्रकारले डेटालाई सीधै केडीई शब्द फाइलमा संग्रह गर्दछ +Comment[nl]=Dit type gegevensbron slaat de gegevens rechtstreeks op in een KWord-bestand. +Comment[nn]=Denne datakjeldetypen lagrar informasjonen rett i KWord-fila +Comment[pl]=To źródło sprawia, że dane są przechowywane bezpośrednio w pliku KWord +Comment[pt]=Este tipo de fonte de dados armazena os dados directamente no ficheiro do KWord +Comment[pt_BR]=Este tipo de fonte de dados armazena os dados diretamente no arquivo do KWord. +Comment[ro]=Acest tip de sursă de date stochează datele direct în fişierul KWord +Comment[ru]=Источник данных в документе KWord +Comment[se]=Dát diehtogáldušládja vurke dáhtaid njuolgga KWord-fiilii +Comment[sk]=Tento typ zdroja dát ukladá údaje priamo do súboru KWord +Comment[sl]=Ta tip vira podatkov shrani podatke neposredno v datoteko KWord +Comment[sr]=Овај тип извора података складишти податке директно у KWord-овом фајлу +Comment[sr@Latn]=Ovaj tip izvora podataka skladišti podatke direktno u KWord-ovom fajlu +Comment[sv]=Den här typen av datakälla lagrar data direkt i Kword-filen +Comment[tg]=Ин намуди манбаъи маълумот нигоҳ доштани таърихро фавран дар файли KWord +Comment[tr]=Bu veri kaynağı veriyi doğrudan KWord dosyasında saklar. +Comment[uk]=Цей тип джерела даних зберігає дані напряму в файлі KWord +Comment[xh]=Uhlobo lwe mvelaphi ye data igcina idata ngqo kwifayile ye KWord +Comment[zh_CN]=该数据源类型将数据直接保存在 KWord 文件中 +Comment[zh_TW]=這個資料來源類別將資料直接以 KWord 檔案儲純 + +X-KDE-Library=kwmailmerge_classic +X-KDE-Capabilities=edit,create +X-KDE-InternalName=Classic diff --git a/kword/mailmerge/sql/KWMySqlCursor.h b/kword/mailmerge/sql/KWMySqlCursor.h new file mode 100644 index 00000000..e5e998b6 --- /dev/null +++ b/kword/mailmerge/sql/KWMySqlCursor.h @@ -0,0 +1,69 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _SERIALLETTER_QtSql_SQLCURSOR_H_ +#define _SERIALLETTER_QtSql_SQLCURSOR_H_ + +/* FOR THE DIRTY HACK */ +#include <qsqlcursor.h> +#include <qsqldriver.h> +/* END FOR THE DIRTY HACK */ + +/****************************************************************** + * + * DIRTY HACK FOR SOME INFLEXIBILITY IN QT3's SQL stuff + * + * This class is rom some Trolltech guy on QT-interest + ******************************************************************/ + + + +class KWMySqlCursor: public QSqlCursor +{ +public: + KWMySqlCursor( const QString & query = QString::null, bool autopopulate = +TRUE, QSqlDatabase* db = 0 ): QSqlCursor( QString::null, autopopulate, db ) + { + exec( query ); + if ( autopopulate ) + *(QSqlRecord*)this = ((QSqlQuery*)this)->driver()->record( +*(QSqlQuery*)this ); + setMode( QSqlCursor::ReadOnly ); + } + KWMySqlCursor( const KWMySqlCursor & other ): QSqlCursor( other ) {} + KWMySqlCursor( const QSqlQuery & query, bool autopopulate = TRUE ): +QSqlCursor( QString::null, autopopulate ) + { + *(QSqlQuery*)this = query; + if ( autopopulate ) + *(QSqlRecord*)this = query.driver()->record( query ); + setMode( QSqlCursor::ReadOnly ); + } + bool select( const QString & /*filter*/, const QSqlIndex & /*sort*/ = +QSqlIndex() ) { return exec( lastQuery() ); } + QSqlIndex primaryIndex( bool /*prime*/ = TRUE ) const { return +QSqlIndex(); } + int insert( bool /*invalidate*/ = TRUE ) { return FALSE; } + int update( bool /*invalidate*/ = TRUE ) { return FALSE; } + int del( bool /*invalidate*/ = TRUE ) { return FALSE; } + void setName( const QString& /*name*/, bool /*autopopulate*/ = TRUE ) {} +}; + + +#endif diff --git a/kword/mailmerge/sql/KWQtSqlEasyFilter.cpp b/kword/mailmerge/sql/KWQtSqlEasyFilter.cpp new file mode 100644 index 00000000..0f5e5ffb --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlEasyFilter.cpp @@ -0,0 +1,98 @@ +#include "KWQtSqlEasyFilter.h" +#include "KWQtSqlEasyFilter.moc" +#include <qtable.h> +#include <qscrollview.h> +#include <klocale.h> +#include <qlayout.h> +#include <qcheckbox.h> + +KWQtSqlEasyFilter::KWQtSqlEasyFilter( QWidget *parent) + :KDialogBase( Swallow, i18n( "Mail Merge - Editor" ), Ok | Cancel, Ok, parent, "", true) +{ + m_fieldList << "" <<"one" << "two" << "three" << "four"; + m_sortingList << ""<<i18n("ascending")<<i18n("descending"); + m_operationList <<"="<<i18n("contains")<< "<" << ">"; + + m_table=new QTable(6,3,this); + setMainWidget(m_table); + + m_table->verticalHeader()->setLabel(0,i18n("Field")); + m_table->verticalHeader()->setLabel(1,i18n("Sorting Order")); + m_table->verticalHeader()->setLabel(2,i18n("Include")); + m_table->verticalHeader()->setLabel(3,i18n("Operator")); + m_table->verticalHeader()->setLabel(4,i18n("Condition")); + m_table->verticalHeader()->setLabel(5,i18n("Value")); + m_table->setSelectionMode(QTable::NoSelection); + m_table->setColumnMovingEnabled(true); + m_table->setSorting(false); + + for (int i=0; i<3; i++) + { + createColumn(i); + } + + int h=m_table->rowHeight(0); + for (int i=0;i<6;i++) h+=m_table->rowHeight(i); + h+=m_table->horizontalHeader()->sizeHint().height(); + m_table->setMinimumHeight(h); + + int w=0; + for (int i=0;i<3;i++) w+=m_table->columnWidth(i); + w+=m_table->verticalHeader()->headerWidth(); + m_table->setMinimumWidth(w); + connect(m_table,SIGNAL(valueChanged ( int, int)),this,SLOT(slotValueChanged ( int, int))); +} + +void KWQtSqlEasyFilter::createColumn(int i) +{ + QTableItem *it; + m_table->setItem(0,i,it=new QComboTableItem(m_table,m_fieldList,false)); + m_table->setItem(1,i,it=new QComboTableItem(m_table,m_sortingList,false)); + it->setEnabled(false); + m_table->setItem(2,i,it=new QCheckTableItem(m_table,i18n("Yes"))); + it->setEnabled(false); + m_table->setItem(3,i,it=new QCheckTableItem(m_table,i18n("NOT"))); + it->setEnabled(false); + m_table->setItem(4,i,it=new QComboTableItem(m_table,m_operationList,false)); + it->setEnabled(false); + m_table->setItem(5,i,it=new QTableItem(m_table,QTableItem::WhenCurrent,"")); + it->setEnabled(false); + m_table->ensureCellVisible(0,i); +} + + +void KWQtSqlEasyFilter::slotValueChanged ( int row, int col ) +{ + switch (row) + { + case 0: + if ( !m_table->item(row,col)->text().isEmpty() ) + { + if (col==m_table->numCols()-1) + { + m_table->insertColumns(col+1,1); + createColumn(col+1); + } + m_table->item(1,col)->setEnabled(true); + m_table->item(2,col)->setEnabled(true); + bool enableSearch=(static_cast<QCheckTableItem*>(m_table->item(2,col))->isChecked()); + m_table->item(3,col)->setEnabled(enableSearch); + m_table->item(4,col)->setEnabled(enableSearch); + m_table->item(5,col)->setEnabled(enableSearch); + } + else + { + for (int i=1;i<6;i++) m_table->item(i,col)->setEnabled(false); + } + break; + case 2: + bool enSearch=static_cast<QCheckTableItem*>(m_table->item(row,col))->isChecked(); + m_table->item(3,col)->setEnabled(enSearch); + m_table->item(4,col)->setEnabled(enSearch); + m_table->item(5,col)->setEnabled(enSearch); + break; + } +} + +KWQtSqlEasyFilter::~KWQtSqlEasyFilter(){;} + diff --git a/kword/mailmerge/sql/KWQtSqlEasyFilter.h b/kword/mailmerge/sql/KWQtSqlEasyFilter.h new file mode 100644 index 00000000..aa20d494 --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlEasyFilter.h @@ -0,0 +1,29 @@ +#ifndef MAILMERGE_QtSqlPLUGIN_EASYFILTER +#define MAILMERGE_QtSqlPLUGIN_EASYFILTER + +#include <kdialogbase.h> + +class QTable; +class QScrollView; +class QStringList; + +class KWQtSqlEasyFilter: public KDialogBase +{ + Q_OBJECT +public: + KWQtSqlEasyFilter( QWidget *parent); + virtual ~KWQtSqlEasyFilter(); +protected: + void createColumn(int i); + +protected slots: + void slotValueChanged ( int, int); +private: + QTable *m_table; + QScrollView *m_view; + QStringList m_fieldList,m_sortingList,m_operationList; + + +}; + +#endif diff --git a/kword/mailmerge/sql/KWQtSqlMailMergeOpen.cpp b/kword/mailmerge/sql/KWQtSqlMailMergeOpen.cpp new file mode 100644 index 00000000..099e92a8 --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlMailMergeOpen.cpp @@ -0,0 +1,123 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "KWQtSqlMailMergeOpen.h" +#include "KWQtSqlMailMergeOpen.moc" +#include <kcombobox.h> +#include <klineedit.h> +#include <kdebug.h> +#include <qlayout.h> +#include <kconfig.h> +#include <kpushbutton.h> +#include <klineeditdlg.h> +#include <kiconloader.h> +#include <qsqldatabase.h> +#include <qguardedptr.h> +#include <klocale.h> + +/****************************************************************** + * + * Class: KWQtSqlMailMergeOpen + * + ******************************************************************/ + +KWQtSqlMailMergeOpen::KWQtSqlMailMergeOpen( QWidget *parent, KWQtSqlSerialDataSourceBase *db_ ) + :KDialogBase( Plain, i18n( "Mail Merge - Setup Database Connection" ), Ok | Cancel, Ok, parent, "", true ), db( db_ ){ + (new QVBoxLayout(plainPage()))->setAutoAdd(true); + setMainWidget(widget=new KWQtSqlOpenWidget(plainPage())); + widget->drivers->insertStringList(QSqlDatabase::drivers()); + widget->hostname->setText(db->hostname); + widget->username->setText(db->username); + widget->port->setText(db->port); + widget->databasename->setText(db->databasename); + fillSavedProperties(); + connect(this,SIGNAL(okClicked()),this,SLOT(handleOk())); + connect(widget->savedProperties,SIGNAL(activated(const QString&)), + this, SLOT(savedPropertiesChanged(const QString&))); + connect(widget->rememberButton,SIGNAL(clicked()), + this, SLOT(slotSave())); +} + +KWQtSqlMailMergeOpen::~KWQtSqlMailMergeOpen(){;} + +void KWQtSqlMailMergeOpen::savedPropertiesChanged(const QString& name) +{ + if (name!=i18n("<not saved>")) + { + KConfig conf("kwmailmergerc"); + conf.setGroup("KWSLQTDB:"+name); + widget->hostname->setText(conf.readEntry("hostname","")); + widget->username->setText(conf.readEntry("username","")); + widget->port->setText(conf.readEntry("port","")); + widget->databasename->setText(conf.readEntry("databasename","")); + } + else + { + widget->hostname->setText(""); + widget->username->setText(""); + widget->port->setText(i18n("default")); + widget->databasename->setText(""); + } + +} + +void KWQtSqlMailMergeOpen::fillSavedProperties() +{ + widget->savedProperties->clear(); + widget->savedProperties->insertItem(i18n("<not saved>")); + //Read data from configuration file and add entries + KConfig conf("kwmailmergerc"); + QStringList list=conf.groupList(); + for (QStringList::Iterator it=list.begin();it!=list.end();++it) + { + if ((*it).startsWith("KWSLQTDB:")) + widget->savedProperties->insertItem((*it).right((*it).length()-9)); + } +} + +void KWQtSqlMailMergeOpen::slotSave() +{ + QString value; + bool ok; + value=KLineEditDlg::getText(i18n("Store Settings"),i18n("Name:"), + QString::null, &ok,this); + if (!ok) kdDebug()<<"Cancel was pressed"<<endl; + if (value.isEmpty()) kdDebug()<<"Name value was empty"<<endl; + if ((ok) && (!value.isEmpty())) + { + KConfig conf("kwmailmergerc"); + conf.setGroup("KWSLQTDB:"+value); + conf.writeEntry("hostname",widget->hostname->text()); + conf.writeEntry("username",widget->username->text()); + conf.writeEntry("port",widget->port->text()); + conf.writeEntry("databasename",widget->databasename->text()); + conf.sync(); + fillSavedProperties(); + widget->savedProperties->setCurrentText(value); + } +} + +void KWQtSqlMailMergeOpen::handleOk() +{ + db->hostname=widget->hostname->text(); + db->username=widget->username->text(); + db->port=widget->port->text(); + db->databasename=widget->databasename->text(); + db->driver=widget->drivers->currentText(); +} diff --git a/kword/mailmerge/sql/KWQtSqlMailMergeOpen.h b/kword/mailmerge/sql/KWQtSqlMailMergeOpen.h new file mode 100644 index 00000000..66b3c329 --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlMailMergeOpen.h @@ -0,0 +1,57 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _SERIALLETTER_QtSql_OPEN_EDITOR_H_ +#define _SERIALLETTER_QtSql_OPEN_EDITOR_H_ + +#include <qdom.h> +#include <kdialogbase.h> +#include <qwidget.h> + +#include "KWMailMergeDataSource.h" +#include "KWQtSqlSerialDataSourceBase.h" +#include "qtsqlopenwidget.h" + +/****************************************************************** + * + * Class: KWQtSqlMailMergeOpen + * + ******************************************************************/ +class KWQtSqlMailMergeOpen : public KDialogBase +{ + Q_OBJECT + +public: + KWQtSqlMailMergeOpen( QWidget *parent, KWQtSqlSerialDataSourceBase *db_ ); + ~KWQtSqlMailMergeOpen(); +private: + KWQtSqlSerialDataSourceBase *db; + KWQtSqlOpenWidget *widget; + + void fillSavedProperties(); + +private slots: +void handleOk(); +public slots: +void savedPropertiesChanged(const QString&); +void slotSave(); +}; + +#endif + diff --git a/kword/mailmerge/sql/KWQtSqlPowerSerialDataSource.cpp b/kword/mailmerge/sql/KWQtSqlPowerSerialDataSource.cpp new file mode 100644 index 00000000..8f89274a --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlPowerSerialDataSource.cpp @@ -0,0 +1,256 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "KWQtSqlPowerSerialDataSource.h" +#include "KWQtSqlPowerSerialDataSource.moc" +#include "KWQtSqlMailMergeOpen.h" +#include <qlayout.h> +#include <qdom.h> +#include <kcombobox.h> +#include <klineedit.h> +#include <kpushbutton.h> +#include <qsqldatabase.h> +#include <qmessagebox.h> +#include <kpassdlg.h> +#include <qsqlrecord.h> +#include <qsqlcursor.h> +#include <qdatatable.h> +#include <kdebug.h> + +#define KWQtSqlBarIcon( x ) BarIcon( x, db->KWInstance() ) + +/****************************************************************** + * + * Class: KWQtSqlSerialDataSource + * + ******************************************************************/ + +KWQtSqlPowerSerialDataSource::KWQtSqlPowerSerialDataSource(KInstance *inst,QObject *parent) + : KWQtSqlSerialDataSourceBase(inst,parent),myquery(0) +{ + port=i18n("default"); +} + +KWQtSqlPowerSerialDataSource::~KWQtSqlPowerSerialDataSource() +{ + if (myquery) delete myquery; + QSqlDatabase::removeDatabase("KWQTSQLPOWER"); +} + +void KWQtSqlPowerSerialDataSource::refresh(bool force) +{ + if ((force) || (myquery==0)) + { + if (myquery) + { + delete myquery; + myquery=0; + } + QString tmp=query.upper(); + if (!tmp.startsWith("SELECT")) return; + if ((!database) || (!database->isOpen()))openDatabase(); + myquery=new KWMySqlCursor(query,true,database); + myquery->setMode(QSqlCursor::ReadOnly); + } + kdDebug()<<QString("There were %1 rows in the query").arg(myquery->size())<<endl; +} + +QString KWQtSqlPowerSerialDataSource::getValue( const QString &name, int record ) const +{ + int num=record; + + if (!myquery) return name; + if ( num < 0 || num > (int)myquery->size() ) + return name; + if (!myquery->seek(num,false)) return i18n(">>>Illegal position within datasource<<<"); + if (!myquery->contains(name)) return i18n(">>>Field %1 is unknown in the current database query<<<").arg(name); + return (myquery->value(name)).toString(); +} + +void KWQtSqlPowerSerialDataSource::save( QDomDocument &doc, QDomElement &parent) +{ + QDomElement def=doc.createElement(QString::fromLatin1("DEFINITION")); + parent.appendChild(def); + { + QDomElement defEnt=doc.createElement(QString::fromLatin1("DATABASE")); + defEnt.setAttribute(QString::fromLatin1("hostname"),hostname); + defEnt.setAttribute(QString::fromLatin1("port"),port); + defEnt.setAttribute(QString::fromLatin1("driver"),driver); + defEnt.setAttribute(QString::fromLatin1("databasename"),databasename); + defEnt.setAttribute(QString::fromLatin1("username"),username); + def.appendChild(defEnt); + + defEnt=doc.createElement(QString::fromLatin1("QUERY")); + defEnt.setAttribute(QString::fromLatin1("value"),query); + def.appendChild(defEnt); + + QDomElement sampleEnt=doc.createElement(QString::fromLatin1("SAMPLERECORD")); + parent.appendChild(sampleEnt); + for (DbRecord::Iterator it=sampleRecord.begin();it!=sampleRecord.end();++it) + { + QDomElement fieldEnt=doc.createElement(QString::fromLatin1("FIELD")); + fieldEnt.setAttribute(QString::fromLatin1("name"),it.key()); + sampleEnt.appendChild(fieldEnt); + } + } +} + +void KWQtSqlPowerSerialDataSource::load( QDomElement& parentElem ) +{ + clearSampleRecord(); + QDomNode defNd=parentElem.namedItem("DEFINITION"); + if (!defNd.isNull()) + { + QDomElement def=defNd.toElement(); + QDomNode dbNd=def.namedItem("DATABASE"); + if (!dbNd.isNull()) + { + QDomElement dbEnt=dbNd.toElement(); + if (dbEnt.tagName()==QString::fromLatin1("DATABASE")) + { + hostname=dbEnt.attribute(QString::fromLatin1("hostname")); + port=dbEnt.attribute(QString::fromLatin1("port")); + driver=dbEnt.attribute(QString::fromLatin1("driver")); + databasename=dbEnt.attribute(QString::fromLatin1("databasename")); + username=dbEnt.attribute(QString::fromLatin1("username")); + } + } + QDomNode queryNd=def.namedItem("QUERY"); + if (!queryNd.isNull()) + { + query=queryNd.toElement().attribute(QString::fromLatin1("value")); + } + } + + defNd=parentElem.namedItem("SAMPLERECORD"); + if (!defNd.isNull()) + { + QDomElement def1=defNd.toElement(); + for (QDomElement defEnt=defNd.firstChild().toElement();!defEnt.isNull();defEnt=defEnt.nextSibling().toElement()) + { + addSampleRecordEntry(defEnt.attribute(QString::fromLatin1("name"))); + } + } +} + +bool KWQtSqlPowerSerialDataSource::showConfigDialog(QWidget *par,int action) +{ + bool ret=false; + if (action==KWSLEdit) + { + if ((!database) || (!database->isOpen()))openDatabase(); + KWQtSqlPowerMailMergeEditor *dia=new KWQtSqlPowerMailMergeEditor(par,this); + ret=dia->exec(); + delete dia; + } + else ret=KWQtSqlSerialDataSourceBase::showConfigDialog(par,action); + return ret; +} + +void KWQtSqlPowerSerialDataSource::clearSampleRecord() {sampleRecord.clear();} + +void KWQtSqlPowerSerialDataSource::addSampleRecordEntry(QString name) +{sampleRecord[name]=name; }//i18n("No Value");} + + +/****************************************************************** + * + * Class: KWQtSqlMailMergeEditor + * + ******************************************************************/ + +KWQtSqlPowerMailMergeEditor::KWQtSqlPowerMailMergeEditor( QWidget *parent, KWQtSqlPowerSerialDataSource *db_ ) + :KDialogBase( Plain, i18n( "Mail Merge - Editor" ), Ok | Cancel, Ok, parent, "", true ), db( db_ ) +{ + (new QVBoxLayout(plainPage()))->setAutoAdd(true); + setMainWidget(widget=new KWQtSqlPowerWidget(plainPage())); + connect(widget->setup,SIGNAL(clicked()),this,SLOT(openSetup())); + connect(widget->tables,SIGNAL(currentChanged(QListBoxItem*)),this,SLOT(slotTableChanged(QListBoxItem*))); + connect(widget->execute,SIGNAL(clicked()),this,SLOT(slotExecute())); + connect(this,SIGNAL(okClicked()),this,SLOT(slotSetQuery())); + widget->query->setText(db->query); + updateDBViews(); +} + +void KWQtSqlPowerMailMergeEditor::slotSetQuery() +{ + db->query=widget->query->text(); + db->refresh(true); +} + +void KWQtSqlPowerMailMergeEditor::slotExecute() +{ + if (!db->database) if (!db->openDatabase()) return; + QString tmp=widget->query->text().upper(); + if (!tmp.startsWith("SELECT")) return; + KWMySqlCursor *cur=new KWMySqlCursor(widget->query->text(),true,db->database); + cur->setMode(QSqlCursor::ReadOnly); + + db->clearSampleRecord(); + kdDebug()<<QString("Fieldname count %1").arg(cur->count())<<endl; + for (uint i=0;i<cur->count();i++) + db->addSampleRecordEntry(cur->fieldName(i)); + + widget->queryresult->setSqlCursor(cur,true,true); + widget->queryresult->refresh(QDataTable::RefreshAll); +} + +void KWQtSqlPowerMailMergeEditor::slotTableChanged ( QListBoxItem * item ) +{ + widget->fields->clear(); + if (item) + { + if (!db->database) return; + QSqlRecord rec=db->database->record(item->text()); + for (uint i=0;i<rec.count();i++) + { + widget->fields->insertItem(rec.fieldName(i)); + } + } +} + +void KWQtSqlPowerMailMergeEditor::openSetup() +{ + KWQtSqlMailMergeOpen *dia=new KWQtSqlMailMergeOpen(this,db); + if (dia->exec()) + { + db->openDatabase(); + updateDBViews(); + } + delete dia; +} + + +void KWQtSqlPowerMailMergeEditor::updateDBViews() +{ + widget->fields->clear(); + widget->tables->clear(); + if (!db->database) return; + widget->tables->insertStringList(db->database->tables()); +} + +KWQtSqlPowerMailMergeEditor::~KWQtSqlPowerMailMergeEditor(){;} + + +extern "C" { + KWORD_MAILMERGE_EXPORT KWMailMergeDataSource *create_kwmailmerge_qtsqldb_power(KInstance *inst,QObject *parent) + { + return new KWQtSqlPowerSerialDataSource(inst,parent); + } +} diff --git a/kword/mailmerge/sql/KWQtSqlPowerSerialDataSource.h b/kword/mailmerge/sql/KWQtSqlPowerSerialDataSource.h new file mode 100644 index 00000000..d7587eea --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlPowerSerialDataSource.h @@ -0,0 +1,96 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _SERIALLETTER_QtSql_POWER_PLUGIN_H_ +#define _SERIALLETTER_QtSql_POWER_PLUGIN_H_ + +#include <qdom.h> +#include <klocale.h> +#include <kiconloader.h> +#include <kdialogbase.h> +#include <qsqldatabase.h> +/* FOR THE DIRTY HACK */ +#include <qsqlcursor.h> +#include <qsqldriver.h> +/* END FOR THE DIRTY HACK */ +#include <qguardedptr.h> + +#include "defs.h" +#include "KWMailMergeDataSource.h" +#include "KWQtSqlSerialDataSourceBase.h" +#include "kwqtsqlpower.h" +#include "KWMySqlCursor.h" + +/****************************************************************** + * + * Class: KWQtSqlSerialDataSource + * + ******************************************************************/ +class KWQtSqlPowerSerialDataSource: public KWQtSqlSerialDataSourceBase +{ + Q_OBJECT + public: + KWQtSqlPowerSerialDataSource(KInstance *inst,QObject *parent); + ~KWQtSqlPowerSerialDataSource(); + + virtual void save( QDomDocument &doc,QDomElement&); + virtual void load( QDomElement& elem ); + virtual class QString getValue( const class QString &name, int record = -1 ) const; + virtual int getNumRecords() const { + return (myquery?((myquery->size()<0)?0:myquery->size()):0); + } + virtual bool showConfigDialog(QWidget *,int); + virtual void refresh(bool force); + + protected: + friend class KWQtSqlPowerMailMergeEditor; + QString query; + KWMySqlCursor *myquery; + + void clearSampleRecord(); + void addSampleRecordEntry(QString name); + +}; + +/****************************************************************** + * + * Class: KWQtSqlPowerMailMergeEditor + * + ******************************************************************/ + +class KWQtSqlPowerMailMergeEditor : public KDialogBase +{ + Q_OBJECT + +public: + KWQtSqlPowerMailMergeEditor( QWidget *parent, KWQtSqlPowerSerialDataSource *db_ ); + ~KWQtSqlPowerMailMergeEditor(); +private: + KWQtSqlPowerSerialDataSource *db; + KWQtSqlPowerWidget *widget; +private slots: + void openSetup(); + void updateDBViews(); + void slotTableChanged ( QListBoxItem * item ); + void slotExecute(); + void slotSetQuery(); +}; + + +#endif diff --git a/kword/mailmerge/sql/KWQtSqlSerialDataSource.cpp b/kword/mailmerge/sql/KWQtSqlSerialDataSource.cpp new file mode 100644 index 00000000..8835bf49 --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlSerialDataSource.cpp @@ -0,0 +1,218 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "KWQtSqlSerialDataSource.h" +#include "KWQtSqlSerialDataSource.moc" +#include "KWQtSqlEasyFilter.h" + +#include <klocale.h> +#include <qlayout.h> +#include <qsqlcursor.h> +#include <qdatatable.h> +#include <qcheckbox.h> +#include <qsqlrecord.h> +#include <qsqlquery.h> +#include <kdebug.h> + +#define KWQtSqlBarIcon( x ) BarIcon( x, db->KWInstance() ) + +/****************************************************************** + * + * Class: KWQtSqlSerialDataSource + * + ******************************************************************/ + +KWQtSqlSerialDataSource::KWQtSqlSerialDataSource(KInstance *inst,QObject *parent) + : KWQtSqlSerialDataSourceBase(inst,parent) +{ + myquery=0; +} + +KWQtSqlSerialDataSource::~KWQtSqlSerialDataSource() +{ + delete myquery; + QSqlDatabase::removeDatabase("KWQTSQLPOWER"); +} + + +QString KWQtSqlSerialDataSource::getValue( const QString &name, int record ) const +{ + int num=record; + + if (!myquery) return name; + if ( num < 0 || num > (int)myquery->size() ) + return name; + if (!myquery->seek(num,false)) return i18n(">>>Illegal position within datasource<<<"); + if (!myquery->contains(name)) return i18n(">>>Field %1 is unknown in the current database query<<<").arg(name); + return (myquery->value(name)).toString(); +} + +void KWQtSqlSerialDataSource::save( QDomDocument & /*doc*/, QDomElement & /*parent*/) +{ +/* + QDomElement def=doc.createElement(QString::fromLatin1("DEFINITION")); + parent.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()); + def.appendChild(defEnt); + } + QDomElement cont=doc.createElement(QString::fromLatin1("CONTENT")); + parent.appendChild(cont); + for (Db::Iterator dbI=db.begin();dbI!=db.end();++dbI) + { + QDomElement rec=doc.createElement(QString::fromLatin1("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()]); + rec.appendChild(recEnt); + } + } +*/ +} + +void KWQtSqlSerialDataSource::load( QDomElement& /*parentElem*/ ) +{ +/* + db.clear(); + sampleRecord.clear(); + QDomNode defNd=parentElem.namedItem("DEFINITION"); + if (defNd.isNull()) return; + QDomElement def=defNd.toElement(); + for (QDomElement defEnt=def.firstChild().toElement();!defEnt.isNull();defEnt=defEnt.nextSibling().toElement()) + { + sampleRecord[defEnt.attribute(QString::fromLatin1("name"))]=defEnt.attribute(QString::fromLatin1("name"));//i18n( "No Value" ); + } + QDomNode contNd=parentElem.namedItem("CONTENT"); + if (contNd.isNull()) return; + for (QDomNode rec=contNd.firstChild();!rec.isNull();rec=rec.nextSibling()) + { + appendRecord(); + for (QDomElement recEnt=rec.firstChild().toElement();!recEnt.isNull();recEnt=recEnt.nextSibling().toElement()) + { + setValue(recEnt.attribute(QString::fromLatin1("name")), + recEnt.attribute(QString::fromLatin1("data")),db.count()-1); + } + } +*/ +} + +bool KWQtSqlSerialDataSource::showConfigDialog(QWidget *par,int action) +{ + bool ret=false; + if (action==KWSLEdit) + { + KWQtSqlDataSourceEditor *dia=new KWQtSqlDataSourceEditor(par,this); + ret=dia->exec(); + delete dia; + } + else ret=KWQtSqlSerialDataSourceBase::showConfigDialog(par,action); + + return ret; +} + +void KWQtSqlSerialDataSource::refresh(bool force) +{ + if ((force) || (myquery==0)) + { + if (myquery) + { + delete myquery; + myquery=0; + } + if ((!database) || (!database->isOpen())) openDatabase(); + if ((!database) || (!database->isOpen())) return; + myquery=new QSqlCursor(tableName,true,database); + myquery->setMode(QSqlCursor::ReadOnly); + myquery->select(filter); + } + kdDebug()<<QString("There were %1 rows in the query").arg(myquery->size())<<endl; + +} + + + + + +/****************************************************************** + * + * Class: KWQtSqlDataSourceEditor + * + ******************************************************************/ + + + +KWQtSqlDataSourceEditor::KWQtSqlDataSourceEditor( QWidget *parent, KWQtSqlSerialDataSource *db_ ) + :KDialogBase( Plain, i18n( "Mail Merge - Editor" ), Ok | Cancel, Ok, parent, "", true ), db( db_ ) +{ + tableName=db->tableName; + filter=db->filter; + (new QVBoxLayout(plainPage()))->setAutoAdd(true); + setMainWidget(widget=new QtSqlDataSourceEditor(plainPage())); + connect(widget->tableCombo,SIGNAL(activated(int)),this,SLOT(tableChanged(int))); + connect(widget->editFilter,SIGNAL(clicked()),this,SLOT(editFilter())); + updateTableCombo(); + +// connect(this,SIGNAL(okClicked()),this,SLOT(slotSetQuery())); +} + +void KWQtSqlDataSourceEditor::tableChanged(int item) +{ + tableName=widget->tableCombo->text(item); + QSqlCursor *tmpCursor=new QSqlCursor(tableName,true,db->database); + tmpCursor->setMode(QSqlCursor::ReadOnly); + + if (widget->filterCheckBox->isChecked()) tmpCursor->select(filter); + + widget->DataTable->setSqlCursor(tmpCursor,true,true); + widget->DataTable->refresh(QDataTable::RefreshAll); +} + +void KWQtSqlDataSourceEditor::updateTableCombo() +{ + widget->tableCombo->clear(); + if (!db->database) return; + widget->tableCombo->insertItem(""); + widget->tableCombo->insertStringList(db->database->tables()); +} + +void KWQtSqlDataSourceEditor::slotSetQuery() +{ + db->tableName=tableName; + db->filter=filter; + db->refresh(true); +} + + +void KWQtSqlDataSourceEditor::editFilter() +{ + KWQtSqlEasyFilter *f=new KWQtSqlEasyFilter(static_cast<QWidget*>(parent())); + f->exec(); +} + +extern "C" { + KWORD_MAILMERGE_EXPORT KWMailMergeDataSource *create_kwmailmerge_qtsqldb(KInstance *inst,QObject *parent) + { + return new KWQtSqlSerialDataSource(inst,parent); + } +} diff --git a/kword/mailmerge/sql/KWQtSqlSerialDataSource.h b/kword/mailmerge/sql/KWQtSqlSerialDataSource.h new file mode 100644 index 00000000..e2051a2f --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlSerialDataSource.h @@ -0,0 +1,85 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _SERIALLETTER_QtSql_PLUGIN_H_ +#define _SERIALLETTER_QtSql_PLUGIN_H_ + +#include <qdom.h> +#include <qsqlcursor.h> +#include "KWMailMergeDataSource.h" +#include "KWQtSqlSerialDataSourceBase.h" +#include "qtsqldatasourceeditor.h" + + +/****************************************************************** + * + * Class: KWQtSqlSerialDataSource + * + ******************************************************************/ + +class KWQtSqlSerialDataSource: public KWQtSqlSerialDataSourceBase +{ + public: + KWQtSqlSerialDataSource(KInstance *inst,QObject *parent); + ~KWQtSqlSerialDataSource(); + + virtual void save( QDomDocument &doc,QDomElement&); + virtual void load( QDomElement& elem ); + virtual class QString getValue( const class QString &name, int record = -1 ) const; + virtual int getNumRecords() const { + return (myquery?((myquery->size()<0)?0:myquery->size()):0); + } + virtual void refresh(bool); + virtual bool showConfigDialog(QWidget *,int); + + protected: + friend class KWQtSqlDataSourceEditor; + QString tableName; + QString filter; + QSqlCursor *myquery; +}; + +/****************************************************************** + * + * Class: KWQtSqlDataSourceEditor + * + ******************************************************************/ + +class KWQtSqlDataSourceEditor : public KDialogBase +{ + Q_OBJECT + +public: + KWQtSqlDataSourceEditor( QWidget *parent, KWQtSqlSerialDataSource *db_ ); + ~KWQtSqlDataSourceEditor(){;} +private: + KWQtSqlSerialDataSource *db; + QtSqlDataSourceEditor *widget; + void updateTableCombo(); + QString filter; + QString tableName; + +private slots: + void tableChanged(int); + void slotSetQuery(); + void editFilter(); +}; + + +#endif diff --git a/kword/mailmerge/sql/KWQtSqlSerialDataSourceBase.cpp b/kword/mailmerge/sql/KWQtSqlSerialDataSourceBase.cpp new file mode 100644 index 00000000..781c1ab5 --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlSerialDataSourceBase.cpp @@ -0,0 +1,105 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "KWQtSqlSerialDataSourceBase.h" +#include "KWQtSqlSerialDataSourceBase.moc" +#include "KWQtSqlMailMergeOpen.h" +#include <qlayout.h> +#include <qdom.h> +#include <kcombobox.h> +#include <klineedit.h> +#include <kpushbutton.h> +#include <qsqldatabase.h> +#include <qmessagebox.h> +#include <kpassdlg.h> +#include <qsqlrecord.h> +#include <qsqlcursor.h> +#include <qdatatable.h> +#include <kdebug.h> +#include <klocale.h> +#include <kiconloader.h> + + + + +/****************************************************************** + * + * Class: KWQtSqlSerialDataSourceBase + * + ******************************************************************/ + +int KWQtSqlSerialDataSourceBase::connectionId=0; + +KWQtSqlSerialDataSourceBase::KWQtSqlSerialDataSourceBase(KInstance *inst,QObject *parent) + : KWMailMergeDataSource(inst,parent) +{ + DataBaseConnection=QString("KWQTSQLPOWER")+parent->name()+QString("--%1").arg(connectionId++); + port=i18n("default"); +} + +KWQtSqlSerialDataSourceBase::~KWQtSqlSerialDataSourceBase() +{ + QSqlDatabase::removeDatabase(DataBaseConnection); +} + + +bool KWQtSqlSerialDataSourceBase::showConfigDialog(QWidget *par,int action) +{ + bool ret=false; + if (action==KWSLOpen) + { + KWQtSqlMailMergeOpen *dia=new KWQtSqlMailMergeOpen(par,this); + + ret=dia->exec(); + if (ret) openDatabase(); + delete dia; + } + return ret; +} + +bool KWQtSqlSerialDataSourceBase::openDatabase() +{ + QCString pwd; + QSqlDatabase::removeDatabase(DataBaseConnection); + database=QSqlDatabase::addDatabase(driver,DataBaseConnection); + if (database) + { + if (database->lastError().type()!=QSqlError::None) + { + QMessageBox::critical(0,i18n("Error"),database->lastError().databaseText(),QMessageBox::Abort,QMessageBox::NoButton,QMessageBox::NoButton); + return false; + } + database->setDatabaseName(databasename); + database->setUserName(username); + database->setHostName(hostname); + if ((port!=i18n("default"))&& (!port.isEmpty())) + database->setPort(port.toInt()); + + if (KPasswordDialog::getPassword(pwd, i18n("Please enter the password for the database connection")) + == KPasswordDialog::Accepted) database->setPassword(pwd); + if (database->open()) + { + return true; + } + QMessageBox::critical(0,i18n("Error"),database->lastError().databaseText(),QMessageBox::Abort,QMessageBox::NoButton,QMessageBox::NoButton); + return false; + } + QMessageBox::critical(0,i18n("Error"),i18n("Unable to create database object"),QMessageBox::Abort,QMessageBox::NoButton,QMessageBox::NoButton); + return false; +} diff --git a/kword/mailmerge/sql/KWQtSqlSerialDataSourceBase.h b/kword/mailmerge/sql/KWQtSqlSerialDataSourceBase.h new file mode 100644 index 00000000..0e4586c3 --- /dev/null +++ b/kword/mailmerge/sql/KWQtSqlSerialDataSourceBase.h @@ -0,0 +1,63 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef _SERIALLETTER_QtSql_BASE_H_ +#define _SERIALLETTER_QtSql_BASE_H_ + +#include <qdom.h> +#include <kdialogbase.h> +#include <qsqldatabase.h> +#include <qguardedptr.h> + +#include "KWMailMergeDataSource.h" +#include "qtsqlopenwidget.h" + + + +/****************************************************************** + * + * Class: KWQtSqlSerialDataSourceBase + * + ******************************************************************/ +class KWQtSqlSerialDataSourceBase: public KWMailMergeDataSource +{ + Q_OBJECT + K_DCOP + public: + KWQtSqlSerialDataSourceBase(KInstance *inst,QObject *parent); + ~KWQtSqlSerialDataSourceBase(); + + virtual bool showConfigDialog(QWidget *par,int action); + + protected: + friend class KWQtSqlMailMergeOpen; + QString hostname; + QString username; + QString driver; + QString port; + QString databasename; + QGuardedPtr<QSqlDatabase> database; + QString DataBaseConnection; + static int connectionId; + k_dcop: + bool openDatabase(); + +}; + +#endif diff --git a/kword/mailmerge/sql/Makefile.am b/kword/mailmerge/sql/Makefile.am new file mode 100644 index 00000000..0c8595e0 --- /dev/null +++ b/kword/mailmerge/sql/Makefile.am @@ -0,0 +1,28 @@ +AM_CPPFLAGS = $(KOFFICE_INCLUDES) -I$(top_srcdir)/lib/kformula \ + $(KOTEXT_INCLUDES) -I$(top_srcdir)/kword $(all_includes) + +kde_module_LTLIBRARIES = kwmailmerge_qtsqldb.la kwmailmerge_qtsqldb_power.la + +## Plugin encapsulating the QT SQL database interface +kwmailmerge_qtsqldb_la_SOURCES = KWQtSqlSerialDataSource.cpp qtsqldatasourceeditor.ui \ + KWQtSqlEasyFilter.cpp +kwmailmerge_qtsqldb_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kwmailmerge_qtsqldb_la_LIBADD = libmailmergesqlcommon.la ../../libkwmailmerge_interface.la $(LIB_KDEUI) +kwmailmerge_qtsqldb_la_COMPILE_FIRST = qtsqlopenwidget.h + +## 2. Plugin encapsulating the QT SQL database interface +kwmailmerge_qtsqldb_power_la_SOURCES = KWQtSqlPowerSerialDataSource.cpp kwqtsqlpower.ui KWQtSqlPowerSerialDataSource.skel +kwmailmerge_qtsqldb_power_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +kwmailmerge_qtsqldb_power_la_LIBADD = libmailmergesqlcommon.la ../../libkwmailmerge_interface.la $(LIB_KDEUI) +kwmailmerge_qtsqldb_power_la_COMPILE_FIRST = qtsqlopenwidget.h + +# Common files +noinst_LTLIBRARIES = libmailmergesqlcommon.la +libmailmergesqlcommon_la_SOURCES = KWQtSqlMailMergeOpen.cpp KWQtSqlSerialDataSourceBase.skel qtsqlopenwidget.ui KWQtSqlSerialDataSourceBase.cpp + +METASOURCES = AUTO + +#services_DATA=kwserialletter_qtsqldb.desktop kwserialletter_qtsqldb_power.desktop +services_DATA=kwserialletter_qtsqldb_power.desktop +servicesdir=$(kde_servicesdir) + diff --git a/kword/mailmerge/sql/kwqtsqlpower.ui b/kword/mailmerge/sql/kwqtsqlpower.ui new file mode 100644 index 00000000..4979166e --- /dev/null +++ b/kword/mailmerge/sql/kwqtsqlpower.ui @@ -0,0 +1,233 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KWQtSqlPowerWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KWQtSqlPowerWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>545</width> + <height>403</height> + </rect> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox3</cstring> + </property> + <property name="title"> + <string>Information</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KListBox" row="1" column="1"> + <property name="name"> + <cstring>fields</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>120</height> + </size> + </property> + </widget> + <widget class="KListBox" row="1" column="0"> + <property name="name"> + <cstring>tables</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>120</height> + </size> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_2</cstring> + </property> + <property name="text"> + <string>&Available tables:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>tables</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>&Fields of the selected table:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>fields</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox6</cstring> + </property> + <property name="title"> + <string>Query Result</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QDataTable"> + <property name="name"> + <cstring>queryresult</cstring> + </property> + <property name="rowMovingEnabled"> + <bool>false</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>&Query:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>query</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>query</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>300</width> + <height>0</height> + </size> + </property> + <property name="lineWidth"> + <number>2</number> + </property> + <property name="frame"> + <bool>true</bool> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>execute</cstring> + </property> + <property name="text"> + <string>&Execute</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>Line2</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="frameShape"> + <enum>VLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>setup</cstring> + </property> + <property name="text"> + <string>&Setup</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<includes> + <include location="global" impldecl="in declaration">klineedit.h</include> + <include location="global" impldecl="in declaration">klistbox.h</include> + <include location="global" impldecl="in declaration">kpushbutton.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kword/mailmerge/sql/kwserialletter_qtsqldb.desktop b/kword/mailmerge/sql/kwserialletter_qtsqldb.desktop new file mode 100644 index 00000000..3b06c655 --- /dev/null +++ b/kword/mailmerge/sql/kwserialletter_qtsqldb.desktop @@ -0,0 +1,106 @@ +[Desktop Entry] +Type=Service +ServiceTypes=KWord/MailMergePlugin + +Name=Qt-SQL Source (single table) +Name[bg]=Източник Qt-SQL (една таблица) +Name[ca]=Font Qt-SQL (taula única) +Name[cy]=Ffynhonell Qt-SQL (tabl sengl) +Name[da]=Qt-SQL-kilde (enkelt tabel) +Name[de]=Qt-SQL (Einzeltabelle) +Name[el]=Πηγή Qt-SQL (απλός πίνακας) +Name[eo]=Qt-SQL-fonto (sola tabelo) +Name[es]=Fuente Qt-SQL (una sola tabla) +Name[et]=Qt-SQL allikas (üksik tabel) +Name[eu]=Qt-SQL iturburua (taula bakarra) +Name[fa]=متن Qt-SQL )جدول تک ( +Name[fi]=Qt-SQL lähde (ykai taulu) +Name[fr]=Source Qt-SQL (table simple) +Name[fy]=Qt-SQL-boarne (inkelfâldige tabel) +Name[gl]=Fonte de Qt-SQL (táboa única) +Name[he]=מקור Qt-SQL (טבלה בודדת) +Name[hr]=Qt-SQL izvor (jedna tablica) +Name[hu]=Qt-SQL adatforrás (egy tábla) +Name[is]=QT-SQL ská (ein tafla) +Name[it]=Fonte Qt-SQL (tabella singola) +Name[ja]=Qt-SQL ソース (シングルテーブル) +Name[km]=ប្រភព Qt-SQL (តារាងតែមួយ) +Name[lv]=Qt-SQL avots (viena tabula) +Name[ms]=Sumber Qt-SQL (jadual tunggal) +Name[nb]=Qt-SQL-kilde (en tabell) +Name[nds]=Qt-SQL-Born (Enkeltabell) +Name[ne]=Qt-SQL स्रोत (एकल तालिका) +Name[nl]=Qt-SQL-bron (enkelvoudige tabel) +Name[nn]=Qt-SQL-kjelde (enkel tabell) +Name[pl]=Źródło Qt-SQL (pojedyncza tabela) +Name[pt]=Fonte do Qt-SQL (tabela única) +Name[pt_BR]=Qt-SQL (tabela única) +Name[ru]=Исходный текст Qt-SQL (одна таблица) +Name[se]=Qt-SQL-gáldu (oktageardanis tabealla) +Name[sk]=Qt-SQL zdroj (jedna tabuľka) +Name[sl]=Vir Qt-SQL (enojna tabela) +Name[sr]=Qt-SQL извор (једна табела) +Name[sr@Latn]=Qt-SQL izvor (jedna tabela) +Name[sv]=QT-SQL-källa (enkel tabell) +Name[uk]=Джерело Qt-SQL (одна таблиця) +Name[uz]=Qt-SQL manbasi (bitta jadval) +Name[uz@cyrillic]=Qt-SQL манбаси (битта жадвал) +Name[zh_CN]=Qt-SQL 源(单表) +Name[zh_TW]=Qt-SQL 來源 (單一表格) +Comment=This datasource type lets you use SQL database tables stored on a SQL Server. Depending on your system configuration, MySQL, PostgreSQL and UnixODBC are among the supported database backends. There might even be more (Oracle in commercial Qt versions or 3rd party backends). +Comment[ar]=هذا النّوع من المصادر البيانيّة يتيح لك إمكانية استخدام جداول قاعدة بيانيّة SQL مُخَزَّنة على خادم SQL. بحسب تهيئة نظامك، فإنّ MySQL، PostgreSQL و UnixODBC تُعتبر من بين ما هو مدعوم من وُجهات خلفيّة للقواعد البيانيّة. يمكن حتى أن يتواجد المزيد (Oracle في إصدارات Qt التِّجاريّة أو الوُجهات الخلفيّة المملوكة لطرف ثالث). +Comment[az]=Bu mənbə sizə SQL verilənlər bazasını istifadə etməyə imkan verir. Sistem qurğularınızdan asılı olaraq : MySQL,Postgres,(Oracle, lisenziyalı QT buraxılışını işlədirsinizsə),.... +Comment[bg]=Този източник на данни използва таблица за съхранение на данните в СУБД (сървър SQL). В зависимост от настройките, поддръжка имат MySQL, PostgreSQL и UnixODBC. Може да има и още (Oracle в комерсиалните версии на Qt или други). +Comment[bs]=Ovaj tip izvora podataka vam omogućuje da koristiti SQL tabele smještene na SQL serveru. Ovisno o konfiguraciji vašeg sistema, MySQL, PostgreSQL i UnixODBC su među podržanim bazama podataka. Možda čak i više od toga (Oracle u komercijalnim verzijama Qt-a ili backendima iz trećeg izvora). +Comment[ca]=Aquest tipus de font de dades permet usar una base de dades SQL guardada a un servidor SQL. Depenent de la configuració del sistema, MySQL, PostgreSQL i UnixODBC estan entre les bases de dades permeses. Inclús n'hi poden haver més(Oracle comercial a la versió Qt i d'altres servidors). +Comment[cs]=Tento zdroj dat vám umožní požívat tabulky SQL databází uložených na SQL serveru. V závislosti na vašem nastavení systému jsou podporovány databázové systémy MySQL, PostgreSQL a UnixODBC (Oracle je podporována v komerční verzi Qt nebo v databázových systémech jiných výrobců). +Comment[cy]=Mae'r math yma o ffynhonnell ddata yn eich galluogi i ddefnyddio tablau cronfa ddata SQL sydd wedi eu storio ar weinydd SQL. Yn dibynnu ar ffurfweddiad eich system, mae MySQL, PostgreSQL a UnixODBC ymysg y cronfeydd data cefndirol a gynhelir. Efallai bod mwy ohonynt (Oracle mewn fersiynau masnachol Qt neu ôl-wynebau 3ydd blaid). +Comment[da]=Denne datakildetype lader dig bruge SQL-databasetabeller gemt på en SQL-server. Afhængig af dine systemindstillinger er MySQL, PostgreSQL og UnixODBC blandt de understøttede underliggende databaser. Der er måske endda flere (Oracle i kommercielle Qt-versioner eller underliggende programmer fra tredjepartsudviklere). +Comment[de]= Mit diesem Datenquellentyp können Sie Tabellen von SQL-Datenbanken verwenden, die sich auf einem SQL-Server befinden. Abhängig von der Systemeinrichtung: MySQL, PostgresSQL oder UnixODBC. Möglicherweise sogar weitere (etwa Oracle bei einer kommerziellen QT-Version oder Paketen von Drittanbietern). +Comment[el]=Αυτός ο τύπος πηγής δεδομένων σας επιτρέπει να χρησιμοποιείτε πίνακες βάσεων δεδομένων SQL αποθηκευμένες σε έναν εξυπηρετητή SQL. Ανάλογα με τη ρύθμιση του συστήματος σας, οι MySQL, PostgreSQL και UnixODBC είναι μέσα στις υποστηριζόμενες βάσεις δεδομένων. Μπορεί να υπάρχουν και περισσότερες (Η Oracle σε εμπορικές εκδόσεις της Qt ή άλλες τρίτων κατασκευαστών). +Comment[eo]=Tiu datumfonta tipo permesas uzi SQL-datumbazan tabelon en SQL-servilo. Depende de la konfiguraĵo de via sistemo estas subtenataj MySQL, PostgreSQL kaj UnixODBC. Povas esti pliaj (Orakolo en komercaj Qt-versioj aŭ triapartiaj datumbazajinterfacoj). +Comment[es]=Este tipo de fuente de datos le permite utilizar tablas de bases de datos almacenadas en un servidor SQL. Dependiendo de la configuración de su sistema, MySQL, PostgreSQL, y UnixODBC están entre los interfaces de bases de datos soportados. Puede que haya incluso más (Oracle, si utiliza una versión de QT con licencia o interfaces de terceras partes). +Comment[et]=See andmeallika tüüp lubab kasutada SQL-andmebaasi tabeleid, mida hoitakse SQL-serveris. Sõltuvalt süsteemi seadistustest on MySQL, PostgreSQL ja UnixODBC toetatud andmebaasisüsteemide hulgas. Neid võib olla isegi rohkem (Oracle kommertslikes Qt versioonides või kolmandate osapoolte mootorites). +Comment[eu]=Datu-iturburu honek SQL zerbitzari batean gordetako SQL datu-baseko taulak erabiltzeko aukera ematen dizu. Zure sistemaren konfigurazioaren arabera, MySQL, PostgreSQL eta UnixODBC euskarriak onartzen dira. Gehiago ere egon daitezke (Oracle (Qt-ren bertsio komertzialetan) edo hirugarrenen beste euskarri batzuk). +Comment[fa]=این نوع متن داده به شما اجازۀ استفاده از جدولهای دادگان SQL ذخیرهشده در یک کارساز SQL را میدهد. بسته به پیکربندی سیستمتان، MySQL، PostgreSQL و UnixODBC، در میان پایانههای دادگان پشتیبانیشده میباشند. حتی ممکن است بیشتر باشند )Oracle در نسخههای تجاری Qt یا پایانههای گروه 3rd(. +Comment[fi]=Tämä tietolähde käyttää SQL-tietokantojen tauluja. Riippuen järjestelmäsi asetuksista tuetaan MySQL, Postgres ja UnixODBC -tietokantoja. Kantoja voi myös olla enemmän (Oracle, jos omistat kaupallisen version QT:sta). +Comment[fr]=Ce type de source de données vous permet d'utiliser des tables de base de données SQL stockées sur un serveur SQL. Selon votre configuration, ces tables peuvent venir de MySQL, PostgreSQL et UnixODBC, et d'autres encore (comme Oracle, si vous avez la licence commerciale de Qt, par exemple). +Comment[fy]=Mei dit type gegevensboarne kinne jo SQL-databanktabellen dy bewarre binne op in SQL-tsjinner brûke. Ofhinklik fan jo systeemkonfiguraasje hearre MySQL, PostgreSQL en UnixOBC ta de stipe backends. Der binne mooglik mear (bgl. Oracle yn de kommersje Qt-ferzjes fan backends fan tredden). +Comment[gl]=Este tipo de fonte de datos permítelle usar as táboas de base de datos armacenadas nun servidor de SQL. Dependendo da configuración do seu sistema, MySQL, PostgreSQL e UnixODBC encóntranse entre os sistemas soportados. Poden até existir máis (Oracle nas versións comerciais de Qt ou mesmo sistemas de terceiros). +Comment[he]=טיפוס מקור נתונים זה מאפשר לך להשתמש בטבלאות של מסדי נתונים של SQL שמאוחסנות בשרת SQL. בין ממשקי מסדי הנתונים הנתמכים ניתן למנות את MySQL ,PostgreSQL ו־UnixODBC (התמיכה תלויה בהגדרות המערכת שלך). עשויים להיות אף ממשקים נתמכים נוספים, כמו Oracle בגירסאות מסחריות של Qt או ממשקי צד שלישי. +Comment[hu]=Ez az adatforrástípus SQL-kiszolgálón tárolt SQL táblák elérését teszi lehetővé. A rendszer konfigurációjától függően MySQL, PostgreSQL és UnixODBC adatbázistípust lehet választani. Ezeken felül még más is előfordulhat (pl. Oracle a Qt fizetős változatában). +Comment[is]=Þessi tegund gerir þér kleyft að nota SQL gagnagrunnstöflur sem liggja á SQL þjóni. MySQL, PostgreSQL og UnixODBC eru meðal studdra gagnagrunnsbakenda, háð kerfisuppsetningu þinni. Það gætu jafnvel verið fleiri (Oracle í verslunarútgáfu Qt eða þriðja aðila bakendar). +Comment[it]=Questa fonte di dati permette di usare le tabelle di banche dati SQL memorizzate in un server SQL. A seconda della configurazione del tuo sistema, MySQL, PostgreSQL e UnixODBC potrebbero essere alcune delle banche dati supportate. Potrebbero essere supportate anche altre banche dati (Oracle nelle versioni commerciali di Qt o moduli di terze parti). +Comment[ja]=このデータソースタイプは SQL サーバに保存されている SQL データベーステーブルを使用します。システム設定によりますが、MySQL, PostgreSQL, UnixODBC がサポートされているデータベース バックエンドです。他のものも使用可能かもしれません (Qt の商用バージョンでの Oracle や、サードパーティのバックエンドなど)。 +Comment[km]=ប្រភេទប្រភពទិន្នន័យនេះអនុញ្ញាតឲ្យអ្នកប្រើតារាងមូលដ្ឋានទិន្នន័យ SQL ដែលបានរក្សាលើម៉ាស៊ីនបម្រើ SQL ។ ការពឹងផ្អែកលើការកំណត់រចនាសម្ព័ន្ធប្រព័ន្ធរបស់អ្នក MySQL, PostgreSQL និង UnixODBC គឺក្នុងចំណោមមូលដ្ឋានទិន្នន័យខាងក្រោយដែលបានគាំទ្រ ។ ប្រហែលជាមានច្រើន (Oracle ក្នុងកំណែពាណិជ្ជកម្ម Qt ឬ ភាគីខាងក្រោយទីបី) ។ +Comment[lt]=Šis duomenų šaltinio tipas leidžia jums naudoti SQL duombazės lenteles išsaugotas SQL serveryje. Priklausomai nuo jūsų sistemos konfigūracijos MySQL, PostgreSQL ir UnixODBC yra tarp palaikomų duombazių tipų. Jų gali būti ir daugiau (Oracle komercinėse Qt versijose ar trečių šalių duombazių tipai). +Comment[lv]=Šis datu avota tips ļauj jums izmantot SQL datubāzes tabulas, kas glabājas uz SQL servera. Atkarībā no jūsu sistēmas konfigurācijas: MySQL,PostgreSQL un UnixODBC ir starp atbalstītajām datubāzēm. Šeit var būt arī vairāk (Oracle, ja jūs izmantojiet komerciālu QT versiju vai trešo pušu risinājumus). +Comment[ms]=Jenis sumber data ini membenarkan anda menggunakan jadual pangkalan data SQL yang distor dalam Pelayan SQL. Bergantung kepada konfigurasi sistem anda, MySQL, PostgreSQL dan UnixODBC antara bahagian belakang pangkalan data yang disokong. Mungkin terdapat lebih banyak lagi pilihan (Oracle dalam versi Qt komersil atau bahagian belakang pihak ketiga). +Comment[mt]=Dan it-tip ta' sors iħallik tuża tabelli minn databases SQL fuq server SQL. Skond il-konfigurazzjoni tas-sistema tiegħek, jista' jkollok MySQL, PostgreSQL jew UnixODBC bħala sistemi sapportiti, u jista' jkun hemm oħrajn (Oracle fuq verżjonijiet kummerċjali ta' Qt jew oħrajn ta' terzi partiti). +Comment[nb]=Datakilden lar deg bruke en databasetabell lagret på en SQL-tjener. Avhengig av oppsettet støttes databasetjenere som MySQL, PostgreSQL og UnixODBC. I tillegg finnes støtte for flere system (som Oracle i den kommersielle QT-utgaven eller tredjepartsystem). +Comment[nds]= Mit dissen Datenborntyp laat sik SQL-Datenbanken vun en SQL-Server bruken. Afhängig vun Dien Systeeminstellen warrt Datenbankplegers för MySQL, PostgresSQL un UnixODBC ünnerstütt. Villicht ok mehr (t.B. Oracle in en warflich Qt-Verschoon oder Plegers vun anner Anbeders). +Comment[ne]=यो डेटासंसाधन प्रकारले तपाईंलाई एसक्यूएल सर्भरमा संग्रह भएको एसक्यूएल डाटाबेस प्रयोग गर्न दिन्छ ।तपाईंको प्रणाली कन्फिगरेसनमा, माइएसक्यूएल, पोस्टग्रेएसक्यूएल र युनीक्सओडीबीसी भर परेर जुन समर्थित डाटाबेस ब्याकेन्डहरू हुन् । त्यहाँ पक्कै पनि अझ बढी (व्यापारिक क्यूटी संस्करणहरू वा तेस्रो पार्टीको ब्याकेन्डमा आकाशवाणी हुन्छन्) +Comment[nl]=Met dit type gegevensbron kunt u SQL-databasetabellen die zijn opgeslagen op een SQL-server gebruiken. Afhankelijk van uw systeemconfiguratie behoren MySQL, PostgreSQL en UnixOBC tot de ondersteunde backends. Er zijn er mogelijk meer (bijv. Oracle in de commerciële Qt-versies of backends van derden). +Comment[nn]=Med denne datakjeldetypen kan du bruka SQL-databasetabellar lagra på ein SQL-tenar. Avhengig av systemoppsettet kan du bruka MySQL, PostgreSQL og UnixODBC. Det finst kanskje til og med fleire. (Oracle i kommersielle Qt-versjonar eller tredjepartstillegg.) +Comment[pl]=To źródło danych pozwala na przechowywanie tabel w bazach danych na serwerze SQL. W zależności od konfiguracji systemu: MySQL, PostgreSQL oraz UnixODBC są obsługiwane. Oczywiście może ich być więcej, np. Oracle w komercyjnej wersji Qt lub poprzez rozszerzenia innych firm. +Comment[pt]=Este tipo de fonte de dados permite-lhe usar as tabelas de base de dados armazenadas num servidor de SQL. Dependendo da configuração do seu sistema, o MySQL, o PostgreSQL e o UnixODBC encontram-se entre os sistemas suportados. Podem até existir mais (o Oracle nas versões comerciais do Qt ou mesmo sistemas de terceiros). +Comment[pt_BR]=Esta fonte de dados deixa você usar as tabelas do banco de dados SQL em seu Servidor SQL. Dependendo da configuração do seu sistema, MySQL, PostgreSQL e Unix ODBC estão entre os bancos de dados suportados. Podem existir outros (o Oracle em versões comerciais da Qt). +Comment[ro]=Acest tip de sursă de date vă permite să utilizaţi tabelele SQL dintr-o bază de date a unui server SQL. În funcţie de configuraţia sistemului dumneavoastră aveţi acces la subsistemul MySQL, PostgreSQL şi UnixODBC. S-ar putea să existe chiar şi mai multe(Oracle în versiunile comerciale Qt sau subsisteme terţe). +Comment[ru]=Этот тип данных позволит вам использовать таблицы на сервере баз данных. В зависимости от наличия в системе поддерживаются MySQL, PostgreSQL и UnixODBC. Помимо этого могут быть доступны Oracle в коммерческом Qt и прочие драйвера к базам данным от сторонних производителей +Comment[se]=Dáinna diehtogáldošlájain sáhtát geavahit SQL-diehtovuođuid SQL-bálvás. MySQL, PostgreSQL ja UnixODBC leat dorjojuvvon diehtovuođđoduogážat. Dáidá gávdnot vel eanet, omd. Oracle kommersiealla QT-veršuvnnain dahje eará moduvllain. +Comment[sk]=Tento zdroj dát umožňuje používať databázové tabuľky SQL. Podporované databáze sú MySQL, PostgreSQL, UnixODBC. (Prípadne aj Oracle, ak máte licencovanú verziu Qt alebo databáze iných výrobcov),... +Comment[sl]=Ta tip vira podatkov vam omogoča uporabo zbirke tabel SQL, ki so shranjene na strežniku SQL. Glede na vašo konfiguracijo sistema so podprte med drugim zbirke MySQL, PostgreSQL in UnixODBC. Mogoče bodo tudi druge (Oracle v komercialnih različicah Qt ali podpore tretjih strani). +Comment[sr]=Овај тип извора података вам омогућава да користите табеле из SQL базе података која се налази на SQL серверу. У зависности од подешавања вашег рачунара, MySQL, PostgreSQL и UnixODBC се налазе међу подржаним приступима бази. Могуће је да постоје и додатни приступи (Oracle у комерцијалним Qt верзијама итд.) +Comment[sr@Latn]=Ovaj tip izvora podataka vam omogućava da koristite tabele iz SQL baze podataka koja se nalazi na SQL serveru. U zavisnosti od podešavanja vašeg računara, MySQL, PostgreSQL i UnixODBC se nalaze među podržanim pristupima bazi. Moguće je da postoje i dodatni pristupi (Oracle u komercijalnim Qt verzijama itd.) +Comment[sv]=Den här typen av datakälla låter dig använda SQL-databastabeller lagrade på en SQL-server. Beroende på systeminställningarna finns MySQL, Postgres och UnixODBC bland de databaser som stöds. Det kan till och med finnas ännu fler (Oracle, om du använder en licensierad version av QT eller tredjepartsdatabaser). +Comment[tg]=Ин намуди манбаъи маълумот ба шумо имкони истифодаи SQL асоси маълумот мизҳои дар Сервери SQL ҷойгир шуда.Аз шакли системаи шумо вобастааст, MySQL,PostSQL ва UnixODBC дар мобайни асоси маълумот дар анҷом.Дар он ҷо мумкин,ки бошад(Oracle дар коммерсияи Qt тафсир ё 3-ум қисми анҷом). +Comment[tr]=Bu verikaynağı tipi bir SQL sunucusundaki SQL veritabanı tablolarını kullanmanıza izin verir.Sistem ayarlarınıza bağlı olarak MySQL, PostgreSQL ve UnixODBC desteklenen veritabanları arasındadır. Daha fazlası da olabilir. (Ticari Qt sürümlerindeki Oracle veya 3. şahıs veritabanları) +Comment[uk]=Цей тип джерела даних дозволяє вам використовувати таблиці баз даних в серверах SQL. Відповідно до конфігурації вашої системи, підтримуються MySQL, PostgreSQL та UnixODBC. Можливо підтримуються і інші сервери БД (Oracle в комерційній поставці Qt або сервери сторонніх компаній). +Comment[xh]=Uhlobo lwe mvelaphi ye data ikuvumela ukuba usebenzise iitafile zesiseko sedata ze SQL ezigcinwe Kumncedisi we SQL.Kuxhomekeke kuqwalaselo lwendlela yokusebenza, I SQL yam, PostgreSQL ne UnixODBC zikunye neziphelo zesiseko sedata esixhasiweyo. Kusenokuba nezingaphezulu (I Oracle ekwi thengiso lwenguqulelo ye QT okanye iziphelo zomntu wesithathu). +Comment[zh_CN]=此数据库类型允许您使用存储于 SQL 服务器的 SQL 数据库表。根据您的系统配置不同,MySQL、PostgreSQL 和 UnixODBC 都是支持的后端数据库。可能还有更多(Qt 商业版中附带 Oracle 支持,或使用第三方后端)。 +Comment[zh_TW]=這個資料來源類別讓你使用在一個 SQL 伺服器上面的 SQL 資料表格。根據你的系統設定,MySQL、PostgreSQL 與 UnixODBC 都在支援之列。還會有更多(例如在商業版本的 QT 或是第三廠商提供相關支援)。 + +X-KDE-Library=kwmailmerge_qtsqldb +X-KDE-Capabilities=edit,open +X-KDE-InternalName=QtSqlEasy +X-KDE-PluginVersion=1 diff --git a/kword/mailmerge/sql/kwserialletter_qtsqldb_power.desktop b/kword/mailmerge/sql/kwserialletter_qtsqldb_power.desktop new file mode 100644 index 00000000..7f45df9b --- /dev/null +++ b/kword/mailmerge/sql/kwserialletter_qtsqldb_power.desktop @@ -0,0 +1,107 @@ +[Desktop Entry] +Type=Service +ServiceTypes=KWord/MailMergePlugin + +Name=Qt-SQL Source (power user) +Name[bg]=Източник Qt-SQL (за напреднали) +Name[ca]=Font Qt-SQL (usuari expert) +Name[cs]=Qt-SQL zdroj (pokročilé) +Name[cy]=Ffynhonell Qt-SQL (defnyddiwr medrus) +Name[da]=Qt-SQL-kilde (avanceret bruger) +Name[de]=Qt-SQL (für fortgeschrittene Benutzer) +Name[el]=Πηγή Qt-SQL (προχωρημένου χρήστη) +Name[eo]=Qt-SQL-fonto (sperta uzanto) +Name[es]=Fuente Qt-SQL (usuario avanzado) +Name[et]=Qt-SQL allikas (nõudlikule kasutajale) +Name[eu]=Qt-SQL iturburua (erabiltzaile aurreratua) +Name[fa]=متن Qt-SQL )کاربر توان( +Name[fi]=Qt-SQL-lähde (tehokäyttäjä) +Name[fr]=Source Qt-SQL (utilisateur expérimenté) +Name[fy]=QT-SQL-boarne (avansearre brûkers) +Name[gl]=Fonte de Qt-SQL (administración) +Name[he]=מקור של Qt-SQL (משתמש מיומן) +Name[hi]=क्यूटी-एसक्यूएल स्रोत (बड़े उपयोक्ता) +Name[hu]=Qt-SQL-forrás (kiemelt felhasználó) +Name[is]=QT-SQL skrá (lengra komnir notendur) +Name[it]=Fonte Qt-SQL (utente esperto) +Name[ja]=Qt-SQL ソース (パワーユーザ) +Name[km]=ប្រភព Qt-SQL (អ្នកប្រើមានអំណាច) +Name[lv]=Qt-SQL avots (power lietotājs) +Name[ms]=Sumber Qt-SQL (pengguna kuasa) +Name[nb]=Qt-SQL kilde (sjefsbruker) +Name[nds]=Qt-SQL-Born (för künnige Brukers) +Name[ne]=Qt-SQL स्रोत (पावर प्रयोगकर्ता) +Name[nl]=QT-SQL-bron (geavanceerde gebruiker) +Name[nn]=Qt-SQL-kjelde (kraftbrukar) +Name[pl]=Źródło Qt-SQL (dla zaawansowanych użytkowników) +Name[pt]=Fonte do Qt-SQL (administração) +Name[pt_BR]=Qt-SQL (usuário avançado) +Name[ru]=Исходный текст Qt-SQL (продвинутый пользователь) +Name[se]=Qt-SQL-gáldu (áhppegeavaheaddji) +Name[sk]=Qt-SQL zdroj (power user) +Name[sl]=Vir Qt-SQL (zahtevni uporabnik) +Name[sr]=Qt-SQL извор (администратор) +Name[sr@Latn]=Qt-SQL izvor (administrator) +Name[sv]=Qt-SQL-källa (avancerade användare) +Name[tg]=Манбаъи Qt-SQL (истифодакунандаи зӯр) +Name[tr]=Qt-SQL Kaynağı (sistem yöneticisi) +Name[uk]=Джерело Qt-SQL (досвідчений користувач) +Name[zh_CN]=Qt-SQL 源(高级用户) +Name[zh_TW]=Qt-SQL 來源 (超級使用者) +Comment=This datasource type lets you use SQL database tables stored on a SQL Server. Depending on your system configuration, MySQL, PostgreSQL and UnixODBC are among the supported database backends. There might even be more (Oracle in commercial Qt versions or 3rd party backends). +Comment[ar]=هذا النّوع من المصادر البيانيّة يتيح لك إمكانية استخدام جداول قاعدة بيانيّة SQL مُخَزَّنة على خادم SQL. بحسب تهيئة نظامك، فإنّ MySQL، PostgreSQL و UnixODBC تُعتبر من بين ما هو مدعوم من وُجهات خلفيّة للقواعد البيانيّة. يمكن حتى أن يتواجد المزيد (Oracle في إصدارات Qt التِّجاريّة أو الوُجهات الخلفيّة المملوكة لطرف ثالث). +Comment[az]=Bu mənbə sizə SQL verilənlər bazasını istifadə etməyə imkan verir. Sistem qurğularınızdan asılı olaraq : MySQL,Postgres,(Oracle, lisenziyalı QT buraxılışını işlədirsinizsə),.... +Comment[bg]=Този източник на данни използва таблица за съхранение на данните в СУБД (сървър SQL). В зависимост от настройките, поддръжка имат MySQL, PostgreSQL и UnixODBC. Може да има и още (Oracle в комерсиалните версии на Qt или други). +Comment[bs]=Ovaj tip izvora podataka vam omogućuje da koristiti SQL tabele smještene na SQL serveru. Ovisno o konfiguraciji vašeg sistema, MySQL, PostgreSQL i UnixODBC su među podržanim bazama podataka. Možda čak i više od toga (Oracle u komercijalnim verzijama Qt-a ili backendima iz trećeg izvora). +Comment[ca]=Aquest tipus de font de dades permet usar una base de dades SQL guardada a un servidor SQL. Depenent de la configuració del sistema, MySQL, PostgreSQL i UnixODBC estan entre les bases de dades permeses. Inclús n'hi poden haver més(Oracle comercial a la versió Qt i d'altres servidors). +Comment[cs]=Tento zdroj dat vám umožní požívat tabulky SQL databází uložených na SQL serveru. V závislosti na vašem nastavení systému jsou podporovány databázové systémy MySQL, PostgreSQL a UnixODBC (Oracle je podporována v komerční verzi Qt nebo v databázových systémech jiných výrobců). +Comment[cy]=Mae'r math yma o ffynhonnell ddata yn eich galluogi i ddefnyddio tablau cronfa ddata SQL sydd wedi eu storio ar weinydd SQL. Yn dibynnu ar ffurfweddiad eich system, mae MySQL, PostgreSQL a UnixODBC ymysg y cronfeydd data cefndirol a gynhelir. Efallai bod mwy ohonynt (Oracle mewn fersiynau masnachol Qt neu ôl-wynebau 3ydd blaid). +Comment[da]=Denne datakildetype lader dig bruge SQL-databasetabeller gemt på en SQL-server. Afhængig af dine systemindstillinger er MySQL, PostgreSQL og UnixODBC blandt de understøttede underliggende databaser. Der er måske endda flere (Oracle i kommercielle Qt-versioner eller underliggende programmer fra tredjepartsudviklere). +Comment[de]= Mit diesem Datenquellentyp können Sie Tabellen von SQL-Datenbanken verwenden, die sich auf einem SQL-Server befinden. Abhängig von der Systemeinrichtung: MySQL, PostgresSQL oder UnixODBC. Möglicherweise sogar weitere (etwa Oracle bei einer kommerziellen QT-Version oder Paketen von Drittanbietern). +Comment[el]=Αυτός ο τύπος πηγής δεδομένων σας επιτρέπει να χρησιμοποιείτε πίνακες βάσεων δεδομένων SQL αποθηκευμένες σε έναν εξυπηρετητή SQL. Ανάλογα με τη ρύθμιση του συστήματος σας, οι MySQL, PostgreSQL και UnixODBC είναι μέσα στις υποστηριζόμενες βάσεις δεδομένων. Μπορεί να υπάρχουν και περισσότερες (Η Oracle σε εμπορικές εκδόσεις της Qt ή άλλες τρίτων κατασκευαστών). +Comment[eo]=Tiu datumfonta tipo permesas uzi SQL-datumbazan tabelon en SQL-servilo. Depende de la konfiguraĵo de via sistemo estas subtenataj MySQL, PostgreSQL kaj UnixODBC. Povas esti pliaj (Orakolo en komercaj Qt-versioj aŭ triapartiaj datumbazajinterfacoj). +Comment[es]=Este tipo de fuente de datos le permite utilizar tablas de bases de datos almacenadas en un servidor SQL. Dependiendo de la configuración de su sistema, MySQL, PostgreSQL, y UnixODBC están entre los interfaces de bases de datos soportados. Puede que haya incluso más (Oracle, si utiliza una versión de QT con licencia o interfaces de terceras partes). +Comment[et]=See andmeallika tüüp lubab kasutada SQL-andmebaasi tabeleid, mida hoitakse SQL-serveris. Sõltuvalt süsteemi seadistustest on MySQL, PostgreSQL ja UnixODBC toetatud andmebaasisüsteemide hulgas. Neid võib olla isegi rohkem (Oracle kommertslikes Qt versioonides või kolmandate osapoolte mootorites). +Comment[eu]=Datu-iturburu honek SQL zerbitzari batean gordetako SQL datu-baseko taulak erabiltzeko aukera ematen dizu. Zure sistemaren konfigurazioaren arabera, MySQL, PostgreSQL eta UnixODBC euskarriak onartzen dira. Gehiago ere egon daitezke (Oracle (Qt-ren bertsio komertzialetan) edo hirugarrenen beste euskarri batzuk). +Comment[fa]=این نوع متن داده به شما اجازۀ استفاده از جدولهای دادگان SQL ذخیرهشده در یک کارساز SQL را میدهد. بسته به پیکربندی سیستمتان، MySQL، PostgreSQL و UnixODBC، در میان پایانههای دادگان پشتیبانیشده میباشند. حتی ممکن است بیشتر باشند )Oracle در نسخههای تجاری Qt یا پایانههای گروه 3rd(. +Comment[fi]=Tämä tietolähde käyttää SQL-tietokantojen tauluja. Riippuen järjestelmäsi asetuksista tuetaan MySQL, Postgres ja UnixODBC -tietokantoja. Kantoja voi myös olla enemmän (Oracle, jos omistat kaupallisen version QT:sta). +Comment[fr]=Ce type de source de données vous permet d'utiliser des tables de base de données SQL stockées sur un serveur SQL. Selon votre configuration, ces tables peuvent venir de MySQL, PostgreSQL et UnixODBC, et d'autres encore (comme Oracle, si vous avez la licence commerciale de Qt, par exemple). +Comment[fy]=Mei dit type gegevensboarne kinne jo SQL-databanktabellen dy bewarre binne op in SQL-tsjinner brûke. Ofhinklik fan jo systeemkonfiguraasje hearre MySQL, PostgreSQL en UnixOBC ta de stipe backends. Der binne mooglik mear (bgl. Oracle yn de kommersje Qt-ferzjes fan backends fan tredden). +Comment[gl]=Este tipo de fonte de datos permítelle usar as táboas de base de datos armacenadas nun servidor de SQL. Dependendo da configuración do seu sistema, MySQL, PostgreSQL e UnixODBC encóntranse entre os sistemas soportados. Poden até existir máis (Oracle nas versións comerciais de Qt ou mesmo sistemas de terceiros). +Comment[he]=טיפוס מקור נתונים זה מאפשר לך להשתמש בטבלאות של מסדי נתונים של SQL שמאוחסנות בשרת SQL. בין ממשקי מסדי הנתונים הנתמכים ניתן למנות את MySQL ,PostgreSQL ו־UnixODBC (התמיכה תלויה בהגדרות המערכת שלך). עשויים להיות אף ממשקים נתמכים נוספים, כמו Oracle בגירסאות מסחריות של Qt או ממשקי צד שלישי. +Comment[hu]=Ez az adatforrástípus SQL-kiszolgálón tárolt SQL táblák elérését teszi lehetővé. A rendszer konfigurációjától függően MySQL, PostgreSQL és UnixODBC adatbázistípust lehet választani. Ezeken felül még más is előfordulhat (pl. Oracle a Qt fizetős változatában). +Comment[is]=Þessi tegund gerir þér kleyft að nota SQL gagnagrunnstöflur sem liggja á SQL þjóni. MySQL, PostgreSQL og UnixODBC eru meðal studdra gagnagrunnsbakenda, háð kerfisuppsetningu þinni. Það gætu jafnvel verið fleiri (Oracle í verslunarútgáfu Qt eða þriðja aðila bakendar). +Comment[it]=Questa fonte di dati permette di usare le tabelle di banche dati SQL memorizzate in un server SQL. A seconda della configurazione del tuo sistema, MySQL, PostgreSQL e UnixODBC potrebbero essere alcune delle banche dati supportate. Potrebbero essere supportate anche altre banche dati (Oracle nelle versioni commerciali di Qt o moduli di terze parti). +Comment[ja]=このデータソースタイプは SQL サーバに保存されている SQL データベーステーブルを使用します。システム設定によりますが、MySQL, PostgreSQL, UnixODBC がサポートされているデータベース バックエンドです。他のものも使用可能かもしれません (Qt の商用バージョンでの Oracle や、サードパーティのバックエンドなど)。 +Comment[km]=ប្រភេទប្រភពទិន្នន័យនេះអនុញ្ញាតឲ្យអ្នកប្រើតារាងមូលដ្ឋានទិន្នន័យ SQL ដែលបានរក្សាលើម៉ាស៊ីនបម្រើ SQL ។ ការពឹងផ្អែកលើការកំណត់រចនាសម្ព័ន្ធប្រព័ន្ធរបស់អ្នក MySQL, PostgreSQL និង UnixODBC គឺក្នុងចំណោមមូលដ្ឋានទិន្នន័យខាងក្រោយដែលបានគាំទ្រ ។ ប្រហែលជាមានច្រើន (Oracle ក្នុងកំណែពាណិជ្ជកម្ម Qt ឬ ភាគីខាងក្រោយទីបី) ។ +Comment[lt]=Šis duomenų šaltinio tipas leidžia jums naudoti SQL duombazės lenteles išsaugotas SQL serveryje. Priklausomai nuo jūsų sistemos konfigūracijos MySQL, PostgreSQL ir UnixODBC yra tarp palaikomų duombazių tipų. Jų gali būti ir daugiau (Oracle komercinėse Qt versijose ar trečių šalių duombazių tipai). +Comment[lv]=Šis datu avota tips ļauj jums izmantot SQL datubāzes tabulas, kas glabājas uz SQL servera. Atkarībā no jūsu sistēmas konfigurācijas: MySQL,PostgreSQL un UnixODBC ir starp atbalstītajām datubāzēm. Šeit var būt arī vairāk (Oracle, ja jūs izmantojiet komerciālu QT versiju vai trešo pušu risinājumus). +Comment[ms]=Jenis sumber data ini membenarkan anda menggunakan jadual pangkalan data SQL yang distor dalam Pelayan SQL. Bergantung kepada konfigurasi sistem anda, MySQL, PostgreSQL dan UnixODBC antara bahagian belakang pangkalan data yang disokong. Mungkin terdapat lebih banyak lagi pilihan (Oracle dalam versi Qt komersil atau bahagian belakang pihak ketiga). +Comment[mt]=Dan it-tip ta' sors iħallik tuża tabelli minn databases SQL fuq server SQL. Skond il-konfigurazzjoni tas-sistema tiegħek, jista' jkollok MySQL, PostgreSQL jew UnixODBC bħala sistemi sapportiti, u jista' jkun hemm oħrajn (Oracle fuq verżjonijiet kummerċjali ta' Qt jew oħrajn ta' terzi partiti). +Comment[nb]=Datakilden lar deg bruke en databasetabell lagret på en SQL-tjener. Avhengig av oppsettet støttes databasetjenere som MySQL, PostgreSQL og UnixODBC. I tillegg finnes støtte for flere system (som Oracle i den kommersielle QT-utgaven eller tredjepartsystem). +Comment[nds]= Mit dissen Datenborntyp laat sik SQL-Datenbanken vun en SQL-Server bruken. Afhängig vun Dien Systeeminstellen warrt Datenbankplegers för MySQL, PostgresSQL un UnixODBC ünnerstütt. Villicht ok mehr (t.B. Oracle in en warflich Qt-Verschoon oder Plegers vun anner Anbeders). +Comment[ne]=यो डेटासंसाधन प्रकारले तपाईंलाई एसक्यूएल सर्भरमा संग्रह भएको एसक्यूएल डाटाबेस प्रयोग गर्न दिन्छ ।तपाईंको प्रणाली कन्फिगरेसनमा, माइएसक्यूएल, पोस्टग्रेएसक्यूएल र युनीक्सओडीबीसी भर परेर जुन समर्थित डाटाबेस ब्याकेन्डहरू हुन् । त्यहाँ पक्कै पनि अझ बढी (व्यापारिक क्यूटी संस्करणहरू वा तेस्रो पार्टीको ब्याकेन्डमा आकाशवाणी हुन्छन्) +Comment[nl]=Met dit type gegevensbron kunt u SQL-databasetabellen die zijn opgeslagen op een SQL-server gebruiken. Afhankelijk van uw systeemconfiguratie behoren MySQL, PostgreSQL en UnixOBC tot de ondersteunde backends. Er zijn er mogelijk meer (bijv. Oracle in de commerciële Qt-versies of backends van derden). +Comment[nn]=Med denne datakjeldetypen kan du bruka SQL-databasetabellar lagra på ein SQL-tenar. Avhengig av systemoppsettet kan du bruka MySQL, PostgreSQL og UnixODBC. Det finst kanskje til og med fleire. (Oracle i kommersielle Qt-versjonar eller tredjepartstillegg.) +Comment[pl]=To źródło danych pozwala na przechowywanie tabel w bazach danych na serwerze SQL. W zależności od konfiguracji systemu: MySQL, PostgreSQL oraz UnixODBC są obsługiwane. Oczywiście może ich być więcej, np. Oracle w komercyjnej wersji Qt lub poprzez rozszerzenia innych firm. +Comment[pt]=Este tipo de fonte de dados permite-lhe usar as tabelas de base de dados armazenadas num servidor de SQL. Dependendo da configuração do seu sistema, o MySQL, o PostgreSQL e o UnixODBC encontram-se entre os sistemas suportados. Podem até existir mais (o Oracle nas versões comerciais do Qt ou mesmo sistemas de terceiros). +Comment[pt_BR]=Esta fonte de dados deixa você usar as tabelas do banco de dados SQL em seu Servidor SQL. Dependendo da configuração do seu sistema, MySQL, PostgreSQL e Unix ODBC estão entre os bancos de dados suportados. Podem existir outros (o Oracle em versões comerciais da Qt). +Comment[ro]=Acest tip de sursă de date vă permite să utilizaţi tabelele SQL dintr-o bază de date a unui server SQL. În funcţie de configuraţia sistemului dumneavoastră aveţi acces la subsistemul MySQL, PostgreSQL şi UnixODBC. S-ar putea să existe chiar şi mai multe(Oracle în versiunile comerciale Qt sau subsisteme terţe). +Comment[ru]=Этот тип данных позволит вам использовать таблицы на сервере баз данных. В зависимости от наличия в системе поддерживаются MySQL, PostgreSQL и UnixODBC. Помимо этого могут быть доступны Oracle в коммерческом Qt и прочие драйвера к базам данным от сторонних производителей +Comment[se]=Dáinna diehtogáldošlájain sáhtát geavahit SQL-diehtovuođuid SQL-bálvás. MySQL, PostgreSQL ja UnixODBC leat dorjojuvvon diehtovuođđoduogážat. Dáidá gávdnot vel eanet, omd. Oracle kommersiealla QT-veršuvnnain dahje eará moduvllain. +Comment[sk]=Tento zdroj dát umožňuje používať databázové tabuľky SQL. Podporované databáze sú MySQL, PostgreSQL, UnixODBC. (Prípadne aj Oracle, ak máte licencovanú verziu Qt alebo databáze iných výrobcov),... +Comment[sl]=Ta tip vira podatkov vam omogoča uporabo zbirke tabel SQL, ki so shranjene na strežniku SQL. Glede na vašo konfiguracijo sistema so podprte med drugim zbirke MySQL, PostgreSQL in UnixODBC. Mogoče bodo tudi druge (Oracle v komercialnih različicah Qt ali podpore tretjih strani). +Comment[sr]=Овај тип извора података вам омогућава да користите табеле из SQL базе података која се налази на SQL серверу. У зависности од подешавања вашег рачунара, MySQL, PostgreSQL и UnixODBC се налазе међу подржаним приступима бази. Могуће је да постоје и додатни приступи (Oracle у комерцијалним Qt верзијама итд.) +Comment[sr@Latn]=Ovaj tip izvora podataka vam omogućava da koristite tabele iz SQL baze podataka koja se nalazi na SQL serveru. U zavisnosti od podešavanja vašeg računara, MySQL, PostgreSQL i UnixODBC se nalaze među podržanim pristupima bazi. Moguće je da postoje i dodatni pristupi (Oracle u komercijalnim Qt verzijama itd.) +Comment[sv]=Den här typen av datakälla låter dig använda SQL-databastabeller lagrade på en SQL-server. Beroende på systeminställningarna finns MySQL, Postgres och UnixODBC bland de databaser som stöds. Det kan till och med finnas ännu fler (Oracle, om du använder en licensierad version av QT eller tredjepartsdatabaser). +Comment[tg]=Ин намуди манбаъи маълумот ба шумо имкони истифодаи SQL асоси маълумот мизҳои дар Сервери SQL ҷойгир шуда.Аз шакли системаи шумо вобастааст, MySQL,PostSQL ва UnixODBC дар мобайни асоси маълумот дар анҷом.Дар он ҷо мумкин,ки бошад(Oracle дар коммерсияи Qt тафсир ё 3-ум қисми анҷом). +Comment[tr]=Bu verikaynağı tipi bir SQL sunucusundaki SQL veritabanı tablolarını kullanmanıza izin verir.Sistem ayarlarınıza bağlı olarak MySQL, PostgreSQL ve UnixODBC desteklenen veritabanları arasındadır. Daha fazlası da olabilir. (Ticari Qt sürümlerindeki Oracle veya 3. şahıs veritabanları) +Comment[uk]=Цей тип джерела даних дозволяє вам використовувати таблиці баз даних в серверах SQL. Відповідно до конфігурації вашої системи, підтримуються MySQL, PostgreSQL та UnixODBC. Можливо підтримуються і інші сервери БД (Oracle в комерційній поставці Qt або сервери сторонніх компаній). +Comment[xh]=Uhlobo lwe mvelaphi ye data ikuvumela ukuba usebenzise iitafile zesiseko sedata ze SQL ezigcinwe Kumncedisi we SQL.Kuxhomekeke kuqwalaselo lwendlela yokusebenza, I SQL yam, PostgreSQL ne UnixODBC zikunye neziphelo zesiseko sedata esixhasiweyo. Kusenokuba nezingaphezulu (I Oracle ekwi thengiso lwenguqulelo ye QT okanye iziphelo zomntu wesithathu). +Comment[zh_CN]=此数据库类型允许您使用存储于 SQL 服务器的 SQL 数据库表。根据您的系统配置不同,MySQL、PostgreSQL 和 UnixODBC 都是支持的后端数据库。可能还有更多(Qt 商业版中附带 Oracle 支持,或使用第三方后端)。 +Comment[zh_TW]=這個資料來源類別讓你使用在一個 SQL 伺服器上面的 SQL 資料表格。根據你的系統設定,MySQL、PostgreSQL 與 UnixODBC 都在支援之列。還會有更多(例如在商業版本的 QT 或是第三廠商提供相關支援)。 + +X-KDE-Library=kwmailmerge_qtsqldb_power +X-KDE-Capabilities=edit,open +X-KDE-InternalName=QtSqlPower +X-KDE-PluginVersion=1 diff --git a/kword/mailmerge/sql/qtsqldatasourceeditor.ui b/kword/mailmerge/sql/qtsqldatasourceeditor.ui new file mode 100644 index 00000000..d0ad9902 --- /dev/null +++ b/kword/mailmerge/sql/qtsqldatasourceeditor.ui @@ -0,0 +1,158 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>QtSqlDataSourceEditor</class> +<widget class="QWidget"> + <property name="name"> + <cstring>QtSqlDataSourceEditor</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>493</width> + <height>270</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>&Table:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>tableCombo</cstring> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>tableCombo</cstring> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>filterCheckBox</cstring> + </property> + <property name="text"> + <string>&Filter output</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>editFilter</cstring> + </property> + <property name="text"> + <string>View or Edit Filter &Rules</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </hbox> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>Line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>&Used database records:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>DataTable</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </hbox> + </widget> + <widget class="QDataTable"> + <property name="name"> + <cstring>DataTable</cstring> + </property> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>filterCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>QtSqlDataSourceEditor</receiver> + <slot>filterCheckBox_toggled(bool)</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">qtsqldatasourceeditor.ui.h</include> +</includes> +<slots> + <slot>filterCheckBox_toggled( bool fcb_state )</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kword/mailmerge/sql/qtsqldatasourceeditor.ui.h b/kword/mailmerge/sql/qtsqldatasourceeditor.ui.h new file mode 100644 index 00000000..23d90812 --- /dev/null +++ b/kword/mailmerge/sql/qtsqldatasourceeditor.ui.h @@ -0,0 +1,13 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + + +void QtSqlDataSourceEditor::filterCheckBox_toggled( bool fcb_state ) +{ + editFilter->setEnabled(fcb_state); +} diff --git a/kword/mailmerge/sql/qtsqlopenwidget.ui b/kword/mailmerge/sql/qtsqlopenwidget.ui new file mode 100644 index 00000000..1b635131 --- /dev/null +++ b/kword/mailmerge/sql/qtsqlopenwidget.ui @@ -0,0 +1,301 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KWQtSqlOpenWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>KWQtSqlOpenWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>319</width> + <height>177</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QComboBox"> + <property name="name"> + <cstring>savedProperties</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>rememberButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Keep Settings...</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>GroupBox1</cstring> + </property> + <property name="title"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>Layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout7</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Hostname:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>hostname</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Driver:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>drivers</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Database &name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>databasename</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Username:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>username</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Port:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>port</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout6</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="KLineEdit"> + <property name="name"> + <cstring>hostname</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KComboBox"> + <property name="name"> + <cstring>drivers</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>databasename</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>username</cstring> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>port</cstring> + </property> + <property name="text"> + <string>default</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </grid> + </widget> + <spacer> + <property name="name" stdset="0"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<includes> + <include location="global" impldecl="in declaration">klineedit.h</include> + <include location="global" impldecl="in declaration">kcombobox.h</include> + <include location="global" impldecl="in declaration">kpushbutton.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +</UI> |