Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "fieldmappingpage.hxx"
21 : #include "fieldmappingimpl.hxx"
22 : #include "addresssettings.hxx"
23 : #include "abspilot.hxx"
24 : #include <comphelper/processfactory.hxx>
25 :
26 :
27 : namespace abp
28 : {
29 : //= FieldMappingPage
30 0 : FieldMappingPage::FieldMappingPage( OAddessBookSourcePilot* _pParent )
31 : : AddressBookSourcePage(_pParent, "FieldAssignPage",
32 0 : "modules/sabpilot/ui/fieldassignpage.ui")
33 : {
34 0 : get(m_pInvokeDialog, "assign");
35 0 : get(m_pHint, "hint");
36 :
37 0 : m_pInvokeDialog->SetClickHdl( LINK( this, FieldMappingPage, OnInvokeDialog ) );
38 0 : }
39 :
40 0 : void FieldMappingPage::ActivatePage()
41 : {
42 0 : AddressBookSourcePage::ActivatePage();
43 0 : m_pInvokeDialog->GrabFocus();
44 0 : }
45 :
46 :
47 0 : void FieldMappingPage::DeactivatePage()
48 : {
49 0 : AddressBookSourcePage::DeactivatePage();
50 0 : }
51 :
52 :
53 0 : void FieldMappingPage::initializePage()
54 : {
55 0 : AddressBookSourcePage::initializePage();
56 0 : implUpdateHint();
57 0 : }
58 :
59 :
60 0 : void FieldMappingPage::implUpdateHint()
61 : {
62 0 : const AddressSettings& rSettings = getSettings();
63 0 : OUString sHint;
64 0 : if ( rSettings.aFieldMapping.empty() )
65 0 : sHint = ModuleRes(RID_STR_NOFIELDSASSIGNED).toString();
66 0 : m_pHint->SetText( sHint );
67 0 : }
68 :
69 :
70 0 : IMPL_LINK( FieldMappingPage, OnInvokeDialog, void*, /*NOTINTERESTEDIN*/ )
71 : {
72 0 : AddressSettings& rSettings = getSettings();
73 :
74 : // invoke the dialog doing the mapping
75 0 : if ( fieldmapping::invokeDialog( getORB(), this, getDialog()->getDataSource().getDataSource(), rSettings ) )
76 : {
77 0 : if ( rSettings.aFieldMapping.size() )
78 0 : getDialog()->travelNext();
79 : else
80 0 : implUpdateHint();
81 : }
82 :
83 0 : return 0L;
84 : }
85 :
86 :
87 0 : } // namespace abp
88 :
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|