[Libreoffice-commits] core.git: connectivity/source
Julien Nabet
serval2412 at yahoo.fr
Tue Jan 6 19:37:59 PST 2015
connectivity/source/drivers/mork/MConnection.cxx | 11 +++++++
connectivity/source/drivers/mork/MDatabaseMetaDataHelper.cxx | 17 ++++++++++-
connectivity/source/drivers/mork/MQueryHelper.cxx | 10 +++++-
connectivity/source/drivers/mork/MorkParser.hxx | 5 +++
4 files changed, 41 insertions(+), 2 deletions(-)
New commits:
commit a527ad98e58a7fc9af482f9088687d82e5c52cca
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Tue Jan 6 00:24:45 2015 +0100
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 at mamane.lu>
Tested-by: Lionel Elie Mamane <lionel at mamane.lu>
diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx
index 2c5748b..7225fc9 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 5c530d8..f04f2bf 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 3d9a9ae..6139d5e 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 1effb8f..a6ffc85 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_;
More information about the Libreoffice-commits
mailing list