Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/tables/kexitabledesignerview.cpp
Show First 20 Lines • Show All 570 Lines • ▼ Show 20 Line(s) | 570 | xi18n("Cannot switch to data view, because table design is empty.\n" | |||
---|---|---|---|---|---|
571 | "First, please create your design.")); | 571 | "First, please create your design.")); | ||
572 | return cancelled; | 572 | return cancelled; | ||
573 | } | 573 | } | ||
574 | //<temporary> | 574 | //<temporary> | ||
575 | else if (isDirty() && !window()->neverSaved()) { | 575 | else if (isDirty() && !window()->neverSaved()) { | ||
576 | // cancelled = (KMessageBox::No == KMessageBox::questionYesNo(this, xi18n("Saving changes for existing table design is not yet supported.\nDo you want to discard your changes now?"))); | 576 | // cancelled = (KMessageBox::No == KMessageBox::questionYesNo(this, xi18n("Saving changes for existing table design is not yet supported.\nDo you want to discard your changes now?"))); | ||
577 | // KDbConnection *conn = KexiMainWindowIface::global()->project()->dbConnection(); | 577 | // KDbConnection *conn = KexiMainWindowIface::global()->project()->dbConnection(); | ||
578 | bool emptyTable; | 578 | bool emptyTable; | ||
579 | bool isPhysicalAlteringNeeded = this->isPhysicalAlteringNeeded(); | ||||
580 | KLocalizedString message( | ||||
581 | kxi18nc("@info", "<para>Saving changes for existing table design is now required.</para>%1") | ||||
582 | .subs(d->messageForSavingChanges(&emptyTable, /*skip warning?*/!isPhysicalAlteringNeeded))); | ||||
583 | if (emptyTable) { | ||||
584 | isPhysicalAlteringNeeded = false; // eventually, not needed because there's no data | ||||
585 | } | ||||
586 | KGuiItem saveItem(KStandardGuiItem::save()); | ||||
587 | saveItem.setToolTip(QString()); | ||||
588 | KGuiItem discardItem(KStandardGuiItem::discard()); | ||||
589 | discardItem.setToolTip(QString()); | ||||
590 | if (isPhysicalAlteringNeeded) { | ||||
591 | saveItem.setText(xi18nc("@action:button", "Save Design and Remove Table Data")); | ||||
592 | discardItem.setText(xi18nc("@action:button", "Discard Design")); | ||||
593 | } | ||||
579 | const KMessageBox::ButtonCode r = KMessageBox::warningYesNoCancel(this, | 594 | const KMessageBox::ButtonCode r = KMessageBox::warningYesNoCancel(this, | ||
580 | xi18n("Saving changes for existing table design is now required.") | 595 | message.toString(), | ||
581 | + "\n" | | |||
582 | + d->messageForSavingChanges(&emptyTable, /*skip warning?*/!isPhysicalAlteringNeeded()), | | |||
583 | QString(), | 596 | QString(), | ||
584 | KStandardGuiItem::save(), KStandardGuiItem::discard(), KStandardGuiItem::cancel(), | 597 | saveItem, discardItem, KStandardGuiItem::cancel(), | ||
585 | QString(), | 598 | QString(), | ||
586 | KMessageBox::Notify | KMessageBox::Dangerous); | 599 | KMessageBox::Notify | KMessageBox::Dangerous); | ||
587 | if (r == KMessageBox::Cancel) | 600 | if (r == KMessageBox::Cancel) | ||
588 | res = cancelled; | 601 | res = cancelled; | ||
589 | else | 602 | else | ||
590 | res = true; | 603 | res = true; | ||
591 | *dontStore = (r != KMessageBox::Yes); | 604 | *dontStore = (r != KMessageBox::Yes); | ||
592 | if (!*dontStore) | 605 | if (!*dontStore) | ||
▲ Show 20 Lines • Show All 829 Lines • ▼ Show 20 Line(s) | 1407 | //!< @todo this is temporary flag before we switch entirely to real alter table | |||
1422 | if (res == true) { | 1435 | if (res == true) { | ||
1423 | if (!d->tempStoreDataUsingRealAlterTable && !realAlterTableCanBeUsed) { | 1436 | if (!d->tempStoreDataUsingRealAlterTable && !realAlterTableCanBeUsed) { | ||
1424 | //! @todo temp; remove this case: | 1437 | //! @todo temp; remove this case: | ||
1425 | delete alterTableHandler; | 1438 | delete alterTableHandler; | ||
1426 | alterTableHandler = 0; | 1439 | alterTableHandler = 0; | ||
1427 | // - inform about removing the current table and ask for confirmation | 1440 | // - inform about removing the current table and ask for confirmation | ||
1428 | if (!d->dontAskOnStoreData && !dontAsk) { | 1441 | if (!d->dontAskOnStoreData && !dontAsk) { | ||
1429 | bool emptyTable; | 1442 | bool emptyTable; | ||
1430 | const QString msg = d->messageForSavingChanges(&emptyTable); | 1443 | const QString msg = d->messageForSavingChanges(&emptyTable).toString(); | ||
1431 | if (!emptyTable) { | 1444 | if (!emptyTable) { | ||
1432 | if (KMessageBox::No == KMessageBox::questionYesNo(this, msg)) | 1445 | if (KMessageBox::No == KMessageBox::questionYesNo(this, msg)) | ||
1433 | res = cancelled; | 1446 | res = cancelled; | ||
1434 | } | 1447 | } | ||
1435 | } | 1448 | } | ||
1436 | d->dontAskOnStoreData = false; //one-time use | 1449 | d->dontAskOnStoreData = false; //one-time use | ||
1437 | if (~res) { | 1450 | if (~res) { | ||
1438 | d->recentResultOfStoreData = res; | 1451 | d->recentResultOfStoreData = res; | ||
▲ Show 20 Lines • Show All 445 Lines • Show Last 20 Lines |