Akonadi::Monitor *TripComponentFactory::createNotesMonitor(QObject *parent) { Akonadi::Monitor *chMon = new Akonadi::Monitor(parent); chMon->setMimeTypeMonitored(Akonotes::Note::mimeType()); chMon->itemFetchScope().fetchFullPayload(true); return chMon; }
Akonadi::Monitor *TripComponentFactory::createTodoMonitor(QObject *parent) { Akonadi::Monitor *chMon = new Akonadi::Monitor(parent); chMon->setMimeTypeMonitored(KCalCore::Todo::todoMimeType()); chMon->itemFetchScope().fetchFullPayload(true); return chMon; }
void KPDialog::setupPane() { kDebug() << "Setting up"; // Setup the core model Akonadi::Session *session = new Akonadi::Session( "KPApplet", m_folderListWidget ); Akonadi::Monitor *monitor = new Akonadi::Monitor( m_folderListWidget ); monitor->setCollectionMonitored( Akonadi::Collection::root() ); monitor->fetchCollection( true ); monitor->setMimeTypeMonitored( "message/rfc822", true ); monitor->itemFetchScope().fetchFullPayload(true); Akonadi::EntityTreeModel *entityModel = new Akonadi::EntityTreeModel( session, monitor, m_folderListWidget ); entityModel->setItemPopulationStrategy( Akonadi::EntityTreeModel::LazyPopulation ); // Create the collection view m_folderListView = new Akonadi::EntityTreeView( 0, m_folderListWidget ); m_folderListView->setSelectionMode( QAbstractItemView::ExtendedSelection ); // Setup the message folders collection... Akonadi::EntityFilterProxyModel *collectionFilter = new Akonadi::EntityFilterProxyModel( m_folderListWidget ); collectionFilter->setSourceModel( entityModel ); //collectionFilter->addMimeTypeInclusionFilter( "message/rfc822" ); collectionFilter->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() ); collectionFilter->setHeaderSet( Akonadi::EntityTreeModel::CollectionTreeHeaders ); // ... with statistics... Akonadi::StatisticsToolTipProxyModel *statisticsProxyModel = new Akonadi::StatisticsToolTipProxyModel( m_folderListWidget ); statisticsProxyModel->setSourceModel( collectionFilter ); // ... and sortable QSortFilterProxyModel *sortModel = new QSortFilterProxyModel( m_folderListWidget ); sortModel->setDynamicSortFilter( true ); sortModel->setSortCaseSensitivity( Qt::CaseInsensitive ); sortModel->setSourceModel( statisticsProxyModel ); // Use the model m_folderListView->setModel( sortModel ); entityModel->setRootCollection(Akonadi::Collection::root()); // Now make the message list multi-tab pane m_messagePane = new MessageList::Pane( entityModel, m_folderListView->selectionModel(), m_messageListWidget ); //connect( m_messagePane, SIGNAL(messageSelected(Akonadi::Item)), // this, SLOT(slotMessageSelected(Akonadi::Item)) ); }
void TagTest::testTagItem() { Akonadi::Monitor monitor; monitor.itemFetchScope().setFetchTags(true); monitor.setAllMonitored(true); const Collection res3 = Collection(collectionIdFromPath(QStringLiteral("res3"))); Tag tag; { TagCreateJob *createjob = new TagCreateJob(Tag(QStringLiteral("gid1")), this); AKVERIFYEXEC(createjob); tag = createjob->tag(); } Item item1; { item1.setMimeType(QStringLiteral("application/octet-stream")); ItemCreateJob *append = new ItemCreateJob(item1, res3, this); AKVERIFYEXEC(append); item1 = append->item(); } item1.setTag(tag); QSignalSpy tagsSpy(&monitor, SIGNAL(itemsTagsChanged(Akonadi::Item::List,QSet<Akonadi::Tag>,QSet<Akonadi::Tag>))); QVERIFY(tagsSpy.isValid()); ItemModifyJob *modJob = new ItemModifyJob(item1, this); AKVERIFYEXEC(modJob); QTRY_VERIFY(tagsSpy.count() >= 1); QTRY_COMPARE(tagsSpy.last().first().value<Akonadi::Item::List>().first().id(), item1.id()); QTRY_COMPARE(tagsSpy.last().at(1).value< QSet<Tag> >().size(), 1); //1 added tag ItemFetchJob *fetchJob = new ItemFetchJob(item1, this); fetchJob->fetchScope().setFetchTags(true); AKVERIFYEXEC(fetchJob); QCOMPARE(fetchJob->items().first().tags().size(), 1); TagDeleteJob *deleteJob = new TagDeleteJob(tag, this); AKVERIFYEXEC(deleteJob); }