29#pragma GCC diagnostic push
30#pragma GCC diagnostic ignored "-Wunused-function"
32#if __has_warning("-Wdeprecated-volatile")
33#pragma clang diagnostic ignored "-Wdeprecated-volatile"
39#pragma GCC diagnostic pop
43 const char *message,
const char *default_user,
const char *default_domain,
44 GAskPasswordFlags flags);
61 G_OBJECT_CLASS (ooo_mount_operation_parent_class)->finalize (
object);
66 GObjectClass *object_class = G_OBJECT_CLASS (klass);
69 GMountOperationClass *mount_op_class = G_MOUNT_OPERATION_CLASS (klass);
77struct GlibThreadDefaultMainContextScope {
79 GlibThreadDefaultMainContextScope(GMainContext * context):
context_(context)
80 { g_main_context_push_thread_default(context_); }
82 ~GlibThreadDefaultMainContextScope() { g_main_context_pop_thread_default(context_); }
91 const char * ,
const char *default_user,
92 const char *default_domain, GAskPasswordFlags flags)
94 css::uno::Reference< css::task::XInteractionHandler > xIH;
97 GlibThreadDefaultMainContextScope scope(pThis->
context.get());
99 const css::uno::Reference< css::ucb::XCommandEnvironment > &xEnv = *(pThis->
pEnv);
102 xIH = xEnv->getInteractionHandler();
106 g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
110 OUString aDomain, aUserName, aPassword;
113 aUserName = OUString(default_user, strlen(default_user), RTL_TEXTENCODING_UTF8);
116 (flags & G_ASK_PASSWORD_NEED_USERNAME)
122 (flags & G_ASK_PASSWORD_NEED_PASSWORD)
126 OUString aPrevPassword, aPrevUsername;
133 if ( aUserName.isEmpty() )
134 aUserName = aPrevUsername;
136 if ( aPassword.isEmpty() )
137 aPassword = aPrevPassword;
140 (flags & G_ASK_PASSWORD_NEED_DOMAIN)
145 aDomain = OUString(default_domain, strlen(default_domain), RTL_TEXTENCODING_UTF8);
150 xIH->handle( xRequest );
154 if ( !xSelection.is() )
156 g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
160 css::uno::Reference< css::task::XInteractionAbort > xAbort(xSelection.get(), css::uno::UNO_QUERY );
163 g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED);
168 aUserName = xSupp->getUserName();
169 aPassword = xSupp->getPassword();
171 if (flags & G_ASK_PASSWORD_NEED_USERNAME)
172 g_mount_operation_set_username(op,
OUStringToOString(aUserName, RTL_TEXTENCODING_UTF8).getStr());
174 if (flags & G_ASK_PASSWORD_NEED_PASSWORD)
175 g_mount_operation_set_password(op,
OUStringToOString(aPassword, RTL_TEXTENCODING_UTF8).getStr());
177 if (flags & G_ASK_PASSWORD_NEED_DOMAIN)
178 g_mount_operation_set_domain(op,
OUStringToOString(xSupp->getRealm(), RTL_TEXTENCODING_UTF8).getStr());
180 switch (xSupp->getRememberPasswordMode())
183 case css::ucb::RememberAuthentication_NO:
184 g_mount_operation_set_password_save(op, G_PASSWORD_SAVE_NEVER);
186 case css::ucb::RememberAuthentication_SESSION:
187 g_mount_operation_set_password_save(op, G_PASSWORD_SAVE_FOR_SESSION);
189 case css::ucb::RememberAuthentication_PERSISTENT:
190 g_mount_operation_set_password_save(op, G_PASSWORD_SAVE_PERMANENTLY);
200 g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED);
206 pRet->
context = std::move(context);
static void ooo_mount_operation_ask_password(GMountOperation *op, const char *message, const char *default_user, const char *default_domain, GAskPasswordFlags flags)
G_DEFINE_TYPE(OOoMountOperation, ooo_mount_operation, G_TYPE_MOUNT_OPERATION)
static void ooo_mount_operation_init(OOoMountOperation *op)
static void ooo_mount_operation_finalize(GObject *object)
GMountOperation * ooo_mount_operation_new(ucb::ucp::gio::glib::MainContextRef &&context, const css::uno::Reference< css::ucb::XCommandEnvironment > &rEnv)
static void ooo_mount_operation_class_init(OOoMountOperationClass *klass)
#define OOO_MOUNT_OPERATION(o)
#define OOO_TYPE_MOUNT_OPERATION
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
std::unique_ptr< GMainContext, detail::MainContextUnref > MainContextRef
GMountOperation parent_instance
ucb::ucp::gio::glib::MainContextRef context
const css::uno::Reference< css::ucb::XCommandEnvironment > * pEnv
uno::Reference< uno::XComponentContext > context_