Kaydet (Commit) f1489399 authored tarafından Caolán McNamara's avatar Caolán McNamara

convert fileview context menu to .ui

Change-Id: I4631b4fa0312c6548a1176872e3a836d377f518c
üst 0b31912b
...@@ -24,11 +24,6 @@ ...@@ -24,11 +24,6 @@
#define HID_FILEDLG_PREVIEW_CB "SVT_HID_FILEDLG_PREVIEW_CB" #define HID_FILEDLG_PREVIEW_CB "SVT_HID_FILEDLG_PREVIEW_CB"
#define HID_FILEDLG_STANDARD "SVT_HID_FILEDLG_STANDARD" #define HID_FILEDLG_STANDARD "SVT_HID_FILEDLG_STANDARD"
// Help ids for the filepicker dialogs
// help ids for fileview contextmenu
#define HID_FILEVIEW_MENU_DELETE "SVT_HID_FILEVIEW_MENU_DELETE"
#define HID_FILEVIEW_MENU_RENAME "SVT_HID_FILEVIEW_MENU_RENAME"
// help ids for the different modi of the file picker dialog // help ids for the different modi of the file picker dialog
#define HID_FILESAVE_LEVELUP "SVT_HID_FILESAVE_LEVELUP" #define HID_FILESAVE_LEVELUP "SVT_HID_FILESAVE_LEVELUP"
#define HID_FILESAVE_CREATEDIRECTORY "SVT_HID_FILESAVE_CREATEDIRECTORY" #define HID_FILESAVE_CREATEDIRECTORY "SVT_HID_FILESAVE_CREATEDIRECTORY"
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define STR_SVT_GB (RID_SVTOOLS_START + 28) #define STR_SVT_GB (RID_SVTOOLS_START + 28)
#define STR_SVT_FILEVIEW_COLUMN_TYPE (RID_SVTOOLS_START + 29) #define STR_SVT_FILEVIEW_COLUMN_TYPE (RID_SVTOOLS_START + 29)
#define STR_FILTERNAME_ALL (RID_SVTOOLS_START + 30) #define STR_FILTERNAME_ALL (RID_SVTOOLS_START + 30)
#define RID_FILEVIEW_CONTEXTMENU (RID_SVTOOLS_START + 31) //FREE
#define STR_SVT_1BIT_THRESHOLD (RID_SVTOOLS_START + 32) #define STR_SVT_1BIT_THRESHOLD (RID_SVTOOLS_START + 32)
#define STR_SVT_1BIT_DITHERED (RID_SVTOOLS_START + 33) #define STR_SVT_1BIT_DITHERED (RID_SVTOOLS_START + 33)
#define STR_SVT_4BIT_GRAYSCALE (RID_SVTOOLS_START + 34) #define STR_SVT_4BIT_GRAYSCALE (RID_SVTOOLS_START + 34)
......
...@@ -11,6 +11,7 @@ $(eval $(call gb_UIConfig_UIConfig,svt)) ...@@ -11,6 +11,7 @@ $(eval $(call gb_UIConfig_UIConfig,svt))
$(eval $(call gb_UIConfig_add_uifiles,svt,\ $(eval $(call gb_UIConfig_add_uifiles,svt,\
svtools/uiconfig/ui/addresstemplatedialog \ svtools/uiconfig/ui/addresstemplatedialog \
svtools/uiconfig/ui/fileviewmenu \
svtools/uiconfig/ui/graphicexport \ svtools/uiconfig/ui/graphicexport \
svtools/uiconfig/ui/GraphicExportOptionsDialog \ svtools/uiconfig/ui/GraphicExportOptionsDialog \
svtools/uiconfig/ui/javadisableddialog \ svtools/uiconfig/ui/javadisableddialog \
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <svtools/svtools.hrc> #include <svtools/svtools.hrc>
#include <svtools/viewdataentry.hxx> #include <svtools/viewdataentry.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include "fileview.hrc"
#include "contentenumeration.hxx" #include "contentenumeration.hxx"
#include <svtools/AccessibleBrowseBoxObjType.hxx> #include <svtools/AccessibleBrowseBoxObjType.hxx>
#include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/util/DateTime.hpp>
...@@ -162,6 +161,8 @@ class ViewTabListBox_Impl : public SvHeaderTabListBox ...@@ -162,6 +161,8 @@ class ViewTabListBox_Impl : public SvHeaderTabListBox
{ {
private: private:
Reference< XCommandEnvironment > mxCmdEnv; Reference< XCommandEnvironment > mxCmdEnv;
std::unique_ptr<VclBuilder> mxBuilder;
VclPtr<PopupMenu> mxMenu;
::osl::Mutex maMutex; ::osl::Mutex maMutex;
VclPtr<HeaderBar> mpHeaderBar; VclPtr<HeaderBar> mpHeaderBar;
...@@ -533,7 +534,6 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin, ...@@ -533,7 +534,6 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
EnableContextMenuHandling(); EnableContextMenuHandling();
} }
ViewTabListBox_Impl::~ViewTabListBox_Impl() ViewTabListBox_Impl::~ViewTabListBox_Impl()
{ {
disposeOnce(); disposeOnce();
...@@ -543,11 +543,13 @@ void ViewTabListBox_Impl::dispose() ...@@ -543,11 +543,13 @@ void ViewTabListBox_Impl::dispose()
{ {
maResetQuickSearch.Stop(); maResetQuickSearch.Stop();
mxMenu.disposeAndClear();
mxBuilder.reset();
mpHeaderBar.disposeAndClear(); mpHeaderBar.disposeAndClear();
SvHeaderTabListBox::dispose(); SvHeaderTabListBox::dispose();
} }
IMPL_LINK_NOARG(ViewTabListBox_Impl, ResetQuickSearch_Impl, Timer *, void) IMPL_LINK_NOARG(ViewTabListBox_Impl, ResetQuickSearch_Impl, Timer *, void)
{ {
::osl::MutexGuard aGuard( maMutex ); ::osl::MutexGuard aGuard( maMutex );
...@@ -692,32 +694,26 @@ VclPtr<PopupMenu> ViewTabListBox_Impl::CreateContextMenu() ...@@ -692,32 +694,26 @@ VclPtr<PopupMenu> ViewTabListBox_Impl::CreateContextMenu()
if ( bEnableDelete || bEnableRename ) if ( bEnableDelete || bEnableRename )
{ {
VclPtrInstance<PopupMenu> pRet(SvtResId( RID_FILEVIEW_CONTEXTMENU )); mxMenu.disposeAndClear();
pRet->EnableItem( MID_FILEVIEW_DELETE, bEnableDelete ); mxBuilder.reset(new VclBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svt/ui/fileviewmenu.ui", ""));
pRet->EnableItem( MID_FILEVIEW_RENAME, bEnableRename ); mxMenu.set(mxBuilder->get_menu("menu"));
pRet->RemoveDisabledEntries( true, true ); mxMenu->EnableItem(mxMenu->GetItemId("delete"), bEnableDelete);
return pRet; mxMenu->EnableItem(mxMenu->GetItemId("rename"), bEnableRename);
mxMenu->RemoveDisabledEntries( true, true );
return mxMenu;
} }
return nullptr; return nullptr;
} }
void ViewTabListBox_Impl::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) void ViewTabListBox_Impl::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
{ {
switch ( nSelectedPopupEntry ) if (nSelectedPopupEntry == mxMenu->GetItemId("delete"))
{
case MID_FILEVIEW_DELETE :
DeleteEntries(); DeleteEntries();
break; else if (nSelectedPopupEntry == mxMenu->GetItemId("rename"))
case MID_FILEVIEW_RENAME :
EditEntry( FirstSelected() ); EditEntry( FirstSelected() );
break;
}
} }
void ViewTabListBox_Impl::ClearAll() void ViewTabListBox_Impl::ClearAll()
{ {
for ( sal_uLong i = 0; i < GetEntryCount(); ++i ) for ( sal_uLong i = 0; i < GetEntryCount(); ++i )
......
/* -*- 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: */
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
#include <svtools/svtools.hrc> #include <svtools/svtools.hrc>
#include "fileview.hrc"
#include <svtools/helpid.hrc> #include <svtools/helpid.hrc>
// strings -------------------------------------------------------------------- // strings --------------------------------------------------------------------
...@@ -73,25 +72,4 @@ Bitmap RID_BMP_FOLDER_OPEN ...@@ -73,25 +72,4 @@ Bitmap RID_BMP_FOLDER_OPEN
File = "folderop.png"; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?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>
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