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 0 : FieldMappingPage::FieldMappingPage( OAddessBookSourcePilot* _pParent )
30 : : AddressBookSourcePage(_pParent, "FieldAssignPage",
31 0 : "modules/sabpilot/ui/fieldassignpage.ui")
32 : {
33 0 : get(m_pInvokeDialog, "assign");
34 0 : get(m_pHint, "hint");
35 :
36 0 : m_pInvokeDialog->SetClickHdl( LINK( this, FieldMappingPage, OnInvokeDialog ) );
37 0 : }
38 :
39 0 : FieldMappingPage::~FieldMappingPage()
40 : {
41 0 : disposeOnce();
42 0 : }
43 :
44 0 : void FieldMappingPage::dispose()
45 : {
46 0 : m_pInvokeDialog.clear();
47 0 : m_pHint.clear();
48 0 : AddressBookSourcePage::dispose();
49 0 : }
50 :
51 0 : void FieldMappingPage::ActivatePage()
52 : {
53 0 : AddressBookSourcePage::ActivatePage();
54 0 : m_pInvokeDialog->GrabFocus();
55 0 : }
56 :
57 :
58 0 : void FieldMappingPage::DeactivatePage()
59 : {
60 0 : AddressBookSourcePage::DeactivatePage();
61 0 : }
62 :
63 :
64 0 : void FieldMappingPage::initializePage()
65 : {
66 0 : AddressBookSourcePage::initializePage();
67 0 : implUpdateHint();
68 0 : }
69 :
70 :
71 0 : void FieldMappingPage::implUpdateHint()
72 : {
73 0 : const AddressSettings& rSettings = getSettings();
74 0 : OUString sHint;
75 0 : if ( rSettings.aFieldMapping.empty() )
76 0 : sHint = ModuleRes(RID_STR_NOFIELDSASSIGNED).toString();
77 0 : m_pHint->SetText( sHint );
78 0 : }
79 :
80 :
81 0 : IMPL_LINK_NOARG( FieldMappingPage, OnInvokeDialog )
82 : {
83 0 : AddressSettings& rSettings = getSettings();
84 :
85 : // invoke the dialog doing the mapping
86 0 : if ( fieldmapping::invokeDialog( getORB(), this, getDialog()->getDataSource().getDataSource(), rSettings ) )
87 : {
88 0 : if ( rSettings.aFieldMapping.size() )
89 0 : getDialog()->travelNext();
90 : else
91 0 : implUpdateHint();
92 : }
93 :
94 0 : return 0L;
95 : }
96 :
97 :
98 0 : } // namespace abp
99 :
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|