summaryrefslogtreecommitdiffstats
path: root/konqueror/sidebar
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2014-10-07 23:26:42 -0500
committerTimothy Pearson <[email protected]>2014-10-07 23:26:42 -0500
commit4724b1a838bf20c85309d8812c1a0bd23bbf2f90 (patch)
treed6d1bb89830a7e2e25600e392a6afe2c724f8ec6 /konqueror/sidebar
parent4d21a120d2478b8d0abe7ecaf9a688f2aa88c049 (diff)
downloadtdebase-4724b1a838bf20c85309d8812c1a0bd23bbf2f90.tar.gz
tdebase-4724b1a838bf20c85309d8812c1a0bd23bbf2f90.zip
Push the following patches from Bug 1499:
tdebase: updates default Xorg arguments in TDM tdebase: add ability to restrict the konqueror side bar
Diffstat (limited to 'konqueror/sidebar')
-rw-r--r--konqueror/sidebar/sidebar_widget.cpp113
-rw-r--r--konqueror/sidebar/sidebar_widget.h2
2 files changed, 69 insertions, 46 deletions
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 <kinputdialog.h>
#include <tdefiledialog.h>
#include <kdesktopfile.h>
+#include <tdeapplication.h>
#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<Sidebar_Widget *>( 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: "<<m_path<<endl;
TQDir dir(m_path);
- TQStringList list=dir.entryList("*.desktop");
+ TQStringList list;
+
+ if ( ! m_restrictedViews.empty() ) {
+ for ( TQStringList::Iterator it = m_restrictedViews.begin(); it != m_restrictedViews.end(); ++it ) {
+ list += dir.entryList( *it + ".desktop");
+ }
+ } else {
+ list = dir.entryList("*.desktop");
+ }
+
for (TQStringList::Iterator it=list.begin(); it!=list.end(); ++it)
{
+ kdDebug() << "Sidebar buttons: " << *it << endl;
addButton(*it);
}
}
@@ -833,47 +852,48 @@ bool Sidebar_Widget::addButton(const TQString &desktoppath,int pos)
bool Sidebar_Widget::eventFilter(TQObject *obj, TQEvent *ev)
{
-
- if (ev->type()==TQEvent::MouseButtonPress && ((TQMouseEvent *)ev)->button()==Qt::RightButton)
- {
- KMultiTabBarTab *bt=tqt_dynamic_cast<KMultiTabBarTab*>(obj);
- if (bt)
+ if ( kapp->authorize( "action/konqsidebarmenu" ) ) {
+ if (ev->type()==TQEvent::MouseButtonPress && ((TQMouseEvent *)ev)->button()==Qt::RightButton)
{
- kdDebug()<<"Request for popup"<<endl;
- m_currentButton = 0;
- for (uint i=0;i<m_buttons.count();i++)
+ KMultiTabBarTab *bt=tqt_dynamic_cast<KMultiTabBarTab*>(obj);
+ if (bt)
{
- if (bt==m_buttonBar->tab(i))
+ kdDebug()<<"Request for popup"<<endl;
+ m_currentButton = 0;
+ for (uint i=0;i<m_buttons.count();i++)
{
- m_currentButton = m_buttons.at(i);
- break;
+ if (bt==m_buttonBar->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);