tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / ui / dlg / ConnectionHelper.hxx
blobbbcf24783355995192350274bec6c7cf91f9f3ff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include "adminpages.hxx"
23 #include <curledit.hxx>
24 #include <sfx2/filedlghelper.hxx>
26 namespace dbaui
29 enum IS_PATH_EXIST
31 PATH_NOT_EXIST = 0,
32 PATH_EXIST,
33 PATH_NOT_KNOWN
36 class OConnectionHelper : public OGenericAdministrationPage
38 bool m_bUserGrabFocus;
40 public:
41 OConnectionHelper(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OUString& _rId, const SfxItemSet& _rCoreAttrs);
42 virtual ~OConnectionHelper() override;
44 OUString m_eType; // the type can't be changed in this class, so we hold it as member.
45 // setting/retrieving the current connection URL
46 // necessary because for some types, the URL must be decoded for display purposes
47 ::dbaccess::ODsnTypeCollection* m_pCollection; /// the DSN type collection instance
49 std::unique_ptr<weld::Label> m_xFT_Connection;
50 std::unique_ptr<weld::Button> m_xPB_Connection;
51 std::unique_ptr<weld::Button> m_xPB_CreateDB;
52 std::unique_ptr<OConnectionURLEdit> m_xConnectionURL;
54 public:
56 // <method>OGenericAdministrationPage::fillControls</method>
57 virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
58 // <method>OGenericAdministrationPage::fillWindows</method>
59 virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
60 virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
62 // setting/retrieving the current connection URL
63 // necessary because for some types, the URL must be decoded for display purposes
64 //String getURL( OConnectionURLEdit* _m_pConnection ) const;
65 //void setURL( const OUString& _rURL, OConnectionURLEdit* _m_pConnection );
67 OUString getURLNoPrefix( ) const;
68 void setURLNoPrefix( std::u16string_view _rURL );
70 /** checks if the path is existence
71 @param _rURL
72 The URL to check.
74 sal_Int32 checkPathExistence(const OUString& _rURL);
76 IS_PATH_EXIST pathExists(const OUString& _rURL, bool bIsFile) const;
77 bool createDirectoryDeep(std::u16string_view _rPathNormalized);
78 bool commitURL();
80 /** opens the FileOpen dialog and asks for a FileName
81 @param _aFileOpen
82 Executes the file open dialog, which must be filled from caller.
84 void askForFileName(::sfx2::FileDialogHelper& _aFileOpen);
86 protected:
87 void setURL( std::u16string_view _rURL );
88 virtual bool checkTestConnection();
90 private:
91 DECL_LINK(OnBrowseConnections, weld::Button&, void);
92 DECL_LINK(OnCreateDatabase, weld::Button&, void);
93 DECL_LINK(GetFocusHdl, weld::Widget&, void);
94 DECL_LINK(LoseFocusHdl, weld::Widget&, void);
95 OUString impl_getURL() const;
96 void impl_setURL( std::u16string_view _rURL, bool _bPrefix );
97 void implUpdateURLDependentStates() const;
101 } // namespace dbaui
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */