• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ akonadi::Collection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setLinkUrl

void KJotsLinkDialog::setLinkUrl(const QString &linkUrl)
{
    Akonadi::Item item = Akonadi::Item::fromUrl(KUrl(linkUrl));
    Akonadi::Collection collection = Akonadi::Collection::fromUrl(KUrl(linkUrl));

    if (!item.isValid() && !collection.isValid()) {
        linkUrlLineEdit->setText(linkUrl);
        linkUrlLineEditRadioButton->setChecked(true);
        return;
    }

    QModelIndex idx;

    if (collection.isValid()) {
        idx = Akonadi::EntityTreeModel::modelIndexForCollection( m_descendantsProxyModel, collection );
    } else if (item.isValid()) {
        const QModelIndexList list = Akonadi::EntityTreeModel::modelIndexesForItem( m_descendantsProxyModel, item );
        if (list.isEmpty())
            return;

        idx = list.first();
    }

    if (!idx.isValid())
        return;

    hrefComboRadioButton->setChecked(true);

    hrefCombo->view()->setCurrentIndex( idx );
    hrefCombo->setCurrentIndex( idx.row() );
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:31,代码来源:kjotslinkdialog.cpp


示例2: qCompare

inline bool qCompare(const Akonadi::Collection &left, const Akonadi::Collection &right,
                     const char *actual, const char *expected,
                     const char *file, int line)
{
    return zCompareHelper((left == right) && (left.displayName() == right.displayName()),
                          left, right, actual, expected, file, line);
}
开发者ID:KDE,项目名称:zanshin,代码行数:7,代码来源:akonadifakedatatest.cpp


示例3: save

void CollectionInternalsPage::save(Akonadi::Collection & col)
{
  col.setRemoteId( ui.ridEdit->text() );
  col.setRemoteRevision( ui.rrevEdit->text() );
  col.setContentMimeTypes( ui.contentTypes->items() );
  col.setVirtual( ui.virtCheck->isChecked() );
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:7,代码来源:collectioninternalspage.cpp


示例4: error

void MapiResource::error(const Akonadi::Collection &collection, const QString &body)
{
    static QString prefix = QString::fromAscii("Error %1(%2): %3");
    QString message = prefix.arg(collection.remoteId()).arg(collection.name()).arg(body);

    error(message);
}
开发者ID:KDE,项目名称:akonadi-exchange,代码行数:7,代码来源:mapiresource.cpp


示例5: initializeCollectionList

void CheckIndexingManager::initializeCollectionList(QAbstractItemModel *model, const QModelIndex &parentIndex)
{
    const int rowCount = model->rowCount(parentIndex);
    for (int row = 0; row < rowCount; ++row) {
        const QModelIndex index = model->index(row, 0, parentIndex);
        const Akonadi::Collection collection =
            model->data(
                index, Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();

        if (!collection.isValid() || MailCommon::Util::isVirtualCollection(collection)) {
            continue;
        }
        if (collection.hasAttribute<Akonadi::EntityHiddenAttribute>()) {
            continue;
        }
        if (PimCommon::Util::isImapResource(collection.resource()) && !collection.cachePolicy().localParts().contains(QLatin1String("RFC822"))) {
            continue;
        }
        if (!mCollectionsIndexed.contains(collection.id())) {
            mListCollection.append(collection);
        }
        if (model->rowCount(index) > 0) {
            initializeCollectionList(model, index);
        }
    }
}
开发者ID:KDE,项目名称:kdepim,代码行数:26,代码来源:checkindexingmanager.cpp


示例6: fillRecentCollection

void RecentCollectionAction::fillRecentCollection()
{
  delete mRecentAction->menu();
  if ( mListRecentCollection.isEmpty() ) {
    mRecentAction->setEnabled( false );
    return;
  }

  QMenu* popup = new QMenu;
  mRecentAction->setMenu( popup );

  const int numberOfRecentCollection(mListRecentCollection.count());
  for ( int i=0; i < numberOfRecentCollection; ++i )
  {
    const QModelIndex index = Akonadi::EntityTreeModel::modelIndexForCollection( mModel, Akonadi::Collection( mListRecentCollection.at( i ).toLongLong() ) );
    const Akonadi::Collection collection = mModel->data( index, Akonadi::CollectionModel::CollectionRole ).value<Akonadi::Collection>();
    if ( index.isValid() ) {
      const bool canCreateNewItems = (collection.rights() & Collection::CanCreateItem);
      QAction *action = popup->addAction( actionName( index ) );
      const QIcon icon = mModel->data( index, Qt::DecorationRole ).value<QIcon>();
      action->setIcon( icon );
      action->setData( QVariant::fromValue<QModelIndex>( index ) );
      action->setEnabled(canCreateNewItems);
    }
  }
}
开发者ID:crevetor,项目名称:kcalcore,代码行数:26,代码来源:recentcollectionaction.cpp


示例7: mailBoxForCollections

QString MoveCollectionTask::mailBoxForCollections(const Akonadi::Collection &parent, const Akonadi::Collection &child) const
{
    const QString parentMailbox = mailBoxForCollection(parent);
    if (parentMailbox.isEmpty()) {
        return child.remoteId().mid(1); //Strip separator on toplevel mailboxes
    }
    return parentMailbox + child.remoteId();
}
开发者ID:KDE,项目名称:kdepim-runtime,代码行数:8,代码来源:movecollectiontask.cpp


示例8: detatchCollection

static Akonadi::Collection detatchCollection(const Akonadi::Collection &collection)
{
    //HACK: Attributes are accessed via a const function, and the implicitly shared private pointer thus doesn't detach.
    //We force a detach to avoid surprises. (RetrieveItemsTask used to write back the collection changes, even though the task was canceled)
    //Once this is fixed this function can go away.
    Akonadi::Collection col = collection;
    col.setId(col.id());
    return col;
}
开发者ID:KDE,项目名称:kdepim-runtime,代码行数:9,代码来源:resourcetask.cpp


示例9: reset

void VirtualResource::reset()
{
    Q_ASSERT(mRootCollection.isValid());
    Akonadi::Collection col = mRootCollection;
    CollectionDeleteJob *d = new CollectionDeleteJob(mRootCollection, mSession);
    EXEC(d);
    col.setId(-1);
    createRootCollection(col);
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:9,代码来源:virtualresource.cpp


示例10:

Akonadi::Item::Id KMail::Util::putRepliesInSameFolder( const Akonadi::Item& item )
{
  Akonadi::Collection parentCollection = item.parentCollection();
  if ( parentCollection.isValid() ) {
    const QSharedPointer<FolderCollection> fd = FolderCollection::forCollection( parentCollection, false );
    if( fd->putRepliesInSameFolder() ) {
      return parentCollection.id();
    }
  }
  return -1;
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:11,代码来源:util.cpp


示例11: slotImport

void XXPortManager::slotImport( const QString &identifier )
{
  const XXPort *xxport = mFactory.createXXPort( identifier, mParentWidget );
  if( !xxport ) {
    return;
  }

  const KABC::Addressee::List contacts = xxport->importContacts();

  delete xxport;

  if ( contacts.isEmpty() ) { // nothing to import
    return;
  }

  const QStringList mimeTypes( KABC::Addressee::mimeType() );

  QPointer<Akonadi::CollectionDialog> dlg = new Akonadi::CollectionDialog( mParentWidget );
  dlg->setMimeTypeFilter( mimeTypes );
  dlg->setAccessRightsFilter( Akonadi::Collection::CanCreateItem );
  dlg->setCaption( i18n( "Select Address Book" ) );
  dlg->setDescription(
    i18n( "Select the address book the imported contact(s) shall be saved in:" ) );
  dlg->setDefaultCollection( mDefaultAddressBook );

  if ( !dlg->exec() || !dlg ) {
    delete dlg;
    return;
  }

  const Akonadi::Collection collection = dlg->selectedCollection();
  delete dlg;

  if ( !mImportProgressDialog ) {
    mImportProgressDialog = new KProgressDialog( mParentWidget, i18n( "Import Contacts" ) );
    mImportProgressDialog->setLabelText(
      i18np( "Importing one contact to %2", "Importing %1 contacts to %2",
             contacts.count(), collection.name() ) );
    mImportProgressDialog->setAllowCancel( false );
    mImportProgressDialog->setAutoClose( true );
    mImportProgressDialog->progressBar()->setRange( 1, contacts.count() );
  }

  mImportProgressDialog->show();

  for ( int i = 0; i < contacts.count(); ++i ) {
    Akonadi::Item item;
    item.setPayload<KABC::Addressee>( contacts.at( i ) );
    item.setMimeType( KABC::Addressee::mimeType() );

    Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob( item, collection );
    connect( job, SIGNAL(result(KJob*)), SLOT(slotImportJobDone(KJob*)) );
  }
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:54,代码来源:xxportmanager.cpp


示例12: handlerCollection

Akonadi::Collection TasksHandler::handlerCollection() const
{
    Akonadi::Collection taskCollection;
    taskCollection.setContentMimeTypes( QStringList() << KCalCore::Todo::todoMimeType() );
    taskCollection.setName( i18nc( "@item folder name", "Tasks" ) );
    taskCollection.setRights( Akonadi::Collection::CanChangeItem |
                              Akonadi::Collection::CanCreateItem |
                              Akonadi::Collection::CanDeleteItem );

    return taskCollection;
}
开发者ID:Acidburn0zzz,项目名称:FatCRM,代码行数:11,代码来源:taskshandler.cpp


示例13: collection

Akonadi::Collection SalesforceContactsHandler::collection() const
{
    Akonadi::Collection contactCollection;
    contactCollection.setRemoteId(moduleName());
    contactCollection.setContentMimeTypes(QStringList() << KABC::Addressee::mimeType());
    contactCollection.setName(i18nc("@item folder name", "Contacts"));
    contactCollection.setRights(Akonadi::Collection::CanChangeItem |
                                Akonadi::Collection::CanCreateItem |
                                Akonadi::Collection::CanDeleteItem);

    return contactCollection;
}
开发者ID:winterz,项目名称:FatCRM,代码行数:12,代码来源:salesforcecontactshandler.cpp


示例14: handlerCollection

Akonadi::Collection DocumentsHandler::handlerCollection() const
{
    Akonadi::Collection documentCollection;
    documentCollection.setRemoteId(moduleToName(module()));
    documentCollection.setContentMimeTypes(QStringList() << SugarDocument::mimeType());
    documentCollection.setName(i18nc("@item folder name", "Documents"));
    documentCollection.setRights(Akonadi::Collection::CanChangeItem |
                                 Akonadi::Collection::CanCreateItem |
                                 Akonadi::Collection::CanDeleteItem);

    return documentCollection;
}
开发者ID:KDAB,项目名称:FatCRM,代码行数:12,代码来源:documentshandler.cpp


示例15: slotCollectionRemoved

void FolderArchiveManager::slotCollectionRemoved(const Akonadi::Collection &collection)
{
    KConfig config(FolderArchive::FolderArchiveUtil::configFileName());
    mFolderArchiveCache->clearCacheWithContainsCollection(collection.id());
    Q_FOREACH (FolderArchiveAccountInfo *info, mListAccountInfo) {
        if (info->archiveTopLevel() == collection.id()) {
            info->setArchiveTopLevel(-1);
            KConfigGroup group = config.group(FolderArchive::FolderArchiveUtil::groupConfigPattern() + info->instanceName());
            info->writeConfig(group);
        }
    }
    load();
}
开发者ID:KDE,项目名称:kdepim,代码行数:13,代码来源:folderarchivemanager.cpp


示例16: execute

void EmptyTrashCommand::execute()
{
    if (!mFolder.isValid() && !mModel) {
        emitResult(Failed);
        return;
    }

    if (!mFolder.isValid()) {   //expunge all
        const QString title = i18n("Empty Trash");
        const QString text = i18n("Are you sure you want to empty the trash folders of all accounts?");
        if (KMessageBox::warningContinueCancel(nullptr, text, title,
                                               KStandardGuiItem::cont(), KStandardGuiItem::cancel(),
                                               QStringLiteral("confirm_empty_trash"))
            != KMessageBox::Continue) {
            emitResult(OK);
            return;
        }
        Akonadi::Collection trash = trashCollectionFolder();
        QVector<Akonadi::Collection> trashFolder;
        trashFolder << trash;

        const Akonadi::AgentInstance::List lst = agentInstances();
        for (const Akonadi::AgentInstance &type : lst) {
            if (type.identifier().contains(IMAP_RESOURCE_IDENTIFIER)) {
                if (type.status() == Akonadi::AgentInstance::Broken) {
                    continue;
                }
                OrgKdeAkonadiImapSettingsInterface *iface = Util::createImapSettingsInterface(type.identifier());
                if (iface->isValid()) {
                    const int trashImap = iface->trashCollection();
                    if (trashImap != trash.id()) {
                        trashFolder << Akonadi::Collection(trashImap);
                    }
                }
                delete iface;
            }
        }
        mNumberOfTrashToEmpty = trashFolder.count();
        for (int i = 0; i < mNumberOfTrashToEmpty; ++i) {
            expunge(trashFolder.at(i));
        }
    } else {
        if (folderIsTrash(mFolder)) {
            mNumberOfTrashToEmpty++;
            expunge(mFolder);
        } else {
            emitResult(OK);
        }
    }
}
开发者ID:KDE,项目名称:akonadi-mime,代码行数:50,代码来源:emptytrashcommand.cpp


示例17: linkUrl

QString KJotsLinkDialog::linkUrl() const
{
    if (hrefComboRadioButton->isChecked()){
        const QModelIndex index = hrefCombo->view()->currentIndex();
        const Akonadi::Collection collection = index.data(Akonadi::EntityTreeModel::CollectionRole).value<Akonadi::Collection>();
        if (collection.isValid()) {
          return "kjots://org.kjots.book/" + QString::number(collection.id());
        }
        const Akonadi::Item item = index.data(Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
        Q_ASSERT(item.isValid());
        return "kjots://org.kjots.page/" + QString::number(item.id());
    } else {
        return linkUrlLineEdit->text();
    }
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:15,代码来源:kjotslinkdialog.cpp


示例18: 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


示例19: load

void CollectionGeneralPage::load(const Akonadi::Collection &collection)
{
    init(collection);
    mNameEdit->setEnabled(collection.rights() & Collection::CanChangeCollection);

    const QString displayName = collection.displayName();

    mNameEdit->setText(displayName);
    mBlockAlarmsCheckBox->setChecked(collection.hasAttribute<BlockAlarmsAttribute>() && collection.attribute<BlockAlarmsAttribute>()->isEverythingBlocked());

    QString iconName;
    if (collection.hasAttribute<EntityDisplayAttribute>()) {
        iconName = collection.attribute<EntityDisplayAttribute>()->iconName();
    }

    if (iconName.isEmpty()) {
        const QStringList mimeTypes = collection.contentMimeTypes();
        if (collection.contentMimeTypes().count() > 1 ||
                collection.contentMimeTypes().contains(KCalCore::Event::eventMimeType())) {
            mIconButton->setIcon(QIcon::fromTheme(QStringLiteral("view-pim-calendar")));
        } else if (collection.contentMimeTypes().contains(KCalCore::Todo::todoMimeType())) {
            mIconButton->setIcon(QIcon::fromTheme(QStringLiteral("view-pim-tasks")));
        } else if (collection.contentMimeTypes().contains(KCalCore::Journal::journalMimeType())) {
            mIconButton->setIcon(QIcon::fromTheme(QStringLiteral("view-pim-journal")));
        } else if (mimeTypes.isEmpty()) {
            mIconButton->setIcon(QIcon::fromTheme(QStringLiteral("folder-grey")));
        } else {
            mIconButton->setIcon(QIcon::fromTheme(QStringLiteral("folder")));
        }
    } else {
        mIconButton->setIcon(iconName);
    }
    mIconCheckBox->setChecked(!iconName.isEmpty());
}
开发者ID:KDE,项目名称:kdepim,代码行数:34,代码来源:collectiongeneralpage.cpp


示例20: expunge

void EmptyTrashCommand::expunge(const Akonadi::Collection &col)
{
    if (col.isValid()) {
        Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(col, this);
        connect(job, &Akonadi::ItemFetchJob::result, this, &EmptyTrashCommand::slotExpungeJob);
    } else {
        qCDebug(AKONADIMIME_LOG) << " Try to expunge an invalid collection :" << col;
        emitResult(Failed);
    }
}
开发者ID:KDE,项目名称:akonadi-mime,代码行数:10,代码来源:emptytrashcommand.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ al::ALValue类代码示例发布时间:2022-05-31
下一篇:
C++ fs::path类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap