void CalDavClient::startSlowSync()
{
    FUNCTION_CALL_TRACE;

    if (!mManager) {
        mManager = new Accounts::Manager(this);
    }
    Accounts::Account *account  = mManager->account(mAccountId);
    if (account != NULL) {
        mKCal::Notebook::Ptr notebook = mKCal::Notebook::Ptr(new mKCal::Notebook(account->displayName(), ""));
        notebook->setAccount(QString::number(mAccountId));
        notebook->setPluginName(getPluginName());
        notebook->setSyncProfile(getProfileName());

        mKCal::ExtendedCalendar::Ptr calendar = mKCal::ExtendedCalendar::Ptr(new mKCal::ExtendedCalendar(KDateTime::Spec::UTC()));
        mKCal::ExtendedStorage::Ptr storage = calendar->defaultStorage(calendar);
        storage->open();
        bool status = storage->addNotebook(notebook);
        LOG_DEBUG("NOTEBOOK created " << status << "   UUID of NoteBook = " << notebook->uid());
        storage->close();
        calendar->close();

        Report *report = new Report(mNAManager, &mSettings);
        mRequests.insert(report);
        connect(report, SIGNAL(finished()), this, SLOT(reportRequestFinished()));
        report->getAllEvents();
    }
}
QList <QSharedPointer<Account> > SystemPrivate::loadAccounts (
    const QString & serviceType, bool includeCustomUI) {

    qDebug() << "PERF: LoadAccounts START";

    QList <QSharedPointer<Account> > retList;
    Accounts::AccountIdList idList =
        m_accountsManager->accountList (serviceType);

    for (int i = 0; i < idList.size (); ++i) {
        Accounts::Account * aAccount = m_accountsManager->account (idList [i]);

        if (aAccount == 0) {
            qWarning() << "Null account received" << i + 1;
            continue;
        }

        Accounts::ServiceList sList = aAccount->services (serviceType);

        for (int j = 0; j < sList.size (); ++j) {
            Accounts::Service aService = sList [j];

            aAccount->selectService (aService);
            qDebug() << "Service" << aService.displayName() << "found for"
                << "account" << aAccount->displayName();

            QSharedPointer <Account> sAccount = QSharedPointer <Account> (
                new Account);

            if (sAccount->init (idList [i], aService.name())) {
                bool append = true;

                if (includeCustomUI == false) {
                    if (sAccount->service()->publishCustom() ==
                        Service::PUBLISH_CUSTOM_TOTAL) {
                        append = false;
                    }
                }

                if (append == true) {
                    retList.append (sAccount);
                }
            }
        }

        delete aAccount;
        aAccount = 0;

    }

    qDebug() << "PERF: LoadAccounts END";

    return retList;
}
Пример #3
0
void QmlApplicationViewer::debugAccount(Accounts::AccountId id){

    qDebug()<<"START DEBUG ACCT";
    Accounts::Account *a;
    a = manager->account(id);

    qDebug()<<a->displayName();
    qDebug()<<a->valueAsString("username");

   qDebug()<<"END DEBUG ACCT";

}