コード例 #1
0
ファイル: filterproxymodel.cpp プロジェクト: KDAB/FatCRM
static bool accountMatchesFilter(const SugarAccount &account, const QString &filter)
{
    if (account.name().contains(filter, Qt::CaseInsensitive)) {
        return true;
    }
    if (account.billingAddressCity().contains(filter, Qt::CaseInsensitive) ||
            account.shippingAddressCity().contains(filter, Qt::CaseInsensitive) ||
            account.billingAddressStreet().contains(filter, Qt::CaseInsensitive) ||
            account.shippingAddressStreet().contains(filter, Qt::CaseInsensitive)) {
        return true;
    }
    if (account.email1().contains(filter, Qt::CaseInsensitive)) {
        return true;
    }
    if (account.billingAddressCountry().contains(filter, Qt::CaseInsensitive)) {
        return true;
    }
    if (account.phoneOffice().contains(filter, Qt::CaseInsensitive)) {
        return true;
    }
    if (account.postalCodeForGui().contains(filter, Qt::CaseInsensitive)) {
        return true;
    }
    return false;
}
コード例 #2
0
 void testImportingAccounts()
 {
     ContactsImporter importer;
     QTemporaryFile file;
     writeTempFile(file,
     "David,Faure,Mr,12345,[email protected],KDAB,\"32, street name\",Vedène,84000,,France,FR 12345");
     QVERIFY(importer.importFile(file.fileName()));
     const QVector<SugarAccount> accounts = importer.accounts();
     QCOMPARE(accounts.size(), 1);
     const SugarAccount account = accounts.at(0);
     QCOMPARE(account.name(), QString("KDAB"));
     QCOMPARE(account.billingAddressStreet(), QString::fromUtf8("32, street name"));
     QCOMPARE(account.billingAddressCity(), QString::fromUtf8("Vedène"));
     QCOMPARE(account.billingAddressCountry(), QString::fromUtf8("France"));
     QCOMPARE(account.billingAddressPostalcode(), QString::fromUtf8("84000"));
     QCOMPARE(account.billingAddressState(), QString());
 }