Kaydet (Commit) af3662e3 authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst 157d94d3
...@@ -1131,7 +1131,6 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( ...@@ -1131,7 +1131,6 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
if (eds_check_version(3, 6, 0) == NULL) 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); GList *pSources = e_source_registry_list_sources(get_e_source_registry(), E_SOURCE_EXTENSION_ADDRESS_BOOK);
for (GList* liter = pSources; liter; liter = liter->next) for (GList* liter = pSources; liter; liter = liter->next)
...@@ -1158,13 +1157,16 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( ...@@ -1158,13 +1157,16 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables(
ODatabaseMetaDataResultSet::ORow aRow(3); ODatabaseMetaDataResultSet::ORow aRow(3);
aRow.reserve(6); aRow.reserve(6);
OUString aUID = OStringToOUString( e_source_get_uid( pSource ), OUString aHumanName = OStringToOUString( e_source_get_display_name( pSource ),
RTL_TEXTENCODING_UTF8 ); RTL_TEXTENCODING_UTF8 );
aRow.push_back(new ORowSetValueDecorator(aUID)); aRow.push_back(new ORowSetValueDecorator(aHumanName)); //tablename
aRow.push_back(new ORowSetValueDecorator(aTable)); 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 ); 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); aRows.push_back(aRow);
} }
......
...@@ -389,8 +389,26 @@ public: ...@@ -389,8 +389,26 @@ public:
freeContacts(); 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); ESource *pSource = e_source_registry_ref_source(get_e_source_registry(), id);
EBookClient *pBook = pSource ? e_book_client_new (pSource, NULL) : NULL; EBookClient *pBook = pSource ? e_book_client_new (pSource, NULL) : NULL;
if (pBook && !e_client_open_sync (pBook, TRUE, NULL, NULL)) if (pBook && !e_client_open_sync (pBook, TRUE, NULL, NULL))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment