From 4724b1a838bf20c85309d8812c1a0bd23bbf2f90 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 7 Oct 2014 23:26:42 -0500 Subject: Push the following patches from Bug 1499: tdebase: updates default Xorg arguments in TDM tdebase: add ability to restrict the konqueror side bar --- konqueror/sidebar/sidebar_widget.cpp | 113 +++++++++++++++++++++-------------- konqueror/sidebar/sidebar_widget.h | 2 + 2 files changed, 69 insertions(+), 46 deletions(-) (limited to 'konqueror') diff --git a/konqueror/sidebar/sidebar_widget.cpp b/konqueror/sidebar/sidebar_widget.cpp index 62a26cba9..e8e2f9f91 100644 --- a/konqueror/sidebar/sidebar_widget.cpp +++ b/konqueror/sidebar/sidebar_widget.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include "konqsidebar.h" #include "sidebar_widget.h" @@ -65,10 +66,19 @@ addBackEnd::addBackEnd(TQWidget *parent, class TQPopupMenu *addmenu, void addBackEnd::aboutToShowAddMenu() { + TQStringList m_restrictedViews( dynamic_cast( m_parent )->getRestrictedViews() ); if (!menu) return; TDEStandardDirs *dirs = TDEGlobal::dirs(); - TQStringList list = dirs->findAllResources("data","konqsidebartng/add/*.desktop",true,true); + TQStringList list; + + if ( ! m_restrictedViews.empty() ) { + for ( TQStringList::Iterator it = m_restrictedViews.begin(); it != m_restrictedViews.end(); ++it ) { + list += dirs->findAllResources("data","konqsidebartng/add/" + *it + ".desktop",true,true); + } + } else { + list = dirs->findAllResources( "data","konqsidebartng/add/*.desktop",true,true ); + } libNames.setAutoDelete(true); libNames.resize(0); libParam.setAutoDelete(true); @@ -645,17 +655,16 @@ void Sidebar_Widget::activatedMenu(int id) void Sidebar_Widget::readConfig() { - m_disableConfig = m_config->readBoolEntry("DisableConfig",false); + m_disableConfig = m_config->readBoolEntry("DisableConfig",false); m_singleWidgetMode = m_config->readBoolEntry("SingleWidgetMode",true); - m_immutableSingleWidgetMode = - m_config->entryIsImmutable("SingleWidgetMode"); + m_immutableSingleWidgetMode = m_config->entryIsImmutable("SingleWidgetMode"); m_showExtraButtons = m_config->readBoolEntry("ShowExtraButtons",false); - m_immutableShowExtraButtons = - m_config->entryIsImmutable("ShowExtraButtons"); + m_immutableShowExtraButtons = m_config->entryIsImmutable("ShowExtraButtons"); m_showTabsLeft = m_config->readBoolEntry("ShowTabsLeft", true); - m_immutableShowTabsLeft = m_config->entryIsImmutable("ShowTabsLeft"); + m_immutableShowTabsLeft = m_config->entryIsImmutable("ShowTabsLeft"); m_hideTabs = m_config->readBoolEntry("HideTabs", false); - m_immutableHideTabs = m_config->entryIsImmutable("HideTabs"); + m_immutableHideTabs = m_config->entryIsImmutable("HideTabs"); + m_restrictedViews = m_config->readListEntry( "RestrictViews" ); if (m_initial) { m_openViews = m_config->readListEntry("OpenViews"); @@ -722,9 +731,19 @@ void Sidebar_Widget::createButtons() { kdDebug()<<"m_path: "<type()==TQEvent::MouseButtonPress && ((TQMouseEvent *)ev)->button()==Qt::RightButton) - { - KMultiTabBarTab *bt=tqt_dynamic_cast(obj); - if (bt) + if ( kapp->authorize( "action/konqsidebarmenu" ) ) { + if (ev->type()==TQEvent::MouseButtonPress && ((TQMouseEvent *)ev)->button()==Qt::RightButton) { - kdDebug()<<"Request for popup"<(obj); + if (bt) { - if (bt==m_buttonBar->tab(i)) + kdDebug()<<"Request for popup"<tab(i)) + { + m_currentButton = m_buttons.at(i); + break; + } } - } - if (m_currentButton) - { - if (!m_buttonPopup) + if (m_currentButton) { - m_buttonPopup=new TDEPopupMenu(this, "Sidebar_Widget::ButtonPopup"); - m_buttonPopup->insertTitle(SmallIcon("unknown"), "", 50); - m_buttonPopup->insertItem(SmallIconSet("text"), i18n("Set Name..."),4); // Item to open a dialog to change the name of the sidebar item (by Pupeno) - m_buttonPopup->insertItem(SmallIconSet("www"), i18n("Set URL..."),2); - m_buttonPopup->insertItem(SmallIconSet("icons"), i18n("Set Icon..."),1); - m_buttonPopup->insertSeparator(); - m_buttonPopup->insertItem(SmallIconSet("editdelete"), i18n("Remove"),3); - m_buttonPopup->insertSeparator(); - m_buttonPopup->insertItem(SmallIconSet("configure"), i18n("Configure Navigation Panel"), m_menu, 4); - connect(m_buttonPopup, TQT_SIGNAL(activated(int)), - this, TQT_SLOT(buttonPopupActivate(int))); + if (!m_buttonPopup) + { + m_buttonPopup=new TDEPopupMenu(this, "Sidebar_Widget::ButtonPopup"); + m_buttonPopup->insertTitle(SmallIcon("unknown"), "", 50); + m_buttonPopup->insertItem(SmallIconSet("text"), i18n("Set Name..."),4); // Item to open a dialog to change the name of the sidebar item (by Pupeno) + m_buttonPopup->insertItem(SmallIconSet("www"), i18n("Set URL..."),2); + m_buttonPopup->insertItem(SmallIconSet("icons"), i18n("Set Icon..."),1); + m_buttonPopup->insertSeparator(); + m_buttonPopup->insertItem(SmallIconSet("editdelete"), i18n("Remove"),3); + m_buttonPopup->insertSeparator(); + m_buttonPopup->insertItem(SmallIconSet("configure"), i18n("Configure Navigation Panel"), m_menu, 4); + connect(m_buttonPopup, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(buttonPopupActivate(int))); + } + m_buttonPopup->setItemEnabled(2,!m_currentButton->URL.isEmpty()); + m_buttonPopup->changeTitle(50,SmallIcon(m_currentButton->iconName), + m_currentButton->displayName); + if (!m_disableConfig) + { m_buttonPopup->exec(TQCursor::pos()); } } - m_buttonPopup->setItemEnabled(2,!m_currentButton->URL.isEmpty()); - m_buttonPopup->changeTitle(50,SmallIcon(m_currentButton->iconName), - m_currentButton->displayName); - if (!m_disableConfig) - { m_buttonPopup->exec(TQCursor::pos()); } - } - return true; + return true; + } } } return false; @@ -881,10 +901,11 @@ bool Sidebar_Widget::eventFilter(TQObject *obj, TQEvent *ev) void Sidebar_Widget::mousePressEvent(TQMouseEvent *ev) { - if (ev->type()==TQEvent::MouseButtonPress && - ((TQMouseEvent *)ev)->button()==Qt::RightButton && - !m_disableConfig) - { m_menu->exec(TQCursor::pos()); } + if ( kapp->authorize( "action/konqsidebarmenu" ) ) { + if (ev->type()==TQEvent::MouseButtonPress && ((TQMouseEvent *)ev)->button()==Qt::RightButton) { + m_menu->exec(TQCursor::pos()); + } + } } KonqSidebarPlugin *Sidebar_Widget::loadModule(TQWidget *par,TQString &desktopName,TQString lib_name,ButtonInfo* bi) diff --git a/konqueror/sidebar/sidebar_widget.h b/konqueror/sidebar/sidebar_widget.h index 36612a033..b45f79b7c 100644 --- a/konqueror/sidebar/sidebar_widget.h +++ b/konqueror/sidebar/sidebar_widget.h @@ -142,6 +142,7 @@ public: // virtual void showMessage(TQString &); for later extension /* end of interface implementation */ + TQStringList getRestrictedViews() const { return m_restrictedViews; } /* The following public slots are wrappers for browserextension fields */ public slots: @@ -217,6 +218,7 @@ private: TQString m_currentProfile; TQStringList m_visibleViews; // The views that are actually open TQStringList m_openViews; // The views that should be opened + TQStringList m_restrictedViews; signals: void panelHasBeenExpanded(bool); -- cgit v1.2.3