diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2015-01-06 00:24:45 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2015-01-07 03:37:31 +0000 |
commit | a527ad98e58a7fc9af482f9088687d82e5c52cca (patch) | |
tree | bb27e94e7318fddae87d1f44a2ed036d27840e14 | |
parent | 1f4fd70495b3d0e732447e8e60e5faa9086471a8 (diff) |
Resolves fdo#87789: show groups in collected addresses
Retrieves lists in CollectedAddressBook and retrieves the right mork parser
However, it doesn't take into account addresses books created by user
Change-Id: I2cee6ba7afd43dd772f69af6686cc4308e753e66
Reviewed-on: https://gerrit.libreoffice.org/13760
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
4 files changed, 41 insertions, 2 deletions
diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx index 2c5748b06f48..7225fc9f432c 100644 --- a/connectivity/source/drivers/mork/MConnection.cxx +++ b/connectivity/source/drivers/mork/MConnection.cxx @@ -169,6 +169,17 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& SAL_INFO("connectivity.mork", "table->first : " << tableIter->first); } } + // check that we can retrieve the history tables: + MorkTableMap *Tables_hist = m_pHistory->getTables( defaultScope ); + if (Tables_hist) + { + // Iterate all tables + for ( tableIter = Tables_hist->begin(); tableIter != Tables_hist->end(); ++tableIter ) + { + if ( 0 == tableIter->first ) continue; + SAL_INFO("connectivity.mork", "table->first : " << tableIter->first); + } + } } // XServiceInfo diff --git a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx index 5c530d869837..f04f2bf84360 100644 --- a/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx +++ b/connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx @@ -58,12 +58,27 @@ bool MDatabaseMetaDataHelper::getTableStrings( OConnection* _pCon, /* retrieve list table names (not from collected ab) */ std::set<std::string> lists; - _pCon->getMorkParser("AddressBook")->retrieveLists(lists); + MorkParser* pMork = _pCon->getMorkParser("AddressBook"); + pMork->retrieveLists(lists); for (::std::set<std::string>::iterator iter = lists.begin(); iter != lists.end(); ++iter) { OUString groupTableName = OStringToOUString((*iter).c_str(), RTL_TEXTENCODING_UTF8); SAL_INFO("connectivity.mork", "add Table " << groupTableName); _rStrings.push_back(groupTableName); + // remember the list in the mork parser, we'll use it later + pMork->lists_.push_back(groupTableName); + } + + std::set<std::string> lists_history; + pMork = _pCon->getMorkParser("CollectedAddressBook"); + pMork->retrieveLists(lists_history); + for (::std::set<std::string>::iterator iter = lists_history.begin(); iter != lists_history.end(); ++iter) { + OUString groupTableName = OStringToOUString((*iter).c_str(), RTL_TEXTENCODING_UTF8); + SAL_INFO("connectivity.mork", "add Table " << groupTableName); + + _rStrings.push_back(groupTableName); + // remember the list in the mork parser, we'll use it later + pMork->lists_.push_back(groupTableName); } return true; diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx index 3d9a9aeed384..6139d5e54504 100644 --- a/connectivity/source/drivers/mork/MQueryHelper.cxx +++ b/connectivity/source/drivers/mork/MQueryHelper.cxx @@ -195,7 +195,15 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression OString oStringTable = OUStringToOString( m_aAddressbook, RTL_TEXTENCODING_UTF8 ); std::set<int> listRecords; bool handleListTable = false; - MorkParser* xMork = xConnection->getMorkParser(oStringTable); + + // Let's try to retrieve the list in Collected Addresses book + MorkParser* xMork = xConnection->getMorkParser(OString("CollectedAddressBook")); + if (std::find(xMork->lists_.begin(), xMork->lists_.end(), m_aAddressbook) == xMork->lists_.end()) + { + // so the list is in Address book + // TODO : manage case where an address book has been created + xMork = xConnection->getMorkParser(OString("AddressBook")); + } // check if we are retrieving the default table if (oStringTable != "AddressBook" && oStringTable != "CollectedAddressBook") diff --git a/connectivity/source/drivers/mork/MorkParser.hxx b/connectivity/source/drivers/mork/MorkParser.hxx index 1effb8f41397..a6ffc852ae62 100644 --- a/connectivity/source/drivers/mork/MorkParser.hxx +++ b/connectivity/source/drivers/mork/MorkParser.hxx @@ -36,6 +36,7 @@ #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MORKPARSER_HXX #include <sal/types.h> +#include <rtl/ustring.hxx> #include <string> #include <map> @@ -113,6 +114,9 @@ public: void dump(); + // All lists + std::vector<OUString> lists_; + protected: // Members void initVars(); @@ -149,6 +153,7 @@ protected: // Data // All Mork data std::string morkData_; + unsigned morkPos_; int nextAddValueId_; int defaultScope_; |