22#include "importwizard.h"
23#include "keximigrate.h"
24#include "importoptionsdlg.h"
28#include <tqvbuttongroup.h>
29#include <tqradiobutton.h>
30#include <tqcheckbox.h>
33#include <tdemessagebox.h>
34#include <kpushbutton.h>
37#include <kiconloader.h>
38#include <kbuttonbox.h>
40#include <kexidb/drivermanager.h>
41#include <kexidb/driver.h>
42#include <kexidb/connectiondata.h>
43#include <kexidb/utils.h>
44#include <core/kexidbconnectionset.h>
46#include <KexiConnSelector.h>
47#include <KexiProjectSelector.h>
48#include <KexiOpenExistingFile.h>
49#include <KexiDBTitlePage.h>
50#include <kexiutils/utils.h>
51#include <kexidbdrivercombobox.h>
52#include <kexitextmsghandler.h>
53#include <widget/kexicharencodingcombobox.h>
54#include <widget/kexiprjtypeselector.h>
65 setCaption(i18n(
"Import Database"));
66 setIcon(DesktopIcon(
"database_import"));
68 m_fileBasedDstWasPresented =
false;
69 m_setupFileBasedSrcNeeded =
true;
70 m_importExecuted =
false;
73 setMinimumSize(400, 400);
86 connect(
this, TQ_SIGNAL(selected(
const TQString &)),
this, TQ_SLOT(pageSelected(
const TQString &)));
87 connect(
this, TQ_SIGNAL(helpClicked()),
this, TQ_SLOT(helpClicked()));
89 if (m_predefinedConnectionData) {
91 m_srcConn->showAdvancedConn();
92 setAppropriate( m_srcConnPage,
false );
93 setAppropriate( m_srcDBPage,
false );
95 else if (!m_predefinedDatabaseName.isEmpty()) {
103 m_srcConn->showSimpleConn();
104 m_srcConn->setSelectedFileName(m_predefinedDatabaseName);
107 for (
int i=0; i<indexOf(m_dstTypePage); i++) {
108 if (page(i)!=m_introPage)
109 setAppropriate( page(i),
false );
113 m_sourceDBEncoding = TQString::fromLatin1(TDEGlobal::locale()->encoding());
118ImportWizard::~ImportWizard()
125void ImportWizard::parseArguments()
127 m_predefinedConnectionData = 0;
130 if (!(*m_args)[
"databaseName"].isEmpty() && !(*m_args)[
"mimeType"].isEmpty()) {
131 m_predefinedDatabaseName = (*m_args)[
"databaseName"];
132 m_predefinedMimeType = (*m_args)[
"mimeType"];
133 if (m_args->contains(
"connectionData")) {
145void ImportWizard::setupIntro()
147 m_introPage =
new TQWidget(
this);
148 TQVBoxLayout *vbox =
new TQVBoxLayout(m_introPage, KDialog::marginHint());
150 TQLabel *lblIntro =
new TQLabel(m_introPage);
151 lblIntro->setAlignment( TQt::AlignTop | TQt::AlignLeft | TQt::WordBreak );
153 if (m_predefinedConnectionData) {
154 msg = i18n(
"<qt>Database Importing wizard is about to import \"%1\" database "
155 "<nobr>(connection %2)</nobr> into a Kexi database.</qt>")
156 .arg(m_predefinedDatabaseName).arg(m_predefinedConnectionData->serverInfoString());
158 else if (!m_predefinedDatabaseName.isEmpty()) {
160 KMimeType::Ptr mimeTypePtr = KMimeType::mimeType(m_predefinedMimeType);
161 msg = i18n(
"<qt>Database Importing wizard is about to import <nobr>\"%1\"</nobr> file "
162 "of type \"%2\" into a Kexi database.</qt>")
163 .arg(TQDir::convertSeparators(m_predefinedDatabaseName)).arg(mimeTypePtr->comment());
166 msg = i18n(
"Database Importing wizard allows you to import an existing database "
167 "into a Kexi database.");
169 lblIntro->setText(msg+
"\n\n"
170 +i18n(
"Click \"Next\" button to continue or \"Cancel\" button to exit this wizard."));
171 vbox->addWidget( lblIntro );
172 addPage(m_introPage, i18n(
"Welcome to the Database Importing Wizard"));
183 TQVBoxLayout *vbox = new TQVBoxLayout(m_srcTypePage, KDialog::marginHint());
185 TQHBoxLayout *hbox = new TQHBoxLayout(vbox);
186 TQLabel *lbl = new TQLabel(i18n("Source database type:")+" ", m_srcTypePage);
187 hbox->addWidget(lbl);
189 m_srcTypeCombo = new KComboBox(m_srcTypePage);
190 hbox->addWidget(m_srcTypeCombo);
193 lbl->setBuddy(m_srcTypeCombo);
195 MigrateManager manager;
196 TQStringList names = manager.driverNames();
198 m_srcTypeCombo->insertStringList(names);
199 addPage(m_srcTypePage, i18n("Select Source Database Type"));
204void ImportWizard::setupSrcConn()
206 m_srcConnPage =
new TQWidget(
this);
207 TQVBoxLayout *vbox =
new TQVBoxLayout(m_srcConnPage, KDialog::marginHint());
210 ":ProjectMigrationSourceDir", m_srcConnPage,
"m_srcConnSelector");
212 m_srcConn->hideConnectonIcon();
213 m_srcConn->showSimpleConn();
215 TQStringList excludedFilters;
218 excludedFilters +=
"application/x-kexiproject-shortcut";
219 excludedFilters +=
"application/x-kexi-connectiondata";
220 m_srcConn->m_fileDlg->setExcludedFilters(excludedFilters);
223 vbox->addWidget(m_srcConn);
224 addPage(m_srcConnPage, i18n(
"Select Location for Source Database"));
229void ImportWizard::setupSrcDB()
232 m_srcDBPage =
new TQWidget(
this);
234 addPage(m_srcDBPage, i18n(
"Select Source Database"));
239void ImportWizard::setupDstType()
241 m_dstTypePage =
new TQWidget(
this);
243 KexiDB::DriverManager manager;
244 KexiDB::Driver::InfoMap drvs = manager.
driversInfo();
246 TQVBoxLayout *vbox =
new TQVBoxLayout(m_dstTypePage, KDialog::marginHint());
248 TQHBoxLayout *hbox =
new TQHBoxLayout(vbox);
249 TQLabel *lbl =
new TQLabel(i18n(
"Destination database type:")+
" ", m_dstTypePage);
250 lbl->setAlignment(TQt::AlignAuto|TQt::AlignTop);
251 hbox->addWidget(lbl);
253 m_dstPrjTypeSelector =
new KexiPrjTypeSelector(m_dstTypePage);
254 hbox->addWidget(m_dstPrjTypeSelector);
255 m_dstPrjTypeSelector->option_file->setText(i18n(
"Database project stored in a file"));
256 m_dstPrjTypeSelector->option_server->setText(i18n(
"Database project stored on a server"));
258 TQVBoxLayout *frame_server_vbox =
new TQVBoxLayout(m_dstPrjTypeSelector->frame_server, KDialog::spacingHint());
259 m_dstServerTypeCombo =
new KexiDBDriverComboBox(m_dstPrjTypeSelector->frame_server, drvs,
260 KexiDBDriverComboBox::ShowServerDrivers);
261 frame_server_vbox->addWidget(m_dstServerTypeCombo);
264 lbl->setBuddy(m_dstServerTypeCombo);
268 addPage(m_dstTypePage, i18n(
"Select Destination Database Type"));
273void ImportWizard::setupDstTitle()
275 m_dstTitlePage =
new KexiDBTitlePage(i18n(
"Destination project's caption:"),
276 this,
"KexiDBTitlePage");
277 m_dstTitlePage->layout()->setMargin( KDialog::marginHint() );
278 m_dstTitlePage->updateGeometry();
279 m_dstNewDBNameLineEdit = m_dstTitlePage->le_caption;
280 addPage(m_dstTitlePage, i18n(
"Select Destination Database Project's Caption"));
285void ImportWizard::setupDst()
287 m_dstPage =
new TQWidget(
this);
288 TQVBoxLayout *vbox =
new TQVBoxLayout(m_dstPage, KDialog::marginHint());
291 ":ProjectMigrationDestinationDir", m_dstPage,
"m_dstConnSelector");
292 m_dstConn->hideHelpers();
296 vbox->addWidget( m_dstConn );
297 connect(m_dstConn,TQ_SIGNAL(connectionItemExecuted(ConnectionDataLVItem*)),
298 this,TQ_SLOT(
next()));
301 m_dstConn->showSimpleConn();
303 m_dstConn->m_fileDlg->setMode( KexiStartupFileDialog::SavingFileBasedDB );
313 addPage(m_dstPage, i18n(
"Select Location for Destination Database"));
318void ImportWizard::setupImportType()
320 m_importTypePage =
new TQWidget(
this);
321 TQVBoxLayout *vbox =
new TQVBoxLayout(m_importTypePage, KDialog::marginHint());
322 m_importTypeButtonGroup =
new TQVButtonGroup(m_importTypePage);
323 m_importTypeButtonGroup->setLineWidth(0);
324 vbox->addWidget( m_importTypeButtonGroup );
326 (void)
new TQRadioButton(i18n(
"Structure and data"), m_importTypeButtonGroup);
327 (void)
new TQRadioButton(i18n(
"Structure only"), m_importTypeButtonGroup);
329 m_importTypeButtonGroup->setExclusive(
true );
330 m_importTypeButtonGroup->setButton( 0 );
331 addPage(m_importTypePage, i18n(
"Select Type of Import"));
336void ImportWizard::setupImporting()
338 m_importingPage =
new TQWidget(
this);
339 m_importingPage->hide();
340 TQVBoxLayout *vbox =
new TQVBoxLayout(m_importingPage, KDialog::marginHint());
341 m_lblImportingTxt =
new TQLabel(m_importingPage);
342 m_lblImportingTxt->setAlignment( TQt::AlignTop | TQt::AlignLeft | TQt::WordBreak );
344 m_lblImportingErrTxt =
new TQLabel(m_importingPage);
345 m_lblImportingErrTxt->setAlignment( TQt::AlignTop | TQt::AlignLeft | TQt::WordBreak );
347 m_progressBar =
new KProgress(100, m_importingPage);
348 m_progressBar->hide();
350 vbox->addWidget( m_lblImportingTxt );
351 vbox->addWidget( m_lblImportingErrTxt );
354 KButtonBox *optionsBox =
new KButtonBox(m_importingPage);
355 vbox->addWidget( optionsBox );
356 m_importOptionsButton = optionsBox->addButton(i18n(
"Advanced Options"),
this, TQ_SLOT(slotOptionsButtonClicked()));
357 m_importOptionsButton->setIconSet(SmallIconSet(
"configure"));
358 optionsBox->addStretch(1);
360 vbox->addWidget( m_progressBar );
364 m_importingPage->show();
366 addPage(m_importingPage, i18n(
"Importing"));
371void ImportWizard::setupFinish()
373 m_finishPage =
new TQWidget(
this);
374 m_finishPage->hide();
375 TQVBoxLayout *vbox =
new TQVBoxLayout(m_finishPage, KDialog::marginHint());
376 m_finishLbl =
new TQLabel(m_finishPage);
377 m_finishLbl->setAlignment( TQt::AlignTop | TQt::AlignLeft | TQt::WordBreak );
379 vbox->addWidget( m_finishLbl );
380 m_openImportedProjectCheckBox =
new TQCheckBox(i18n(
"Open imported project"),
381 m_finishPage,
"openImportedProjectCheckBox");
382 m_openImportedProjectCheckBox->setChecked(
true);
383 vbox->addSpacing( KDialog::spacingHint() );
384 vbox->addWidget( m_openImportedProjectCheckBox );
387 addPage(m_finishPage, i18n(
"Success"));
392bool ImportWizard::checkUserInput()
396 if (m_dstNewDBNameLineEdit->text().isEmpty())
398 finishtxt = finishtxt +
"<br>" + i18n(
"No new database name was entered.");
401 Kexi::ObjectStatus result;
402 KexiMigrate* sourceDriver = prepareImport(result);
405 finishtxt = finishtxt +
"<br>" + i18n(
"Source database is the same as destination.");
408 if (! finishtxt.isNull())
410 finishtxt =
"<qt>" + i18n(
"Following problems were found with the data you entered:") +
411 "<br>" + finishtxt +
"<br><br>" +
412 i18n(
"Please click 'Back' button and correct these errors.");
413 m_lblImportingErrTxt->setText(finishtxt);
416 return finishtxt.isNull();
419void ImportWizard::arriveSrcConnPage()
421 m_srcConnPage->hide();
428 if (m_setupFileBasedSrcNeeded) {
429 m_setupFileBasedSrcNeeded =
false;
430 TQStringList additionalMimeTypes;
434 additionalMimeTypes << "application/x-msaccess";
436 m_srcConn->m_fileDlg->setMode(KexiStartupFileDialog::Opening);
437 m_srcConn->m_fileDlg->setAdditionalFilters(additionalMimeTypes);
441 m_srcConn->m_fileDlg->setSelectedFilter("*.mdb");
443 m_srcConn->m_fileDlg->setFilter("*.mdb");
454 m_srcConnPage->show();
457void ImportWizard::arriveSrcDBPage()
459 if (fileBasedSrcSelected()) {
463 else if (!m_srcDBName) {
465 kdDebug() <<
"Looks like we need a project selector widget!" << endl;
467 KexiDB::ConnectionData* condata = m_srcConn->selectedConnectionData();
469 m_prjSet =
new KexiProjectSet(*condata);
470 TQVBoxLayout *vbox =
new TQVBoxLayout(m_srcDBPage, KDialog::marginHint());
471 m_srcDBName =
new KexiProjectSelectorWidget(m_srcDBPage,
472 "KexiMigrationProjectSelector", m_prjSet);
473 vbox->addWidget( m_srcDBName );
474 m_srcDBName->label->setText(i18n(
"Select source database you wish to import:"));
480void ImportWizard::arriveDstTitlePage()
482 if(fileBasedSrcSelected()) {
483 TQString suggestedDBName( TQFileInfo(m_srcConn->selectedFileName()).fileName() );
484 const TQFileInfo fi( suggestedDBName );
485 suggestedDBName = suggestedDBName.left(suggestedDBName.length()
486 - (fi.extension().length() ? (fi.extension().length()+1) : 0));
487 m_dstNewDBNameLineEdit->setText( suggestedDBName );
489 if (m_predefinedConnectionData) {
491 m_dstNewDBNameLineEdit->setText( m_predefinedDatabaseName );
494 if (!m_srcDBName || !m_srcDBName->selectedProjectData()) {
498 m_dstNewDBNameLineEdit->setText( m_srcDBName->selectedProjectData()->databaseName() );
503void ImportWizard::arriveDstPage()
508 if(fileBasedDstSelected()) {
509 m_dstConn->showSimpleConn();
510 m_dstConn->m_fileDlg->setMode( KexiStartupFileDialog::SavingFileBasedDB );
511 if (!m_fileBasedDstWasPresented) {
513 m_dstConn->m_fileDlg->setLocationText(m_dstNewDBNameLineEdit->text());
515 m_fileBasedDstWasPresented =
true;
517 m_dstConn->showAdvancedConn();
522void ImportWizard::arriveImportingPage() {
530 m_importingPage->hide();
531 if (checkUserInput()) {
532 setNextEnabled(m_importingPage,
true);
535 setNextEnabled(m_importingPage,
false);
538 m_lblImportingTxt->setText(i18n(
539 "All required information has now "
540 "been gathered. Click \"Next\" button to start importing.\n\n"
541 "Depending on size of the database this may take some time."
552 bool showOptions =
false;
553 if (fileBasedSrcSelected()) {
554 Kexi::ObjectStatus result;
555 KexiMigrate* sourceDriver = prepareImport(result);
557 showOptions = !result.error()
558 && sourceDriver->
propertyValue(
"source_database_has_nonunicode_encoding" ).toBool();
559 KexiMigration::Data *data = sourceDriver->
data();
565 m_importOptionsButton->show();
567 m_importOptionsButton->hide();
569 m_importingPage->show();
572void ImportWizard::arriveFinishPage() {
578bool ImportWizard::fileBasedSrcSelected()
const
580 if (m_predefinedConnectionData)
584 return m_srcConn->selectedConnectionType()==KexiConnSelectorWidget::FileBased;
587bool ImportWizard::fileBasedDstSelected()
const
591 return m_dstPrjTypeSelector->buttonGroup->selectedId() == 1;
601void ImportWizard::progressUpdated(
int percent) {
602 m_progressBar->setProgress(percent);
603 TDEApplication::kApplication()->processEvents();
608TQString ImportWizard::driverNameForSelectedSource()
610 if (fileBasedSrcSelected()) {
611 KMimeType::Ptr ptr = KMimeType::findByFileContent( m_srcConn->selectedFileName() );
612 if (!ptr || ptr.data()->name()==
"application/octet-stream" || ptr.data()->name()==
"text/plain") {
614 ptr = KMimeType::findByURL( m_srcConn->selectedFileName() );
616 return ptr ? m_migrateManager.driverForMimeType( ptr.data()->name() ) : TQString();
620 if (m_predefinedConnectionData) {
621 return m_predefinedConnectionData->driverName;
624 return m_srcConn->selectedConnectionData()
625 ? m_srcConn->selectedConnectionData()->driverName : TQString();
630void ImportWizard::accept()
642 if ((!fileBasedDstSelected() && !m_args->contains(
"destinationConnectionShortcut"))
643 || !m_openImportedProjectCheckBox->isChecked())
647 m_args->remove(
"destinationDatabaseName");
653KexiMigrate* ImportWizard::prepareImport(Kexi::ObjectStatus& result)
655 KexiUtils::WaitCursor wait;
658 KexiDB::DriverManager manager;
660 kdDebug() <<
"Creating destination driver..." << endl;
663 KexiDB::Driver *destDriver = manager.
driver(
664 m_dstConn->selectedConnectionData() ? m_dstConn->selectedConnectionData()->driverName
668 if (!destDriver || manager.
error())
670 result.setStatus(&manager);
671 kdDebug() <<
"Manager error..." << endl;
677 KexiDB::ConnectionData *cdata;
678 bool cdataOwned =
false;
682 if (m_dstConn->selectedConnectionData())
685 kdDebug() <<
"Server destination..." << endl;
686 cdata = m_dstConn->selectedConnectionData();
687 dbname = m_dstNewDBNameLineEdit->text();
692 kdDebug() <<
"File Destination..." << endl;
693 cdata =
new KexiDB::ConnectionData();
695 cdata->
caption = m_dstNewDBNameLineEdit->text();
697 dbname = m_dstConn->selectedFileName();
699 kdDebug() <<
"Current file name: " << dbname << endl;
711 TQString sourceDriverName;
714 sourceDriverName = driverNameForSelectedSource();
715 if (sourceDriverName.isEmpty())
716 result.setStatus(i18n(
"No appropriate migration driver found."),
717 m_migrateManager.possibleProblemsInfoMsg());
721 KexiMigrate* sourceDriver = 0;
724 sourceDriver = m_migrateManager.driver( sourceDriverName );
725 if(!sourceDriver || m_migrateManager.error()) {
726 kdDebug() <<
"Import migrate driver error..." << endl;
727 result.setStatus(&m_migrateManager);
734 if (sourceDriver && !result.error())
738 m_progressBar->updateGeometry();
739 disconnect(sourceDriver, TQ_SIGNAL(progressPercent(
int)),
740 this, TQ_SLOT(progressUpdated(
int)));
741 connect(sourceDriver, TQ_SIGNAL(progressPercent(
int)),
742 this, TQ_SLOT(progressUpdated(
int)));
747 if (m_importTypeButtonGroup->selectedId() == 0)
749 kdDebug() <<
"Structure and data selected" << endl;
752 else if (m_importTypeButtonGroup->selectedId() == 1)
754 kdDebug() <<
"structure only selected" << endl;
759 kdDebug() <<
"Neither radio button is selected (not possible?) presume keep data" << endl;
763 KexiMigration::Data* md =
new KexiMigration::Data();
765 md->destination =
new KexiProjectData(*cdata, dbname);
766 if(fileBasedSrcSelected()) {
767 KexiDB::ConnectionData* conn_data =
new KexiDB::ConnectionData();
768 conn_data->
setFileName(m_srcConn->selectedFileName());
769 md->source = conn_data;
774 if (m_predefinedConnectionData)
775 md->source = m_predefinedConnectionData;
777 md->source = m_srcConn->selectedConnectionData();
779 if (!m_predefinedDatabaseName.isEmpty())
780 md->sourceName = m_predefinedDatabaseName;
782 md->sourceName = m_srcDBName->selectedProjectData()->databaseName();
785 md->keepData = keepData;
792tristate ImportWizard::import()
794 m_importExecuted =
true;
796 Kexi::ObjectStatus result;
797 KexiMigrate* sourceDriver = prepareImport(result);
799 bool acceptingNeeded =
false;
802 if (sourceDriver && !result.error())
804 if (!m_sourceDBEncoding.isEmpty()) {
806 TQVariant(m_sourceDBEncoding.upper().replace(
' ',
""))
811 kdDebug() <<
"Abort import cause checkIfDestinationDatabaseOverwritingNeedsAccepting returned false." << endl;
816 kdDebug() <<
"Performing import..." << endl;
819 if (sourceDriver && !result.error() && acceptingNeeded) {
820 if (KMessageBox::Yes != KMessageBox::warningYesNo(
this,
821 "<qt>"+i18n(
"Database %1 already exists."
822 "<p>Do you want to replace it with a new one?")
824 0, KGuiItem(i18n(
"&Replace")), KGuiItem(i18n(
"No"))))
831 m_progressBar->show();
834 if (sourceDriver && !result.error() && sourceDriver->
performImport(&result))
838 m_args->insert(
"destinationDatabaseName",
841 TQString destinationConnectionShortcut(
842 Kexi::connset().fileNameForConnectionData( m_dstConn->selectedConnectionData() ) );
843 if (!destinationConnectionShortcut.isEmpty()) {
844 m_args->insert(
"destinationConnectionShortcut", destinationConnectionShortcut);
847 setTitle(m_finishPage, i18n(
"Success"));
851 if (!sourceDriver || result.error())
853 m_progressBar->setProgress(0);
854 m_progressBar->hide();
856 TQString msg, details;
857 KexiTextMessageHandler handler(msg, details);
858 handler.showErrorMessage(&result);
860 kdDebug() << msg <<
"\n" << details << endl;
861 setTitle(m_finishPage, i18n(
"Failure"));
862 m_finishLbl->setText(
863 i18n(
"<p>Import failed.</p>%1<p>%2</p><p>You can click \"Back\" button and try again.</p>")
864 .arg(msg).arg(details));
871void ImportWizard::reject()
880 if (currentPage() == m_srcConnPage) {
881 if (fileBasedSrcSelected()
882 && !TQFileInfo(m_srcConn->selectedFileName()).isFile()) {
884 KMessageBox::sorry(
this,i18n(
"Select source database filename."));
888 if ( (! fileBasedSrcSelected()) && (! m_srcConn->selectedConnectionData()) ) {
889 KMessageBox::sorry(
this,i18n(
"Select source database."));
893 KexiMigrate*
import = m_migrateManager.driver( driverNameForSelectedSource() );
894 if(!
import || m_migrateManager.error()) {
896 if (fileBasedSrcSelected())
897 dbname = m_srcConn->selectedFileName();
899 dbname = m_srcConn->selectedConnectionData()
900 ? m_srcConn->selectedConnectionData()->serverInfoString() : TQString();
901 if (!dbname.isEmpty())
902 dbname = TQString(
" \"%1\"").arg(dbname);
903 KMessageBox::error(
this, i18n(
"Could not import database%1. This type is not supported.")
908 else if (currentPage() == m_dstPage) {
909 if (m_fileBasedDstWasPresented) {
910 if (fileBasedDstSelected() && !m_dstConn->m_fileDlg->checkFileName())
914 else if (currentPage() == m_importingPage) {
915 if (!m_importExecuted) {
916 m_importOptionsButton->hide();
917 nextButton()->setEnabled(
false);
918 finishButton()->setEnabled(
false);
919 backButton()->setEnabled(
false);
920 m_lblImportingTxt->setText(i18n(
"Importing in progress..."));
923 m_finishLbl->setText(
924 i18n(
"Database has been imported into Kexi database project \"%1\".")
925 .arg(m_dstNewDBNameLineEdit->text()) );
926 cancelButton()->setEnabled(
false);
927 setBackEnabled(m_finishPage,
false);
928 setFinishEnabled(m_finishPage,
true);
929 m_openImportedProjectCheckBox->show();
934 m_progressBar->hide();
935 cancelButton()->setEnabled(
true);
936 setBackEnabled(m_finishPage,
true);
937 setFinishEnabled(m_finishPage,
false);
938 m_openImportedProjectCheckBox->hide();
942 arriveImportingPage();
945 m_importExecuted =
false;
950 setAppropriate( m_srcDBPage, !fileBasedSrcSelected() && !m_predefinedConnectionData );
954void ImportWizard::back()
956 setAppropriate( m_srcDBPage, !fileBasedSrcSelected() && !m_predefinedConnectionData );
960void ImportWizard::pageSelected(
const TQString &)
962 if (currentPage() == m_introPage) {
966 else if (currentPage() == m_srcConnPage) {
969 else if (currentPage() == m_srcDBPage) {
972 else if (currentPage() == m_dstTypePage) {
974 else if (currentPage() == m_dstTitlePage) {
975 arriveDstTitlePage();
977 else if (currentPage() == m_dstPage) {
980 else if (currentPage() == m_importingPage) {
981 arriveImportingPage();
983 else if (currentPage() == m_finishPage) {
988void ImportWizard::helpClicked()
990 if (currentPage() == m_introPage)
992 KMessageBox::information(
this, i18n(
"No help is available for this page."), i18n(
"Help"));
998 else if (currentPage() == m_srcConnPage)
1000 KMessageBox::information(
this, i18n(
"Here you can choose the location to import data from."), i18n(
"Help"));
1002 else if (currentPage() == m_srcDBPage)
1004 KMessageBox::information(
this, i18n(
"Here you can choose the actual database to import data from."), i18n(
"Help"));
1006 else if (currentPage() == m_dstTypePage)
1008 KMessageBox::information(
this, i18n(
"Here you can choose the location to save the data."), i18n(
"Help"));
1010 else if (currentPage() == m_dstPage)
1012 KMessageBox::information(
this, i18n(
"Here you can choose the location to save the data in and the new database name."), i18n(
"Help"));
1014 else if (currentPage() == m_finishPage || currentPage() == m_importingPage)
1016 KMessageBox::information(
this, i18n(
"No help is available for this page."), i18n(
"Help"));
1020void ImportWizard::slotOptionsButtonClicked()
1022 OptionsDialog dlg(m_srcConn->selectedFileName(), m_sourceDBEncoding,
this);
1023 if (TQDialog::Accepted != dlg.exec())
1026 if (m_sourceDBEncoding != dlg.encodingComboBox()->selectedEncoding()) {
1027 m_sourceDBEncoding = dlg.encodingComboBox()->selectedEncoding();
1031#include "importwizard.moc"
TQString caption
The caption of the connection.
TQString driverName
the name of the driver that should be used to create a connection
Database specific connection data, e.g. host, port.
void setFileName(const TQString &fn)
Set the filename used by the connection.
const KexiDB::Driver::InfoMap driversInfo()
Driver * driver(const TQString &name)
static TQString defaultFileBasedDriverName()
static TQString defaultFileBasedDriverMimeType()
ImportWizard(TQWidget *parent=0, TQMap< TQString, TQString > *args=0)
Imports non-native databases into Kexi projects.
bool performImport(Kexi::ObjectStatus *result=0)
Perform an import operation.
bool progressSupported()
Returns true if the migration driver supports progress updates.
virtual TQVariant propertyValue(const TQCString &propName)
bool isSourceAndDestinationDataSourceTheSame() const
bool checkIfDestinationDatabaseOverwritingNeedsAccepting(Kexi::ObjectStatus *result, bool &acceptingNeeded)
void setData(KexiMigration::Data *migrateData)
Data Setup. Requires two connection objects, a name and a bool.
void setPropertyValue(const TQCString &propName, const TQVariant &value)
KexiMigration::Data * data() const
TQString infoString(bool nobr=true) const
TQString databaseName() const
3-state logical type with three values: true, false and cancelled and convenient operators.
KEXI_DB_EXPORT void fromMap(const TQMap< TQString, TQString > &map, ConnectionData &data)
Framework for importing databases into native KexiDB databases.
KEXIUTILS_EXPORT TQMap< TQString, TQString > deserializeMap(const TQByteArray &array)
KEXIUTILS_EXPORT void removeWaitCursor()
KEXICORE_EXPORT KexiDBConnectionSet & connset()
A set of known connections.