Kaydet (Commit) 2527a4d5 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Implement some more XModify methods

Change-Id: I1345d6a3d62f1e5c3353c5412024f6b47f824f7a
üst ccfab82e
...@@ -53,6 +53,32 @@ namespace ...@@ -53,6 +53,32 @@ namespace
throw RuntimeException("couldnt get a proxy!"); throw RuntimeException("couldnt get a proxy!");
return proxy; return proxy;
} }
void request(
char const * method, sal_uInt32 xid,
css::uno::Sequence<OUString> const & resources,
OUString const & interaction)
{
std::vector<OString> resUtf8;
std::shared_ptr<GVariantBuilder> builder(
g_variant_builder_new(G_VARIANT_TYPE ("as")), GVariantBuilderDeleter());
for (auto & i: resources) {
auto s(OUStringToOString(i, RTL_TEXTENCODING_UTF8));
resUtf8.push_back(s);
g_variant_builder_add(builder.get(), "s", s.getStr());
}
auto iactUtf8(OUStringToOString(interaction, RTL_TEXTENCODING_UTF8));
std::shared_ptr<GDBusProxy> proxy(
lcl_GetPackageKitProxy("Modify"), GObjectDeleter<GDBusProxy>());
GErrorWrapper error(nullptr);
g_dbus_proxy_call_sync(
proxy.get(), method,
g_variant_new(
"(uass)", static_cast<guint32>(xid), builder.get(),
iactUtf8.getStr()),
G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &error.getRef());
}
} }
namespace shell { namespace sessioninstall namespace shell { namespace sessioninstall
...@@ -63,31 +89,78 @@ namespace shell { namespace sessioninstall ...@@ -63,31 +89,78 @@ namespace shell { namespace sessioninstall
g_type_init (); g_type_init ();
#endif #endif
} }
void SAL_CALL SyncDbusSessionHelper::InstallPackageNames( const ::sal_uInt32 nXid, const Sequence< OUString >& vPackages, const OUString& sInteraction ) throw (RuntimeException, std::exception)
{
vector< OString > vPackagesOString;
vPackagesOString.reserve(vPackages.getLength());
boost::shared_ptr<GVariantBuilder> pBuilder(g_variant_builder_new(G_VARIANT_TYPE ("as")), GVariantBuilderDeleter());
for( const OUString* pPackage = vPackages.begin(); pPackage != vPackages.end(); ++pPackage)
{
vPackagesOString.push_back(OUStringToOString(*pPackage, RTL_TEXTENCODING_ASCII_US));
g_variant_builder_add(pBuilder.get(), "s", vPackagesOString.back().getStr());
}
const OString sInteractionAscii = OUStringToOString(sInteraction, RTL_TEXTENCODING_ASCII_US); void SyncDbusSessionHelper::InstallPackageFiles(
boost::shared_ptr<GDBusProxy> proxy(lcl_GetPackageKitProxy("Modify"), GObjectDeleter<GDBusProxy>()); sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
GErrorWrapper error(NULL); OUString const & interaction)
g_dbus_proxy_call_sync (proxy.get(), throw (css::uno::RuntimeException, std::exception)
"InstallPackageNames", {
g_variant_new ("(uass)", request("InstallPackageFiles", xid, files, interaction);
sal::static_int_cast<guint32>(nXid), }
pBuilder.get(),
sInteractionAscii.getStr()), void SyncDbusSessionHelper::InstallProvideFiles(
G_DBUS_CALL_FLAGS_NONE, sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
-1, /* timeout */ OUString const & interaction)
NULL, /* cancellable */ throw (css::uno::RuntimeException, std::exception)
&error.getRef()); {
} request("InstallProvideFiles", xid, files, interaction);
}
void SyncDbusSessionHelper::InstallCatalogs(
sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
OUString const & interaction)
throw (css::uno::RuntimeException, std::exception)
{
request("InstallCatalogs", xid, files, interaction);
}
void SyncDbusSessionHelper::InstallPackageNames(
sal_uInt32 xid, css::uno::Sequence<OUString> const & packages,
OUString const & interaction)
throw (css::uno::RuntimeException, std::exception)
{
request("InstallPackageNames", xid, packages, interaction);
}
void SyncDbusSessionHelper::InstallMimeTypes(
sal_uInt32 xid, css::uno::Sequence<OUString> const & mimeTypes,
OUString const & interaction)
throw (css::uno::RuntimeException, std::exception)
{
request("InstallMimeTypes", xid, mimeTypes, interaction);
}
void SyncDbusSessionHelper::InstallFontconfigResources(
sal_uInt32 xid, css::uno::Sequence<OUString> const & resources,
OUString const & interaction)
throw (css::uno::RuntimeException, std::exception)
{
request("InstallFontconfigResources", xid, resources, interaction);
}
void SyncDbusSessionHelper::InstallGStreamerResources(
sal_uInt32 xid, css::uno::Sequence<OUString> const & resources,
OUString const & interaction)
throw (css::uno::RuntimeException, std::exception)
{
request("InstallGStreamerResources", xid, resources, interaction);
}
void SyncDbusSessionHelper::RemovePackageByFiles(
sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
OUString const & interaction)
throw (css::uno::RuntimeException, std::exception)
{
request("RemovePackageByFiles", xid, files, interaction);
}
void SyncDbusSessionHelper::InstallPrinterDrivers(
sal_uInt32 xid, css::uno::Sequence<OUString> const & files,
OUString const & interaction)
throw (css::uno::RuntimeException, std::exception)
{
request("InstallPrinteDrivers", xid, files, interaction);
}
void SAL_CALL SyncDbusSessionHelper::IsInstalled( const OUString& sPackagename, const OUString& sInteraction, sal_Bool& o_isInstalled ) throw (RuntimeException, std::exception) void SAL_CALL SyncDbusSessionHelper::IsInstalled( const OUString& sPackagename, const OUString& sInteraction, sal_Bool& o_isInstalled ) throw (RuntimeException, std::exception)
{ {
......
...@@ -22,27 +22,29 @@ namespace shell { namespace sessioninstall ...@@ -22,27 +22,29 @@ namespace shell { namespace sessioninstall
public: public:
SyncDbusSessionHelper(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); SyncDbusSessionHelper(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&);
virtual ~SyncDbusSessionHelper() {} virtual ~SyncDbusSessionHelper() {}
// XModify Methods // XModify Methods
virtual void SAL_CALL InstallPackageNames( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* packages */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL InstallPackageFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL InstallProvideFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL InstallCatalogs( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL InstallPackageNames( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& packages, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL InstallMimeTypes( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& mimeTypes, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL InstallFontconfigResources( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& resources, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL InstallGStreamerResources( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& resources, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL InstallPackageFiles( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented
virtual void SAL_CALL InstallProvideFiles( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented
virtual void SAL_CALL InstallCatalogs( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented
virtual void SAL_CALL InstallMimeTypes( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* mime_types */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented
virtual void SAL_CALL InstallFontconfigResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented
virtual void SAL_CALL InstallGStreamerResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented
virtual void SAL_CALL InstallResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* types */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE virtual void SAL_CALL InstallResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* types */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented { throw ::com::sun::star::uno::RuntimeException(); } // not implemented
virtual void SAL_CALL RemovePackageByFiles( SAL_UNUSED_PARAMETER ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented virtual void SAL_CALL RemovePackageByFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL InstallPrinterDrivers( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
{ throw ::com::sun::star::uno::RuntimeException(); } // not implemented virtual void SAL_CALL InstallPrinterDrivers( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XQuery Methods // XQuery Methods
virtual void SAL_CALL IsInstalled( const OUString& /* package_name */, const OUString& /* interaction */, sal_Bool& /* installed */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; virtual void SAL_CALL IsInstalled( const OUString& /* package_name */, const OUString& /* interaction */, sal_Bool& /* installed */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment