summaryrefslogtreecommitdiffstats
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-02-07 16:55:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-02-07 17:22:15 +0000
commitaf3662e3e2172c3bc8178f7ce4042ef26eb2ac3a (patch)
tree813dbea6b7142e302ed71dc19c405a7d11b76942 /connectivity
parentmake evolution-3.6 work with address book (diff)
downloadcore-af3662e3e2172c3bc8178f7ce4042ef26eb2ac3a.tar.gz
core-af3662e3e2172c3bc8178f7ce4042ef26eb2ac3a.zip
deliberately continue to use addressbook human name as addressbox identifier
because we identified the addressbook by their user name continue to do that for evo >= 3.6 even though that's got a better uid we could use. This way we can reuse the automatic mapping of fields in writer (search for Personal in officecfg) for mail merge Change-Id: I42e1d7aac9dd9640f0bb38e9224a393ac81481a1
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx12
-rw-r--r--connectivity/source/drivers/evoab2/NResultSet.cxx20
2 files changed, 26 insertions, 6 deletions
diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
index e5b504e2c6b3..a83de24bc724 100644
--- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx
@@ -1131,7 +1131,6 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
if (eds_check_version(3, 6, 0) == NULL)
{
- fprintf(stderr, "OEvoabDatabaseMetaData::getTables\n");
GList *pSources = e_source_registry_list_sources(get_e_source_registry(), E_SOURCE_EXTENSION_ADDRESS_BOOK);
for (GList* liter = pSources; liter; liter = liter->next)
@@ -1158,13 +1157,16 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
ODatabaseMetaDataResultSet::ORow aRow(3);
aRow.reserve(6);
- OUString aUID = OStringToOUString( e_source_get_uid( pSource ),
+ OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ),
RTL_TEXTENCODING_UTF8 );
- aRow.push_back(new ORowSetValueDecorator(aUID));
+ aRow.push_back(new ORowSetValueDecorator(aHumanName)); //tablename
aRow.push_back(new ORowSetValueDecorator(aTable));
- OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ),
+ OUString aUID = OStringToOUString( e_source_get_uid( pSource ),
RTL_TEXTENCODING_UTF8 );
- aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
+ aRow.push_back(new ORowSetValueDecorator(aUID)); //comment
+ //I'd prefer to swap the comment and the human name and
+ //just use e_source_registry_ref_source(get_e_source_registry(), aUID);
+ //in open book rather than search for the name again
aRows.push_back(aRow);
}
diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx
index 13a510d100ec..4baf3ae54800 100644
--- a/connectivity/source/drivers/evoab2/NResultSet.cxx
+++ b/connectivity/source/drivers/evoab2/NResultSet.cxx
@@ -389,8 +389,26 @@ public:
freeContacts();
}
- virtual EBook* openBook(const char *id)
+ virtual EBook* openBook(const char *abname)
{
+ //It would be better if here we had id to begin with, see
+ //NDatabaseMetaData.cxx
+ const char *id = NULL;
+ GList *pSources = e_source_registry_list_sources(get_e_source_registry(), E_SOURCE_EXTENSION_ADDRESS_BOOK);
+ for (GList* liter = pSources; liter; liter = liter->next)
+ {
+ ESource *pSource = E_SOURCE (liter->data);
+
+ if (strcmp(abname, e_source_get_display_name( pSource )) == 0)
+ {
+ id = e_source_get_uid( pSource );
+ break;
+ }
+ }
+ g_list_free_full (pSources, g_object_unref);
+ if (!id)
+ return NULL;
+
ESource *pSource = e_source_registry_ref_source(get_e_source_registry(), id);
EBookClient *pBook = pSource ? e_book_client_new (pSource, NULL) : NULL;
if (pBook && !e_client_open_sync (pBook, TRUE, NULL, NULL))