support for containment type in the desktop file

add a test panel containment
wilder-5.14
Marco Martin 13 years ago
parent bc9cd6dd28
commit 3dbdeaa074
  1. 5
      CMakeLists.txt
  2. 3
      applets/CMakeLists.txt
  3. 0
      applets/testapplet/contents/ui/main.qml
  4. 0
      applets/testapplet/metadata.desktop
  5. 0
      applets/testcomponentsapplet/contents/ui/testcomponents.qml
  6. 0
      applets/testcomponentsapplet/metadata.desktop
  7. 3
      containments/CMakeLists.txt
  8. 0
      containments/testcontainment/contents/ui/main.qml
  9. 0
      containments/testcontainment/metadata.desktop
  10. 113
      containments/testpanel/contents/ui/main.qml
  11. 18
      containments/testpanel/metadata.desktop
  12. 2
      desktopcorona.cpp
  13. 2
      panelview.h
  14. 2
      view.h

@ -50,7 +50,6 @@ target_link_libraries(testplasma2
install(TARGETS testplasma2 ${INSTALL_TARGETS_DEFAULT_ARGS})
add_subdirectory(applets)
add_subdirectory(containments)
add_subdirectory(qmlpackages)
installPackage(testcontainment org.kde.testcontainment)
installPackage(testapplet org.kde.testapplet)
installPackage(testcomponentsapplet org.kde.testcomponentsapplet)

@ -0,0 +1,3 @@
installPackage(testapplet org.kde.testapplet)
installPackage(testcomponentsapplet org.kde.testcomponentsapplet)

@ -0,0 +1,3 @@
installPackage(testcontainment org.kde.testcontainment)
installPackage(testpanel org.kde.testpanel)

@ -0,0 +1,113 @@
/*
* Copyright 2013 Marco Martin <mart@kde.org>
*
* 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.
*
* 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 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.
*/
import QtQuick 2.0
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents
Item {
id: root
width: 640
height: 480
property Item toolBox
Connections {
target: plasmoid
onAppletAdded: {
var container = appletContainerComponent.createObject(root)
container.visible = true
print("Applet added: " + applet)
applet.parent = container
container.applet = applet
applet.anchors.fill= applet.parent
applet.visible = true
}
}
Component {
id: appletContainerComponent
PlasmaCore.FrameSvgItem {
id: frame
x: 50
y: 50
width: large + frame.margins.left + frame.margins.right
height: large + frame.margins.top + frame.margins.bottom
property alias applet: appletContainer.children
property int small: 90
property int large: 400
property int tm: 0
property int lm: 0
imagePath: applet.length > 0 && applet[0].backgroundHints == 0 ? "" : "widgets/background"
onImagePathChanged: {
// Reposition applet so it fits into the frame
if (imagePath == "") {
frame.x = frame.x + lm;
frame.y = frame.y + tm;
} else {
// Cache values, so we can subtract them when the background is removed
frame.lm = frame.margins.left;
frame.tm = frame.margins.top;
frame.x = frame.x - frame.margins.left;
frame.y = frame.y - frame.margins.top;
}
}
MouseArea {
anchors.fill: parent
drag.target: parent
onClicked: {
var s = (frame.width == frame.large) ? frame.small : frame.large;
frame.x = s
frame.height = s
frame.width = s
}
}
Item {
id: appletContainer
anchors {
fill: parent
leftMargin: frame.margins.left
rightMargin: parent.margins.right
topMargin: parent.margins.top
bottomMargin: parent.margins.bottom
}
}
PlasmaComponents.BusyIndicator {
z: 1000
visible: applet.length > 0 && applet[0].busy
running: visible
anchors.centerIn: parent
}
}
}
Component.onCompleted: {
print("Test Containment loaded")
print(plasmoid)
}
}

@ -0,0 +1,18 @@
[Desktop Entry]
Encoding=UTF-8
Keywords=
Name=Panel Test
Type=Service
X-KDE-ServiceTypes=Plasma/Applet,Plasma/Containment
X-Plasma-API=declarativeappletscript
X-KDE-ParentApp=
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Category=
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-License=GPLv2+
X-KDE-PluginInfo-Name=org.kde.testpanel
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
X-Plasma-MainScript=ui/main.qml
X-Plasma-ContainmentType=PanelContainment

@ -115,7 +115,7 @@ void DesktopCorona::checkScreen(int screen, bool signalWhenExists)
void DesktopCorona::checkDesktop(/*Activity *activity,*/ bool signalWhenExists, int screen, int desktop)
{
Plasma::Containment *c = /*activity->*/containmentForScreen(screen, desktop);
qWarning()<<"AAAAA"<<c<<c->formFactor();
//TODO: remove following when activities are restored
if (!c) {
c = addContainment("desktop");

@ -28,7 +28,7 @@ class PanelView : public View
Q_OBJECT
public:
PanelView(Plasma::Corona *corona, QWindow *parent = 0);
explicit PanelView(Plasma::Corona *corona, QWindow *parent = 0);
virtual ~PanelView();
private:

@ -31,7 +31,7 @@ class View : public QQuickView
Q_OBJECT
public:
View(Plasma::Corona *corona, QWindow *parent = 0);
explicit View(Plasma::Corona *corona, QWindow *parent = 0);
virtual ~View();
//FIXME: not super nice, but we have to be sure qml assignment is done after window flags

Loading…
Cancel
Save