[Kmymoney-devel] Re: extragear/office/kmymoney/kmymoney

Cristian Oneţ onet.cristian at gmail.com
Mon Oct 4 09:32:54 CEST 2010


Hi Alvaro,

Nice, we could do the same for the accounts view and categories view.
I always found it strange that when adding a new account while
selecting an existing one the new account will not be added by default
as a child of the selected account. I don't know if the KDE3 version
did this but it would be nice if we added this feature.

Regards,
Cristian

On Mon, Oct 4, 2010 at 4:09 AM, Alvaro Soliverez <asoliverez at kde.org> wrote:
> SVN commit 1182268 by asoliverez:
>
> Preset the institution in the new account wizard if one has been selected in the institutions view
>
>  M  +1 -0      kmymoney.cpp
>  M  +21 -3     wizards/newaccountwizard/knewaccountwizard.cpp
>  M  +3 -1      wizards/newaccountwizard/knewaccountwizard_p.h
>
>
> --- trunk/extragear/office/kmymoney/kmymoney/kmymoney.cpp #1182267:1182268
> @@ -3015,6 +3015,7 @@
>  void KMyMoneyApp::slotAccountNew(void)
>  {
>   MyMoneyAccount acc;
> +  acc.setInstitutionId(d->m_selectedInstitution.id());
>   acc.setOpeningDate(KMyMoneyGlobalSettings::firstFiscalDate());
>
>   slotAccountNew(acc);
> --- trunk/extragear/office/kmymoney/kmymoney/wizards/newaccountwizard/knewaccountwizard.cpp #1182267:1182268
> @@ -113,7 +113,11 @@
>  {
>   m_account = acc;
>   m_accountTypePage->setAccount(m_account);
> +
> +  if(!acc.institutionId().isEmpty()) {
> +    m_institutionPage->selectExistingInstitution(acc.institutionId());
>  }
> +}
>
>  const MyMoneySecurity& Wizard::currency(void) const
>  {
> @@ -418,12 +422,26 @@
>   }
>  }
>
> -void InstitutionPage::slotSelectInstitution(int id)
> +void InstitutionPage::slotSelectInstitution(const int index)
>  {
> -  m_accountNumber->setEnabled(id != 0);
> -  m_iban->setEnabled(id != 0);
> +  m_accountNumber->setEnabled(index != 0);
> +  m_iban->setEnabled(index != 0);
>  }
>
> +void InstitutionPage::selectExistingInstitution(const QString id)
> +{
> +  QList<MyMoneyInstitution>::const_iterator it = d->m_list.constBegin();
> +
> +  for(int i = 0; i < d->m_list.length(); ++i)
> +  {
> +    if(d->m_list[i].id() == id) {
> +      m_institutionComboBox->setCurrentIndex(i + 1);
> +      slotSelectInstitution(i + 1);
> +      break;
> +    }
> +  }
> +}
> +
>  const MyMoneyInstitution& InstitutionPage::institution(void) const
>  {
>   static MyMoneyInstitution emptyInstitution;
> --- trunk/extragear/office/kmymoney/kmymoney/wizards/newaccountwizard/knewaccountwizard_p.h #1182267:1182268
> @@ -85,10 +85,12 @@
>     */
>   const MyMoneyInstitution& institution(void) const;
>
> +  void selectExistingInstitution(const QString id);
> +
>  private slots:
>   void slotLoadWidgets(void);
>   void slotNewInstitution(void);
> -  void slotSelectInstitution(int id);
> +  void slotSelectInstitution(int index);
>
>  private:
>   /// \internal d-pointer class.
>


More information about the KMyMoney-devel mailing list