1
/* This file is part of the KDE project
2
Copyright (C) 2003 Lucijan Busch <lucijan@gmx.at>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this program; see the file COPYING. If not, write to
16
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
Boston, MA 02111-1307, USA.
21
#include <kgenericfactory.h>
22
#include <kfiledialog.h>
23
#include <kmessagebox.h>
25
#include <kio/netaccess.h>
26
#include <ktempfile.h>
28
#include "kexiDB/kexidb.h"
29
#include "kexiDB/kexidbtable.h"
30
#include "kexiDB/kexidbfield.h"
31
#include "kexiDB/kexidbrecordset.h"
33
#include "kexicsvimport.h"
34
#include "kexicsvsource.h"
36
#include "core/filters/kexifiltermanager.h"
37
#include "core/filters/kexifilterwizardbase.h"
38
#include "core/kexiproject.h"
41
KexiCSVImport::KexiCSVImport(QObject *parent, const char *name, const QStringList &l)
42
: KexiFilter(KEXIFILTERWIZARDBASE(parent), name,l)
51
return i18n("csv file");
55
bool KexiCSVImport::prepareImport(unsigned long type, const KURL& url)
59
if( KIO::NetAccess::download( url, m_file) ) {
62
#warning display error
70
KexiDBTable KexiCSVImport::tableStructure() {
71
return m_srcWidget->tableStructure();
74
bool KexiCSVImport::firstTableRow() {
75
return m_srcWidget->firstTableRow();
79
bool KexiCSVImport::nextTableRow() {
80
return m_srcWidget->nextTableRow();
83
QVariant KexiCSVImport::tableValue(int field) {
84
return m_srcWidget->tableValue(field);
87
QPtrList<QWidget> KexiCSVImport::sourceWidgets(QWidget *parent) {
88
filterWizard()->setMode(KexiFilterManager::Data);
89
m_srcWidget=new KexiCSVSource(parent);
90
m_srcWidget->setFile(m_file);
91
QPtrList<QWidget> tmp;
92
tmp.append(m_srcWidget);
98
KexiCSVImport::~KexiCSVImport()
101
if (m_file.isEmpty()) {
102
KIO::NetAccess::removeTempFile(m_file);
106
K_EXPORT_COMPONENT_FACTORY(kexicsvimport, KGenericFactory<KexiCSVImport>("kexicsvimport"))
108
#include "kexicsvimport.moc"