kword
KWQtSqlPowerSerialDataSource.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _SERIALLETTER_QtSql_POWER_PLUGIN_H_ 00021 #define _SERIALLETTER_QtSql_POWER_PLUGIN_H_ 00022 00023 #include <qdom.h> 00024 #include <klocale.h> 00025 #include <kiconloader.h> 00026 #include <kdialogbase.h> 00027 #include <qsqldatabase.h> 00028 /* FOR THE DIRTY HACK */ 00029 #include <qsqlcursor.h> 00030 #include <qsqldriver.h> 00031 /* END FOR THE DIRTY HACK */ 00032 #include <qguardedptr.h> 00033 00034 #include "defs.h" 00035 #include "KWMailMergeDataSource.h" 00036 #include "KWQtSqlSerialDataSourceBase.h" 00037 #include "kwqtsqlpower.h" 00038 #include "KWMySqlCursor.h" 00039 00040 /****************************************************************** 00041 * 00042 * Class: KWQtSqlSerialDataSource 00043 * 00044 ******************************************************************/ 00045 class KWQtSqlPowerSerialDataSource: public KWQtSqlSerialDataSourceBase 00046 { 00047 Q_OBJECT 00048 public: 00049 KWQtSqlPowerSerialDataSource(KInstance *inst,QObject *parent); 00050 ~KWQtSqlPowerSerialDataSource(); 00051 00052 virtual void save( QDomDocument &doc,QDomElement&); 00053 virtual void load( QDomElement& elem ); 00054 virtual class QString getValue( const class QString &name, int record = -1 ) const; 00055 virtual int getNumRecords() const { 00056 return (myquery?((myquery->size()<0)?0:myquery->size()):0); 00057 } 00058 virtual bool showConfigDialog(QWidget *,int); 00059 virtual void refresh(bool force); 00060 00061 protected: 00062 friend class KWQtSqlPowerMailMergeEditor; 00063 QString query; 00064 KWMySqlCursor *myquery; 00065 00066 void clearSampleRecord(); 00067 void addSampleRecordEntry(QString name); 00068 00069 }; 00070 00071 /****************************************************************** 00072 * 00073 * Class: KWQtSqlPowerMailMergeEditor 00074 * 00075 ******************************************************************/ 00076 00077 class KWQtSqlPowerMailMergeEditor : public KDialogBase 00078 { 00079 Q_OBJECT 00080 00081 public: 00082 KWQtSqlPowerMailMergeEditor( QWidget *parent, KWQtSqlPowerSerialDataSource *db_ ); 00083 ~KWQtSqlPowerMailMergeEditor(); 00084 private: 00085 KWQtSqlPowerSerialDataSource *db; 00086 KWQtSqlPowerWidget *widget; 00087 private slots: 00088 void openSetup(); 00089 void updateDBViews(); 00090 void slotTableChanged ( QListBoxItem * item ); 00091 void slotExecute(); 00092 void slotSetQuery(); 00093 }; 00094 00095 00096 #endif