Debian Codegraph @

vcl/unx/gtk3_kde5/gtk3_kde5_folderpicker.cxx

raw
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 "gtk3_kde5_folderpicker.hxx"
21
22 #include <vcl/svapp.hxx>
23
24 #include <fpicker/strings.hrc>
25
26 using namespace ::com::sun::star;
27 using namespace ::com::sun::star::ui::dialogs;
28 using namespace ::com::sun::star::lang;
29 using namespace ::com::sun::star::uno;
30
31 // constructor
32
33 Gtk3KDE5FolderPicker::Gtk3KDE5FolderPicker(
34 const uno::Reference<uno::XComponentContext>& /*xContext*/)
35 {
36 m_ipc.sendCommand(Commands::EnablePickFolderMode);
37 setTitle(getResString(STR_SVT_FOLDERPICKER_DEFAULT_TITLE));
38 }
39
40 Gtk3KDE5FolderPicker::~Gtk3KDE5FolderPicker() = default;
41
42 void SAL_CALL Gtk3KDE5FolderPicker::setDisplayDirectory(const OUString& aDirectory)
43 {
44 m_ipc.sendCommand(Commands::SetDisplayDirectory, aDirectory);
45 }
46
47 OUString SAL_CALL Gtk3KDE5FolderPicker::getDisplayDirectory()
48 {
49 auto id = m_ipc.sendCommand(Commands::GetDisplayDirectory);
50 OUString ret;
51 m_ipc.readResponse(id, ret);
52 return ret;
53 }
54
55 OUString SAL_CALL Gtk3KDE5FolderPicker::getDirectory()
56 {
57 auto id = m_ipc.sendCommand(Commands::GetSelectedFiles);
58 uno::Sequence<OUString> seq;
59 m_ipc.readResponse(id, seq);
60 return seq.hasElements() ? seq[0] : OUString();
61 }
62
63 void SAL_CALL Gtk3KDE5FolderPicker::setDescription(const OUString& /*rDescription*/) {}
64
65 // XExecutableDialog functions
66
67 void SAL_CALL Gtk3KDE5FolderPicker::setTitle(const OUString& aTitle)
68 {
69 m_ipc.sendCommand(Commands::SetTitle, aTitle);
70 }
71
72 sal_Int16 SAL_CALL Gtk3KDE5FolderPicker::execute()
73 {
74 SolarMutexGuard g;
75 return m_ipc.execute();
76 }
77
78 // XCancellable
79
80 void SAL_CALL Gtk3KDE5FolderPicker::cancel()
81 {
82 // TODO
83 }
84
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */