kexi

kexidynamicqueryparameterdialog.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Joseph Wenninger <jowenn@kde.org>
00003 
00004    This program 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 program 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 program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 
00021 #include "kexidynamicqueryparameterdialog.h"
00022 #include "kexidynamicqueryparameterdialog.moc"
00023 
00024 #include <qvbox.h>
00025 #include <klocale.h>
00026 #include <kdebug.h>
00027 #include <qlineedit.h>
00028 #include <qobjectlist.h>
00029 
00030 KexiDynamicQueryParameterDialog::KexiDynamicQueryParameterDialog(QWidget *parent,
00031     KexiDataProvider::Parameters *values, const KexiDataProvider::ParameterList &list):
00032         KDialogBase(parent, "paramddialog", true, i18n("Query Parameters"),
00033         KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true )
00034 {
00035     m_values=values;
00036     int y;
00037     m_mainView=new QVBox(this);
00038 
00039     for (KexiDataProvider::ParameterList::const_iterator it=list.begin();
00040         it!=list.end();++it) {
00041         QLineEdit *le=new QLineEdit(m_mainView,(*it).name.utf8());
00042         le->setText((*values)[(*it).name]);
00043     }
00044 
00045     setMainWidget(m_mainView);
00046 }
00047 
00048 KexiDynamicQueryParameterDialog::~KexiDynamicQueryParameterDialog() {}
00049 
00050 void KexiDynamicQueryParameterDialog::slotOk() {
00051     QObjectList *l=queryList(0,"kexi_.*",true,true);
00052     QObjectListIt it(*l);
00053     QObject *obj;
00054     kdDebug()<<"KexiDynamicQueryParameterDialog::slotOk()"<<endl;
00055     while ((obj=it.current())!=0) {
00056         kdDebug()<<"KexiDynamicQueryParameterDialog::slotOk()::loop"<<endl;
00057         (*m_values)[QString().fromUtf8(obj->name())]=
00058             (dynamic_cast<QLineEdit*>(obj))->text();
00059         ++it;
00060     }
00061     delete l;
00062     KDialogBase::slotOk();
00063 }
KDE Home | KDE Accessibility Home | Description of Access Keys