[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdebase/konqueror/sidebar
From:       Tobias Hunger <tobias.hunger () basyskom ! de>
Date:       2008-06-06 15:24:29
Message-ID: 1212765869.567497.29351.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 817674 by hunger:

Honor Kiosk settings in sidebar ng.

Improve kiosk support in the sidebar ng:
 * Add DisableConfig setting that can get used to block
   access to the configuration popup menus.
 * Have the configuration popup menu honor kiosk settings
   by not displaying any option to change immutable
   settings.



 M  +43 -20    sidebar_widget.cpp  
 M  +7 -1      sidebar_widget.h  


--- branches/KDE/3.5/kdebase/konqueror/sidebar/sidebar_widget.cpp #817673:817674
@@ -49,7 +49,9 @@
 #include "sidebar_widget.moc"
 
 
-addBackEnd::addBackEnd(QWidget *parent,class QPopupMenu *addmenu,bool \
universal,const QString &currentProfile, const char *name) \
+addBackEnd::addBackEnd(QWidget *parent, class QPopupMenu *addmenu, +                 \
bool universal, const QString &currentProfile, +                       const char \
*name)  : QObject(parent,name),
    m_parent(parent)
 {
@@ -110,8 +112,8 @@
 		libParam.insert(libParam.count(), new \
QString(confFile->readEntry("X-KDE-KonqSidebarAddParam")));  delete confFile;
 	}
-	menu->insertSeparator();
-	menu->insertItem(i18n("Rollback to System Default"), i);
+        menu->insertSeparator();
+        menu->insertItem(i18n("Rollback to System Default"), i);
 }
 
 
@@ -267,19 +269,18 @@
 	m_mainDockWidget->setDockSite(KDockWidget::DockTop);
 	m_mainDockWidget->setEnableDocking(KDockWidget::DockNone);
 
-   	m_buttonBar = new KMultiTabBar(KMultiTabBar::Vertical,this);
+	m_buttonBar = new KMultiTabBar(KMultiTabBar::Vertical,this);
 	m_buttonBar->showActiveTabTexts(true);
 
 	m_menu = new QPopupMenu(this, "Sidebar_Widget::Menu");
 	QPopupMenu *addMenu = new QPopupMenu(this, "Sidebar_Widget::addPopup");
 	m_menu->insertItem(i18n("Add New"), addMenu, 0);
-	m_menu->insertSeparator();
 	m_menu->insertItem(i18n("Multiple Views"), 1);
 	m_menu->insertItem(i18n("Show Tabs Left"), 2);
 	m_menu->insertItem(i18n("Show Configuration Button"), 3);
 	if (!m_universalMode) {
-		m_menu->insertSeparator();
-		m_menu->insertItem(SmallIconSet("remove"), i18n("Close Navigation Panel"),
+		m_menu->insertItem(SmallIconSet("remove"),
+                                   i18n("Close Navigation Panel"),
 				par, SLOT(deleteLater()));
 	}
         connect(m_menu, SIGNAL(aboutToShow()),
@@ -288,7 +289,10 @@
 		this, SLOT(activatedMenu(int)));
 
 	m_buttonPopup = 0;
-	addBackEnd *ab = new addBackEnd(this, \
addMenu,universalMode,currentProfile,"Sidebar_Widget-addBackEnd"); +	addBackEnd *ab = \
new addBackEnd(this, addMenu, universalMode, +                                        \
currentProfile, +                                        \
"Sidebar_Widget-addBackEnd"); +
 	connect(ab, SIGNAL(updateNeeded()),
 		this, SLOT(updateButtons()));
 	connect(ab, SIGNAL(initialCopyNeeded()),
@@ -296,16 +300,24 @@
 
 	initialCopy();
 
-	if (universalMode)
-		m_config = new KConfig("konqsidebartng_kicker.rc");
-	else
-	{
-		m_config = new KConfig("konqsidebartng.rc");
-		m_config->setGroup(currentProfile);
-	}
+        if (universalMode)
+        {
+                m_config = new KConfig("konqsidebartng_kicker.rc");
+        }
+        else
+        {
+                m_config = new KConfig("konqsidebartng.rc");
+                m_config->setGroup(currentProfile);
+        }
+        readConfig();
+
+        // Disable stuff (useful for Kiosk mode)!
+        m_menu->setItemVisible(1, !m_immutableSingleWidgetMode);
+        m_menu->setItemVisible(2, !m_immutableShowTabsLeft);
+        m_menu->setItemVisible(3, !m_immutableShowExtraButtons);
+
 	connect(&m_configTimer, SIGNAL(timeout()),
 		this, SLOT(saveConfig()));
-        readConfig();
 	m_somethingVisible = !m_openViews.isEmpty();
 	doLayout();
 	QTimer::singleShot(0,this,SLOT(createButtons()));
@@ -632,10 +644,18 @@
 
 void Sidebar_Widget::readConfig()
 {
+        m_disableConfig = m_config->readBoolEntry("DisableConfig",false);
 	m_singleWidgetMode = m_config->readBoolEntry("SingleWidgetMode",true);
+        m_immutableSingleWidgetMode =
+                m_config->entryIsImmutable("SingleWidgetMode");
 	m_showExtraButtons = m_config->readBoolEntry("ShowExtraButtons",false);
+        m_immutableShowExtraButtons =
+                m_config->entryIsImmutable("ShowExtraButtons");
 	m_showTabsLeft = m_config->readBoolEntry("ShowTabsLeft", true);
+        m_immutableShowTabsLeft = m_config->entryIsImmutable("ShowTabsLeft");
 	m_hideTabs = m_config->readBoolEntry("HideTabs", false);
+        m_immutableHideTabs = m_config->entryIsImmutable("HideTabs");
+
 	if (m_initial) {
 		m_openViews = m_config->readListEntry("OpenViews");
 		m_savedWidth = m_config->readNumEntry("SavedWidth",200);
@@ -713,7 +733,7 @@
 					i18n("Configure Sidebar"));
 	}
 
-	if (m_showExtraButtons) {
+	if (m_showExtraButtons && !m_disableConfig) {
 		m_buttonBar->button(-1)->show();
 	} else {
 		m_buttonBar->button(-1)->hide();
@@ -848,7 +868,8 @@
 				m_buttonPopup->setItemEnabled(2,!m_currentButton->URL.isEmpty());
 			        m_buttonPopup->changeTitle(50,SmallIcon(m_currentButton->iconName),
 						m_currentButton->displayName);
-				m_buttonPopup->exec(QCursor::pos());
+				if (!m_disableConfig)
+                                { m_buttonPopup->exec(QCursor::pos()); }
 			}
 			return true;
 
@@ -859,8 +880,10 @@
 
 void Sidebar_Widget::mousePressEvent(QMouseEvent *ev)
 {
-	if (ev->type()==QEvent::MouseButtonPress && ((QMouseEvent \
                *)ev)->button()==QMouseEvent::RightButton)
-		m_menu->exec(QCursor::pos());
+	if (ev->type()==QEvent::MouseButtonPress &&
+            ((QMouseEvent *)ev)->button()==QMouseEvent::RightButton &&
+            !m_disableConfig)
+        { m_menu->exec(QCursor::pos()); }
 }
 
 KonqSidebarPlugin *Sidebar_Widget::loadModule(QWidget *par,QString \
                &desktopName,QString lib_name,ButtonInfo* bi)
--- branches/KDE/3.5/kdebase/konqueror/sidebar/sidebar_widget.h #817673:817674
@@ -74,7 +74,8 @@
 {
 	Q_OBJECT
 public:
-	addBackEnd(QWidget *parent,class QPopupMenu *addmenu, bool univeral, const QString \
&currentProfile, const char *name=0); +	addBackEnd(QWidget *parent,class QPopupMenu \
*addmenu, bool universal, +                   const QString &currentProfile, const \
char *name=0);  ~addBackEnd(){;}
 protected slots:
 	void aboutToShowAddMenu();
@@ -199,9 +200,14 @@
 
 	bool m_hasStoredUrl;
 	bool m_singleWidgetMode;
+        bool m_immutableSingleWidgetMode;
 	bool m_showTabsLeft;
+        bool m_immutableShowTabsLeft;
 	bool m_hideTabs;
+        bool m_immutableHideTabs;
+        bool m_disableConfig;
 	bool m_showExtraButtons;
+        bool m_immutableShowExtraButtons;
 	bool m_somethingVisible;
 	bool m_noUpdate;
 	bool m_initial;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic