Kaydet (Commit) 77725bf4 authored tarafından Akshay Deep's avatar Akshay Deep Kaydeden (comit) Samuel Mehrbrodt

GSoC: Remove TemplateRemoteView from Template Manager

Conflicts:
	include/sfx2/templatedlg.hxx
	sfx2/source/doc/templatedlg.cxx

Change-Id: Ia0623707e452c79346d92b5a5ab75a4063928c20
Reviewed-on: https://gerrit.libreoffice.org/26658Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
üst e7ca62bb
......@@ -773,9 +773,6 @@
<glade-widget-class title="Template Search View" name="sfxlo-TemplateSearchView"
generic-name="Template Icon View" parent="GtkIconView"
icon-name="widget-gtk-iconview"/>
<glade-widget-class title="Template Remote View" name="sfxlo-TemplateRemoteView"
generic-name="Template Icon View" parent="GtkIconView"
icon-name="widget-gtk-iconview"/>
<glade-widget-class title="Driver List Control" name="cuilo-DriverListControl"
generic-name="DriverListControl" parent="GtkEntry"
......
......@@ -25,8 +25,6 @@ class Edit;
class PopupMenu;
class TemplateAbstractView;
class TemplateLocalView;
class TemplateRemoteView;
class TemplateRepository;
class TemplateSearchView;
class ThumbnailView;
class ThumbnailViewItem;
......@@ -77,7 +75,6 @@ protected:
DECL_LINK_TYPED(TVItemStateHdl, const ThumbnailViewItem*, void);
DECL_LINK_TYPED(MenuSelectHdl, Menu*, bool);
DECL_LINK_TYPED(RepositoryMenuSelectHdl, Menu*, bool);
DECL_LINK_TYPED(DefaultTemplateMenuSelectHdl, Menu*, bool);
DECL_LINK_TYPED(OpenRegionHdl, void*, void);
......@@ -101,8 +98,6 @@ protected:
void OnCategoryRename();
void OnCategoryDelete();
void createRepositoryMenu ();
void createDefaultTemplateMenu ();
// Exchange view between local/online view.
......@@ -116,8 +111,6 @@ protected:
void localMoveTo (sal_uInt16 nMenuId);
void remoteMoveTo (const sal_uInt16 nMenuId);
/**
*
* Move search result templates stored in the filesystem to another folder.
......@@ -126,15 +119,6 @@ protected:
void localSearchMoveTo (sal_uInt16 nMenuId);
// Remote repositories handling methods
void loadRepositories ();
const std::vector<TemplateRepository*>& getRepositories () const { return maRepositories; }
bool insertRepository (const OUString &rName, const OUString &rURL);
void syncRepositories () const;
/// Return filter according to the currently selected application filter.
FILTER_APPLICATION getCurrentApplicationFilter();
......@@ -152,19 +136,14 @@ protected:
VclPtr<CheckBox> mpCBXHideDlg;
VclPtr<ToolBox> mpActionBar;
VclPtr<TemplateSearchView> mpSearchView;
VclPtr<TemplateAbstractView> mpCurView;
VclPtr<TemplateLocalView> mpLocalView;
VclPtr<TemplateRemoteView> mpRemoteView;
VclPtr<PopupMenu> mpActionMenu;
VclPtr<PopupMenu> mpRepositoryMenu;
VclPtr<PopupMenu> mpTemplateDefaultMenu;
std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelTemplates;
css::uno::Reference< css::frame::XModel > m_xModel;
css::uno::Reference< css::frame::XDesktop2 > mxDesktop;
std::vector<TemplateRepository*> maRepositories; ///< Stores the remote repositories for templates
};
// class SfxTemplateCategoryDialog -------------------------------------------------------------------
......
/* -*- 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_SFX2_TEMPLATEREMOTEVIEW_HXX
#define INCLUDED_SFX2_TEMPLATEREMOTEVIEW_HXX
#include <sfx2/templateabstractview.hxx>
#include <sfx2/templateproperties.hxx>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
class TemplateRepository;
class TemplateRemoteView : public TemplateAbstractView
{
public:
TemplateRemoteView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
virtual void showAllTemplates () override;
virtual void showRegion (TemplateContainerItem *pItem) override;
bool loadRepository (TemplateRepository* pRepository);
virtual sal_uInt16 createRegion (const OUString &rName) override;
private:
css::uno::Reference< css::ucb::XCommandEnvironment > m_xCmdEnv;
};
#endif // INCLUDED_SFX2_TEMPLATEREMOTEVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_SFX2_TEMPLATEREPOSITORY_HXX
#define INCLUDED_SFX2_TEMPLATEREPOSITORY_HXX
#include <sfx2/templateproperties.hxx>
class TemplateRepository
{
public:
TemplateRepository () : mnId(0) { };
virtual ~TemplateRepository () { };
void setURL (const OUString &rURL) { maUrl = rURL; }
const OUString& getURL () const { return maUrl; }
void insertTemplate (const TemplateItemProperties &prop) { maTemplates.push_back(prop); }
void clearTemplates () { maTemplates.clear(); }
const std::vector<TemplateItemProperties>& getTemplates () const { return maTemplates; }
public:
sal_uInt16 mnId;
OUString maTitle;
private:
OUString maUrl;
std::vector<TemplateItemProperties> maTemplates;
};
#endif // INCLUDED_SFX2_TEMPLATEREPOSITORY_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -155,7 +155,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/control/templateviewitem \
sfx2/source/control/templatelocalview \
sfx2/source/control/templatecontaineritem \
sfx2/source/control/templateremoteview \
sfx2/source/control/templatesearchview \
sfx2/source/control/thumbnailviewitem \
sfx2/source/control/thumbnailviewacc \
......
/* -*- 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 <sfx2/templateremoteview.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/templaterepository.hxx>
#include <sfx2/templateviewitem.hxx>
#include <svtools/imagemgr.hxx>
#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <vcl/builderfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
using namespace com::sun::star;
using namespace com::sun::star::lang;
using namespace com::sun::star::task;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;
enum
{
ROW_TITLE = 1,
ROW_SIZE,
ROW_DATE_MOD,
ROW_DATE_CREATE,
ROW_TARGET_URL,
ROW_IS_HIDDEN,
ROW_IS_REMOTE,
ROW_IS_REMOVABLE
};
TemplateRemoteView::TemplateRemoteView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
: TemplateAbstractView(pParent,nWinStyle,bDisableTransientChildren)
{
Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
Reference< XInteractionHandler > xGlobalInteractionHandler(
InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY_THROW );
m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() );
}
VCL_BUILDER_DECL_FACTORY(TemplateRemoteView)
{
(void)rMap;
rRet = VclPtr<TemplateRemoteView>::Create(pParent, WB_VSCROLL, false);
}
void TemplateRemoteView::showRegion(TemplateContainerItem * /*pItem*/)
{
//TODO:
}
void TemplateRemoteView::showAllTemplates()
{
//TODO:
}
bool TemplateRemoteView::loadRepository (TemplateRepository* pItem)
{
if (!pItem)
return false;
if (!pItem->getTemplates().empty())
{
insertItems(pItem->getTemplates());
return true;
}
mnCurRegionId = pItem->mnId;
maCurRegionName = pItem->maTitle;
OUString aURL = pItem->getURL();
try
{
uno::Sequence<OUString> aProps(8);
aProps[0] = "Title";
aProps[1] = "Size";
aProps[2] = "DateModified";
aProps[3] = "DateCreated";
aProps[4] = "TargetURL";
aProps[5] = "IsHidden";
aProps[6] = "IsRemote";
aProps[7] = "IsRemoveable";
ucbhelper::Content aContent(aURL, m_xCmdEnv, comphelper::getProcessComponentContext());
uno::Reference< XResultSet > xResultSet;
uno::Reference< XDynamicResultSet > xDynResultSet;
ucbhelper::ResultSetInclude eInclude = ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS;
xDynResultSet = aContent.createDynamicCursor( aProps, eInclude );
if ( xDynResultSet.is() )
xResultSet = xDynResultSet->getStaticResultSet();
if ( xResultSet.is() )
{
pItem->clearTemplates();
uno::Reference< XRow > xRow( xResultSet, UNO_QUERY );
uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY );
std::vector<TemplateItemProperties> aItems;
sal_uInt16 nIdx = 0;
while ( xResultSet->next() )
{
bool bIsHidden = xRow->getBoolean( ROW_IS_HIDDEN );
// don't show hidden files or anything besides documents
if ( !bIsHidden || xRow->wasNull() )
{
OUString aContentURL = xContentAccess->queryContentIdentifierString();
OUString aTargetURL = xRow->getString( ROW_TARGET_URL );
bool bHasTargetURL = !xRow->wasNull() && !aTargetURL.isEmpty();
OUString sRealURL = bHasTargetURL ? aTargetURL : aContentURL;
TemplateItemProperties aTemplateItem;
aTemplateItem.nId = nIdx+1;
aTemplateItem.nRegionId = pItem->mnId-1;
aTemplateItem.aPath = sRealURL;
aTemplateItem.aThumbnail = TemplateAbstractView::fetchThumbnail(sRealURL,
TEMPLATE_THUMBNAIL_MAX_WIDTH,
TEMPLATE_THUMBNAIL_MAX_HEIGHT);
aTemplateItem.aName = xRow->getString( ROW_TITLE );
pItem->insertTemplate(aTemplateItem);
aItems.push_back(aTemplateItem);
++nIdx;
}
}
insertItems(aItems);
}
}
catch( ucb::CommandAbortedException& )
{
}
catch( uno::RuntimeException& )
{
}
catch( uno::Exception& )
{
}
return true;
}
sal_uInt16 TemplateRemoteView::createRegion(const OUString &/*rName*/)
{
// TODO: Create new folder in current remote repository
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
......@@ -263,20 +263,6 @@
<property name="position">3</property>
</packing>
</child>
<child>
<object class="sfxlo-TemplateRemoteView" id="remote_view">
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="margin">0</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......@@ -300,20 +286,6 @@
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="hexpand">True</property>
<child>
<object class="GtkToolButton" id="repository">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">repository</property>
<property name="label" translatable="yes">Repository</property>
<property name="use_underline">True</property>
<property name="icon_name">sfx2/imglst/actionview026.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="action_menu">
<property name="visible">True</property>
......
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