summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-14 10:43:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-14 11:51:30 +0100
commitf1489399d50070c17ca7cbf4fa6b67a2bb307c66 (patch)
treefcbe556e5b53953ea96c9b41c75469eaeebe891c /svtools
parent0b31912b1df719c5507b22a2f63086cb8921f597 (diff)
convert fileview context menu to .ui
Change-Id: I4631b4fa0312c6548a1176872e3a836d377f518c
Diffstat (limited to 'svtools')
-rw-r--r--svtools/UIConfig_svt.mk1
-rw-r--r--svtools/source/contnr/fileview.cxx36
-rw-r--r--svtools/source/contnr/fileview.hrc23
-rw-r--r--svtools/source/contnr/fileview.src22
-rw-r--r--svtools/uiconfig/ui/fileviewmenu.ui25
5 files changed, 42 insertions, 65 deletions
diff --git a/svtools/UIConfig_svt.mk b/svtools/UIConfig_svt.mk
index dd6182e50125..3aeeff899dd8 100644
--- a/svtools/UIConfig_svt.mk
+++ b/svtools/UIConfig_svt.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_UIConfig_UIConfig,svt))
$(eval $(call gb_UIConfig_add_uifiles,svt,\
svtools/uiconfig/ui/addresstemplatedialog \
+ svtools/uiconfig/ui/fileviewmenu \
svtools/uiconfig/ui/graphicexport \
svtools/uiconfig/ui/GraphicExportOptionsDialog \
svtools/uiconfig/ui/javadisableddialog \
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index dbca494e3578..b310c60282ee 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -30,7 +30,6 @@
#include <svtools/svtools.hrc>
#include <svtools/viewdataentry.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-#include "fileview.hrc"
#include "contentenumeration.hxx"
#include <svtools/AccessibleBrowseBoxObjType.hxx>
#include <com/sun/star/util/DateTime.hpp>
@@ -162,6 +161,8 @@ class ViewTabListBox_Impl : public SvHeaderTabListBox
{
private:
Reference< XCommandEnvironment > mxCmdEnv;
+ std::unique_ptr<VclBuilder> mxBuilder;
+ VclPtr<PopupMenu> mxMenu;
::osl::Mutex maMutex;
VclPtr<HeaderBar> mpHeaderBar;
@@ -533,7 +534,6 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
EnableContextMenuHandling();
}
-
ViewTabListBox_Impl::~ViewTabListBox_Impl()
{
disposeOnce();
@@ -543,11 +543,13 @@ void ViewTabListBox_Impl::dispose()
{
maResetQuickSearch.Stop();
+ mxMenu.disposeAndClear();
+ mxBuilder.reset();
+
mpHeaderBar.disposeAndClear();
SvHeaderTabListBox::dispose();
}
-
IMPL_LINK_NOARG(ViewTabListBox_Impl, ResetQuickSearch_Impl, Timer *, void)
{
::osl::MutexGuard aGuard( maMutex );
@@ -692,32 +694,26 @@ VclPtr<PopupMenu> ViewTabListBox_Impl::CreateContextMenu()
if ( bEnableDelete || bEnableRename )
{
- VclPtrInstance<PopupMenu> pRet(SvtResId( RID_FILEVIEW_CONTEXTMENU ));
- pRet->EnableItem( MID_FILEVIEW_DELETE, bEnableDelete );
- pRet->EnableItem( MID_FILEVIEW_RENAME, bEnableRename );
- pRet->RemoveDisabledEntries( true, true );
- return pRet;
+ mxMenu.disposeAndClear();
+ mxBuilder.reset(new VclBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svt/ui/fileviewmenu.ui", ""));
+ mxMenu.set(mxBuilder->get_menu("menu"));
+ mxMenu->EnableItem(mxMenu->GetItemId("delete"), bEnableDelete);
+ mxMenu->EnableItem(mxMenu->GetItemId("rename"), bEnableRename);
+ mxMenu->RemoveDisabledEntries( true, true );
+ return mxMenu;
}
return nullptr;
}
-
void ViewTabListBox_Impl::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
{
- switch ( nSelectedPopupEntry )
- {
- case MID_FILEVIEW_DELETE :
- DeleteEntries();
- break;
-
- case MID_FILEVIEW_RENAME :
- EditEntry( FirstSelected() );
- break;
- }
+ if (nSelectedPopupEntry == mxMenu->GetItemId("delete"))
+ DeleteEntries();
+ else if (nSelectedPopupEntry == mxMenu->GetItemId("rename"))
+ EditEntry( FirstSelected() );
}
-
void ViewTabListBox_Impl::ClearAll()
{
for ( sal_uLong i = 0; i < GetEntryCount(); ++i )
diff --git a/svtools/source/contnr/fileview.hrc b/svtools/source/contnr/fileview.hrc
deleted file mode 100644
index 94fed39d9d0c..000000000000
--- a/svtools/source/contnr/fileview.hrc
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- 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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#define MID_FILEVIEW_DELETE 1
-#define MID_FILEVIEW_RENAME 2
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src
index 8e433edf0a83..7e933e12d3f2 100644
--- a/svtools/source/contnr/fileview.src
+++ b/svtools/source/contnr/fileview.src
@@ -18,7 +18,6 @@
*/
#include <svtools/svtools.hrc>
-#include "fileview.hrc"
#include <svtools/helpid.hrc>
// strings --------------------------------------------------------------------
@@ -73,25 +72,4 @@ Bitmap RID_BMP_FOLDER_OPEN
File = "folderop.png";
};
-// Menus -----------------------------------------------------------------
-
-Menu RID_FILEVIEW_CONTEXTMENU
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = MID_FILEVIEW_DELETE ;
- HelpId = HID_FILEVIEW_MENU_DELETE ;
- Text [ en-US ] = "~Delete";
- };
- MenuItem
- {
- Identifier = MID_FILEVIEW_RENAME ;
- HelpId = HID_FILEVIEW_MENU_RENAME ;
- Text [ en-US ] = "~Rename";
- };
- };
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/uiconfig/ui/fileviewmenu.ui b/svtools/uiconfig/ui/fileviewmenu.ui
new file mode 100644
index 000000000000..a63f7061abee
--- /dev/null
+++ b/svtools/uiconfig/ui/fileviewmenu.ui
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+ <requires lib="gtk+" version="3.10"/>
+ <object class="GtkMenu" id="menu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="delete">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Delete</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="rename">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Rename</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+</interface>