[Kmymoney-devel] playground/office/kmymoney/kmymoney2

Alvaro Soliverez asoliverez at gmail.com
Tue Oct 27 21:20:38 CET 2009


I'm not sure why KPluginDlg is not there, because it was a KMM class.
You could check if it actually wasn't ported from the KDE3 version.



On Tue, Oct 27, 2009 at 5:06 PM, Cristian Oneț <onet.cristian at gmail.com>wrote:

> SVN commit 1041330 by conet:
>
> Some cleanup and ported the online plugin selection code to KDE4.
> Since KPluginDlg seems to have been removed use a popup menu to let the
> user select the online plugin if there is more that one of them (it's not
> such a nice solution but it will be OK for now - at least the action can be
> used now).
>
>  M  +24 -22    kmymoney2.cpp
>
>
> --- trunk/playground/office/kmymoney/kmymoney2/kmymoney2.cpp
> #1041329:1041330
> @@ -1022,11 +1022,6 @@
>
>   // Initialization of progress bar taken from KDevelop ;-)
>   d->m_progressBar = new QProgressBar(statusBar());
> -  //FIXME: Port to KDE4
> -  //progressBar->setFrameStyle(Q3Frame::NoFrame | Q3Frame::Plain);
> -  //progressBar->setMargin(0);
> -  //progressBar->setLineWidth(0);
> -  //progressBar->setBackgroundMode(QWidget::PaletteBackground);
>   statusBar()->addWidget(d->m_progressBar);
>   d->m_progressBar->setFixedHeight(d->m_progressBar->sizeHint().height() -
> 8);
>
> @@ -6508,8 +6503,6 @@
>
>  void KMyMoney2App::slotAccountMapOnline(void)
>  {
> -    #warning "port to kde4"
> -#if 0
>   // no account selected
>   if(d->m_selectedAccount.id().isEmpty())
>     return;
> @@ -6525,10 +6518,7 @@
>     }
>   }
>
> -  // if we have more than one provider display a dialog to select the
> current providers
> -  KPluginDlg dlg(this);
> -  dlg.setCaption(i18n("Select online banking plugin"));
> -  dlg.closeButton->hide();
> +  // if we have more than one provider let the user select the current
> provider
>   QString provider;
>   QMap<QString, KMyMoneyPlugin::OnlinePlugin*>::const_iterator it_p;
>   switch(d->m_onlinePlugins.count()) {
> @@ -6538,15 +6528,28 @@
>       provider = d->m_onlinePlugins.begin().key();
>       break;
>     default:
> -      for(it_p = d->m_onlinePlugins.begin(); it_p !=
> d->m_onlinePlugins.end(); ++it_p) {
> -        QStringList protocolList;
> -        (*it_p)->protocols(protocolList);
> -        new K3ListViewItem(dlg.d->m_listView, it_p.key(), "Loaded",
> protocolList.join(", "));
> -      }
> -      if(dlg.exec() == QDialog::Accepted) {
> -        if(dlg.d->m_listView->selectedItem()) {
> -          provider = dlg.d->m_listView->selectedItem()->text(0);
> +      {
> +        QMenu popup(this);
> +        popup.setTitle(i18n("Select online banking plugin"));
> +
> +        // Populate the pick list with all the provider
> +        for (it_p = d->m_onlinePlugins.constBegin(); it_p !=
> d->m_onlinePlugins.constEnd(); ++it_p) {
> +          popup.addAction(it_p.key())->setData(it_p.key());
>         }
> +
> +        QAction *item = popup.actions()[0];
> +        if (item) {
> +          popup.setActiveAction(item);
> +        }
> +
> +        // cancelled
> +        if ((item = popup.exec(QCursor::pos(), item)) == 0) {
> +          return;
> +        }
> +
> +        // We need to create a valid date in the month selected so we can
> find out how many days are
> +        // in the month.
> +        provider = item->data().toString();
>       }
>       break;
>   }
> @@ -6555,8 +6558,8 @@
>     return;
>
>   // find the provider
> -  it_p = d->m_onlinePlugins.find(provider);
> -  if(it_p != d->m_onlinePlugins.end()) {
> +  it_p = d->m_onlinePlugins.constFind(provider);
> +  if(it_p != d->m_onlinePlugins.constEnd()) {
>     // plugin found, call it
>     MyMoneyKeyValueContainer settings;
>     if((*it_p)->mapAccount(d->m_selectedAccount, settings)) {
> @@ -6573,7 +6576,6 @@
>       }
>     }
>   }
> -#endif
>  }
>
>  void KMyMoney2App::slotAccountUpdateOnlineAll(void)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kmymoney-devel/attachments/20091027/b34c52b5/attachment.htm 


More information about the KMyMoney-devel mailing list