Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/kmymoney.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 2854 Lines • ▼ Show 20 Line(s) | 2853 | } else { | |||
---|---|---|---|---|---|
2855 | // the message no matter what. Otherwise, the user is not able to use this feature | 2855 | // the message no matter what. Otherwise, the user is not able to use this feature | ||
2856 | // in the future anymore. | 2856 | // in the future anymore. | ||
2857 | KMessageBox::enableMessage(dontShowAgain); | 2857 | KMessageBox::enableMessage(dontShowAgain); | ||
2858 | } | 2858 | } | ||
2859 | } | 2859 | } | ||
2860 | 2860 | | |||
2861 | void KMyMoneyApp::slotInvestmentNew() | 2861 | void KMyMoneyApp::slotInvestmentNew() | ||
2862 | { | 2862 | { | ||
2863 | KNewInvestmentWizard dlg; | 2863 | QPointer<KNewInvestmentWizard> dlg = new KNewInvestmentWizard(this); | ||
2864 | if (dlg.exec() == QDialog::Accepted) { | 2864 | if (dlg->exec() == QDialog::Accepted) | ||
2865 | dlg.createObjects(d->m_selectedAccount.id()); | 2865 | dlg->createObjects(d->m_selectedAccount.id()); | ||
2866 | } | 2866 | delete dlg; | ||
2867 | } | 2867 | } | ||
2868 | 2868 | | |||
2869 | void KMyMoneyApp::slotInvestmentEdit() | 2869 | void KMyMoneyApp::slotInvestmentEdit() | ||
2870 | { | 2870 | { | ||
2871 | KNewInvestmentWizard dlg(d->m_selectedInvestment); | 2871 | QPointer<KNewInvestmentWizard> dlg = new KNewInvestmentWizard(d->m_selectedInvestment); | ||
2872 | if (dlg.exec() == QDialog::Accepted) { | 2872 | if (dlg->exec() == QDialog::Accepted) | ||
2873 | dlg.createObjects(d->m_selectedAccount.id()); | 2873 | dlg->createObjects(d->m_selectedAccount.id()); | ||
2874 | } | 2874 | delete dlg; | ||
2875 | } | 2875 | } | ||
2876 | 2876 | | |||
2877 | void KMyMoneyApp::slotInvestmentDelete() | 2877 | void KMyMoneyApp::slotInvestmentDelete() | ||
2878 | { | 2878 | { | ||
2879 | if (KMessageBox::questionYesNo(this, i18n("<p>Do you really want to delete the investment <b>%1</b>?</p>", d->m_selectedInvestment.name()), i18n("Delete investment"), KStandardGuiItem::yes(), KStandardGuiItem::no(), "DeleteInvestment") == KMessageBox::Yes) { | 2879 | if (KMessageBox::questionYesNo(this, i18n("<p>Do you really want to delete the investment <b>%1</b>?</p>", d->m_selectedInvestment.name()), i18n("Delete investment"), KStandardGuiItem::yes(), KStandardGuiItem::no(), "DeleteInvestment") == KMessageBox::Yes) { | ||
2880 | MyMoneyFile* file = MyMoneyFile::instance(); | 2880 | MyMoneyFile* file = MyMoneyFile::instance(); | ||
2881 | MyMoneyFileTransaction ft; | 2881 | MyMoneyFileTransaction ft; | ||
2882 | try { | 2882 | try { | ||
2883 | d->m_selectedAccount = MyMoneyAccount(); // CAUTION: deleting equity from investments view needs this, if ID of the equity to be deleted is the smallest from all | ||||
2883 | file->removeAccount(d->m_selectedInvestment); | 2884 | file->removeAccount(d->m_selectedInvestment); | ||
2884 | ft.commit(); | 2885 | ft.commit(); | ||
2885 | } catch (const MyMoneyException &e) { | 2886 | } catch (const MyMoneyException &e) { | ||
2886 | KMessageBox::information(this, i18n("Unable to delete investment: %1", e.what())); | 2887 | KMessageBox::information(this, i18n("Unable to delete investment: %1", e.what())); | ||
2887 | } | 2888 | } | ||
2888 | } else { | 2889 | } else { | ||
2889 | // we should not keep the 'no' setting because that can confuse people like | 2890 | // we should not keep the 'no' setting because that can confuse people like | ||
2890 | // I have seen in some usability tests. So we just delete it right away. | 2891 | // I have seen in some usability tests. So we just delete it right away. | ||
▲ Show 20 Lines • Show All 4669 Lines • Show Last 20 Lines |