[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace/plasma/sreich/sal-qml] plasma/netbook/containments/sal: add my own custom shell, plas
From: Shaun Reich <shaun.reich () kdemail ! net>
Date: 2012-02-29 22:45:22
Message-ID: 20120229224522.866B3A60C4 () git ! kde ! org
[Download RAW message or body]
Git commit b7ab3b804c479686cc45104a4af4f2e64f19d4a1 by Shaun Reich.
Committed on 29/02/2012 at 18:01.
Pushed by sreich into branch 'plasma/sreich/sal-qml'.
add my own custom shell, plasma-sal, from the basis of plasma-overaly
M +2 -0 plasma/netbook/containments/sal/CMakeLists.txt
A +254 -0 plasma/netbook/containments/sal/shell/BackgroundDialog.ui
A +27 -0 plasma/netbook/containments/sal/shell/CMakeLists.txt
A +5 -0 plasma/netbook/containments/sal/shell/Messages.sh
A +227 -0 plasma/netbook/containments/sal/shell/backgrounddialog.cpp \
[License: GPL (v2+)] A +52 -0 \
plasma/netbook/containments/sal/shell/backgrounddialog.h [License: GPL (v2+)] A \
+61 -0 plasma/netbook/containments/sal/shell/main.cpp [License: GPL (v2+)] A \
+17 -0 plasma/netbook/containments/sal/shell/org.kde.plasma-sal.App.xml A +10 \
-0 plasma/netbook/containments/sal/shell/plasma-salrc A +498 -0 \
plasma/netbook/containments/sal/shell/plasmaapp.cpp [License: GPL (v2+)] A +137 \
-0 plasma/netbook/containments/sal/shell/plasmaapp.h [License: GPL (v2+)] A \
+205 -0 plasma/netbook/containments/sal/shell/salcorona.cpp [License: LGPL \
(v2+)] A +65 -0 plasma/netbook/containments/sal/shell/salcorona.h [License: \
LGPL (v2+)] A +293 -0 plasma/netbook/containments/sal/shell/salview.cpp \
[License: LGPL (v2+)] A +85 -0 plasma/netbook/containments/sal/shell/salview.h \
[License: LGPL (v2+)]
http://commits.kde.org/kde-workspace/b7ab3b804c479686cc45104a4af4f2e64f19d4a1
diff --git a/plasma/netbook/containments/sal/CMakeLists.txt \
b/plasma/netbook/containments/sal/CMakeLists.txt index a7ecaa9..a7890d7 100644
--- a/plasma/netbook/containments/sal/CMakeLists.txt
+++ b/plasma/netbook/containments/sal/CMakeLists.txt
@@ -4,3 +4,5 @@ install(DIRECTORY package/
DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/sal)
install(FILES package/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME \
plasma-applet-sal.desktop) +
+add_subdirectory(shell)
\ No newline at end of file
diff --git a/plasma/netbook/containments/sal/shell/BackgroundDialog.ui \
b/plasma/netbook/containments/sal/shell/BackgroundDialog.ui new file mode 100644
index 0000000..d6d2df7
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/BackgroundDialog.ui
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BackgroundDialog</class>
+ <widget class="QWidget" name="BackgroundDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>519</width>
+ <height>173</height>
+ </rect>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>200</width>
+ <height>700</height>
+ </size>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="m_wallpaperLabel_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Widget Translucency</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>17</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>User activity:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>m_activeSlider</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QSlider" name="m_activeSlider">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>10</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>While idle:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>m_idleSlider</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QSlider" name="m_idleSlider">
+ <property name="maximum">
+ <number>10</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>17</width>
+ <height>13</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="0" colspan="2">
+ <widget class="QLabel" name="m_wallpaperLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Wallpaper</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>17</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1">
+ <widget class="QLabel" name="m_wallpaperTypeLabel">
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>m_wallpaperMode</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QComboBox" name="m_wallpaperMode">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>150</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1" rowspan="3">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="m_monitor">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Monitor</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QWidget" name="m_wallpaperConfig" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>143</width>
+ <height>6</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plasma/netbook/containments/sal/shell/CMakeLists.txt \
b/plasma/netbook/containments/sal/shell/CMakeLists.txt new file mode 100644
index 0000000..2c933fd
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/CMakeLists.txt
@@ -0,0 +1,27 @@
+include_directories(${KDEBASE_WORKSPACE_SOURCE_DIR}/libs \
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/plasmagenericshell) +
+set(plasma-sal_SRCS
+ main.cpp
+ plasmaapp.cpp
+ salcorona.cpp
+ salview.cpp
+)
+
+kde4_add_ui_files(plasma-sal_SRCS BackgroundDialog.ui)
+
+set(plasmaapp_dbusXML org.kde.plasma-sal.App.xml)
+
+qt4_add_dbus_adaptor(plasma-sal_SRCS ${plasmaapp_dbusXML} plasmaapp.h PlasmaApp)
+
+kde4_add_executable(plasma-sal ${plasma-sal_SRCS})
+
+target_link_libraries(plasma-sal ${KDE4_PLASMA_LIBS} kworkspace ${KDE4_KIO_LIBS} \
${KDE4_KFILE_LIBS} + ${X11_X11_LIB} \
plasmagenericshell) +if(X11_Xrender_FOUND)
+ target_link_libraries(plasma-sal ${X11_Xrender_LIB})
+endif(X11_Xrender_FOUND)
+
+set_target_properties(plasma-sal PROPERTIES OUTPUT_NAME plasma-sal)
+
+install(TARGETS plasma-sal ${INSTALL_TARGETS_DEFAULT_ARGS})
+install(FILES plasma-salrc DESTINATION ${CONFIG_INSTALL_DIR})
diff --git a/plasma/netbook/containments/sal/shell/Messages.sh \
b/plasma/netbook/containments/sal/shell/Messages.sh new file mode 100755
index 0000000..b79d051
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/Messages.sh
@@ -0,0 +1,5 @@
+#! /usr/bin/env bash
+$EXTRACTRC *.ui >> rc.cpp
+$XGETTEXT *.cpp -o $podir/plasma-overlay.pot
+rm -f rc.cpp
+
diff --git a/plasma/netbook/containments/sal/shell/backgrounddialog.cpp \
b/plasma/netbook/containments/sal/shell/backgrounddialog.cpp new file mode 100644
index 0000000..a92dc7a
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/backgrounddialog.cpp
@@ -0,0 +1,227 @@
+/*
+ Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
+ Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
+ Copyright (c) 2008 by Petri Damsten <damu@iki.fi>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+*/
+
+#include "backgrounddialog.h"
+
+//#include <QFile>
+//#include <QAbstractItemView>
+//#include <QStandardItemModel>
+
+#include <KDebug>
+//#include <KStandardDirs>
+//#include <KDesktopFile>
+//#include <KColorScheme>
+
+#include <Plasma/Containment>
+#include <Plasma/FrameSvg>
+#include <Plasma/Wallpaper>
+#include <Plasma/View>
+//#include <Plasma/Corona>
+
+#include "plasmaapp.h"
+#include "plasmagenericshell/wallpaperpreview.h"
+
+#include "kworkspace/screenpreviewwidget.h"
+
+typedef QPair<QString, QString> WallpaperInfo;
+Q_DECLARE_METATYPE(WallpaperInfo)
+
+
+BackgroundDialog::BackgroundDialog(const QSize& res, Plasma::Containment *c, \
/*Plasma::View* view,*/ QWidget* parent) + : KDialog(parent),
+ m_wallpaper(0),
+ //m_view(view),
+ m_containment(c),
+ m_preview(0)
+{
+ //setWindowIcon(KIcon("preferences-desktop-wallpaper"));
+ setCaption(i18n("Background Settings"));
+ setButtons(Ok | Cancel | Apply);
+
+ QWidget * main = new QWidget(this);
+ setupUi(main);
+
+ // Size of monitor image: 200x186
+ // Geometry of "display" part of monitor image: (23,14)-[151x115]
+ qreal previewRatio = (qreal)res.width() / (qreal)res.height();
+ QSize monitorSize(200, int(200 * previewRatio));
+
+ m_monitor->setFixedSize(200,200);
+ m_monitor->setText(QString());
+ m_monitor->setWhatsThis(i18n(
+ "This picture of a monitor contains a preview of "
+ "what the current settings will look like on your desktop."));
+ m_preview = new ScreenPreviewWidget(m_monitor);
+ m_preview->setRatio(previewRatio);
+ m_preview->resize(200,200);
+
+ connect(this, SIGNAL(finished(int)), this, SLOT(cleanup()));
+ connect(this, SIGNAL(okClicked()), this, SLOT(saveConfig()));
+ connect(this, SIGNAL(applyClicked()), this, SLOT(saveConfig()));
+
+ setMainWidget(main);
+ reloadConfig();
+ adjustSize();
+}
+
+BackgroundDialog::~BackgroundDialog()
+{
+ cleanup();
+}
+
+void BackgroundDialog::cleanup()
+{
+ //FIXME could be bad if we get hidden and reshown
+ delete m_wallpaper;
+ m_wallpaper = 0;
+}
+
+void BackgroundDialog::reloadConfig()
+{
+ //transparency
+ m_activeSlider->setValue(PlasmaApp::self()->activeOpacity() * 10);
+ m_idleSlider->setValue(PlasmaApp::self()->idleOpacity() * 10);
+
+ label->setVisible(PlasmaApp::hasComposite());
+ m_activeSlider->setVisible(PlasmaApp::hasComposite());
+
+ // Wallpaper
+ disconnect(m_wallpaperMode, SIGNAL(currentIndexChanged(int)), this, \
SLOT(changeBackgroundMode(int))); + int wallpaperIndex = 0;
+
+ bool doWallpaper = m_containment->drawWallpaper() && ! \
PlasmaApp::hasComposite(); + m_wallpaperLabel->setVisible(doWallpaper);
+ m_wallpaperTypeLabel->setVisible(doWallpaper);
+ m_wallpaperMode->setVisible(doWallpaper);
+ m_wallpaperConfig->setVisible(doWallpaper);
+ m_monitor->setVisible(doWallpaper);
+ m_preview->setVisible(doWallpaper);
+ if (doWallpaper) {
+ // Load wallpaper plugins
+ QString currentPlugin;
+ QString currentMode;
+
+ Plasma::Wallpaper *currentWallpaper = m_containment->wallpaper();
+ if (currentWallpaper) {
+ currentPlugin = currentWallpaper->pluginName();
+ currentMode = currentWallpaper->renderingMode().name();
+ }
+
+ const KPluginInfo::List plugins = Plasma::Wallpaper::listWallpaperInfo();
+ m_wallpaperMode->clear();
+ int i = 0;
+ QString placeholder = i18n("No Wallpaper");
+ //m_wallpaperMode->addItem(KIcon(), i18n("No Wallpaper"),
+ // QVariant::fromValue(WallpaperInfo(QString(), \
QString()))); + foreach (const KPluginInfo& info, plugins) {
+ bool matches = info.pluginName() == currentPlugin;
+ const QList<KServiceAction>& modes = info.service()->actions();
+ if (modes.count() > 0) {
+ foreach (const KServiceAction& mode, modes) {
+ m_wallpaperMode->addItem(KIcon(mode.icon()), mode.text(),
+ \
QVariant::fromValue(WallpaperInfo(info.pluginName(), mode.name()))); + \
if (matches && mode.name() == currentMode) { + wallpaperIndex \
= i; + }
+ ++i;
+ }
+ } else {
+ m_wallpaperMode->addItem(KIcon(info.icon()), info.name(),
+ QVariant::fromValue(WallpaperInfo(info.pluginName(), \
QString()))); + if (matches) {
+ wallpaperIndex = i;
+ }
+ ++i;
+ }
+ }
+ m_wallpaperMode->setCurrentIndex(wallpaperIndex);
+ changeBackgroundMode(wallpaperIndex);
+ }
+
+ connect(m_wallpaperMode, SIGNAL(currentIndexChanged(int)), this, \
SLOT(changeBackgroundMode(int))); +}
+
+void BackgroundDialog::changeBackgroundMode(int mode)
+{
+ kDebug();
+ QWidget* w = 0;
+ WallpaperInfo wallpaperInfo = \
m_wallpaperMode->itemData(mode).value<WallpaperInfo>(); +
+ if (!m_wallpaperConfig->layout()) {
+ new QVBoxLayout(m_wallpaperConfig);
+ }
+
+ if (m_wallpaperConfig->layout()->count() > 0) {
+ delete dynamic_cast<QWidgetItem*>(m_wallpaperConfig->layout()->takeAt(0))->widget();
+ }
+
+ if (m_wallpaper && m_wallpaper->pluginName() != wallpaperInfo.first) {
+ delete m_wallpaper;
+ m_wallpaper = 0;
+ }
+
+ if (wallpaperInfo.first.isEmpty()) {
+ return;
+ }
+
+ if (!m_wallpaper) {
+ m_wallpaper = Plasma::Wallpaper::load(wallpaperInfo.first);
+ m_preview->setPreview(m_wallpaper);
+ }
+
+ if (m_wallpaper) {
+ m_wallpaper->setRenderingMode(wallpaperInfo.second);
+ KConfigGroup cfg = wallpaperConfig(wallpaperInfo.first);
+ kDebug() << "making a" << wallpaperInfo.first << "in mode" << \
wallpaperInfo.second; + m_wallpaper->restore(cfg);
+ w = m_wallpaper->createConfigurationInterface(m_wallpaperConfig);
+ }
+
+ if (!w) {
+ w = new QWidget(m_wallpaperConfig);
+ }
+
+ m_wallpaperConfig->layout()->addWidget(w);
+}
+
+KConfigGroup BackgroundDialog::wallpaperConfig(const QString &plugin)
+{
+ Q_ASSERT(m_containment);
+
+ //FIXME: we have details about the structure of the containment config \
duplicated here! + KConfigGroup cfg = m_containment->config();
+ cfg = KConfigGroup(&cfg, "Wallpaper");
+ return KConfigGroup(&cfg, plugin);
+}
+
+void BackgroundDialog::saveConfig()
+{
+ //transparency
+ PlasmaApp::self()->setActiveOpacity(m_activeSlider->value() / 10.0);
+ PlasmaApp::self()->setIdleOpacity(m_idleSlider->value() / 10.0);
+
+ // Wallpaper
+ QString wallpaperPlugin = \
m_wallpaperMode->itemData(m_wallpaperMode->currentIndex()).value<WallpaperInfo>().first;
+ QString wallpaperMode = \
m_wallpaperMode->itemData(m_wallpaperMode->currentIndex()).value<WallpaperInfo>().second;
+
+ Plasma::Wallpaper *currentWallpaper = m_containment->wallpaper();
+ if (currentWallpaper) {
+ KConfigGroup cfg = wallpaperConfig(currentWallpaper->pluginName());
+ currentWallpaper->save(cfg);
+ }
+
+ if (m_wallpaper) {
+ KConfigGroup cfg = wallpaperConfig(m_wallpaper->pluginName());
+ m_wallpaper->save(cfg);
+ }
+
+ m_containment->setWallpaper(wallpaperPlugin, wallpaperMode);
+}
diff --git a/plasma/netbook/containments/sal/shell/backgrounddialog.h \
b/plasma/netbook/containments/sal/shell/backgrounddialog.h new file mode 100644
index 0000000..04b507a
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/backgrounddialog.h
@@ -0,0 +1,52 @@
+/*
+ Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
+ Copyright (c) 2008 by Petri Damsten <damu@iki.fi>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+*/
+
+#ifndef BACKGROUNDDIALOG_H
+#define BACKGROUNDDIALOG_H
+
+#include <KDialog>
+#include "ui_BackgroundDialog.h"
+
+namespace Plasma {
+ class Wallpaper;
+ class Containment;
+ class View;
+}
+
+class ScreenPreviewWidget;
+
+class BackgroundDialog : public KDialog, public Ui::BackgroundDialog
+{
+ Q_OBJECT
+public:
+ BackgroundDialog(const QSize &res, Plasma::Containment *containment,
+ /*Plasma::View *view,*/ QWidget *parent = 0);
+ ~BackgroundDialog();
+
+ void reloadConfig();
+
+public slots:
+ void saveConfig();
+
+private:
+ KConfigGroup wallpaperConfig(const QString &plugin);
+
+private slots:
+ void changeBackgroundMode(int mode);
+ void cleanup();
+
+private:
+ Plasma::Wallpaper* m_wallpaper;
+ //Plasma::View* m_view;
+ Plasma::Containment* m_containment;
+ ScreenPreviewWidget* m_preview;
+};
+
+#endif // BACKGROUNDDIALOG_H
diff --git a/plasma/netbook/containments/sal/shell/main.cpp \
b/plasma/netbook/containments/sal/shell/main.cpp new file mode 100644
index 0000000..03b3036
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/main.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
+ * Copyright 2008 Chani Armitage <chanika@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <KAboutData>
+#include <KCmdLineArgs>
+#include <KLocale>
+#include <KIcon>
+
+#include <config-workspace.h>
+#include "plasmaapp.h"
+
+static const char description[] = I18N_NOOP( "Plasma widgets over the screensaver" \
); +static const char version[] = "0.0";
+
+//extern "C"
+int main(int argc, char **argv)
+{
+ KAboutData aboutData("plasma-sal",0 , ki18n("Plasma for the Screensaver"),
+ version, ki18n(description), KAboutData::License_GPL,
+ ki18n("Copyright 2006-2008, The KDE Team"));
+ aboutData.addAuthor(ki18n("Chani Armitage"),
+ ki18n("Author and maintainer"),
+ "chanika@gmail.com");
+ aboutData.addAuthor(ki18n("Aaron J. Seigo"),
+ ki18n("Plasma Author and maintainer"),
+ "aseigo@kde.org");
+ aboutData.addCredit(ki18n("John Lions"),
+ ki18n("In memory of his contributions, 1937-1998."),
+ 0, "http://en.wikipedia.org/wiki/John_Lions");
+
+ KCmdLineArgs::init(argc, argv, &aboutData);
+
+ KCmdLineOptions options;
+ options.add("cheats",ki18n("Enables some cheats that are useful for \
debugging.")); + options.add("setup",ki18n("Start unlocked for configuration."));
+ KCmdLineArgs::addCmdLineOptions(options);
+
+ PlasmaApp *app = PlasmaApp::self();
+ QApplication::setWindowIcon(KIcon("plasma"));
+ app->disableSessionManagement(); // I assume we'd never want a screensaver thing \
reppearing on login? + int rc = app->exec();
+ delete app;
+ return rc;
+}
diff --git a/plasma/netbook/containments/sal/shell/org.kde.plasma-sal.App.xml \
b/plasma/netbook/containments/sal/shell/org.kde.plasma-sal.App.xml new file mode \
100644 index 0000000..54724a8
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/org.kde.plasma-sal.App.xml
@@ -0,0 +1,17 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" \
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node>
+ <interface name="org.kde.plasmaoverlay.App">
+ <signal name="hidden">
+ </signal>
+ <method name="setActive">
+ <arg name="activate" type="b" direction="in"/>
+ </method>
+ <method name="lock">
+ </method>
+ <method name="setup">
+ <arg name="setupMode" type="b" direction="in"/>
+ </method>
+ <method name="quit">
+ </method>
+ </interface>
+</node>
diff --git a/plasma/netbook/containments/sal/shell/plasma-salrc \
b/plasma/netbook/containments/sal/shell/plasma-salrc new file mode 100644
index 0000000..393e2c9
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/plasma-salrc
@@ -0,0 +1,10 @@
+[KDE Action Restrictions][$i]
+plasma/allow_configure_when_locked=false
+
+[Constraints]
+FileDialog=false
+LaunchApp=false
+
+[General]
+ExcludeCategories=Windows and Tasks,Application Launchers
+
diff --git a/plasma/netbook/containments/sal/shell/plasmaapp.cpp \
b/plasma/netbook/containments/sal/shell/plasmaapp.cpp new file mode 100644
index 0000000..c55ec8d
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/plasmaapp.cpp
@@ -0,0 +1,498 @@
+/*
+ * Copyright 2006 Aaron Seigo <aseigo@kde.org>
+ * Copyright 2008 Chani Armitage <chanika@gmail.com>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+// plasma.loadEngine("hardware")
+// LineGraph graph
+// plasma.connect(graph, "hardware", "cpu");
+
+#include "plasmaapp.h"
+
+#include <unistd.h>
+
+#ifndef _SC_PHYS_PAGES
+ #ifdef Q_OS_FREEBSD
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #endif
+
+ #ifdef Q_OS_NETBSD
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
+ #endif
+#endif
+
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QPixmapCache>
+#include <QtDBus/QtDBus>
+
+//#include <KCrash>
+#include <KDebug>
+#include <KCmdLineArgs>
+#include <KWindowSystem>
+
+//#include <ksmserver_interface.h>
+
+#include <Plasma/Containment>
+#include <Plasma/Theme>
+#include <Plasma/Dialog>
+
+#include "appadaptor.h"
+#include "salcorona.h"
+#include "salview.h"
+
+#include <X11/Xlib.h>
+#include <X11/extensions/Xrender.h>
+#include <fixx11h.h>
+
+Atom tag; //FIXME should this be a member var or what?
+const unsigned char DIALOG = 1; //FIXME this is really bad code
+const unsigned char VIEW = 2;
+
+Display* dpy = 0;
+Colormap colormap = 0;
+Visual *visual = 0;
+bool composite = false;
+
+void checkComposite()
+{
+ dpy = XOpenDisplay(0); // open default display
+ if (!dpy) {
+ kError() << "Cannot connect to the X server" << endl;
+ return;
+ }
+ if( qgetenv( "KDE_SKIP_ARGB_VISUALS" ) == "1" )
+ return;
+
+ int screen = DefaultScreen(dpy);
+ int eventBase, errorBase;
+
+ if (XRenderQueryExtension(dpy, &eventBase, &errorBase)) {
+ int nvi;
+ XVisualInfo templ;
+ templ.screen = screen;
+ templ.depth = 32;
+ templ.c_class = TrueColor;
+ XVisualInfo *xvi = XGetVisualInfo(dpy,
+ VisualScreenMask | VisualDepthMask | \
VisualClassMask, + &templ, &nvi);
+ for (int i = 0; i < nvi; ++i) {
+ XRenderPictFormat *format = XRenderFindVisualFormat(dpy, xvi[i].visual);
+ if (format->type == PictTypeDirect && format->direct.alphaMask) {
+ visual = xvi[i].visual;
+ colormap = XCreateColormap(dpy, RootWindow(dpy, screen), visual, \
AllocNone); + break;
+ }
+ }
+ XFree(xvi);
+ }
+
+ composite = KWindowSystem::compositingActive() && colormap;
+
+ kDebug() << (colormap ? "Plasma has an argb visual" : "Plasma lacks an argb \
visual") << visual << colormap; + kDebug() << ((KWindowSystem::compositingActive() \
&& colormap) ? "Plasma can use COMPOSITE for effects" + \
: "Plasma is COMPOSITE-less") << "on" << dpy; +}
+
+PlasmaApp* PlasmaApp::self()
+{
+ if (!kapp) {
+ checkComposite();
+ return new PlasmaApp(dpy, visual ? Qt::HANDLE(visual) : 0, colormap ? \
Qt::HANDLE(colormap) : 0); + }
+
+ return qobject_cast<PlasmaApp*>(kapp);
+}
+
+PlasmaApp::PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap)
+ : KUniqueApplication(display, visual, colormap),
+ m_corona(0)
+{
+ //load translations for libplasma
+ KGlobal::locale()->insertCatalog("libplasma");
+ KGlobal::locale()->insertCatalog("plasmagenericshell");
+
+ new AppAdaptor(this);
+ QDBusConnection::sessionBus().registerObject("/App", this);
+
+ //FIXME this is probably totally invalid
+ // Enlarge application pixmap cache
+ // Calculate the size required to hold background pixmaps for all screens.
+ // Add 10% so that other (smaller) pixmaps can also be cached.
+ int cacheSize = 0;
+ QDesktopWidget *desktop = QApplication::desktop();
+ int numScreens = desktop->numScreens();
+ for (int i = 0; i < numScreens; i++) {
+ QRect geometry = desktop->screenGeometry(i);
+ cacheSize += 4 * geometry.width() * geometry.height() / 1024;
+ }
+ cacheSize += cacheSize / 10;
+
+ // Calculate the size of physical system memory; _SC_PHYS_PAGES *
+ // _SC_PAGESIZE is documented to be able to overflow 32-bit integers,
+ // so apply a 10-bit shift. FreeBSD 6-STABLE doesn't have _SC_PHYS_PAGES
+ // (it is documented in FreeBSD 7-STABLE as "Solaris and Linux extension")
+ // so use sysctl in those cases.
+#if defined(_SC_PHYS_PAGES)
+ int memorySize = sysconf(_SC_PHYS_PAGES);
+ memorySize *= sysconf(_SC_PAGESIZE) / 1024;
+#else
+#ifdef Q_OS_FREEBSD
+ int sysctlbuf[2];
+ size_t size = sizeof(sysctlbuf);
+ int memorySize;
+ // This could actually use hw.physmem instead, but I can't find
+ // reliable documentation on how to read the value (which may
+ // not fit in a 32 bit integer).
+ if (!sysctlbyname("vm.stats.vm.v_page_size", sysctlbuf, &size, NULL, 0)) {
+ memorySize = sysctlbuf[0] / 1024;
+ size = sizeof(sysctlbuf);
+ if (!sysctlbyname("vm.stats.vm.v_page_count", sysctlbuf, &size, NULL, 0)) {
+ memorySize *= sysctlbuf[0];
+ }
+ }
+#endif
+#ifdef Q_OS_NETBSD
+ size_t memorySize;
+ size_t len;
+ static int mib[] = { CTL_HW, HW_PHYSMEM };
+
+ len = sizeof(memorySize);
+ sysctl(mib, 2, &memorySize, &len, NULL, 0);
+ memorySize /= 1024;
+#endif
+ // If you have no suitable sysconf() interface and are not FreeBSD,
+ // then you are out of luck and get a compile error.
+#endif
+
+ // Increase the pixmap cache size to 1% of system memory if it isn't already
+ // larger so as to maximize cache usage. 1% of 1GB ~= 10MB.
+ if (cacheSize < memorySize / 100) {
+ cacheSize = memorySize / 100;
+ }
+
+ kDebug() << "Setting the pixmap cache size to" << cacheSize << "kilobytes";
+ QPixmapCache::setCacheLimit(cacheSize);
+
+ KConfigGroup cg(KGlobal::config(), "General");
+ Plasma::Theme::defaultTheme()->setFont(cg.readEntry("desktopFont", font()));
+ m_activeOpacity = cg.readEntry("activeOpacity", 1.0);
+
+ if (cg.readEntry("forceNoComposite", false)) {
+ composite = false;
+ }
+
+ //we have to keep an eye on created windows
+ tag = XInternAtom(QX11Info::display(), "_KDE_SCREENSAVER_OVERRIDE", False);
+ qApp->installEventFilter(this);
+
+ // this line initializes the corona.
+ corona();
+
+ connect(this, SIGNAL(aboutToQuit()), this, SLOT(cleanup()));
+
+ setup(KCmdLineArgs::parsedArgs()->isSet("setup"));
+
+ m_viewCreationTimer.setSingleShot(true);
+ m_viewCreationTimer.setInterval(0);
+ connect(&m_viewCreationTimer, SIGNAL(timeout()), this, \
SLOT(createWaitingViews())); +}
+
+PlasmaApp::~PlasmaApp()
+{
+}
+
+void PlasmaApp::cleanup()
+{
+ if (m_corona) {
+ m_corona->saveLayout();
+ }
+
+ qDeleteAll(m_views);
+ delete m_corona;
+ m_corona = 0;
+
+ KGlobal::config()->sync();
+}
+
+void PlasmaApp::setActiveOpacity(qreal opacity)
+{
+ if (qFuzzyCompare(opacity, m_activeOpacity)) {
+ return;
+ }
+ m_activeOpacity = opacity;
+ emit setViewOpacity(opacity);
+ KConfigGroup cg(KGlobal::config(), "General");
+ cg.writeEntry("activeOpacity", opacity);
+ m_corona->requestConfigSync();
+}
+
+void PlasmaApp::createWaitingViews()
+{
+ const QList<QWeakPointer<Plasma::Containment> > containments = m_viewsWaiting;
+ m_viewsWaiting.clear();
+ foreach(QWeakPointer<Plasma::Containment> weakContainment, containments) {
+ if (weakContainment) {
+ Plasma::Containment *containment = weakContainment.data();
+
+ KConfigGroup viewIds(KGlobal::config(), "ViewIds");
+
+ // we have a new screen. neat.
+ SalView *view = viewForScreen(containment->screen());
+ if (view) {
+ return;
+ }
+
+ view = new SalView(containment, 0);
+ if (m_corona) {
+ connect(m_corona, \
SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)), + \
view, SLOT(screenOwnerChanged(int,int,Plasma::Containment*))); + \
connect(m_corona, SIGNAL(shortcutsChanged()), view, SLOT(updateShortcuts())); + \
} + view->setGeometry(QApplication::desktop()->screenGeometry(containment->screen()));
+
+ //FIXME why do I get BadWindow?
+ //unsigned char data = VIEW;
+ //XChangeProperty(QX11Info::display(), view->effectiveWinId(), tag, tag, \
8, PropModeReplace, &data, 1); +
+ connect(containment, SIGNAL(configureRequested(Plasma::Containment*)),
+ this, SLOT(configureContainment(Plasma::Containment*)));
+
+ //a hack to make sure the keyboard shortcut works
+ view->addAction(corona()->action("unlock desktop"));
+ view->addAction(corona()->action("unlock widgets"));
+ m_views.append(view);
+ connect(view, SIGNAL(hidden()), SLOT(lock()));
+ connect(view, SIGNAL(hidden()), SIGNAL(hidden()));
+ connect(this, SIGNAL(showViews()), view, SLOT(show()));
+ connect(this, SIGNAL(hideViews()), view, SLOT(hide()));
+ connect(this, SIGNAL(setViewOpacity(qreal)), view, \
SLOT(setOpacity(qreal))); + connect(this, SIGNAL(enableSetupMode()), view, \
SLOT(disableSetupMode())); + connect(this, SIGNAL(disableSetupMode()), \
view, SLOT(disableSetupMode())); + connect(this, SIGNAL(openToolBox()), \
view, SLOT(openToolBox())); + connect(this, SIGNAL(closeToolBox()), view, \
SLOT(closeToolBox())); + connect(QApplication::desktop(), \
SIGNAL(resized(int)), view, SLOT(adjustSize(int))); + emit(openToolBox());
+ kDebug() << "view created";
+ }
+ }
+ //activate the new views (yes, this is a lazy way to do it)
+ setActive(m_active);
+}
+
+qreal PlasmaApp::activeOpacity() const
+{
+ return m_activeOpacity;
+}
+
+void PlasmaApp::setActive(bool activate)
+{
+ m_active = activate;
+
+ emit setViewOpacity(m_activeOpacity);
+ emit showViews();
+ emit openToolBox();
+}
+
+void PlasmaApp::syncConfig()
+{
+ KGlobal::config()->sync();
+}
+
+Plasma::Corona* PlasmaApp::corona()
+{
+ if (!m_corona) {
+ m_corona = new SalCorona(this);
+ connect(m_corona, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)),
+ this, \
SLOT(containmentScreenOwnerChanged(int,int,Plasma::Containment*))); + \
connect(m_corona, SIGNAL(configSynced()), SLOT(syncConfig())); + //kDebug() << \
"connected to containmentAdded"; + /*
+ foreach (DesktopView *view, m_desktops) {
+ connect(c, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)),
+ view, \
SLOT(screenOwnerChanged(int,int,Plasma::Containment*))); + }*/
+
+ m_corona->setItemIndexMethod(QGraphicsScene::NoIndex);
+ m_corona->initializeLayout();
+
+ //we want this *after* init so that we ignore any lock/unlock spasms that \
might happen then + connect(m_corona, \
SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, \
SLOT(immutabilityChanged(Plasma::ImmutabilityType))); +
+ //kDebug() << "layout should exist";
+ //c->checkScreens();
+ }
+
+ return m_corona;
+}
+
+bool PlasmaApp::hasComposite()
+{
+ return composite;
+}
+
+void PlasmaApp::containmentScreenOwnerChanged(int wasScreen, int isScreen, \
Plasma::Containment *containment) +{
+ Q_UNUSED(wasScreen);
+ if (isScreen < 0)
+ return;
+ m_viewsWaiting.append(containment);
+ m_viewCreationTimer.start();
+}
+
+void PlasmaApp::setup(bool setupMode)
+{
+ kDebug() << "setup mode:" << setupMode;
+
+ if (setupMode) {
+ emit enableSetupMode();
+ if (m_corona->immutability() == Plasma::UserImmutable) {
+ m_corona->setImmutability(Plasma::Mutable);
+ }
+ setActive(true);
+ } else {
+ kDebug() << "checking lockprocess is still around";
+ QDBusInterface lockprocess("org.kde.screenlocker", "/LockProcess",
+ "org.kde.screenlocker.LockProcess", QDBusConnection::sessionBus(), \
this); + if (lockprocess.isValid()) {
+ kDebug() << "success!";
+ setActive(false);
+ } else {
+ kDebug() << "bailing out";
+ qApp->quit(); //this failed once. why?
+ }
+ }
+}
+
+bool PlasmaApp::eventFilter(QObject *obj, QEvent *event)
+{
+ if (event->type() == QEvent::Show) {
+ //apparently this means we created a new window
+ //so, add a tag to prove it's our window
+ //FIXME using the show event means we tag on every show, not just the first.
+ //harmless but kinda wasteful.
+ QWidget *widget = qobject_cast<QWidget*>(obj);
+ if (widget && widget->isWindow() && !(qobject_cast<QDesktopWidget*>(widget) \
|| + widget->testAttribute(Qt::WA_DontShowOnScreen))) {
+ unsigned char data = 0;
+ if (qobject_cast<SalView*>(widget)) {
+ data = VIEW;
+ } else if (m_dialogs.contains(widget)) {
+ data = DIALOG;
+ } else {
+ Qt::WindowFlags oldFlags = widget->windowFlags();
+ Qt::WindowFlags newFlags = oldFlags | \
Qt::X11BypassWindowManagerHint; + if (oldFlags != newFlags) {
+ //now we're *really* fucking with things
+ //we force-disable window management and frames to cut off \
access to wm-y stuff + //and to make it easy to check the tag \
(frames are a pain) + kDebug() << "!!!!!!!setting flags on!!!!!" \
<< widget; + QDesktopWidget *desktop = QApplication::desktop();
+ if (qobject_cast<Plasma::Dialog*>(widget)) {
+ //this is a terrible horrible hack that breaks extenders but \
it mostly works + //weird thing is, it sometimes makes the \
calendar popup too small. + newFlags = Qt::Popup;
+ } else {
+ //plasmadialogs can't handle direct input
+ //but configdialogs need it
+ m_dialogs.append(widget);
+ connect(widget, SIGNAL(destroyed(QObject*)), \
SLOT(dialogDestroyed(QObject*))); + connect(this, \
SIGNAL(showDialogs()), widget, SLOT(show())); + connect(this, \
SIGNAL(hideDialogs()), widget, SLOT(hide())); + }
+ widget->setWindowFlags(newFlags);
+ //we do not know the screen this widget should appear on
+ QRect availableGeometry = desktop->availableGeometry();
+ //move to the default screen
+ widget->move(availableGeometry.x(), availableGeometry.y());
+ widget->show(); //setting the flags hid it :(
+ //qApp->setActiveWindow(widget); //gives kbd but not mouse \
events + //kDebug() << "parent" << widget->parentWidget();
+ //FIXME why can I only activate these dialogs from this exact \
line? + widget->activateWindow(); //gives keyboard focus
+ return false; //we'll be back when we get the new show event
+ } else {
+ widget->activateWindow(); //gives keyboard focus
+ }
+ }
+
+ XChangeProperty(QX11Info::display(), widget->effectiveWinId(), tag, tag, \
8, PropModeReplace, &data, 1); + kDebug() << "tagged" << widget << \
widget->effectiveWinId() << "as" << data; + }
+ }
+ return false;
+}
+
+void PlasmaApp::dialogDestroyed(QObject *obj)
+{
+ m_dialogs.removeAll(qobject_cast<QWidget*>(obj));
+ //if (m_dialogs.isEmpty()) {
+ //FIXME multiview
+ //if (m_view) {
+ //this makes qactions work again
+ //m_view->activateWindow();
+ //}
+ /*} else { failed attempt to fix kbd input after a subdialog closes
+ QWidget *top = m_dialogs.last();
+ top->activateWindow();
+ kDebug() << top;*/
+ //}
+}
+
+void PlasmaApp::configureContainment(Plasma::Containment *containment)
+{
+
+}
+
+void PlasmaApp::lock()
+{
+ kDebug() << "lock";
+ if (corona() && corona()->immutability() == Plasma::Mutable) {
+ corona()->setImmutability(Plasma::UserImmutable);
+ }
+}
+
+void PlasmaApp::quit()
+{
+ qApp->quit();
+}
+
+void PlasmaApp::immutabilityChanged(Plasma::ImmutabilityType immutability)
+{
+ if (immutability == Plasma::Mutable) {
+ emit showDialogs();
+ } else {
+ emit hideDialogs();
+ emit hideWidgetExplorer();
+ emit disableSetupMode();
+ }
+}
+
+SalView *PlasmaApp::viewForScreen(int screen)
+{
+ foreach(SalView *view, m_views) {
+ if (view->screen() == screen)
+ return view;
+ }
+ return 0;
+}
+
+#include "plasmaapp.moc"
diff --git a/plasma/netbook/containments/sal/shell/plasmaapp.h \
b/plasma/netbook/containments/sal/shell/plasmaapp.h new file mode 100644
index 0000000..f3f011f
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/plasmaapp.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2006, 2007 Aaron Seigo <aseigo@kde.org>
+ * Copyright 2008 Chani Armitage <chanika@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PLASMA_APP_H
+#define PLASMA_APP_H
+
+#include <QList>
+#include <QPointer>
+#include <QTimer>
+
+#include <KUniqueApplication>
+
+#include <plasma/plasma.h>
+
+namespace Plasma
+{
+ class Containment;
+ class Corona;
+} // namespace Plasma
+
+class SalView;
+
+class PlasmaApp : public KUniqueApplication
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.plasmasal.App")
+public:
+ ~PlasmaApp();
+
+ static PlasmaApp* self();
+ static bool hasComposite();
+
+ Plasma::Corona* corona();
+
+ void setActiveOpacity(qreal opacity);
+ void setIdleOpacity(qreal opacity);
+ qreal activeOpacity() const;
+ qreal idleOpacity() const;
+
+Q_SIGNALS:
+ // DBUS interface.
+ //if you change stuff, remember to regenerate with:
+ //qdbuscpp2xml -S -M plasmaapp.h > org.kde.plasma-overlay.App.xml
+
+ //XXX can this be deleted? probably. if lockprocess really cares it can use the \
unmapnotify + void hidden();
+
+public Q_SLOTS:
+ // DBUS interface.
+ //if you change stuff, remember to regenerate ^^^
+ /**
+ * tell plasma to go into active mode, ready for interaction
+ */
+ void setActive(bool activate);
+
+ /**
+ * lock widgets
+ */
+ void lock();
+
+ //not really slots, but we want them in dbus:
+
+ /**
+ * get plasma all set up and ready
+ * this makes sure things like opacity, visibility and locked-ness are set right
+ * normally this is called only by plasmaapp itself when it finishes \
initialization, but it's + * possible that it might need to be run again by \
lockprocess + *
+ * @param setupMode whether we're starting in setup mode
+ */
+ void setup(bool setupMode);
+
+ /**
+ * quit the application
+ * this is a duplicate so we can have everything we need in one dbus interface
+ */
+ void quit();
+
+private Q_SLOTS:
+ void cleanup();
+ //void adjustSize(int screen);
+ void dialogDestroyed(QObject *obj);
+ void configureContainment(Plasma::Containment*);
+ void syncConfig();
+ void immutabilityChanged(Plasma::ImmutabilityType immutability);
+ void createWaitingViews();
+ void containmentScreenOwnerChanged(int, int, Plasma::Containment*);
+
+Q_SIGNALS:
+ void showViews();
+ void hideViews();
+ void setViewOpacity(qreal opacity);
+ void showDialogs();
+ void hideDialogs();
+ void hideWidgetExplorer();
+ void enableSetupMode();
+ void disableSetupMode();
+ void openToolBox();
+ void closeToolBox();
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *event);
+
+private:
+ PlasmaApp(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap);
+ SalView *viewForScreen(int screen);
+
+ Plasma::Corona *m_corona;
+ QList<SalView*> m_views;
+ QList<QWidget*> m_dialogs;
+
+ QList<QWeakPointer<Plasma::Containment> > m_viewsWaiting;
+ QTimer m_viewCreationTimer;
+
+ qreal m_activeOpacity;
+ qreal m_idleOpacity;
+ bool m_active;
+};
+
+#endif // multiple inclusion guard
diff --git a/plasma/netbook/containments/sal/shell/salcorona.cpp \
b/plasma/netbook/containments/sal/shell/salcorona.cpp new file mode 100644
index 0000000..2093c9b
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/salcorona.cpp
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2008 Aaron Seigo <aseigo@kde.org>
+ * Copyright 2008 by Chani Armitage <chanika@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "salcorona.h"
+
+#include <QApplication>
+#include <QDesktopWidget>
+#include <QGraphicsLayout>
+#include <QAction>
+
+#include <QDBusConnection>
+#include <QDBusInterface>
+#include <QDBusMessage>
+
+#include <KDebug>
+#include <KDialog>
+#include <KStandardDirs>
+#include <KIcon>
+
+#include <Plasma/Containment>
+#include <plasma/containmentactionspluginsconfig.h>
+
+SalCorona::SalCorona(QObject *parent)
+ : Plasma::Corona(parent)
+{
+ init();
+}
+
+void SalCorona::init()
+{
+ setPreferredToolBoxPlugin(Plasma::Containment::DesktopContainment, \
"org.kde.desktoptoolbox"); + \
setPreferredToolBoxPlugin(Plasma::Containment::CustomContainment, \
"org.kde.desktoptoolbox"); + \
setPreferredToolBoxPlugin(Plasma::Containment::PanelContainment, \
"org.kde.paneltoolbox"); + \
setPreferredToolBoxPlugin(Plasma::Containment::CustomPanelContainment, \
"org.kde.paneltoolbox"); +
+ QDesktopWidget *desktop = QApplication::desktop();
+ connect(desktop,SIGNAL(screenCountChanged(int)), SLOT(numScreensUpdated(int)));
+ m_numScreens = desktop->numScreens();
+
+ Plasma::ContainmentActionsPluginsConfig plugins;
+ plugins.addPlugin(Qt::NoModifier, Qt::RightButton, "minimalcontextmenu");
+ //should I add paste too?
+ setContainmentActionsDefaults(Plasma::Containment::CustomContainment, plugins);
+
+ bool unlocked = immutability() == Plasma::Mutable;
+
+ QAction *lock = action("lock widgets");
+ if (lock) {
+ kDebug() << "unlock action";
+ //rename the lock action so that corona doesn't mess with it
+ addAction("unlock widgets", lock);
+ //rewire the action so we can check for a password
+ lock->disconnect(SIGNAL(triggered(bool)));
+ connect(lock, SIGNAL(triggered()), this, SLOT(toggleLock()));
+ lock->setIcon(KIcon(unlocked ? "object-locked" : "configure"));
+ lock->setText(unlocked ? i18n("Lock Screen") : i18n("Configure Widgets"));
+ }
+
+ //the most important action ;)
+ QAction *leave = new QAction(unlocked ? i18n("Leave Screensaver") : \
i18n("Unlock"), this); + leave->setIcon(KIcon("system-lock-screen"));
+ leave->setShortcut(QKeySequence("esc"));
+ connect(leave, SIGNAL(triggered()), this, SLOT(unlockDesktop()));
+ addAction("unlock desktop", leave);
+
+ //updateShortcuts(); //just in case we ever get a config dialog
+
+ connect(this, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), \
SLOT(updateActions(Plasma::ImmutabilityType))); +}
+
+void SalCorona::loadDefaultLayout()
+{
+ //kDebug();
+ QDesktopWidget *desktop = QApplication::desktop();
+
+ // create a containment for the screens
+ Plasma::Containment *c;
+ for(int screen = 0; screen < m_numScreens; ++screen)
+ {
+ QRect g = desktop->screenGeometry(screen);
+ kDebug() << " screen" << screen << "geometry is" << g;
+ c = addContainment("saverdesktop");
+ if (c) {
+ c->setScreen(screen);
+ c->setFormFactor(Plasma::Planar);
+ c->flushPendingConstraintsEvents();
+ }
+ }
+
+ // a default clock
+ c = containmentForScreen(desktop->primaryScreen());
+ if (c) {
+ Plasma::Applet *clock = Plasma::Applet::load("clock"/*, c->id() + 1*/);
+ c->addApplet(clock, QPointF(KDialog::spacingHint(), KDialog::spacingHint()), \
true); + clock->init();
+ clock->flushPendingConstraintsEvents();
+ }
+ //emit containmentAdded(c);
+}
+
+int SalCorona::numScreens() const
+{
+ return m_numScreens;
+}
+
+QRect SalCorona::screenGeometry(int id) const
+{
+ return QApplication::desktop()->screenGeometry(id);
+}
+
+void SalCorona::updateActions(Plasma::ImmutabilityType immutability)
+{
+ bool unlocked = immutability == Plasma::Mutable;
+ QAction *a = action("unlock widgets");
+ if (a) {
+ a->setIcon(KIcon(unlocked ? "object-locked" : "configure"));
+ a->setText(unlocked ? i18n("Lock Screen") : i18n("Configure Widgets"));
+ }
+ a = action("unlock desktop");
+ if (a) {
+ a->setText(unlocked ? i18n("Leave Screensaver") : i18n("Unlock"));
+ }
+}
+
+void SalCorona::toggleLock()
+{
+ //require a password to unlock
+ QDBusInterface lockprocess("org.kde.screenlocker", "/LockProcess", \
"org.kde.screenlocker.LockProcess", QDBusConnection::sessionBus(), this); + if \
(immutability() == Plasma::Mutable) { + \
setImmutability(Plasma::UserImmutable); + lockprocess.call(QDBus::NoBlock, \
"startLock"); + kDebug() << "locking up!";
+ } else if (immutability() == Plasma::UserImmutable) {
+ QList<QVariant> args;
+ args << i18n("Unlock widgets to configure them");
+ bool sent = lockprocess.callWithCallback("checkPass", args, this, \
SLOT(unlock(QDBusMessage)), SLOT(dbusError(QDBusError))); + kDebug() << sent;
+ }
+}
+
+void SalCorona::unlock(QDBusMessage reply)
+{
+ //assuming everything went as expected
+ if (reply.arguments().isEmpty()) {
+ kDebug() << "quit succeeded, I guess";
+ return;
+ }
+ //else we were trying to unlock just the widgets
+ bool success = reply.arguments().first().toBool();
+ kDebug() << success;
+ if (success) {
+ setImmutability(Plasma::Mutable);
+ }
+}
+
+void SalCorona::dbusError(QDBusError error)
+{
+ kDebug() << error.errorString(error.type());
+ kDebug() << "bailing out";
+ //if it was the quit call and it failed, we shouldn't leave the user stuck in
+ //plasma-overlay forever.
+ qApp->quit();
+}
+
+void SalCorona::unlockDesktop()
+{
+ QDBusInterface lockprocess("org.kde.screenlocker", "/LockProcess",
+ "org.kde.screenlocker.LockProcess", QDBusConnection::sessionBus(), \
this); + bool sent = (lockprocess.isValid() &&
+ lockprocess.callWithCallback("quit", QList<QVariant>(), this, \
SLOT(unlock(QDBusMessage)), SLOT(dbusError(QDBusError)))); + //the unlock slot \
above is a dummy that should never be called. + //somehow I need a valid reply \
slot or the error slot is never ever used. + if (!sent) {
+ //ah crud.
+ kDebug() << "bailing out!";
+ qApp->quit();
+ }
+}
+
+void SalCorona::numScreensUpdated(int newCount)
+{
+ m_numScreens = newCount;
+ //do something?
+}
+
+
+#include "salcorona.moc"
+
diff --git a/plasma/netbook/containments/sal/shell/salcorona.h \
b/plasma/netbook/containments/sal/shell/salcorona.h new file mode 100644
index 0000000..bf04851
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/salcorona.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2008 Aaron Seigo <aseigo@kde.org>
+ * Copyright 2008 by Chani Armitage <chanika@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SALCORONA_H
+#define SALCORONA_H
+
+#include <QtGui/QGraphicsScene>
+
+#include <Plasma/Corona>
+
+class QDBusMessage;
+class QDBusError;
+
+/**
+ * @short A Corona for SAL
+ */
+class SalCorona : public Plasma::Corona
+{
+ Q_OBJECT
+
+public:
+ explicit SalCorona(QObject * parent = 0);
+
+ /**
+ * Loads the default (system wide) layout for this user
+ **/
+ void loadDefaultLayout();
+
+ virtual int numScreens() const;
+ virtual QRect screenGeometry(int id) const;
+
+private Q_SLOTS:
+ void updateActions(Plasma::ImmutabilityType immutability);
+ void toggleLock();
+ void unlock(QDBusMessage reply);
+ void dbusError(QDBusError error);
+ void unlockDesktop();
+ void numScreensUpdated(int newCount);
+
+private:
+ void init();
+
+ int m_numScreens;
+};
+
+#endif
+
+
diff --git a/plasma/netbook/containments/sal/shell/salview.cpp \
b/plasma/netbook/containments/sal/shell/salview.cpp new file mode 100644
index 0000000..a37457b
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/salview.cpp
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2007 Aaron Seigo <aseigo@kde.org>
+ * Copyright 2007 Matt Broadstone <mbroadst@gmail.com>
+ * Copyright 2007 André Duffeck <duffeck@kde.org>
+ * Copyright 2008 Chani Armitage <chanika@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "salview.h"
+
+#include <QKeyEvent>
+#include <QTimer>
+
+#include <Plasma/Applet>
+#include <Plasma/Corona>
+#include <Plasma/Containment>
+#include <Plasma/Svg>
+
+#include <widgetsexplorer/widgetexplorer.h>
+
+#include "plasmaapp.h"
+
+static const int SUPPRESS_SHOW_TIMEOUT = 500; // Number of millis to prevent reshow \
of dashboard +
+
+class ScreenSaverWidgetExplorer : public Plasma::WidgetExplorer
+{
+public:
+ ScreenSaverWidgetExplorer(QGraphicsWidget *parent)
+ : Plasma::WidgetExplorer(parent)
+ {
+ connect(this, SIGNAL(closeClicked()), this, SLOT(deleteLater()));
+ m_svg = new Plasma::FrameSvg(this);
+ m_svg->setImagePath("widgets/frame");
+ m_svg->setElementPrefix("raised");
+ m_svg->setEnabledBorders(Plasma::FrameSvg::TopBorder);
+ }
+
+protected:
+ void resizeEvent(QGraphicsSceneResizeEvent *event)
+ {
+ m_svg->resizeFrame(event->newSize());
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget \
*widget) + {
+ Q_UNUSED(option)
+ Q_UNUSED(widget)
+ m_svg->paintFrame(painter);
+ }
+
+private:
+ Plasma::FrameSvg *m_svg;
+};
+
+SalView::SalView(Plasma::Containment *containment, QWidget *parent)
+ : Plasma::View(containment, parent),
+ m_suppressShow(false),
+ m_setupMode(false),
+ m_init(false)
+{
+ setAttribute(Qt::WA_TranslucentBackground);
+ setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | \
Qt::X11BypassWindowManagerHint); + if (!PlasmaApp::hasComposite()) {
+ setAutoFillBackground(false);
+ setAttribute(Qt::WA_NoSystemBackground);
+ }
+
+ setWallpaperEnabled(!PlasmaApp::hasComposite());
+ installEventFilter(this);
+}
+
+SalView::~SalView()
+{
+ delete m_widgetExplorer.data();
+}
+
+void SalView::enableSetupMode()
+{
+ if (!m_setupMode) {
+ m_setupMode = true;
+ update();
+ }
+}
+
+void SalView::disableSetupMode()
+{
+ if (m_setupMode) {
+ m_setupMode = false;
+ update();
+ }
+}
+
+void SalView::drawBackground(QPainter *painter, const QRectF & rect)
+{
+ if (PlasmaApp::hasComposite()) {
+ painter->setCompositionMode(QPainter::CompositionMode_Source);
+ painter->fillRect(rect, Qt::transparent);
+ } else {
+ Plasma::View::drawBackground(painter, rect);
+ }
+}
+
+void SalView::showWidgetExplorer()
+{
+ Plasma::Containment *c = containment();
+ if (!c) {
+ return;
+ }
+
+ if (m_widgetExplorer) {
+ delete m_widgetExplorer.data();
+ } else {
+ ScreenSaverWidgetExplorer *widgetExplorer = new \
ScreenSaverWidgetExplorer(c); + widgetExplorer->installEventFilter(this);
+ widgetExplorer->setContainment(c);
+ widgetExplorer->setLocation(Plasma::BottomEdge);
+ widgetExplorer->populateWidgetList();
+ widgetExplorer->setMaximumWidth(width());
+ widgetExplorer->adjustSize();
+ widgetExplorer->setZValue(1000000);
+ widgetExplorer->resize(width(), widgetExplorer->size().height());
+ widgetExplorer->setPos(0, containment()->geometry().height() - \
widgetExplorer->geometry().height()); + m_widgetExplorer = widgetExplorer;
+ }
+}
+
+void SalView::hideWidgetExplorer()
+{
+ delete m_widgetExplorer.data();
+}
+
+void SalView::paintEvent(QPaintEvent *event)
+{
+ Plasma::View::paintEvent(event);
+
+
+ // now draw a little label reminding the user their screen's not quite locked
+ const QRect r = rect();
+ const QString text = i18n("Setup Mode - Screen is NOT locked");
+ QFont f = font();
+ f.bold();
+ const QFontMetrics fm(f);
+ const int margin = 6;
+ const int textWidth = fm.width(text);
+ const QPoint centered(r.width() / 2 - textWidth / 2 - margin, r.y());
+ const QRect boundingBox(centered, QSize(margin * 2 + textWidth, fm.height() + \
margin * 2)); +
+// if (!viewport() || !event->rect().intersects(boundingBox)) {
+// return;
+// }
+
+ QPainterPath box;
+ box.moveTo(boundingBox.topLeft());
+ box.lineTo(boundingBox.bottomLeft() + QPoint(0, -margin * 2));
+ box.quadTo(boundingBox.bottomLeft(), boundingBox.bottomLeft() + QPoint(margin * \
2, 0)); + box.lineTo(boundingBox.bottomRight() + QPoint(-margin * 2, 0));
+ box.quadTo(boundingBox.bottomRight(), boundingBox.bottomRight() + QPoint(0, \
-margin * 2)); + box.lineTo(boundingBox.topRight());
+ box.closeSubpath();
+
+ QPainter painter(viewport());
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.setFont(f);
+ //kDebug() << "******************** painting from" << centered << boundingBox << \
rect() << event->rect(); + QColor highlight = palette().highlight().color();
+ highlight.setAlphaF(0.7);
+ painter.setPen(highlight.darker());
+ painter.setBrush(highlight);
+ painter.drawPath(box);
+ painter.setPen(palette().highlightedText().color());
+ painter.drawText(boundingBox, Qt::AlignCenter | Qt::AlignVCenter, text);
+}
+
+bool SalView::eventFilter(QObject *watched, QEvent *event)
+{
+ if (containment() && (watched == (QObject*)m_widgetExplorer.data()) &&
+ (event->type() == QEvent::GraphicsSceneResize || event->type() == \
QEvent::GraphicsSceneMove)) { + Plasma::WidgetExplorer *widgetExplorer = \
m_widgetExplorer.data(); + widgetExplorer->setPos(0, \
containment()->geometry().height() - widgetExplorer->geometry().height()); + }
+
+ return false;
+}
+
+void SalView::showView()
+{
+ if (isHidden()) {
+ if (m_suppressShow) {
+ kDebug() << "show was suppressed";
+ return;
+ }
+
+ setWindowState(Qt::WindowFullScreen);
+ //KWindowSystem::setOnAllDesktops(winId(), true);
+ //KWindowSystem::setState(winId(), NET::KeepAbove|NET::SkipTaskbar);
+
+ show();
+ raise();
+
+ m_suppressShow = true;
+ QTimer::singleShot(SUPPRESS_SHOW_TIMEOUT, this, \
SLOT(suppressShowTimeout())); + }
+}
+
+void SalView::setContainment(Plasma::Containment *newContainment)
+{
+ if (m_init && newContainment == containment()) {
+ return;
+ }
+
+ m_init = true;
+
+ if (containment()) {
+ disconnect(containment(), SIGNAL(showAddWidgetsInterface(QPointF)), this, \
SLOT(showWidgetExplorer())); + }
+
+ if (newContainment) {
+ connect(newContainment, SIGNAL(showAddWidgetsInterface(QPointF)), this, \
SLOT(showWidgetExplorer())); + }
+
+ if (m_widgetExplorer) {
+ m_widgetExplorer.data()->setContainment(newContainment);
+ }
+
+ View::setContainment(newContainment);
+}
+
+void SalView::hideView()
+{
+ if (isHidden()) {
+ return;
+ }
+
+ hideWidgetExplorer();
+
+ if (containment()) {
+ containment()->closeToolBox();
+ }
+
+ hide();
+ //let the lockprocess know
+ emit hidden();
+}
+
+void SalView::suppressShowTimeout()
+{
+ kDebug() << "SalView::suppressShowTimeout";
+ m_suppressShow = false;
+}
+
+void SalView::setOpacity(qreal opacity)
+{
+ setWindowOpacity(opacity);
+}
+
+void SalView::openToolBox()
+{
+ kDebug() << "close toolbox";
+ containment()->openToolBox();
+}
+
+void SalView::closeToolBox()
+{
+ kDebug() << "close toolbox";
+ containment()->closeToolBox();
+}
+
+void SalView::adjustSize(int screen)
+{
+ QDesktopWidget *desktop = QApplication::desktop();
+ int thisScreen = desktop->screenNumber(this);
+ if(screen == thisScreen)
+ {
+ setGeometry(desktop->screenGeometry(screen));
+ }
+}
+
+#include "salview.moc"
diff --git a/plasma/netbook/containments/sal/shell/salview.h \
b/plasma/netbook/containments/sal/shell/salview.h new file mode 100644
index 0000000..36de124
--- /dev/null
+++ b/plasma/netbook/containments/sal/shell/salview.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2007 Aaron Seigo <aseigo@kde.org>
+ * Copyright 2007 André Duffeck <duffeck@kde.org>
+ * Copyright 2008 Chani Armitage <chanika@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SALVIEW_H
+#define SALVIEW_H
+
+#include <QWeakPointer>
+
+#include <Plasma/Plasma>
+#include <Plasma/View>
+
+namespace Plasma
+{
+ class Containment;
+ class WidgetExplorer;
+}
+
+class SalView : public Plasma::View
+{
+ Q_OBJECT
+
+public:
+ SalView(Plasma::Containment* containment, QWidget *parent);
+ ~SalView();
+
+ bool eventFilter(QObject *watched, QEvent *event);
+
+signals:
+ void hidden();
+
+protected:
+ void drawBackground(QPainter *painter, const QRectF & rect);
+ void paintEvent(QPaintEvent *event);
+
+public slots:
+ void showView();
+ void hideView();
+ void setOpacity(qreal opacity);
+ void adjustSize(int screen);
+
+ /**
+ * Sets the containment for this view, which will also cause the view
+ * to track the geometry of the containment.
+ *
+ * @arg containment the containment to center the view on
+ */
+ void setContainment(Plasma::Containment *newContainment);
+ void hideWidgetExplorer();
+
+ void enableSetupMode();
+ void disableSetupMode();
+
+protected slots:
+ void showWidgetExplorer(); //FIXME actually this is toggle
+ void suppressShowTimeout();
+ void openToolBox();
+ void closeToolBox();
+
+private:
+ QWeakPointer<Plasma::WidgetExplorer> m_widgetExplorer;
+ QPoint m_appletBrowserDragStart;
+ bool m_suppressShow : 1;
+ bool m_setupMode : 1;
+ bool m_init : 1;
+};
+
+#endif // multiple inclusion guard
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic