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