void KMail::ManageSieveScriptsDialog::slotRefresh()
{
    killAllJobs();
    mUrls.clear();
    mListView->clear();

    KMail::AccountManager *am = kmkernel->acctMgr();
    assert(am);
    QCheckListItem *last = 0;
    for(KMAccount *a = am->first() ; a ; a = am->next())
    {
        last = new QCheckListItem(mListView, last, a->name(), QCheckListItem::Controller);
        last->setPixmap(0, SmallIcon("server"));
        if(ImapAccountBase *iab = dynamic_cast<ImapAccountBase *>(a))
        {
            const KURL u = ::findUrlForAccount(iab);
            if(u.isEmpty())
                continue;
            SieveJob *job = SieveJob::list(u);
            connect(job, SIGNAL(item(KMail::SieveJob *, const QString &, bool)),
                    this, SLOT(slotItem(KMail::SieveJob *, const QString &, bool)));
            connect(job, SIGNAL(result(KMail::SieveJob *, bool, const QString &, bool)),
                    this, SLOT(slotResult(KMail::SieveJob *, bool, const QString &, bool)));
            mJobs.insert(job, last);
            mUrls.insert(last, u);
        }
        else
        {
            QListViewItem *item = new QListViewItem(last, i18n("No Sieve URL configured"));
            item->setEnabled(false);
            last->setOpen(true);
        }
    }
Example #2
0
void CertificateInfoWidgetImpl::updateChainView() {
  pathView->clear();
  if ( mChain.empty() )
    return;
  QListViewItem * item = 0;

  QValueList<GpgME::Key>::const_iterator it = mChain.begin();
  // root item:
  if ( (*it).chainID() && qstrcmp( (*it).chainID(), (*it).primaryFingerprint() ) == 0 )
    item = new QListViewItem( pathView, Kleo::DN( (*it++).userID(0).id() ).prettyDN() );
  else {
    item = new QListViewItem( pathView, i18n("Issuer certificate not found ( %1)")
			      .arg( Kleo::DN( (*it).issuerName() ).prettyDN() ) );
    item->setOpen( true ); // Qt bug: doesn't open after setEnabled( false ) :/
    item->setEnabled( false );
  }
  item->setOpen( true );

  // subsequent items:
  while ( it != mChain.end() ) {
    item = new QListViewItem( item, Kleo::DN( (*it++).userID(0).id() ).prettyDN() );
    item->setOpen( true );
  }
}