当前位置: 首页>>代码示例>>C++>>正文


C++ Collection::parentCollection方法代码示例

本文整理汇总了C++中akonadi::Collection::parentCollection方法的典型用法代码示例。如果您正苦于以下问题:C++ Collection::parentCollection方法的具体用法?C++ Collection::parentCollection怎么用?C++ Collection::parentCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在akonadi::Collection的用法示例。


在下文中一共展示了Collection::parentCollection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: itemAdded

void CalendarResource::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
{
    if ((!collection.contentMimeTypes().contains(KCalCore::Event::eventMimeType()) &&
            !collection.contentMimeTypes().contains(KCalCore::Todo::todoMimeType())) ||
            (!canPerformTask<KCalCore::Event::Ptr>(item, KCalCore::Event::eventMimeType()) &&
             !canPerformTask<KCalCore::Todo::Ptr>(item, KCalCore::Todo::todoMimeType()))) {
        return;
    }

    if (collection.parentCollection() == Akonadi::Collection::root()) {
        cancelTask(i18n("The top-level collection cannot contain any tasks or events"));
        return;
    }

    KGAPI2::Job *job = Q_NULLPTR;
    if (item.hasPayload<KCalCore::Event::Ptr>()) {
        KCalCore::Event::Ptr event = item.payload<KCalCore::Event::Ptr>();
        EventPtr kevent(new Event(*event));
        kevent->setUid(QLatin1String(""));

        job = new EventCreateJob(kevent, collection.remoteId(), account(),  this);

    } else if (item.hasPayload<KCalCore::Todo::Ptr>()) {
        KCalCore::Todo::Ptr todo = item.payload<KCalCore::Todo::Ptr>();
        TaskPtr ktodo(new Task(*todo));
        ktodo->setUid(QLatin1String(""));

        if (!ktodo->relatedTo(KCalCore::Incidence::RelTypeParent).isEmpty()) {
            Akonadi::Item parentItem;
            parentItem.setGid(ktodo->relatedTo(KCalCore::Incidence::RelTypeParent));

            ItemFetchJob *fetchJob = new ItemFetchJob(parentItem, this);
            fetchJob->setProperty(ITEM_PROPERTY, QVariant::fromValue(item));
            fetchJob->setProperty(TASK_PROPERTY, QVariant::fromValue(ktodo));

            connect(fetchJob, &ItemFetchJob::finished, this, &CalendarResource::slotTaskAddedSearchFinished);
            return;
        } else {
            job = new TaskCreateJob(ktodo, collection.remoteId(), account(), this);
        }
    } else {
        cancelTask(i18n("Invalid payload type"));
        return;
    }

    job->setProperty(ITEM_PROPERTY, QVariant::fromValue(item));
    connect(job, &EventCreateJob::finished, this, &CalendarResource::slotCreateJobFinished);
}
开发者ID:KDE,项目名称:kdepim-runtime,代码行数:48,代码来源:calendarresource.cpp

示例2: init

void CollectionGeneralPage::init(const Akonadi::Collection &collection)
{
    QVBoxLayout *topLayout = new QVBoxLayout(this);

    QHBoxLayout *hbox = new QHBoxLayout();
    topLayout->addItem(hbox);

    QLabel *label = new QLabel(i18nc("@label:textbox Name of the folder.", "&Name:"), this);
    hbox->addWidget(label);

    mNameEdit = new QLineEdit(this);
    mNameEdit->setToolTip(
        i18nc("@info:tooltip", "Set the folder name"));
    mNameEdit->setWhatsThis(
        i18nc("@info:whatsthis",
              "Enter a name here to set the name of this folder."));
    label->setBuddy(mNameEdit);
    hbox->addWidget(mNameEdit);

    // should replies to mails in this folder be kept in this same folder?
    hbox = new QHBoxLayout();
    topLayout->addItem(hbox);

    mBlockAlarmsCheckBox = new QCheckBox(i18nc("@option:check", "Block reminders locally"), this);
    mBlockAlarmsCheckBox->setToolTip(
        i18nc("@info:tooltip", "Ignore reminders from this calendar"));
    mBlockAlarmsCheckBox->setWhatsThis(
        i18nc("@info:whatsthis",
              "Check this box if you do not want to receive reminders from items "
              "associated with this calendar."));
    hbox->addWidget(mBlockAlarmsCheckBox);

    hbox = new QHBoxLayout();
    topLayout->addItem(hbox);
    mIconCheckBox = new QCheckBox(i18nc("@option:check", "&Use custom icon:"), this);
    mIconCheckBox->setToolTip(
        i18nc("@info:tooltip", "Set a custom icon"));
    mIconCheckBox->setWhatsThis(
        i18nc("@info:whatsthis",
              "Check this box if you want to set a custom icon for this folder."));
    mIconButton = new KIconButton(this);
    mIconButton->setIconSize(16);
    hbox->addWidget(mIconCheckBox);
    hbox->addWidget(mIconButton);
    hbox->addStretch();

    if ((collection.parentCollection() != Akonadi::Collection::root()) && PimCommon::Util::isImapResource(collection.resource())) {
        const MailCommon::CollectionAnnotationsAttribute *annotationAttribute =
            collection.attribute<MailCommon::CollectionAnnotationsAttribute>();

        const QMap<QByteArray, QByteArray> annotations =
            (annotationAttribute ?
             annotationAttribute->annotations() :
             QMap<QByteArray, QByteArray>());

        MailCommon::CollectionTypeUtil collectionUtil;
        const MailCommon::CollectionTypeUtil::IncidencesFor incidencesFor =
            collectionUtil.incidencesForFromString(QLatin1String(annotations.value(MailCommon::CollectionTypeUtil::kolabIncidencesFor())));
        hbox = new QHBoxLayout();
        topLayout->addItem(hbox);
        mIncidencesForComboBox = new MailCommon::IncidencesForWidget(this);
        hbox->addWidget(mIncidencesForComboBox);

        mIncidencesForComboBox->setCurrentIndex(incidencesFor);
    }
    topLayout->addStretch(100);   // eat all superfluous space
}
开发者ID:KDE,项目名称:kdepim,代码行数:67,代码来源:collectiongeneralpage.cpp


注:本文中的akonadi::Collection::parentCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。