Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > d452cce76a211840150b563e9f20ef84 > files > 17

kdebase-3.5.7-38.4mdv2008.0.src.rpm

--- kdebase-3.5.6/konqueror/sidebar/sidebar_widget.h.kiosk_konqsidebar_restrictions	2005-09-10 05:25:47.000000000 -0300
+++ kdebase-3.5.6/konqueror/sidebar/sidebar_widget.h	2007-08-08 13:32:32.000000000 -0300
@@ -140,6 +140,7 @@
 //        virtual void showError(QString &);      for later extension
 //        virtual void showMessage(QString &);    for later extension
 	/* end of interface implementation */
+    QStringList getRestrictedViews() const { return m_restrictedViews; }
 
 
  /* The following public slots are wrappers for browserextension fields */
@@ -211,6 +212,7 @@
 	QString m_currentProfile;
 	QStringList m_visibleViews; // The views that are actually open
 	QStringList m_openViews; // The views that should be opened
+   QStringList m_restrictedViews;
 
 signals:
 	void panelHasBeenExpanded(bool);
--- kdebase-3.5.6/konqueror/sidebar/sidebar_widget.cpp.kiosk_konqsidebar_restrictions	2007-08-08 11:30:38.000000000 -0300
+++ kdebase-3.5.6/konqueror/sidebar/sidebar_widget.cpp	2007-08-08 13:33:21.000000000 -0300
@@ -49,6 +49,7 @@
 #include <kinputdialog.h>
 #include <kfiledialog.h>
 #include <kdesktopfile.h>
+#include <kapplication.h>
 #include "konqsidebar.h"
 
 #include "sidebar_widget.h"
@@ -68,11 +69,19 @@
 
 void addBackEnd::aboutToShowAddMenu()
 {
+
+    QStringList m_restrictedViews( dynamic_cast<Sidebar_Widget *>( m_parent )->getRestrictedViews() );
 	if (!menu)
 		return;
 	KStandardDirs *dirs = KGlobal::dirs();
-	QStringList list = dirs->findAllResources("data","konqsidebartng/add/*.desktop",true,true);
-	libNames.setAutoDelete(true);
+   QStringList list;
+	
+      if ( ! m_restrictedViews.empty() )
+         for ( QStringList::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);
 	libParam.resize(0);
@@ -642,6 +651,7 @@
 	m_showExtraButtons = m_config->readBoolEntry("ShowExtraButtons",false);
 	m_showTabsLeft = m_config->readBoolEntry("ShowTabsLeft", true);
 	m_hideTabs = m_config->readBoolEntry("HideTabs", false);
+   m_restrictedViews = m_config->readListEntry( "RestrictViews" );
 	if (m_initial) {
 		m_openViews = m_config->readListEntry("OpenViews");
 		m_savedWidth = m_config->readNumEntry("SavedWidth",200);
@@ -703,15 +713,26 @@
 
 void Sidebar_Widget::createButtons()
 {
+
 	if (!m_path.isEmpty())
 	{
 		kdDebug()<<"m_path: "<<m_path<<endl;
 		QDir dir(m_path);
-		QStringList list=dir.entryList("*.desktop");
+
+      QStringList list;
+      
+      if ( ! m_restrictedViews.empty() )
+         for ( QStringList::Iterator it = m_restrictedViews.begin(); it != m_restrictedViews.end(); ++it )
+            list += dir.entryList( *it + ".desktop");
+      else
+         list = dir.entryList("*.desktop");
+
 		for (QStringList::Iterator it=list.begin(); it!=list.end(); ++it)
-		{
-			addButton(*it);
-		}
+      {
+         kdDebug() << "Sidebar buttons: " << *it << endl;
+         addButton(*it);
+      }
+
 	}
 
 	if (!m_buttonBar->button(-1)) {
@@ -818,55 +839,57 @@
 
 bool Sidebar_Widget::eventFilter(QObject *obj, QEvent *ev)
 {
-
-	if (ev->type()==QEvent::MouseButtonPress && ((QMouseEvent *)ev)->button()==QMouseEvent::RightButton)
-	{
-		KMultiTabBarTab *bt=dynamic_cast<KMultiTabBarTab*>(obj);
-		if (bt)
-		{
-			kdDebug()<<"Request for popup"<<endl;
-			m_currentButton = 0;
-			for (uint i=0;i<m_buttons.count();i++)
-			{
-				if (bt==m_buttonBar->tab(i))
-				{
-					m_currentButton = m_buttons.at(i);
-					break;
-				}
-			}
-
-			if (m_currentButton)
-			{
-				if (!m_buttonPopup)
-				{
-					m_buttonPopup=new KPopupMenu(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, SIGNAL(activated(int)),
-						this, SLOT(buttonPopupActivate(int)));
-				}
-				m_buttonPopup->setItemEnabled(2,!m_currentButton->URL.isEmpty());
-			        m_buttonPopup->changeTitle(50,SmallIcon(m_currentButton->iconName),
-						m_currentButton->displayName);
-				m_buttonPopup->exec(QCursor::pos());
-			}
-			return true;
-
-		}
-	}
-	return false;
+   if ( kapp->authorize( "action/konqsidebarmenu" ) )
+      if (ev->type()==QEvent::MouseButtonPress && ((QMouseEvent *)ev)->button()==QMouseEvent::RightButton)
+      {
+         KMultiTabBarTab *bt=dynamic_cast<KMultiTabBarTab*>(obj);
+         if (bt)
+         {
+            kdDebug()<<"Request for popup"<<endl;
+            m_currentButton = 0;
+            for (uint i=0;i<m_buttons.count();i++)
+            {
+               if (bt==m_buttonBar->tab(i))
+               {
+                  m_currentButton = m_buttons.at(i);
+                  break;
+               }
+            }
+            
+            if (m_currentButton)
+            {
+               if (!m_buttonPopup)
+               {
+                  m_buttonPopup=new KPopupMenu(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, SIGNAL(activated(int)),
+                        this, SLOT(buttonPopupActivate(int)));
+               }
+               m_buttonPopup->setItemEnabled(2,!m_currentButton->URL.isEmpty());
+               m_buttonPopup->changeTitle(50,SmallIcon(m_currentButton->iconName),
+                     m_currentButton->displayName);
+               m_buttonPopup->exec(QCursor::pos());
+            }
+            return true;
+         }
+      }
+   return false;
 }
 
 void Sidebar_Widget::mousePressEvent(QMouseEvent *ev)
 {
-	if (ev->type()==QEvent::MouseButtonPress && ((QMouseEvent *)ev)->button()==QMouseEvent::RightButton)
-		m_menu->exec(QCursor::pos());
+   if ( kapp->authorize( "action/konqsidebarmenu" ) )
+   {
+      if (ev->type()==QEvent::MouseButtonPress && ((QMouseEvent *)ev)->button()==QMouseEvent::RightButton)
+         m_menu->exec(QCursor::pos());
+   }
 }
 
 KonqSidebarPlugin *Sidebar_Widget::loadModule(QWidget *par,QString &desktopName,QString lib_name,ButtonInfo* bi)