[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra/calligra/2.8] kexi/plugins/importexport/csv: fix regression introduced in e15559512c2 (rem
From: Jaroslaw Staniek <staniek () kde ! org>
Date: 2014-09-01 22:22:24
Message-ID: E1XOZzU-0006b2-Se () scm ! kde ! org
[Download RAW message or body]
Git commit cb58acc12b1b8155e217abbfc047d538a1f9181a by Jaroslaw Staniek.
Committed on 01/09/2014 at 22:18.
Pushed by staniek into branch 'calligra/2.8'.
fix regression introduced in e15559512c2 (remove button setups)
It caused next button being hidden.
+use more readable button codes
M +49 -33 kexi/plugins/importexport/csv/kexicsvimportdialog.cpp
http://commits.kde.org/calligra/cb58acc12b1b8155e217abbfc047d538a1f9181a
diff --git a/kexi/plugins/importexport/csv/kexicsvimportdialog.cpp \
b/kexi/plugins/importexport/csv/kexicsvimportdialog.cpp index 5dd35a0..8afab7f 100644
--- a/kexi/plugins/importexport/csv/kexicsvimportdialog.cpp
+++ b/kexi/plugins/importexport/csv/kexicsvimportdialog.cpp
@@ -237,7 +237,10 @@ static bool shouldSaveRow(int row, bool firstRowForFieldNames)
class KexiCSVImportDialog::Private
{
public:
- Private() {}
+ Private()
+ : imported(false)
+ {
+ }
~Private() {
qDeleteAll(m_uniquenessTest);
}
@@ -286,6 +289,8 @@ public:
m_uniquenessTest[col] = test;
}
}
+
+ bool imported;
private:
//! vector of detected types
//! @todo more types
@@ -298,6 +303,11 @@ private:
// --
+const KDialog::ButtonCode FinishButton = KDialog::User1;
+const KDialog::ButtonCode NextButton = KDialog::User2;
+const KDialog::ButtonCode BackButton = KDialog::User3;
+const KDialog::ButtonCode ConfigureButton = KDialog::Help;
+
KexiCSVImportDialog::KexiCSVImportDialog(Mode mode, QWidget * parent)
: KAssistantDialog(parent),
m_cancelled(false),
@@ -338,13 +348,10 @@ KexiCSVImportDialog::KexiCSVImportDialog(Mode mode, QWidget * \
parent) adjustSize();
KDialog::centerOnScreen(this);
- setButtonGuiItem(KDialog::Apply, KGuiItem(i18n("&Import..."), _IMPORT_ICON));
- setButtonGuiItem(KDialog::User1, KStandardGuiItem::open());
- setButtonGuiItem(KDialog::Help, KStandardGuiItem::configure());
+ setButtonGuiItem(ConfigureButton, KStandardGuiItem::configure());
- showButton(KDialog::Apply, false);
- showButton(KDialog::User1, false);
- showButton(KDialog::User3, false);
+ showButton(FinishButton, false);
+ showButton(BackButton, false);
KConfigGroup importExportGroup(KGlobal::config()->group("ImportExport"));
m_maximumRowsForPreview = importExportGroup.readEntry(
@@ -360,7 +367,7 @@ KexiCSVImportDialog::KexiCSVImportDialog(Mode mode, QWidget * \
parent) // m_trimmedInTextValuesChecked = true;
if (m_mode == File) {
- showButton(KDialog::Help, false);
+ showButton(ConfigureButton, false);
createFileOpenPage();
} else if (m_mode == Clipboard) {
QString subtype("plain");
@@ -450,7 +457,6 @@ KexiCSVImportDialog::KexiCSVImportDialog(Mode mode, QWidget * \
parent) this, SLOT(slot1stRowForFieldNamesChanged(int)));
connect(this, SIGNAL(helpClicked()), this, SLOT(optionsButtonClicked()));
- connect(this, SIGNAL(applyClicked()), this, SLOT(import()));
connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
this, SLOT(slotCurrentPageChanged(KPageWidgetItem*,KPageWidgetItem*)));
@@ -536,7 +542,7 @@ void KexiCSVImportDialog::slotShowSchema(KexiPart::Item *item)
return;
}
- enableButton(KDialog::User2, true);
+ enableButton(NextButton, true);
KexiDB::TableOrQuerySchema *tableOrQuery = new KexiDB::TableOrQuerySchema(
KexiMainWindowIface::global()->project()->dbConnection(),
item->identifier()
@@ -554,11 +560,14 @@ void KexiCSVImportDialog::slotShowSchema(KexiPart::Item *item)
void KexiCSVImportDialog::slotCurrentPageChanged(KPageWidgetItem *page, \
KPageWidgetItem *prev) {
- enableButton(KDialog::User2, (page == m_saveMethodPage ? false : true));
- showButton(KDialog::Apply, (page == m_importPage ? true : false));
- showButton(KDialog::Help, (page == m_optionsPage ? true : false));
- showButton(KDialog::User2, (page == m_importPage ? false : true));
- showButton(KDialog::User3, (page == m_openFilePage ? false : true));
+ enableButton(NextButton, (page == m_saveMethodPage ? false : true));
+ showButton(FinishButton, (page == m_importPage ? true : false));
+ if (page == m_importPage) {
+ setButtonGuiItem(FinishButton, KGuiItem(i18n("&Import..."), _IMPORT_ICON));
+ }
+ showButton(ConfigureButton, (page == m_optionsPage ? true : false));
+ showButton(NextButton, (page == m_importPage ? false : true));
+ showButton(BackButton, (page == m_openFilePage ? false : true));
if (page == m_saveMethodPage && prev == m_tableNamePage && \
m_partItemForSavedTable) { if (m_newTable) {
@@ -630,7 +639,7 @@ void KexiCSVImportDialog::slotCurrentPageChanged(KPageWidgetItem \
*page, KPageWid } else if (!m_newTable) {
KexiPart::Item *i = m_tablesList->selectedPartItem();
if (!i) {
- enableButton(KDialog::User2, false);
+ enableButton(NextButton, false);
}
slotShowSchema(i);
}
@@ -1831,27 +1840,33 @@ void KexiCSVImportDialog::dropDestinationTable(KexiProject* \
project, KexiPart::I //! Used in emergency by accept()
void KexiCSVImportDialog::raiseErrorInAccept(KexiProject* project, KexiPart::Item* \
partItemForSavedTable) {
- enableButton(KDialog::Apply, true);
+ enableButton(FinishButton, true);
+ setButtonGuiItem(FinishButton, KGuiItem(i18n("&Import..."), _IMPORT_ICON));
project->deleteUnstoredItem(partItemForSavedTable);
delete m_destinationTableSchema;
m_destinationTableSchema = 0;
m_conn = 0;
- enableButton(KDialog::User3, true);
+ enableButton(BackButton, true);
m_importInProgress = false;
m_importingProgressBar->hide();
}
void KexiCSVImportDialog::accept()
{
- parentWidget()->raise();
- bool openingCancelled;
- KexiWindow *win = \
KexiMainWindowIface::global()->openedWindowFor(m_partItemForSavedTable);
- if (win) {
- KexiMainWindowIface::global()->closeObject(m_partItemForSavedTable);
- }
- KexiMainWindowIface::global()->openObject(m_partItemForSavedTable,
- Kexi::DataViewMode, openingCancelled);
- KAssistantDialog::accept();
+ if (d->imported) {
+ parentWidget()->raise();
+ bool openingCancelled;
+ KexiWindow *win = \
KexiMainWindowIface::global()->openedWindowFor(m_partItemForSavedTable); + if \
(win) { + \
KexiMainWindowIface::global()->closeObject(m_partItemForSavedTable); + }
+ KexiMainWindowIface::global()->openObject(m_partItemForSavedTable,
+ Kexi::DataViewMode, \
openingCancelled); + KAssistantDialog::accept();
+ }
+ else {
+ import();
+ }
}
void KexiCSVImportDialog::import()
@@ -1978,8 +1993,8 @@ void KexiCSVImportDialog::import()
}
m_importInProgress = true;
- enableButton(KDialog::User3, false);
- enableButton(KDialog::Apply, false);
+ enableButton(BackButton, false);
+ enableButton(FinishButton, false);
KexiPart::Part *part = \
Kexi::partManager().partForClass("org.kexi-project.table"); if (!part) {
msg.showErrorMessage(&Kexi::partManager());
@@ -2067,12 +2082,13 @@ void KexiCSVImportDialog::import()
m_destinationTableSchema->name()));
m_importInProgress = false;
kDebug()<<"IMPORT DONE";
- showButton(KDialog::User1, true);
- showButton(KDialog::Apply, false);
+ setButtonGuiItem(FinishButton, KStandardGuiItem::open());
+ showButton(FinishButton, true);
setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::close());
- showButton(KDialog::User2, false);
- showButton(KDialog::User3, false);
+ showButton(NextButton, false);
+ showButton(BackButton, false);
m_conn = 0;
+ d->imported = true;
}
void KexiCSVImportDialog::reject()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic