Kaydet (Commit) 87297284 authored tarafından Szymon Kłos's avatar Szymon Kłos

RemoteFilesDialog

Change-Id: I296ce6233287dac5447462faa4b7404c25297f8b
üst ee79541a
......@@ -215,6 +215,7 @@ public:
SAL_DLLPRIVATE void NewDocDirectExec_Impl(SfxRequest &);
SAL_DLLPRIVATE void NewDocExec_Impl(SfxRequest &);
SAL_DLLPRIVATE void OpenDocExec_Impl(SfxRequest &);
SAL_DLLPRIVATE void OpenRemoteExec_Impl(SfxRequest &);
SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &);
SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &);
SAL_DLLPRIVATE void PropExec_Impl(SfxRequest &);
......
......@@ -96,6 +96,7 @@
// default-ids for document
#define SID_NEWDOC (SID_SFX_START + 500)
#define SID_OPENDOC (SID_SFX_START + 501)
#define SID_OPENREMOTE (SID_SFX_START + 517)
#define SID_OPENURL (SID_SFX_START + 596)
#define SID_SAVEASURL (SID_SFX_START + 643)
#define SID_JUMPTOMARK (SID_SFX_START + 598)
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
#define INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
#include <svtools/svtdllapi.h>
#include <svtools/place.hxx>
#include <svtools/PlaceEditDialog.hxx>
#include <vcl/button.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/dialog.hxx>
#include <vcl/vclptr.hxx>
#include <officecfg/Office/Common.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <vector>
enum SvtRemoteDlgMode
{
REMOTEDLG_MODE_OPEN = 0,
REMOTEDLG_MODE_SAVE = 1
};
typedef std::shared_ptr<Place> ServicePtr;
class SVT_DLLPUBLIC RemoteFilesDialog : public ModalDialog
{
public:
RemoteFilesDialog(vcl::Window* pParent, WinBits nBits);
private:
::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_context;
SvtRemoteDlgMode m_eMode;
VclPtr<PushButton> m_pOpen_btn;
VclPtr<PushButton> m_pSave_btn;
VclPtr<CancelButton> m_pCancel_btn;
VclPtr<PushButton> m_pAddService_btn;
VclPtr<ListBox> m_pServices_lb;
std::vector<ServicePtr> m_aServices;
void fillServicesListbox();
DECL_LINK ( AddServiceHdl, void * );
};
#endif // INCLUDED_SVTOOLS_REMOTEFILESDIALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -29,6 +29,10 @@ interface Documents
[
ExecMethod = OpenDocExec_Impl ;
]
SID_OPENREMOTE
[
ExecMethod = OpenRemoteExec_Impl ;
]
SID_OPENHYPERLINK // ole(no) api(final/play/rec)
[
ExecMethod = OpenDocExec_Impl ;
......
......@@ -3800,6 +3800,30 @@ SfxObjectItem Open SID_OPENDOC
GroupId = GID_APPLICATION;
]
SfxObjectItem OpenRemote SID_OPENREMOTE
()
[
/* flags: */
AutoUpdate = FALSE,
Cachable = Cachable,
FastCall = FALSE,
HasCoreId = FALSE,
HasDialog = TRUE,
ReadOnlyDoc = TRUE,
Toggle = FALSE,
Container = TRUE,
RecordAbsolute = FALSE,
RecordPerSet;
Asynchron;
/* config: */
AccelConfig = TRUE,
MenuConfig = TRUE,
StatusBarConfig = FALSE,
ToolBoxConfig = TRUE,
GroupId = GID_APPLICATION;
]
SfxObjectItem WebHtml SID_WEBHTML
()
[
......
......@@ -98,6 +98,7 @@
#include <sfx2/event.hxx>
#include <sfx2/templatedlg.hxx>
#include "openuriexternally.hxx"
#include <svtools/RemoteFilesDialog.hxx>
#include <officecfg/Office/ProtocolHandler.hxx>
......@@ -1124,4 +1125,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
}
}
void SfxApplication::OpenRemoteExec_Impl( SfxRequest& )
{
ScopedVclPtrInstance< RemoteFilesDialog > aDlg((vcl::Window*)NULL, WB_OPEN);
aDlg->Execute();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -69,6 +69,7 @@ const char BASE_URL[] = "private:factory/sdatabase?Interactive";
const char MATH_URL[] = "private:factory/smath";
const char TEMPLATE_URL[] = ".uno:NewDoc";
const char OPEN_URL[] = ".uno:Open";
const char REMOTE_URL[] = ".uno:OpenRemote";
const char SERVICENAME_CFGREADACCESS[] = "com.sun.star.configuration.ConfigurationAccess";
// increase size of the text in the buttons on the left fMultiplier-times
......@@ -103,6 +104,7 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) :
m_pUIBuilder = new VclBuilder(this, getUIRootDir(), "sfx/ui/startcenter.ui", "StartCenter" );
get(mpOpenButton, "open_all");
get(mpRemoteButton, "open_remote");
get(mpRecentButton, "open_recent");
get(mpTemplateButton, "templates_all");
......@@ -215,6 +217,7 @@ void BackingWindow::dispose()
}
disposeBuilder();
mpOpenButton.clear();
mpRemoteButton.clear();
mpRecentButton.clear();
mpTemplateButton.clear();
mpCreateLabel.clear();
......@@ -291,6 +294,7 @@ void BackingWindow::initControls()
mpLocalView->setOpenTemplateHdl(LINK(this,BackingWindow,OpenTemplateHdl));
setupButton( mpOpenButton );
setupButton( mpRemoteButton );
setupButton( mpRecentButton );
setupButton( mpTemplateButton );
setupButton( mpWriterAllButton );
......@@ -577,6 +581,14 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
dispatchURL( OPEN_URL, OUString(), xFrame, aArgs );
}
else if( pButton == mpRemoteButton )
{
Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY );
Sequence< com::sun::star::beans::PropertyValue > aArgs(0);
dispatchURL( REMOTE_URL, OUString(), xFrame, aArgs );
}
else if( pButton == mpRecentButton )
{
mpLocalView->Hide();
......
......@@ -61,6 +61,7 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer
VclPtr<PushButton> mpOpenButton;
VclPtr<PushButton> mpRecentButton;
VclPtr<PushButton> mpRemoteButton;
VclPtr<MenuButton> mpTemplateButton;
VclPtr<FixedText> mpCreateLabel;
......
......@@ -135,6 +135,26 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="open_remote">
<property name="label" translatable="yes">_Open Remote File</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_top">6</property>
<property name="image">open_all_image</property>
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="open_recent">
<property name="label" translatable="yes">_Recent Files</property>
......@@ -151,7 +171,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
......@@ -170,7 +190,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
......@@ -183,7 +203,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
......@@ -198,7 +218,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
......@@ -218,7 +238,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
<child>
......@@ -238,7 +258,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
<child>
......@@ -258,7 +278,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
<property name="position">8</property>
</packing>
</child>
<child>
......@@ -278,7 +298,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">8</property>
<property name="position">9</property>
</packing>
</child>
<child>
......@@ -298,7 +318,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">9</property>
<property name="position">10</property>
</packing>
</child>
<child>
......@@ -318,7 +338,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">10</property>
<property name="position">11</property>
</packing>
</child>
<child>
......@@ -329,7 +349,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">11</property>
<property name="position">12</property>
</packing>
</child>
<child>
......@@ -342,7 +362,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">12</property>
<property name="position">13</property>
</packing>
</child>
</object>
......
......@@ -137,6 +137,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/dialogs/mcvmath \
svtools/source/dialogs/PlaceEditDialog \
svtools/source/dialogs/prnsetup \
svtools/source/dialogs/RemoteFilesDialog \
svtools/source/dialogs/restartdialog \
svtools/source/dialogs/roadmapwizard \
svtools/source/dialogs/ServerDetailsControls \
......
......@@ -17,6 +17,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svt,\
svtools/uiconfig/ui/placeedit \
svtools/uiconfig/ui/printersetupdialog \
svtools/uiconfig/ui/querydeletedialog \
svtools/uiconfig/ui/remotefilesdialog \
svtools/uiconfig/ui/restartdialog \
svtools/uiconfig/ui/wizarddialog \
))
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <svtools/RemoteFilesDialog.hxx>
using namespace ::com::sun::star::uno;
RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
: ModalDialog(pParent, "RemoteFilesDialog", "svt/ui/remotefilesdialog.ui")
, m_context(comphelper::getProcessComponentContext())
{
get(m_pOpen_btn, "open");
get(m_pSave_btn, "save");
get(m_pCancel_btn, "cancel");
get(m_pAddService_btn, "add_service_btn");
get(m_pServices_lb, "services_lb");
m_eMode = (nBits & WB_SAVEAS) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN;
if(m_eMode == REMOTEDLG_MODE_OPEN)
{
m_pSave_btn->Hide();
m_pOpen_btn->Show();
}
else
{
m_pSave_btn->Show();
m_pOpen_btn->Hide();
}
m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl) );
fillServicesListbox();
}
void RemoteFilesDialog::fillServicesListbox()
{
m_pServices_lb->Clear();
// Load from user settings
Sequence< OUString > placesUrlsList(officecfg::Office::Common::Misc::FilePickerPlacesUrls::get(m_context));
Sequence< OUString > placesNamesList(officecfg::Office::Common::Misc::FilePickerPlacesNames::get(m_context));
// TODO: filter - only online services
if(placesUrlsList.getLength() > 0 && placesNamesList.getLength() > 0)
{
for(sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace)
{
ServicePtr pService(new Place(placesNamesList[nPlace], placesUrlsList[nPlace], true));
m_aServices.push_back(pService);
m_pServices_lb->InsertEntry(placesNamesList[nPlace]);
}
m_pServices_lb->SelectEntryPos(0);
}
else
{
m_pServices_lb->Enable(false);
}
}
IMPL_LINK_NOARG ( RemoteFilesDialog, AddServiceHdl )
{
ScopedVclPtrInstance< PlaceEditDialog > aDlg(this);
short aRetCode = aDlg->Execute();
switch (aRetCode) {
case RET_OK :
{
ServicePtr newService = aDlg->GetPlace();
m_aServices.push_back(newService);
m_pServices_lb->Enable(true);
m_pServices_lb->InsertEntry(newService->GetName());
m_pServices_lb->SelectEntryPos(m_pServices_lb->GetEntryCount() - 1);
// save services
Sequence< OUString > placesUrlsList(m_aServices.size());
Sequence< OUString > placesNamesList(m_aServices.size());
int i = 0;
for(std::vector<ServicePtr>::const_iterator it = m_aServices.begin(); it != m_aServices.end(); ++it)
{
placesUrlsList[i] = (*it)->GetUrl();
placesNamesList[i] = (*it)->GetName();
i++;
}
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context));
officecfg::Office::Common::Misc::FilePickerPlacesUrls::set(placesUrlsList, batch);
officecfg::Office::Common::Misc::FilePickerPlacesNames::set(placesNamesList, batch);
batch->commit();
break;
}
case RET_CANCEL :
default :
// Do Nothing
break;
};
return 1;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkDialog" id="RemoteFilesDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Remote Files</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="open">
<property name="label">gtk-open</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="save">
<property name="label">gtk-save</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Service:</property>
<accessibility>
<relation type="label-for" target="services_lb"/>
</accessibility>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="services_lb">
<property name="visible">True</property>
<property name="can_focus">False</property>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="add_service_btn">
<property name="label" translatable="yes">Add service</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>
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