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::iterator tableIter;
18 0 : MorkTableMap *Tables = mork.getTables( defaultScope );
19 0 : if ( Tables )
20 : {
21 : // Iterate all tables
22 0 : for ( tableIter = Tables->begin(); tableIter != Tables->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( int argc, const char* argv[] )
39 : {
40 0 : int x = argc;
41 0 : x++;
42 0 : argv++;
43 0 : ProfileAccess* access = new ProfileAccess();
44 0 : OUString defaultProfile = access->getDefaultProfile(::com::sun::star::mozilla::MozillaProductType_Thunderbird);
45 : SAL_INFO("connectivity.mork", "DefaultProfile: " << defaultProfile);
46 :
47 0 : OUString profilePath = access->getProfilePath(::com::sun::star::mozilla::MozillaProductType_Thunderbird, defaultProfile);
48 : SAL_INFO("connectivity.mork", "ProfilePath: " << profilePath);
49 :
50 0 : profilePath += OUString( "/abook.mab" );
51 :
52 : SAL_INFO("connectivity.mork", "abook.mab: " << profilePath);
53 0 : OString aOString = OUStringToOString( profilePath, RTL_TEXTENCODING_UTF8 );
54 0 : openAddressBook(aOString.getStr());
55 0 : }
56 :
57 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|