Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : #include "MNSProfileDiscover.hxx"
3 : #include "MorkParser.hxx"
4 :
5 :
6 : using namespace connectivity::mork;
7 :
8 0 : bool openAddressBook(const std::string& path)
9 : {
10 0 : MorkParser mork;
11 : // Open and parse mork file
12 0 : if (!mork.open(path))
13 : {
14 0 : return false;
15 : }
16 0 : const int defaultScope = 0x80;
17 0 : MorkTableMap::Map::iterator tableIter;
18 0 : MorkTableMap *Tables = mork.getTables( defaultScope );
19 0 : if ( Tables )
20 : {
21 : // Iterate all tables
22 0 : for ( tableIter = Tables->map.begin(); tableIter != Tables->map.end(); ++tableIter )
23 : {
24 0 : if ( 0 == tableIter->first ) continue;
25 : SAL_INFO("connectivity.mork", "table->first : " << tableIter->first);
26 0 : std::string column = mork.getColumn( tableIter->first );
27 0 : std::string value = mork.getValue( tableIter->first );
28 : SAL_INFO("connectivity.mork", "table.column : " << column);
29 : SAL_INFO("connectivity.mork", "table.value : " << value);
30 0 : }
31 : }
32 :
33 0 : mork.dump();
34 :
35 0 : return true;
36 : }
37 :
38 0 : int main(void)
39 : {
40 0 : ProfileAccess* access = new ProfileAccess();
41 0 : OUString defaultProfile = access->getDefaultProfile(::com::sun::star::mozilla::MozillaProductType_Thunderbird);
42 : SAL_INFO("connectivity.mork", "DefaultProfile: " << defaultProfile);
43 :
44 0 : OUString profilePath = access->getProfilePath(::com::sun::star::mozilla::MozillaProductType_Thunderbird, defaultProfile);
45 : SAL_INFO("connectivity.mork", "ProfilePath: " << profilePath);
46 :
47 0 : profilePath += OUString( "/abook.mab" );
48 :
49 : SAL_INFO("connectivity.mork", "abook.mab: " << profilePath);
50 0 : OString aOString = OUStringToOString( profilePath, RTL_TEXTENCODING_UTF8 );
51 0 : openAddressBook(aOString.getStr());
52 0 : }
53 :
54 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|