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


C++ QOrganizerItem类代码示例

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


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

示例1: QVERIFY

void tst_QOrganizerItemDetails::displayLabel()
{
    QOrganizerItemDisplayLabel d1;
    QOrganizerItem oi;

    QVERIFY(d1.label().isEmpty());
    QVERIFY(d1.value(QOrganizerItemDisplayLabel::FieldLabel).isNull());
    d1.setValue(QOrganizerItemDisplayLabel::FieldLabel, "Test");
    QVERIFY(d1.value(QOrganizerItemDisplayLabel::FieldLabel) == QString("Test"));
    QVERIFY(d1.label() == QString("Test"));

    QOrganizerItemDisplayLabel d2;
    d2.setValue(QOrganizerItemDisplayLabel::FieldLabel, "Test 2");

    // test property add - should update.
    QVERIFY(oi.saveDetail(&d2));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeDisplayLabel).count(), 1);
    QVERIFY(oi.saveDetail(&d1));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeDisplayLabel).count(), 1);

    // test property update - should update
    d1.setLabel("Test 3");
    QVERIFY(oi.saveDetail(&d1));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeDisplayLabel).count(), 1);
    QVERIFY(oi.detail(QOrganizerItemDetail::TypeDisplayLabel).value(QOrganizerItemDisplayLabel::FieldLabel) == QString("Test 3"));

    // test property remove
    QVERIFY(oi.removeDetail(&d1)); // can remove display label.  it's unique but not required.
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeDisplayLabel).count(), 0);
}
开发者ID:chriadam,项目名称:qtpim,代码行数:30,代码来源:tst_qorganizeritemdetails.cpp

示例2: QVERIFY

void tst_QOrganizerItemDetails::location()
{
    QOrganizerItemLocation l1;
    QOrganizerItem oi;

    QVERIFY(l1.isEmpty());
    l1.setLatitude(0.12345);
    QVERIFY(!l1.isEmpty());
    QVERIFY(l1.latitude() == 0.12345);
    l1.setValue(QOrganizerItemLocation::FieldLongitude, 0.54321);
    QVERIFY(l1.longitude() == 0.54321);
    l1.setLabel("test");
    QVERIFY(l1.label() == QString("test"));

    QVERIFY(oi.details<QOrganizerItemLocation>().size() == 0);
    QVERIFY(oi.saveDetail(&l1));
    QVERIFY(oi.details<QOrganizerItemLocation>().size() == 1);
    QVERIFY(oi.detail<QOrganizerItemLocation>() == l1);

    l1.setLabel("test 2");
    QVERIFY(oi.detail<QOrganizerItemLocation>() != l1);
    QVERIFY(oi.saveDetail(&l1)); // update.
    QVERIFY(oi.details<QOrganizerItemLocation>().size() == 1); // should update, not add another.
    QVERIFY(oi.detail<QOrganizerItemLocation>() == l1);

    oi.removeDetail(&l1);
    QVERIFY(oi.details<QOrganizerItemLocation>().size() == 0);
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:28,代码来源:tst_qorganizeritemdetails.cpp

示例3: setCalendarItem

bool CalendarPage::setupData(const QNdefMessage message)
{
	QOrganizerItem o = Util::organizerItemFromNdef(message);
	if (o.isEmpty() == true) {
		setCalendarItem(QOrganizerItem());
		return false;
	}

	setCalendarItem(o);
	if (isTemporary() == true) {
		setDefaultName(m_info.displayLabel());
	}
	return true;
}
开发者ID:Ryetschye,项目名称:Tagbuilder,代码行数:14,代码来源:CalendarPage.cpp

示例4: QVERIFY

void tst_QOrganizerItem::details()
{
    // Check that detail keys are unique, regardless of order of initialisation
    // First, construct the detail first, then the contact
    QOrganizerItemComment note;
    note.setComment("Example Note");
    QOrganizerItem keyTest;
    QVERIFY(keyTest.saveDetail(&note));
    QList<QOrganizerItemDetail> allDetails = keyTest.details();
    QList<int> detailKeys;
    foreach (const QOrganizerItemDetail& det, allDetails) {
        int currKey = det.key();
        QVERIFY(!detailKeys.contains(currKey));
        detailKeys.append(currKey);
    }
开发者ID:ionionica,项目名称:qt-mobility,代码行数:15,代码来源:tst_qorganizeritem.cpp

示例5: transformToEntryL

void OrganizerJournalTimeTransform::transformToEntryL(const QOrganizerItem& item, CCalEntry* entry)
{
    if (item.type() == QOrganizerItemType::TypeJournal)
    {
        QOrganizerJournalTime range = item.detail<QOrganizerJournalTime>();
        if (!range.isEmpty())
            entry->SetDTStampL(toTCalTimeL(range.entryDateTime())); // TODO: is DTStamp correct?
    }
}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:9,代码来源:organizerjournaltimerangetransform.cpp

示例6: transformToEntryL

void OrganizerTodoTimeTransform::transformToEntryL(const QOrganizerItem& item, CCalEntry* entry)
{
    if(item.type() == QOrganizerItemType::TypeTodo || item.type() == QOrganizerItemType::TypeTodoOccurrence)
    {
        QOrganizerTodoTime range = item.detail<QOrganizerTodoTime>();
        
        // Nothing to do?
        if (range.isEmpty())
            return;
        
        // On some platforms symbian calendar server does not leave
        // when start date is more than due date. So make the check here.
        if (range.startDateTime().isValid() && range.dueDateTime().isValid()) {
            if (range.startDateTime() > range.dueDateTime())
                User::Leave(KErrArgument);
        }        
            
        entry->SetStartAndEndTimeL(toTCalTimeL(range.startDateTime()), toTCalTimeL(range.dueDateTime()));
    }
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:20,代码来源:organizertodotimerangetransform.cpp

示例7: setCalendarItemThroughAction

void CalendarPage::setCalendarItemThroughAction(const QOrganizerItem item)
{
	setCalendarItem(item);
	setDefaultName(item.displayLabel());
}
开发者ID:Ryetschye,项目名称:Tagbuilder,代码行数:5,代码来源:CalendarPage.cpp

示例8: removeDetail

 void removeDetail(QOrganizerItem& item)
 {
     T detail = item.detail<T>();
     item.removeDetail(&detail);
 }
开发者ID:ionionica,项目名称:qt-mobility,代码行数:5,代码来源:tst_qorganizermanagerdetails.cpp

示例9: QCOMPARE

void tst_QOrganizerItemDetails::timestamp()
{
    QOrganizerItem oi;
    QOrganizerItemTimestamp t1, t2;
    QDateTime modified = QDateTime::currentDateTime();
    QDateTime created = modified.addSecs(-43);

    // test property set
    t1.setCreated(created);
    QCOMPARE(t1.created(), created);
    QCOMPARE(t1.value(QOrganizerItemTimestamp::FieldCreated).toDateTime(), created);

    // test property add
    QVERIFY(oi.saveDetail(&t1));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeTimestamp).count(), 1);
    QCOMPARE(QOrganizerItemTimestamp(oi.details(QOrganizerItemDetail::TypeTimestamp).value(0)).created(), t1.created());

    // test property update
    t1.setValue(101,"label1");
    t1.setLastModified(modified);
    QVERIFY(oi.saveDetail(&t1));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeTimestamp).value(0).value(101).toString(), QString("label1"));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeTimestamp).value(0).value(QOrganizerItemTimestamp::FieldCreated).toDateTime(), created);
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeTimestamp).value(0).value(QOrganizerItemTimestamp::FieldLastModified).toDateTime(), modified);

    // test property remove
    QVERIFY(oi.removeDetail(&t1));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeTimestamp).count(), 0);
    t2.setCreated(created.addSecs(15));
    QVERIFY(oi.saveDetail(&t2));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeTimestamp).count(), 1);
    QVERIFY(oi.removeDetail(&t2));
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeTimestamp).count(), 0);
    QVERIFY(oi.removeDetail(&t2) == false);
    QCOMPARE(oi.details(QOrganizerItemDetail::TypeTimestamp).count(), 0);
}
开发者ID:chriadam,项目名称:qtpim,代码行数:36,代码来源:tst_qorganizeritemdetails.cpp


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