Merge branch 'master' into cmake-config

This commit is contained in:
Sebastian Kügler 2013-06-13 00:56:55 +02:00
commit 7ca5c68ddb
131 changed files with 2632 additions and 971 deletions

View File

@ -49,8 +49,9 @@ find_package(kdeqt5staging REQUIRED NO_MODULE)
# Load CMake, Compiler and InstallDirs settings from KF5 and the following are already somewhat "done" tier1/tier2 libs from kdelibs:
find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs
KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver
KConfig KAuth kjs)
XmlGui KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver
KConfig KAuth kjs
ki18n kguiaddons kservice kwidgets ItemViews KNotifications KCompletion KJobWidgets KConfigWidgets KIconThemes)
#find_package(KF5Transitional REQUIRED)
# those are not "done" yet:

3
README
View File

@ -1,2 +1 @@
See also: http://community.kde.org/Plasma#Plasma_Workspaces_2

View File

@ -3,7 +3,9 @@ Name=Air
Name[cs]=Vzduch
Name[de]=Air
Name[es]=Aire
Name[fi]=Air
Name[fr]=Air
Name[gl]=Air
Name[mr]=
Name[nl]=Air
Name[pt]=Air
@ -16,6 +18,7 @@ Comment=A breath of fresh air
Comment[cs]=Závan čerstvého vzduchu
Comment[de]=Ein Atemzug frische Luft
Comment[es]=Una bocanada de aire fresco
Comment[fi]=Raikkaan ilman leyhähdys
Comment[fr]=Un souffle d'air frais
Comment[mr]=
Comment[nl]=Een hap frisse lucht

View File

@ -3,6 +3,7 @@ Name=Application dashboard
Name[cs]=Pracovní plocha aplikace
Name[de]=Anwendungsübersicht
Name[es]=Tablero de mandos de la aplicación
Name[fi]=Sovelluskojelauta
Name[fr]=Tableau de bord des applications
Name[mr]=
Name[nl]=Toepassingendashboard
@ -16,6 +17,7 @@ Comment=Intended as Application dashboard default
Comment[cs]=Zamýšleno jako výchozí pracovní plocha aplikace
Comment[de]=Als Voreinstellung für Anwendungsübersicht angedacht
Comment[es]=Pensado como tablero de mandos por omisión de la aplicación
Comment[fi]=Tarkoitettu oletussovelluskojelaudaksi
Comment[fr]=Prévu comme tableau de bord des applications par défaut
Comment[mr]= ि
Comment[nl]=Bedoelt als standaard in het toepassingendashboard

View File

@ -3,6 +3,7 @@ Name=Oxygen
Name[cs]=Oxygen
Name[de]=Oxygen
Name[es]=Oxígeno
Name[fi]=Oxygen
Name[fr]=Oxygen
Name[mr]=
Name[nl]=Oxygen
@ -16,6 +17,7 @@ Comment=Theme done in the Oxygen style
Comment[cs]=Motiv ve stylu Oxygen
Comment[de]=Oberflächen-Design im Oxygen-Stil
Comment[es]=Tema realizado al estilo de Oxígeno
Comment[fi]=Oxygen-tyylinen teema
Comment[fr]=Thème réalisé dans le style de Oxygen
Comment[mr]=
Comment[nl]=Thema in Oxygen-stijl

View File

@ -2,5 +2,6 @@ add_subdirectory(plasma)
add_subdirectory(declarativeimports)
#add_subdirectory(kpart)
add_subdirectory(plasmapkg)
add_subdirectory(platformstatus)
add_subdirectory(scriptengines)
add_subdirectory(shell)

View File

@ -23,7 +23,6 @@ set(corebindings_SRCS
serviceoperationstatus.cpp
dataenginebindings.cpp
iconitem.cpp
plasmanamespace.cpp
)
add_library(corebindingsplugin SHARED ${corebindings_SRCS})

View File

@ -45,7 +45,7 @@
#include "tooltip.h"
// #include "dataenginebindings_p.h"
#include "plasmanamespace.h"
#include <QDebug>
@ -78,7 +78,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.kde.plasma.core"));
qmlRegisterUncreatableType<PlasmaNamespace>(uri, 2, 0, "Plasma", "");
qmlRegisterUncreatableType<Plasma::Types>(uri, 2, 0, "Types", "");
qmlRegisterType<Plasma::Svg>(uri, 2, 0, "Svg");
qmlRegisterType<Plasma::FrameSvg>(uri, 2, 0, "FrameSvg");

View File

@ -38,22 +38,22 @@
#include <QDebug>
// just for debugging purposes, FIXME: remove later
QString locString(const Plasma::Location l) {
QString locString(const Plasma::Types::Location l) {
QString o = "Unknown: " + l;
if (l == Plasma::Floating) {
if (l == Plasma::Types::Floating) {
o = "Floating";
} else if (l == Plasma::Desktop) {
} else if (l == Plasma::Types::Desktop) {
o = "Desktop";
} else if (l == Plasma::FullScreen) {
} else if (l == Plasma::Types::FullScreen) {
o = "FullScreen";
} else if (l == Plasma::TopEdge) {
o = "TopEdge";
} else if (l == Plasma::BottomEdge) {
o = "BottomEdge";
} else if (l == Plasma::LeftEdge) {
o = "LeftEdge";
} else if (l == Plasma::RightEdge) {
o = "RightEdge";
} else if (l == Plasma::Types::TopEdge) {
o = "Types::TopEdge";
} else if (l == Plasma::Types::BottomEdge) {
o = "Types::BottomEdge";
} else if (l == Plasma::Types::LeftEdge) {
o = "Types::LeftEdge";
} else if (l == Plasma::Types::RightEdge) {
o = "Types::RightEdge";
}
return o;
}
@ -61,7 +61,7 @@ QString locString(const Plasma::Location l) {
DialogProxy::DialogProxy(QQuickItem *parent)
: QQuickWindow(),
m_activeWindow(false),
m_location(Plasma::TopEdge)
m_location(Plasma::Types::TopEdge)
{
QSurfaceFormat format;
format.setAlphaBufferSize(8);
@ -153,7 +153,7 @@ void DialogProxy::setVisible(const bool visible)
syncToMainItemSize();
if (!m_visualParent.isNull() && m_visualParent.data()->window()) {
avail = m_visualParent.data()->window()->screen()->availableGeometry();
if (location() == Plasma::FullScreen) {
if (location() == Plasma::Types::FullScreen) {
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder);
setGeometry(avail);
@ -215,7 +215,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
}
}
Plasma::Location l = (Plasma::Location)location();
Plasma::Types::Location l = (Plasma::Types::Location)location();
QPoint topPoint((item->boundingRect().width() - width())/2,
-height());
@ -228,13 +228,13 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
(item->boundingRect().height() - height())/2);
QPoint offset(0, 0);
if (l == Plasma::BottomEdge) {
if (l == Plasma::Types::BottomEdge) {
offset = bottomPoint;
} else if (l == Plasma::LeftEdge) {
} else if (l == Plasma::Types::LeftEdge) {
offset = leftPoint;
} else if (l == Plasma::RightEdge) {
} else if (l == Plasma::Types::RightEdge) {
offset = rightPoint;
} else { // TopEdge
} else { // Types::TopEdge
offset = topPoint;
}
@ -248,7 +248,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
if (menuPos.x() < leftMargin) {
// popup hits lhs
if (l == Plasma::TopEdge || l == Plasma::BottomEdge) {
if (l == Plasma::Types::TopEdge || l == Plasma::Types::BottomEdge) {
// move it
menuPos.setX(0-leftMargin);
} else {
@ -258,7 +258,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
}
if (menuPos.x() + width() > avail.width() - rightMargin) {
// popup hits rhs
if (l == Plasma::TopEdge || l == Plasma::BottomEdge) {
if (l == Plasma::Types::TopEdge || l == Plasma::Types::BottomEdge) {
menuPos.setX(avail.width() - item->boundingRect().width() + rightMargin);
} else {
menuPos.setX(pos.x() + leftPoint.x());
@ -266,7 +266,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
}
if (menuPos.y() < topMargin) {
// hitting top
if (l == Plasma::LeftEdge || l == Plasma::RightEdge) {
if (l == Plasma::Types::LeftEdge || l == Plasma::Types::RightEdge) {
menuPos.setY(0);
} else {
menuPos.setY(pos.y() + bottomPoint.y());
@ -274,7 +274,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
}
if (menuPos.y() + height() > avail.height() - bottomMargin) {
// hitting bottom
if (l == Plasma::TopEdge || l == Plasma::BottomEdge) {
if (l == Plasma::Types::TopEdge || l == Plasma::Types::BottomEdge) {
menuPos.setY(pos.y() + topPoint.y());
} else {
menuPos.setY(avail.height() - item->boundingRect().height() + bottomMargin);
@ -316,7 +316,7 @@ void DialogProxy::setWindowFlags(const int flags)
int DialogProxy::location() const
{
return (Plasma::Location)m_location;
return (Plasma::Types::Location)m_location;
}
void DialogProxy::setLocation(int location)
@ -324,7 +324,7 @@ void DialogProxy::setLocation(int location)
if (m_location == location) {
return;
}
m_location = (Plasma::Location)location;
m_location = (Plasma::Types::Location)location;
emit locationChanged();
}

View File

@ -161,7 +161,7 @@ protected:
void focusOutEvent(QFocusEvent *ev);
QTimer *m_syncTimer;
Plasma::Location m_location;
Plasma::Types::Location m_location;
Plasma::FrameSvgItem *m_frameSvgItem;
QWeakPointer<QQuickItem> m_mainItem;
QWeakPointer<QQuickItem> m_visualParent;

View File

@ -37,22 +37,22 @@ FrameSvgItemMargins::FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *pa
qreal FrameSvgItemMargins::left() const
{
return m_frameSvg->marginSize(LeftMargin);
return m_frameSvg->marginSize(Types::LeftMargin);
}
qreal FrameSvgItemMargins::top() const
{
return m_frameSvg->marginSize(TopMargin);
return m_frameSvg->marginSize(Types::TopMargin);
}
qreal FrameSvgItemMargins::right() const
{
return m_frameSvg->marginSize(RightMargin);
return m_frameSvg->marginSize(Types::RightMargin);
}
qreal FrameSvgItemMargins::bottom() const
{
return m_frameSvg->marginSize(BottomMargin);
return m_frameSvg->marginSize(Types::BottomMargin);
}
void FrameSvgItemMargins::update()
@ -84,11 +84,11 @@ void FrameSvgItem::setImagePath(const QString &path)
m_frameSvg->setElementPrefix(m_prefix);
if (implicitWidth() <= 0) {
setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin));
setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin));
}
if (implicitHeight() <= 0) {
setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin));
setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin));
}
emit imagePathChanged();
@ -114,11 +114,11 @@ void FrameSvgItem::setPrefix(const QString &prefix)
m_prefix = prefix;
if (implicitWidth() <= 0) {
setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin));
setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin));
}
if (implicitHeight() <= 0) {
setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin));
setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin));
}
emit prefixChanged();
@ -167,11 +167,11 @@ void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
void FrameSvgItem::doUpdate()
{
if (implicitWidth() <= 0) {
setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin));
setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin));
}
if (implicitHeight() <= 0) {
setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin));
setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin));
}
update();

View File

@ -10,6 +10,7 @@ set(plasmacomponents_SRCS
enums.cpp
qmenu.cpp
qmenuitem.cpp
units.cpp
#../core/declarativeitemcontainer.cpp
)
@ -60,7 +61,6 @@ install(FILES qml/QueryDialog.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimpo
install(FILES qml/RadioButton.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
install(FILES qml/SelectionDialog.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
install(FILES qml/Slider.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
install(FILES qml/Switch.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
install(FILES qml/TabBar.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
install(FILES qml/TabButton.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
install(FILES qml/TabGroup.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)

View File

@ -35,6 +35,7 @@
#include "qmenu.h"
#include "qmenuitem.h"
//#include "fullscreensheet.h"
#include "units.h"
//Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin)
@ -83,6 +84,10 @@ void PlasmaComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *ur
{
QQmlExtensionPlugin::initializeEngine(engine, uri);
EngineBookKeeping::self()->insertEngine(engine);
QQmlContext *context = engine->rootContext();
Units *units = new Units(context);
context->setContextProperty("units", units);
}
void PlasmaComponentsPlugin::registerTypes(const char *uri)
@ -103,6 +108,7 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri)
qmlRegisterUncreatableType<DialogStatus>(uri, 2, 0, "DialogStatus", "");
qmlRegisterUncreatableType<PageOrientation>(uri, 2, 0, "PageOrientation", "");
qmlRegisterUncreatableType<PageStatus>(uri, 2, 0, "PageStatus", "");
qmlRegisterUncreatableType<Units>(uri, 0, 1, "Units", "");
}

View File

@ -0,0 +1,85 @@
/*
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@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 2.010-1301, USA.
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import "private" as Private
/**
* A boolean toggle button with the visual representation of a "realistic"
* switch with a movable toggle showing the state of the Switch. Generally
* easier to use on touch devices than a CheckBox due to the larger surface
* space and more evident state visualization.
*
* You can bind the Switch component, for example, to a feature that the
* application has to enable or disable depending on the user's input.
*
* All elements of this component are defined in DualStateButton, its base component.
*/
Private.DualStateButton {
id: switchItem
view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/slider"
prefix: "groove"
width: height * 2
height: Math.max(theme.mSize(theme.defaultFont).height + margins.top + margins.bottom,
button.margins.top + button.margins.bottom)
PlasmaCore.FrameSvgItem {
id: highlight
imagePath: "widgets/slider"
prefix: "groove-highlight"
anchors.fill: parent
opacity: checked ? 1 : 0
Behavior on opacity {
PropertyAnimation { duration: 100 }
}
}
PlasmaCore.FrameSvgItem {
imagePath: "widgets/button"
prefix: "shadow"
anchors {
fill: button
leftMargin: -margins.left
topMargin: -margins.top
rightMargin: -margins.right
bottomMargin: -margins.bottom
}
}
PlasmaCore.FrameSvgItem {
id: button
imagePath: "widgets/button"
prefix: "normal"
anchors {
top: parent.top
bottom: parent.bottom
}
width: height
x: checked ? width : 0
Behavior on x {
PropertyAnimation { duration: 100 }
}
}
}
}

View File

@ -38,9 +38,14 @@ QAction* QMenuItem::action() const
void QMenuItem::setAction(QAction* a)
{
if (m_action != a) {
if (m_action) {
disconnect(m_action, 0, this, 0);
}
m_action = a;
connect(m_action, &QAction::changed, this, &QMenuItem::textChanged);
connect(m_action, &QAction::changed, this, &QMenuItem::textChanged);
connect(m_action, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
connect(m_action, SIGNAL(checkableChanged()), this, SIGNAL(checkableChanged()));
emit actionChanged();
}
}
@ -84,6 +89,25 @@ void QMenuItem::setText(const QString& t)
}
}
bool QMenuItem::checkable() const
{
return m_action->isCheckable();
}
void QMenuItem::setCheckable(bool checkable)
{
m_action->setCheckable(checkable);
}
bool QMenuItem::checked() const
{
return m_action->isChecked();
}
void QMenuItem::setChecked(bool checked)
{
m_action->setChecked(checked);
}
#include "qmenuitem.moc"

View File

@ -40,6 +40,8 @@ class QMenuItem : public QQuickItem
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
Q_PROPERTY(QVariant icon READ icon WRITE setIcon NOTIFY iconChanged)
Q_PROPERTY(QAction* action READ action WRITE setAction NOTIFY actionChanged)
Q_PROPERTY(bool checkable READ checkable WRITE setCheckable NOTIFY checkableChanged)
Q_PROPERTY(bool checked READ checked WRITE setChecked NOTIFY toggled)
public:
QMenuItem(QQuickItem *parent = 0);
@ -53,6 +55,12 @@ public:
QString text() const;
void setText(const QString &t);
bool checkable() const;
void setCheckable(bool checkable);
bool checked() const;
void setChecked(bool checked);
Q_SIGNALS:
void clicked();
@ -60,6 +68,8 @@ Q_SIGNALS:
void iconChanged();
void separatorChanged();
void textChanged();
void toggled(bool checked);
void checkableChanged();
private:
QAction* m_action;

View File

@ -22,64 +22,45 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import "private" as Private
/**
* A boolean toggle button with the visual representation of a "realistic"
* switch with a movable toggle showing the state of the Switch. Generally
* easier to use on touch devices than a CheckBox due to the larger surface
* space and more evident state visualization.
* A check box is a component that can be switched on (checked) or off
* (unchecked). Check boxes are typically used to represent features in an
* application that can be enabled or disabled without affecting others, but
* different types of behavior can be implemented. When a check box is checked
* or unchecked it sends a clicked signal for the application to handle.
*
* You can bind the Switch component, for example, to a feature that the
* application has to enable or disable depending on the user's input.
* When a check box has the focus, its state can be toggled using the
* Qt.Key_Select, Qt.Key_Return, and Qt.Key_Enter hardware keys that send the
* clicked signal.
*
* All elements of this component are defined in DualStateButton, its base component.
*/
Private.DualStateButton {
id: switchItem
id: checkBox
view: PlasmaCore.FrameSvgItem {
imagePath: "widgets/slider"
prefix: "groove"
width: height * 2
height: Math.max(theme.mSize(theme.defaultFont).height + margins.top + margins.bottom,
button.margins.top + button.margins.bottom)
PlasmaCore.FrameSvgItem {
id: highlight
imagePath: "widgets/slider"
prefix: "groove-highlight"
anchors.fill: parent
imagePath: "widgets/button"
prefix: "normal"
width: theme.mSize(theme.defaultFont).height + margins.left
height: theme.mSize(theme.defaultFont).height + margins.top
PlasmaCore.SvgItem {
svg: PlasmaCore.Svg {
id: checkmarkSvg
imagePath: "widgets/checkmarks"
}
elementId: "checkbox"
opacity: checked ? 1 : 0
anchors {
fill: parent
margins: parent.margins.left/2
}
Behavior on opacity {
PropertyAnimation { duration: 100 }
}
}
PlasmaCore.FrameSvgItem {
imagePath: "widgets/button"
prefix: "shadow"
anchors {
fill: button
leftMargin: -margins.left
topMargin: -margins.top
rightMargin: -margins.right
bottomMargin: -margins.bottom
}
}
PlasmaCore.FrameSvgItem {
id: button
imagePath: "widgets/button"
prefix: "normal"
anchors {
top: parent.top
bottom: parent.bottom
}
width: height
x: checked ? width : 0
Behavior on x {
PropertyAnimation { duration: 100 }
NumberAnimation {
duration: 250
easing.type: Easing.InOutQuad
}
}
}
}
}
shadow: Private.ButtonShadow {}
}

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
* 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 *
@ -17,16 +17,59 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "plasmanamespace.h"
#include "units.h"
PlasmaNamespace::PlasmaNamespace(QObject *parent)
: QObject(parent)
#include <QApplication>
#include <QDebug>
#include <QDesktopWidget>
#include <QtGlobal>
#include <cmath>
Units::Units (QObject *parent)
: QObject(parent),
m_gridUnit(-1)
{
themeChanged();
connect(&m_theme, SIGNAL(themeChanged()),
this, SLOT(themeChanged()));
}
Units::~Units()
{
}
PlasmaNamespace::~PlasmaNamespace()
qreal Units::gridUnit() const
{
return m_gridUnit;
}
#include "plasmanamespace.moc"
qreal Units::dp(qreal value) const
{
//Usual "default" is 96 dpi
//that magic ratio follows the definition of "device independent pixel" by Microsoft
const qreal ratio = (qreal)QApplication::desktop()->physicalDpiX() / (qreal)96;
if (value <= 2.0) {
return qRound(value * floor(ratio));
} else {
return qRound(value * ratio);
}
}
qreal Units::gu(qreal value) const
{
return qRound(m_gridUnit * value);
}
void Units::themeChanged()
{
const int gridUnit = QFontMetrics(QApplication::font()).boundingRect("M").width();
if (gridUnit != m_gridUnit) {
m_gridUnit = gridUnit;
emit gridUnitChanged();
}
}
#include "units.moc"

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
* 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 *
@ -16,31 +16,51 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef PLASMA_NAMESPACE_CORE
#define PLASMA_NAMESPACE_CORE
#ifndef UNITS_H
#define UNITS_H
#include <QObject>
class PlasmaNamespace : public QObject
#include <Plasma/Theme>
class Units : public QObject
{
Q_OBJECT
Q_ENUMS(Location)
/**
* The fundamental unit of space that should be used for sizes, expressed in pixels.
* Given the screen has an accurate DPI settings, it corresponds to a millimeter
*/
Q_PROPERTY(qreal gridUnit READ gridUnit NOTIFY gridUnitChanged())
public:
enum Location {
Floating = 0, /**< Free floating. Neither geometry or z-ordering
is described precisely by this value. */
Desktop, /**< On the planar desktop layer, extending across
the full screen from edge to edge */
FullScreen, /**< Full screen */
TopEdge, /**< Along the top of the screen*/
BottomEdge, /**< Along the bottom of the screen*/
LeftEdge, /**< Along the left side of the screen */
RightEdge /**< Along the right side of the screen */
};
Units(QObject *parent = 0);
~Units();
PlasmaNamespace(QObject *parent = 0);
~PlasmaNamespace();
qreal gridUnit() const;
/**
* @returns the number of pixels value density independent pixels correspond to.
*/
Q_INVOKABLE qreal dp(qreal value) const;
/**
* @returns the number of pixels value grid units correspond to.
*/
Q_INVOKABLE qreal gu(qreal value) const;
Q_SIGNALS:
void gridUnitChanged();
private Q_SLOTS:
void themeChanged();
private:
int m_gridUnit;
Plasma::Theme m_theme;
};
#endif
#endif //UNITS_H

View File

@ -98,7 +98,9 @@ Item {
// See push() for details.
function replace(page, properties, immediate)
{
return Engine.push(page, properties, true, immediate);
var item = Engine.push(page, properties, true, immediate);
scrollToLevel(depth)
return item
}
// Clears the page stack.
@ -207,7 +209,7 @@ Item {
Row {
id: root
spacing: -100
width: columnWidth*depth
width: childrenRect.width - 100
height: parent.height
Behavior on width {
NumberAnimation {
@ -252,7 +254,8 @@ Item {
Item {
id: container
width: columnWidth + 100
implicitWidth: actualContainer.width + 100
width: implicitWidth
height: parent ? parent.height : 0
x: 0
@ -305,7 +308,7 @@ Item {
right: parent.right
rightMargin: 100
}
width: columnWidth
width: (container.pageDepth >= actualRoot.depth ? Math.min(actualRoot.width, Math.max(1, Math.round(page.implicitWidth/columnWidth))*columnWidth) : columnWidth)
}
Image {
@ -430,7 +433,7 @@ Item {
State {
name: ""
PropertyChanges { target: container; visible: true; opacity: 1 }
PropertyChanges { target: container; width: columnWidth+100}
PropertyChanges { target: container; width: container.implicitWidth}
},
// Start state for pop entry, end state for push exit.
State {
@ -448,7 +451,7 @@ Item {
State {
name: "Hidden"
PropertyChanges { target: container; visible: false }
PropertyChanges { target: container; width: columnWidth+100}
PropertyChanges { target: container; width: container.implicitWidth}
}
]

View File

@ -3,6 +3,7 @@ Name=plasma-kpart
Name[cs]=plasma-kpart
Name[de]=plasma-kpart
Name[es]=plasma-kpart
Name[fi]=plasma-kpart
Name[fr]=plasma-kpart
Name[mr]=-kpart
Name[nl]=plasma-kpart

View File

@ -34,7 +34,7 @@ class PlasmaKPartView : public Plasma::View
{
Q_OBJECT
public:
typedef Plasma::ImmutabilityType ImmutabilityType;
typedef Plasma::Types::ImmutabilityType ImmutabilityType;
PlasmaKPartView(Plasma::Containment *containment, int uid, QWidget *parent = 0);
~PlasmaKPartView();

View File

@ -164,8 +164,8 @@ target_link_libraries(plasma LINK_INTERFACE_LIBRARIES ${KDE4_KDECORE_LIBS} Qt5::
#do NOT use GENERIC versioning -- the plasma team will take care of versioning
set_target_properties(plasma PROPERTIES
VERSION 4.0.0
SOVERSION 4
VERSION 5.0.0
SOVERSION 5
)
install(TARGETS plasma EXPORT kdelibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
@ -227,13 +227,8 @@ install(FILES
data/servicetypes/plasma-service.desktop
data/servicetypes/plasma-shell.desktop
data/servicetypes/plasma-lookandfeel.desktop
data/servicetypes/plasma-wallpaper.desktop
DESTINATION ${SERVICETYPES_INSTALL_DIR})
install(FILES
data/services/plasma.protocol
DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES data/operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/operations/storage.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)

View File

@ -167,7 +167,7 @@ void Applet::save(KConfigGroup &g) const
void Applet::restore(KConfigGroup &group)
{
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable));
setImmutability((Types::ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable));
KConfigGroup shortcutConfig(&group, "Shortcuts");
QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString());
@ -257,7 +257,7 @@ KConfigGroup Applet::globalConfig() const
void Applet::destroy()
{
if (immutability() != Mutable || d->transient || !d->started) {
if (immutability() != Types::Mutable || d->transient || !d->started) {
return; //don't double delete
}
@ -293,12 +293,12 @@ Package Applet::package() const
return d->package ? *d->package : Package();
}
void Applet::updateConstraints(Plasma::Constraints constraints)
void Applet::updateConstraints(Plasma::Types::Constraints constraints)
{
d->scheduleConstraintsUpdate(constraints);
}
void Applet::constraintsEvent(Plasma::Constraints constraints)
void Applet::constraintsEvent(Plasma::Types::Constraints constraints)
{
//NOTE: do NOT put any code in here that reacts to constraints updates
// as it will not get called for any applet that reimplements constraintsEvent
@ -344,24 +344,24 @@ KPluginInfo Applet::pluginInfo() const
return d->appletDescription;
}
ImmutabilityType Applet::immutability() const
Types::Types::ImmutabilityType Applet::immutability() const
{
// if this object is itself system immutable, then just return that; it's the most
// restrictive setting possible and will override anything that might be happening above it
// in the Corona->Containment->Applet hierarchy
if (d->transient || (d->mainConfig && d->mainConfig->isImmutable())) {
return SystemImmutable;
return Types::SystemImmutable;
}
//Returning the more strict immutability between the applet immutability, Containment and Corona
ImmutabilityType upperImmutability = Mutable;
Types::ImmutabilityType upperImmutability = Types::Mutable;
Containment *cont = d->isContainment ? 0 : containment();
if (cont) {
upperImmutability = cont->immutability();
}
if (upperImmutability != Mutable) {
if (upperImmutability != Types::Mutable) {
// it's either system or user immutable, and we already check for local system immutability,
// so upperImmutability is guaranteed to be as or more severe as this object's immutability
return upperImmutability;
@ -370,9 +370,9 @@ ImmutabilityType Applet::immutability() const
}
}
void Applet::setImmutability(const ImmutabilityType immutable)
void Applet::setImmutability(const Types::Types::ImmutabilityType immutable)
{
if (d->immutability == immutable || immutable == Plasma::SystemImmutable) {
if (d->immutability == immutable || immutable == Types::SystemImmutable) {
// we do not store system immutability in d->immutability since that gets saved
// out to the config file; instead, we check with
// the config group itself for this information at all times. this differs from
@ -381,7 +381,7 @@ void Applet::setImmutability(const ImmutabilityType immutable)
}
d->immutability = immutable;
updateConstraints(ImmutableConstraint);
updateConstraints(Types::ImmutableConstraint);
}
QString Applet::launchErrorMessage() const
@ -409,12 +409,12 @@ void Applet::setConfigurationRequired(bool needsConfig, const QString &reason)
d->showConfigurationRequiredMessage(needsConfig, reason);
}
ItemStatus Applet::status() const
Types::ItemStatus Applet::status() const
{
return d->itemStatus;
}
void Applet::setStatus(const ItemStatus status)
void Applet::setStatus(const Types::ItemStatus status)
{
d->itemStatus = status;
emit statusChanged(status);
@ -422,7 +422,7 @@ void Applet::setStatus(const ItemStatus status)
void Applet::flushPendingConstraintsEvents()
{
if (d->pendingConstraints == NoConstraint) {
if (d->pendingConstraints == Types::NoConstraint) {
return;
}
@ -431,12 +431,12 @@ void Applet::flushPendingConstraintsEvents()
}
//kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!";
Plasma::Constraints c = d->pendingConstraints;
d->pendingConstraints = NoConstraint;
Plasma::Types::Constraints c = d->pendingConstraints;
d->pendingConstraints = Types::NoConstraint;
if (c & Plasma::StartupCompletedConstraint) {
if (c & Plasma::Types::StartupCompletedConstraint) {
//common actions
bool unlocked = immutability() == Mutable;
bool unlocked = immutability() == Types::Mutable;
QAction *closeApplet = d->actions->action("remove");
if (closeApplet) {
closeApplet->setEnabled(unlocked);
@ -467,8 +467,8 @@ void Applet::flushPendingConstraintsEvents()
}
}
if (c & Plasma::ImmutableConstraint) {
bool unlocked = immutability() == Mutable;
if (c & Plasma::Types::ImmutableConstraint) {
bool unlocked = immutability() == Types::Mutable;
QAction *action = d->actions->action("remove");
if (action) {
action->setVisible(unlocked);
@ -494,7 +494,7 @@ void Applet::flushPendingConstraintsEvents()
// pass the constraint on to the actual subclass
constraintsEvent(c);
if (c & StartupCompletedConstraint) {
if (c & Types::StartupCompletedConstraint) {
// start up is done, we can now go do a mod timer
if (d->modificationsTimer) {
if (d->modificationsTimer->isActive()) {
@ -517,7 +517,7 @@ KActionCollection *Applet::actions() const
return d->actions;
}
FormFactor Applet::formFactor() const
Types::FormFactor Applet::formFactor() const
{
Containment *c = containment();
QObject *pw = qobject_cast<QObject *>(parent());
@ -528,7 +528,7 @@ FormFactor Applet::formFactor() const
parentApplet = qobject_cast<Plasma::Applet *>(pw);
}
return c ? c->d->formFactor : Plasma::Planar;
return c ? c->d->formFactor : Plasma::Types::Planar;
}
Containment *Applet::containment() const
@ -599,10 +599,10 @@ KShortcut Applet::globalShortcut() const
return KShortcut();
}
Location Applet::location() const
Types::Location Applet::location() const
{
Containment *c = containment();
return c ? c->d->location : Plasma::Desktop;
return c ? c->d->location : Plasma::Types::Desktop;
}
bool Applet::hasConfigurationInterface() const
@ -620,7 +620,7 @@ void Applet::setHasConfigurationInterface(bool hasInterface)
if (configAction) {
bool enable = hasInterface;
if (enable) {
const bool unlocked = immutability() == Mutable;
const bool unlocked = immutability() == Types::Mutable;
enable = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked");
}
configAction->setEnabled(enable);
@ -714,7 +714,7 @@ void Applet::timerEvent(QTimerEvent *event)
// Don't flushPendingConstraints if we're just starting up
// flushPendingConstraints will be called by Corona
if(!(d->pendingConstraints & Plasma::StartupCompletedConstraint)) {
if(!(d->pendingConstraints & Plasma::Types::StartupCompletedConstraint)) {
flushPendingConstraintsEvents();
}
} else if (d->modificationsTimer && event->timerId() == d->modificationsTimer->timerId()) {

View File

@ -101,7 +101,7 @@ class PLASMA_EXPORT Applet : public QObject
/**
* @return The type of immutability of this applet
*/
ImmutabilityType immutability() const;
Types::ImmutabilityType immutability() const;
/**
* If for some reason, the applet fails to get up on its feet (the
@ -138,21 +138,21 @@ class PLASMA_EXPORT Applet : public QObject
* @return the status of the applet
* @since 4.4
*/
ItemStatus status() const;
Types::ItemStatus status() const;
/**
* Returns the current form factor the applet is being displayed in.
*
* @see Plasma::FormFactor
*/
FormFactor formFactor() const;
Types::FormFactor formFactor() const;
/**
* Returns the location of the scene which is displaying applet.
*
* @see Plasma::Location
* @see Plasma::Types::Location
*/
Location location() const;
Types::Location location() const;
//CONFIGURATION
/**
@ -225,7 +225,7 @@ class PLASMA_EXPORT Applet : public QObject
*
* @param constraints the type of constraints that were updated
*/
void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
void updateConstraints(Plasma::Types::Constraints constraints = Plasma::Types::AllConstraints);
//METADATA
@ -357,13 +357,13 @@ class PLASMA_EXPORT Applet : public QObject
* Emitted when the immutability changes
* @since 4.4
*/
void immutabilityChanged(Plasma::ImmutabilityType immutable);
void immutabilityChanged(Plasma::Types::ImmutabilityType immutable);
/**
* Emitted when the applet status changes
* @since 4.4
*/
void statusChanged(Plasma::ItemStatus status);
void statusChanged(Plasma::Types::ItemStatus status);
//CONFIGURATION
/**
@ -407,7 +407,7 @@ class PLASMA_EXPORT Applet : public QObject
* user immutable or system immutable)
* @param immutable the new immutability type of this applet
*/
void setImmutability(const ImmutabilityType immutable);
void setImmutability(const Types::ImmutabilityType immutable);
/**
* Destroys the applet; it will be removed nicely and deleted.
@ -420,7 +420,7 @@ class PLASMA_EXPORT Applet : public QObject
* sets the status for this applet
* @since 4.4
*/
void setStatus(const ItemStatus stat);
void setStatus(const Types::ItemStatus stat);
//CONFIGURATION
/**
@ -546,7 +546,7 @@ class PLASMA_EXPORT Applet : public QObject
* @param constraints the type of constraints that were updated
* @property constraint
*/
virtual void constraintsEvent(Plasma::Constraints constraints);
virtual void constraintsEvent(Plasma::Types::Constraints constraints);
//TODO: timerEvent should go into AppletPrivate
/**

View File

@ -3,6 +3,7 @@ Name=JavaScript File Operations
Name[cs]=Operace souboru JavaScript
Name[de]=JavaScript-Datei-Aktionen
Name[es]=Operaciones de archivo JavaScript
Name[fi]=JavaScript-tiedostotoiminnot
Name[fr]=Opérations sur les fichiers JavaScript
Name[mr]=ि ि
Name[nl]=Bestandsbewerkingen in JavaScript

View File

@ -5,6 +5,7 @@ Name=Test Package
Name[cs]=Testovací balíček
Name[de]=Test-Paket
Name[es]=Paquete de pruebas
Name[fi]=Testipaketti
Name[fr]=Paquet de test
Name[mr]=
Name[nl]=Testpakket

View File

@ -3,6 +3,7 @@ Name=Package metadata test file
Name[cs]=Testovací soubor metadat balíčku
Name[de]=Testdatei für Paket-Metadaten
Name[es]=Archivo de pruebas de metadatos de paquete
Name[fi]=Pakettimetatietojen testitiedosto
Name[fr]=Fichier de test de métadonnées de paquets
Name[mr]=
Name[nl]=Testbestand voor pakketmetadata

View File

@ -83,7 +83,7 @@ void PackageStructureTest::multiplePaths()
void PackageStructureTest::directories()
{
QList<const char*> dirs;
dirs << "config" << "data" << "images" << "scripts" << "translations" << "ui";
dirs << "config" << "data" << "images" << "theme" << "scripts" << "translations" << "ui";
QList<const char*> psDirs = ps.directories();
@ -156,6 +156,7 @@ void PackageStructureTest::requiredFiles()
void PackageStructureTest::path()
{
QCOMPARE(ps.filePath("images"), QDir(m_packagePath + QString("/contents/images")).canonicalPath());
QCOMPARE(ps.filePath("theme"), QDir(m_packagePath + QString("/contents/theme")).canonicalPath());
QCOMPARE(ps.filePath("mainscript"), QFileInfo(m_packagePath + QString("/contents/ui/main.qml")).canonicalFilePath());
}
@ -175,6 +176,7 @@ void PackageStructureTest::mimeTypes()
QStringList mimeTypes;
mimeTypes << "image/svg+xml" << "image/png" << "image/jpeg";
QCOMPARE(ps.mimeTypes("images"), mimeTypes);
QCOMPARE(ps.mimeTypes("theme"), mimeTypes);
}
QTEST_MAIN(PackageStructureTest)

View File

@ -67,7 +67,7 @@ Containment::Containment(QObject *parent,
{
// WARNING: do not access config() OR globalConfig() in this method!
// that requires a scene, which is not available at this point
setContainmentType(CustomContainment);
setContainmentType(Types::CustomContainment);
setHasConfigurationInterface(true);
}
@ -104,26 +104,26 @@ void Containment::init()
return;
}
if (d->type == NoContainmentType) {
//setContainmentType(Plasma::DesktopContainment);
if (d->type == Types::NoContainmentType) {
//setContainmentType(Plasma::Types::DesktopContainment);
//Try to determine the containment type. It must be done as soon as possible
QString type = pluginInfo().property("X-Plasma-ContainmentType").toString();
if (type == "Panel") {
setContainmentType(Plasma::PanelContainment);
setContainmentType(Plasma::Types::PanelContainment);
} else if (type == "Custom") {
setContainmentType(Plasma::CustomContainment);
setContainmentType(Plasma::Types::CustomContainment);
} else if (type == "CustomPanel") {
setContainmentType(Plasma::CustomPanelContainment);
setContainmentType(Plasma::Types::CustomPanelContainment);
//default to desktop
} else {
setContainmentType(Plasma::DesktopContainment);
setContainmentType(Plasma::Types::DesktopContainment);
}
}
//connect actions
ContainmentPrivate::addDefaultActions(actions(), this);
bool unlocked = immutability() == Mutable;
bool unlocked = immutability() == Types::Mutable;
//fix the text of the actions that need title()
//btw, do we really want to use title() when it's a desktopcontainment?
@ -144,7 +144,7 @@ void Containment::init()
connect(appletBrowserAction, SIGNAL(triggered()), this, SLOT(triggerShowAddWidgets()));
}
if (immutability() != SystemImmutable && corona()) {
if (immutability() != Types::SystemImmutable && corona()) {
QAction *lockDesktopAction = corona()->actions()->action("lock widgets");
//keep a pointer so nobody notices it moved to corona
if (lockDesktopAction) {
@ -178,15 +178,15 @@ void Containment::restore(KConfigGroup &group)
return;
}
setLocation((Plasma::Location)group.readEntry("location", (int)d->location));
setFormFactor((Plasma::FormFactor)group.readEntry("formfactor", (int)d->formFactor));
setLocation((Plasma::Types::Location)group.readEntry("location", (int)d->location));
setFormFactor((Plasma::Types::FormFactor)group.readEntry("formfactor", (int)d->formFactor));
//kDebug() << "setScreen from restore";
d->setScreen(group.readEntry("screen", d->screen));
d->activityId = group.readEntry("activityId", QString());
flushPendingConstraintsEvents();
restoreContents(group);
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable));
setImmutability((Types::ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable));
setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper));
@ -202,9 +202,9 @@ void Containment::restore(KConfigGroup &group)
}
} else { //shell defaults
KConfigGroup defaultActionsCfg;
if (d->type == Plasma::PanelContainment) {
if (d->type == Plasma::Types::PanelContainment) {
defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Panel");
//Plasma::DesktopContainment
//Plasma::Types::DesktopContainment
} else {
defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Desktop");
}
@ -291,12 +291,12 @@ void Containment::restoreContents(KConfigGroup &group)
}
}
Plasma::ContainmentType Containment::containmentType() const
Plasma::Types::ContainmentType Containment::containmentType() const
{
return d->type;
}
void Containment::setContainmentType(Plasma::ContainmentType type)
void Containment::setContainmentType(Plasma::Types::ContainmentType type)
{
if (d->type == type) {
return;
@ -310,7 +310,7 @@ Corona *Containment::corona() const
return qobject_cast<Corona*>(parent());
}
void Containment::setFormFactor(FormFactor formFactor)
void Containment::setFormFactor(Types::FormFactor formFactor)
{
if (d->formFactor == formFactor) {
return;
@ -319,7 +319,7 @@ void Containment::setFormFactor(FormFactor formFactor)
//kDebug() << "switching FF to " << formFactor;
d->formFactor = formFactor;
updateConstraints(Plasma::FormFactorConstraint);
updateConstraints(Plasma::Types::FormFactorConstraint);
KConfigGroup c = config();
c.writeEntry("formfactor", (int)formFactor);
@ -327,7 +327,7 @@ void Containment::setFormFactor(FormFactor formFactor)
emit formFactorChanged(formFactor);
}
void Containment::setLocation(Location location)
void Containment::setLocation(Types::Location location)
{
if (d->location == location) {
return;
@ -336,10 +336,10 @@ void Containment::setLocation(Location location)
d->location = location;
foreach (Applet *applet, d->applets) {
applet->updateConstraints(Plasma::LocationConstraint);
applet->updateConstraints(Plasma::Types::LocationConstraint);
}
updateConstraints(Plasma::LocationConstraint);
updateConstraints(Plasma::Types::LocationConstraint);
KConfigGroup c = config();
c.writeEntry("location", (int)location);
@ -354,7 +354,7 @@ Applet *Containment::createApplet(const QString &name, const QVariantList &args)
void Containment::addApplet(Applet *applet)
{
if (!isContainment() || immutability() != Mutable) {
if (!isContainment() || immutability() != Types::Mutable) {
return;
}
@ -397,7 +397,7 @@ void Containment::addApplet(Applet *applet)
connect(applet, SIGNAL(configNeedsSaving()), this, SIGNAL(configNeedsSaving()));
connect(applet, SIGNAL(releaseVisualFocus()), this, SIGNAL(releaseVisualFocus()));
connect(applet, SIGNAL(appletDeleted(Plasma::Applet*)), this, SLOT(appletDeleted(Plasma::Applet*)));
connect(applet, SIGNAL(statusChanged(Plasma::ItemStatus)), this, SLOT(checkStatus(Plasma::ItemStatus)));
connect(applet, SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SLOT(checkStatus(Plasma::Types::ItemStatus)));
connect(applet, SIGNAL(activate()), this, SIGNAL(activate()));
if (!currentContainment) {
@ -416,13 +416,13 @@ void Containment::addApplet(Applet *applet)
//FIXME: an on-appear animation would be nice to have again
}
applet->updateConstraints(Plasma::AllConstraints);
applet->updateConstraints(Plasma::Types::AllConstraints);
applet->flushPendingConstraintsEvents();
emit appletAdded(applet);
if (!currentContainment) {
applet->updateConstraints(Plasma::StartupCompletedConstraint);
applet->updateConstraints(Plasma::Types::StartupCompletedConstraint);
applet->flushPendingConstraintsEvents();
}

View File

@ -100,7 +100,7 @@ class PLASMA_EXPORT Containment : public Applet
/**
* Returns the type of containment
*/
Plasma::ContainmentType containmentType() const;
Plasma::Types::ContainmentType containmentType() const;
/**
* Returns the Corona (if any) that this Containment is hosted by
@ -254,13 +254,13 @@ Q_SIGNALS:
* Emitted when the location has changed
* @since 5.0
*/
void locationChanged(Plasma::Location location);
void locationChanged(Plasma::Types::Location location);
/**
* Emitted when the formFactor has changed
* @since 5.0
*/
void formFactorChanged(Plasma::FormFactor formFactor);
void formFactorChanged(Plasma::Types::FormFactor formFactor);
public Q_SLOTS:
/**
@ -270,19 +270,19 @@ Q_SIGNALS:
*
* @param location the new location of this Corona
*/
void setLocation(Plasma::Location location);
void setLocation(Plasma::Types::Location location);
/**
* Sets the form factor for this Containment. This may cause changes in both
* the arrangement of Applets as well as the display choices of individual
* Applets.
*/
void setFormFactor(Plasma::FormFactor formFactor);
void setFormFactor(Plasma::Types::FormFactor formFactor);
/**
* Sets the type of this containment.
*/
void setContainmentType(Plasma::ContainmentType type);
void setContainmentType(Plasma::Types::ContainmentType type);
/**
* Sets whether wallpaper is painted or not.
@ -319,7 +319,7 @@ Q_SIGNALS:
Q_PRIVATE_SLOT(d, void appletDeleted(Plasma::Applet*))
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::Types::ItemStatus))
friend class Applet;
friend class AppletPrivate;

View File

@ -92,8 +92,8 @@ void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments
}
//temporarily unlock so that removal works
ImmutabilityType oldImm = immutability();
d->immutability = Mutable;
Types::ImmutabilityType oldImm = immutability();
d->immutability = Types::Mutable;
KConfigGroup dest(&config, "Containments");
KConfigGroup dummy;
@ -102,10 +102,10 @@ void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments
c->config().reparent(&dest);
//ensure the containment is unlocked
//this is done directly because we have to bypass any SystemImmutable checks
c->Applet::d->immutability = Mutable;
//this is done directly because we have to bypass any Types::SystemImmutable checks
c->Applet::d->immutability = Types::Mutable;
foreach (Applet *a, c->applets()) {
a->d->immutability = Mutable;
a->d->immutability = Types::Mutable;
}
c->destroy();
@ -161,8 +161,8 @@ Containment *Corona::containmentForScreen(int screen) const
{
foreach (Containment *containment, d->containments) {
if (containment->screen() == screen &&
(containment->containmentType() == Plasma::DesktopContainment ||
containment->containmentType() == Plasma::CustomContainment)) {
(containment->containmentType() == Plasma::Types::DesktopContainment ||
containment->containmentType() == Plasma::Types::CustomContainment)) {
return containment;
}
}
@ -186,7 +186,7 @@ KSharedConfigPtr Corona::config() const
Containment *Corona::createContainment(const QString &name, const QVariantList &args)
{
if (d->immutability == Mutable) {
if (d->immutability == Types::Mutable) {
return d->addContainment(name, args, 0);
}
@ -213,14 +213,14 @@ void Corona::loadDefaultLayout()
//Default implementation does nothing
}
ImmutabilityType Corona::immutability() const
Types::ImmutabilityType Corona::immutability() const
{
return d->immutability;
}
void Corona::setImmutability(const ImmutabilityType immutable)
void Corona::setImmutability(const Types::ImmutabilityType immutable)
{
if (d->immutability == immutable || d->immutability == SystemImmutable) {
if (d->immutability == immutable || d->immutability == Types::SystemImmutable) {
return;
}
@ -235,11 +235,11 @@ void Corona::setImmutability(const ImmutabilityType immutable)
//update our actions
QAction *action = d->actions.action("lock widgets");
if (action) {
if (d->immutability == SystemImmutable) {
if (d->immutability == Types::SystemImmutable) {
action->setEnabled(false);
action->setVisible(false);
} else {
bool unlocked = d->immutability == Mutable;
bool unlocked = d->immutability == Types::Mutable;
action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"));
action->setIcon(QIcon::fromTheme(unlocked ? "object-locked" : "object-unlocked"));
action->setEnabled(true);
@ -247,7 +247,7 @@ void Corona::setImmutability(const ImmutabilityType immutable)
}
}
if (d->immutability != SystemImmutable) {
if (d->immutability != Types::SystemImmutable) {
KConfigGroup cg(config(), "General");
// we call the dptr member directly for locked since isImmutable()
@ -257,11 +257,11 @@ void Corona::setImmutability(const ImmutabilityType immutable)
}
}
QList<Plasma::Location> Corona::freeEdges(int screen) const
QList<Plasma::Types::Location> Corona::freeEdges(int screen) const
{
QList<Plasma::Location> freeEdges;
freeEdges << Plasma::TopEdge << Plasma::BottomEdge
<< Plasma::LeftEdge << Plasma::RightEdge;
QList<Plasma::Types::Location> freeEdges;
freeEdges << Plasma::Types::TopEdge << Plasma::Types::BottomEdge
<< Plasma::Types::LeftEdge << Plasma::Types::RightEdge;
foreach (Containment *containment, containments()) {
if (containment->screen() == screen &&
@ -280,7 +280,7 @@ KActionCollection *Corona::actions() const
CoronaPrivate::CoronaPrivate(Corona *corona)
: q(corona),
immutability(Mutable),
immutability(Types::Mutable),
config(0),
configSyncTimer(new QTimer(corona)),
actions(corona)
@ -317,7 +317,7 @@ void CoronaPrivate::init()
lockAction->setText(i18n("Lock Widgets"));
lockAction->setAutoRepeat(true);
lockAction->setIcon(QIcon::fromTheme("object-locked"));
lockAction->setData(Plasma::ControlAction);
lockAction->setData(Plasma::Types::ControlAction);
lockAction->setShortcut(KShortcut("alt+d, l"));
lockAction->setShortcutContext(Qt::ApplicationShortcut);
@ -328,10 +328,10 @@ void CoronaPrivate::init()
void CoronaPrivate::toggleImmutability()
{
if (immutability == Mutable) {
q->setImmutability(UserImmutable);
if (immutability == Types::Mutable) {
q->setImmutability(Types::UserImmutable);
} else {
q->setImmutability(Mutable);
q->setImmutability(Types::Mutable);
}
}
@ -349,7 +349,7 @@ void CoronaPrivate::updateContainmentImmutability()
{
foreach (Containment *c, containments) {
// we need to tell each containment that immutability has been altered
c->updateConstraints(ImmutableConstraint);
c->updateConstraints(Types::ImmutableConstraint);
}
}
@ -418,7 +418,7 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
}
// we want to provide something and don't care about the failure to launch
containment->setFormFactor(Plasma::Planar);
containment->setFormFactor(Plasma::Types::Planar);
}
// if this is a new containment, we need to ensure that there are no stale
@ -443,7 +443,7 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
containment->init();
KConfigGroup cg = containment->config();
containment->restore(cg);
containment->updateConstraints(Plasma::StartupCompletedConstraint);
containment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
containment->save(cg);
q->requestConfigSync();
containment->flushPendingConstraintsEvents();
@ -507,7 +507,6 @@ QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigGroup &con
}
foreach (Containment *containment, newContainments) {
containment->updateConstraints(Plasma::StartupCompletedConstraint);
emit q->containmentAdded(containment);
#ifndef NDEBUG
// kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Containment" << containment->name();

View File

@ -127,7 +127,7 @@ public:
* @param screen the id of the screen to look for free edges.
* @returns a list of free edges not filled with panel type containments.
*/
QList<Plasma::Location> freeEdges(int screen) const;
QList<Plasma::Types::Location> freeEdges(int screen) const;
/**
* The actions assocated with this Corona
@ -173,14 +173,14 @@ public Q_SLOTS:
/**
* @return The type of immutability of this Corona
*/
ImmutabilityType immutability() const;
Types::ImmutabilityType immutability() const;
/**
* Sets the immutability type for this Corona (not immutable,
* user immutable or system immutable)
* @param immutable the new immutability type of this applet
*/
void setImmutability(const ImmutabilityType immutable);
void setImmutability(const Types::ImmutabilityType immutable);
/**
* Schedules a flush-to-disk synchronization of the configuration state
@ -230,7 +230,7 @@ Q_SIGNALS:
* it's NOT for containments or applets or any of the other stuff on the scene.
* if your code's not in shells/ it probably shouldn't be using it.
*/
void immutabilityChanged(Plasma::ImmutabilityType immutability);
void immutabilityChanged(Plasma::Types::ImmutabilityType immutability);
protected:
/**

View File

@ -1,24 +0,0 @@
[Protocol]
protocol=plasma
exec=plasma-remote-helper %u
input=none
output=none
Icon=plasma
Description=A protocol for Plasma services
Description[cs]=Protokol pro služby Plasma
Description[de]=Ein Protokoll für Plasma-Dienste
Description[es]=Un protocolo para los servicios de Plasma
Description[fr]=Un protocole pour les services de Plasma
Description[mr]=प्लाज्मा सेवांसाठी शिष्टाचार
Description[nl]=Een protocol voor Plasma-services
Description[pt]=Um protocolo para os serviços do Plasma
Description[pt_BR]=Protocolo para os serviços do Plasma
Description[sk]=Protokol pre Plasma služby
Description[sv]=Ett protokoll för Plasma-tjänster
Description[uk]=Протокол для служб Плазми
Description[x-test]=xxA protocol for Plasma servicesxx
helper=true
Class=:internet

View File

@ -6,6 +6,7 @@ Comment=Plasma applet
Comment[cs]=Aplet Plasma
Comment[de]=Plasma-Miniprogramm
Comment[es]=Miniaplicación para Plasma
Comment[fi]=Plasma-sovelma
Comment[fr]=Applet Plasma
Comment[mr]=
Comment[nl]=Plasma-applet

View File

@ -6,6 +6,7 @@ Comment=Plasma Data Engine
Comment[cs]=Datový nástroj plasma
Comment[de]=Plasma-Daten-Treiber
Comment[es]=Motor de datos para Plasma
Comment[fi]=Plasma-tietomoottori
Comment[fr]=Moteur de données de Plasma
Comment[mr]= ि
Comment[nl]=Plasma-gegevensengine

View File

@ -2,5 +2,23 @@
Type=ServiceType
X-KDE-ServiceType=Plasma/Generic
Name=Plasma Package
Name[cs]=Balíček Plasmy
Name[de]=Plasma-Paket
Name[fi]=Plasma-paketti
Name[nl]=Plasma-pakket
Name[pt]=Pacote do Plasma
Name[pt_BR]=Pacote do Plasma
Name[sk]=Plasma balík
Name[sv]=Plasma-paket
Name[uk]=Пакунок Плазми
Name[x-test]=xxPlasma Packagexx
Comment=Generic Plasma Package
Comment[de]=Allgemeines Plasma-Paket
Comment[nl]=Algemeen plasma-pakket
Comment[pt]=Pacote Genérico do Plasma
Comment[pt_BR]=Pacote genérico do Plasma
Comment[sk]=Všeobecný Plasma balík
Comment[sv]=Generellt Plasma-paket
Comment[uk]=Типовий пакунок Плазми
Comment[x-test]=xxGeneric Plasma Packagexx

View File

@ -3,6 +3,7 @@ Type=ServiceType
X-KDE-ServiceType=Plasma/LookAndFeel
Name=Plasma Look and Feel
Name[de]=Plasma-Erscheinungsbild
Name[fi]=Plasman ulkoasu ja tuntuma
Name[fr]=Apparence de Plasma
Name[nl]=Plasma Look-and-Feel
Name[pt]=Aparência e Comportamento do Plasma

View File

@ -6,6 +6,7 @@ Comment=KRunner plugin
Comment[cs]=Modul KRunneru
Comment[de]=KRunner-Modul
Comment[es]=Complemento para KRunner
Comment[fi]=KRunner-liitännäinen
Comment[fr]=Module externe de KRunner
Comment[mr]=KRunner
Comment[nl]=KRunner-plugin

View File

@ -1,17 +0,0 @@
[Desktop Entry]
Type=ServiceType
X-KDE-ServiceType=Plasma/ToolBox
Comment=Plasma toolbox
Comment[cs]=Plasma toolbox
Comment[de]=Plasma-Werkzeugkasten
Comment[es]=Caja de herramientas de Plasma
Comment[fr]=Boîte à outils de Plasma
Comment[mr]=
Comment[nl]=Plasma-hulpmiddelen
Comment[pt]=Barra de ferramentas do Plasma
Comment[pt_BR]=Barra de ferramentas do Plasma
Comment[sk]=Nástroje Plasma
Comment[sv]=Plasma verktygslåda
Comment[uk]=Набір інструментів Плазми
Comment[x-test]=xxPlasma toolboxxx

View File

@ -1,24 +0,0 @@
[Desktop Entry]
Type=ServiceType
X-KDE-ServiceType=Plasma/Wallpaper
Name=Plasma Wallpaper
Name[cs]=Tapety Plasmy
Name[de]=Plasma-Hintergrundbild
Name[fr]=Papier peint de Plasma
Name[nl]=Plasma-bureaubladachtergrond
Name[pt]=Papel de Parede do Plasma
Name[pt_BR]=Papel de parede do Plasma
Name[sk]=Tapeta Plasma
Name[sv]=Plasma skrivbordsunderlägg
Name[uk]=Тло стільниці Плазми
Name[x-test]=xxPlasma Wallpaperxx
Comment=QML Wallpaper Packages
Comment[de]=QML-Hintergrundbild-Pakete
Comment[fr]=Paquets de papier peint pour QML
Comment[nl]=QML-pakketten voor achtergrondafbeeldingen
Comment[pt]=Pacotes de Papéis de Parede em QML
Comment[pt_BR]=Pacotes de papéis de parede em QML
Comment[sk]=Balíky tapiet QML
Comment[sv]=Paket med QML-skrivbordsunderlägg
Comment[uk]=Пакунки зображень тла QML
Comment[x-test]=xxQML Wallpaper Packagesxx

View File

@ -83,7 +83,7 @@ bool DataContainer::visualizationIsConnected(QObject *visualization) const
}
void DataContainer::connectVisualization(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment alignment)
Plasma::Types::IntervalAlignment alignment)
{
//kDebug() << "connecting visualization" << visualization << "at interval of"
// << pollingInterval << "to" << objectName();

View File

@ -122,7 +122,7 @@ class PLASMA_EXPORT DataContainer : public QObject
* @param alignment the clock position to align updates to
**/
void connectVisualization(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment alignment);
Plasma::Types::IntervalAlignment alignment);
/**
* sets this data container to be automatically stored.

View File

@ -96,7 +96,7 @@ KPluginInfo DataEngine::pluginInfo() const
void DataEngine::connectSource(const QString &source, QObject *visualization,
uint pollingInterval,
Plasma::IntervalAlignment intervalAlignment) const
Plasma::Types::IntervalAlignment intervalAlignment) const
{
//kDebug() << "connectSource" << source;
bool newSource;
@ -117,7 +117,7 @@ void DataEngine::connectSource(const QString &source, QObject *visualization,
}
void DataEngine::connectAllSources(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment intervalAlignment) const
Plasma::Types::IntervalAlignment intervalAlignment) const
{
foreach (DataContainer *s, d->sources) {
d->connectSource(s, visualization, pollingInterval, intervalAlignment);
@ -486,7 +486,7 @@ DataContainer *DataEnginePrivate::source(const QString &sourceName, bool createW
void DataEnginePrivate::connectSource(DataContainer *s, QObject *visualization,
uint pollingInterval,
Plasma::IntervalAlignment align,
Plasma::Types::IntervalAlignment align,
bool immediateCall)
{
//kDebug() << "connect source called" << s->objectName() << "with interval" << pollingInterval;

View File

@ -120,7 +120,7 @@ class PLASMA_EXPORT DataEngine : public QObject
Q_INVOKABLE void connectSource(
const QString &source, QObject *visualization,
uint pollingInterval = 0,
Plasma::IntervalAlignment intervalAlignment = NoAlignment) const;
Plasma::Types::IntervalAlignment intervalAlignment = Types::NoAlignment) const;
/**
* Connects all currently existing sources to an object for data updates.
@ -150,8 +150,8 @@ class PLASMA_EXPORT DataEngine : public QObject
* @param intervalAlignment the number of ms to align the interval to
**/
Q_INVOKABLE void connectAllSources(QObject *visualization, uint pollingInterval = 0,
Plasma::IntervalAlignment intervalAlignment =
NoAlignment) const;
Plasma::Types::IntervalAlignment intervalAlignment =
Types::NoAlignment) const;
/**
* Disconnects a source from an object that was receiving data updates.

View File

@ -180,19 +180,19 @@ FrameSvg::EnabledBorders FrameSvg::enabledBorders() const
}
}
void FrameSvg::setElementPrefix(Plasma::Location location)
void FrameSvg::setElementPrefix(Plasma::Types::Location location)
{
switch (location) {
case TopEdge:
case Types::TopEdge:
setElementPrefix("north");
break;
case BottomEdge:
case Types::BottomEdge:
setElementPrefix("south");
break;
case LeftEdge:
case Types::LeftEdge:
setElementPrefix("west");
break;
case RightEdge:
case Types::RightEdge:
setElementPrefix("east");
break;
default:
@ -269,7 +269,7 @@ void FrameSvg::setElementPrefix(const QString &prefix)
}
}
d->location = Floating;
d->location = Types::Floating;
}
bool FrameSvg::hasElementPrefix(const QString & prefix) const
@ -283,19 +283,19 @@ bool FrameSvg::hasElementPrefix(const QString & prefix) const
}
}
bool FrameSvg::hasElementPrefix(Plasma::Location location) const
bool FrameSvg::hasElementPrefix(Plasma::Types::Location location) const
{
switch (location) {
case TopEdge:
case Types::TopEdge:
return hasElementPrefix("north");
break;
case BottomEdge:
case Types::BottomEdge:
return hasElementPrefix("south");
break;
case LeftEdge:
case Types::LeftEdge:
return hasElementPrefix("west");
break;
case RightEdge:
case Types::RightEdge:
return hasElementPrefix("east");
break;
default:
@ -386,22 +386,22 @@ QSizeF FrameSvg::frameSize() const
}
}
qreal FrameSvg::marginSize(const Plasma::MarginEdge edge) const
qreal FrameSvg::marginSize(const Plasma::Types::MarginEdge edge) const
{
if (d->frames[d->prefix]->noBorderPadding) {
return .0;
}
switch (edge) {
case Plasma::TopMargin:
case Plasma::Types::TopMargin:
return d->frames[d->prefix]->topMargin;
break;
case Plasma::LeftMargin:
case Plasma::Types::LeftMargin:
return d->frames[d->prefix]->leftMargin;
break;
case Plasma::RightMargin:
case Plasma::Types::RightMargin:
return d->frames[d->prefix]->rightMargin;
break;

View File

@ -140,7 +140,7 @@ class PLASMA_EXPORT FrameSvg : public Svg
* @param edge the margin edge we want, top, bottom, left or right
* @return the margin size
*/
Q_INVOKABLE qreal marginSize(const Plasma::MarginEdge edge) const;
Q_INVOKABLE qreal marginSize(const Plasma::Types::MarginEdge edge) const;
/**
* Convenience method that extracts the size of the four margins
@ -166,7 +166,7 @@ class PLASMA_EXPORT FrameSvg : public Svg
* called successfully after setImagePath is called.
* @param location location in the UI this frame will be drawn
*/
Q_INVOKABLE void setElementPrefix(Plasma::Location location);
Q_INVOKABLE void setElementPrefix(Plasma::Types::Location location);
/**
* Sets the prefix for the SVG elements to be used for painting. For example,
@ -201,7 +201,7 @@ class PLASMA_EXPORT FrameSvg : public Svg
* to draw a frame.
* @param location the given prefix we want to check if drawable
*/
Q_INVOKABLE bool hasElementPrefix(Plasma::Location location) const;
Q_INVOKABLE bool hasElementPrefix(Plasma::Types::Location location) const;
/**
* Returns the prefix for SVG elements of the FrameSvg

View File

@ -28,46 +28,55 @@
namespace Plasma
{
Direction locationToDirection(Location location)
Types::Types(QObject *parent)
: QObject(parent)
{
switch (location) {
case Floating:
case Desktop:
case TopEdge:
case FullScreen:
//TODO: should we be smarter for floating and planer?
// perhaps we should take a QRect and/or QPos as well?
return Down;
case BottomEdge:
return Up;
case LeftEdge:
return Right;
case RightEdge:
return Left;
}
return Down;
}
Direction locationToInverseDirection(Location location)
Types::~Types()
{
}
Types::Direction locationToDirection(Types::Location location)
{
switch (location) {
case Floating:
case Desktop:
case TopEdge:
case FullScreen:
case Types::Floating:
case Types::Desktop:
case Types::TopEdge:
case Types::FullScreen:
//TODO: should we be smarter for floating and planer?
// perhaps we should take a QRect and/or QPos as well?
return Up;
case BottomEdge:
return Down;
case LeftEdge:
return Left;
case RightEdge:
return Right;
return Types::Down;
case Types::BottomEdge:
return Types::Up;
case Types::LeftEdge:
return Types::Right;
case Types::RightEdge:
return Types::Left;
}
return Up;
return Types::Down;
}
Types::Direction locationToInverseDirection(Types::Location location)
{
switch (location) {
case Types::Floating:
case Types::Desktop:
case Types::TopEdge:
case Types::FullScreen:
//TODO: should we be smarter for floating and planer?
// perhaps we should take a QRect and/or QPos as well?
return Types::Up;
case Types::BottomEdge:
return Types::Down;
case Types::LeftEdge:
return Types::Left;
case Types::RightEdge:
return Types::Right;
}
return Types::Up;
}
} // Plasma namespace

View File

@ -34,6 +34,12 @@ class QAction;
namespace Plasma
{
class PLASMA_EXPORT Types : public QObject
{
Q_OBJECT
public:
~Types();
/**
* The Constraint enumeration lists the various constraints that Plasma
* objects have managed for them and which they may wish to react to,
@ -50,6 +56,7 @@ enum Constraint {
AllConstraints = FormFactorConstraint | LocationConstraint | ScreenConstraint |
ImmutableConstraint
};
Q_ENUMS(Constraint)
Q_DECLARE_FLAGS(Constraints, Constraint)
/**
@ -75,6 +82,7 @@ enum FormFactor {
Application /**< The Applet lives in a plane and should be optimized to look as a full application,
for the desktop or the particular device. */
};
Q_ENUMS(FormFactor)
/**
* This enumeration describes the type of the Containment.
@ -116,6 +124,7 @@ enum Direction {
Left, /**< Display to the left */
Right /**< Display to the right */
};
Q_ENUMS(Direction)
/**
* The Location enumeration describes where on screen an element, such as an
@ -132,6 +141,7 @@ enum Location {
LeftEdge, /**< Along the left side of the screen */
RightEdge /**< Along the right side of the screen */
};
Q_ENUMS(Location)
/**
* The position enumeration
@ -144,12 +154,12 @@ enum Position {
BottomPositioned, /**< Positioned bottom */
CenterPositioned /**< Positioned in the center */
};
Q_ENUMS(Position)
/**
* The popup position enumeration relatively to his attached widget
*
**/
enum PopupPlacement {
FloatingPopup = 0, /**< Free floating, non attached popup */
TopPosedLeftAlignedPopup, /**< Popup positioned on the top, aligned
@ -169,6 +179,7 @@ enum PopupPlacement {
RightPosedBottomAlignedPopup /**< Popup positioned on the right, aligned
to the bottom of the widget */
};
Q_ENUMS(PopupPlacement)
/**
* Flip enumeration
@ -178,6 +189,7 @@ enum FlipDirection {
HorizontalFlip = 1, /**< Flip horizontally */
VerticalFlip = 2 /**< Flip vertically */
};
Q_ENUMS(FlipDirection)
Q_DECLARE_FLAGS(Flip, FlipDirection)
/**
@ -188,6 +200,7 @@ enum IntervalAlignment {
AlignToMinute, /**< Align to the minute **/
AlignToHour /**< Align to the hour **/
};
Q_ENUMS(IntervalAlignment)
/**
* Defines the immutability of items like applets, corona and containments
@ -201,6 +214,7 @@ enum ImmutabilityType {
SystemImmutable = 4 /**< the item is locked down by the system, the user
can't unlock it **/
};
Q_ENUMS(ImmutabilityType)
/**
* The ComonentType enumeration refers to the various types of components,
@ -215,6 +229,7 @@ enum ComponentType {
WallpaperComponent = 32, /**< Plasma::Wallpaper based plugins **/
GenericComponent = 64 /** Generic repositories of files, usually they keep QML files and their assets **/
};
Q_ENUMS(ComponentType)
Q_DECLARE_FLAGS(ComponentTypes, ComponentType)
enum MarginEdge {
@ -223,15 +238,7 @@ enum MarginEdge {
LeftMargin, /**< The left margin **/
RightMargin /**< The right margin **/
};
enum MessageButton {
ButtonNone = 0, /**< None **/
ButtonOk = 1, /**< OK Button **/
ButtonYes = 2, /**< Yes Button **/
ButtonNo = 4, /**< No Button **/
ButtonCancel = 8 /**< Cancel Button **/
};
Q_DECLARE_FLAGS(MessageButtons, MessageButton)
Q_ENUMS(MarginEdge)
/**
* Status of an applet
@ -246,12 +253,6 @@ enum ItemStatus {
};
Q_ENUMS(ItemStatus)
enum AnnouncementMethod {
NoAnnouncement = 0, /**< No announcements **/
ZeroconfAnnouncement = 1 /**< Announcements via ZeroConf **/
};
Q_DECLARE_FLAGS(AnnouncementMethods, AnnouncementMethod)
enum TrustLevel {
UnverifiableTrust = 0, /**< The trust of the object can not be verified, usually because no
trust information (e.g. a cryptographic signature) was provided */
@ -276,6 +277,10 @@ enum BackgroundHints {
};
Q_ENUMS(BackgroundHints)
private:
Types(QObject *parent = 0);
};
/**
* Converts a location to a direction. Handy for figuring out which way to send a popup based on
* location or to point arrows and other directional items.
@ -283,7 +288,7 @@ Q_ENUMS(BackgroundHints)
* @param location the location of the container the element will appear in
* @return the visual direction the element should be oriented in
**/
PLASMA_EXPORT Direction locationToDirection(Location location);
PLASMA_EXPORT Types::Direction locationToDirection(Types::Location location);
/**
* Converts a location to the direction facing it. Handy for figuring out which way to collapse
@ -292,13 +297,14 @@ PLASMA_EXPORT Direction locationToDirection(Location location);
* @param location the location of the container the element will appear in
* @return the visual direction the element should be oriented in
**/
PLASMA_EXPORT Direction locationToInverseDirection(Location location);
PLASMA_EXPORT Types::Direction locationToInverseDirection(Types::Location location);
} // Plasma namespace
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Constraints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Flip)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::ComponentTypes)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::MessageButtons)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Constraints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Flip)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::ComponentTypes)
#endif // multiple inclusion guard

View File

@ -50,16 +50,16 @@ namespace Plasma
AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int uniqueID, Applet *applet)
: appletId(uniqueID),
q(applet),
immutability(Mutable),
immutability(Types::Mutable),
appletDescription(info ? *info : KPluginInfo(service)),
mainConfig(0),
pendingConstraints(NoConstraint),
pendingConstraints(Types::NoConstraint),
script(0),
package(0),
configLoader(0),
actions(AppletPrivate::defaultActions(applet)),
activationAction(0),
itemStatus(UnknownStatus),
itemStatus(Types::UnknownStatus),
modificationsTimer(0),
hasConfigurationInterface(false),
isContainment(false),
@ -202,14 +202,14 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
configAction->setText(i18n("Widget Settings"));
configAction->setIcon(QIcon::fromTheme("configure"));
configAction->setShortcut(KShortcut("alt+d, s"));
configAction->setData(Plasma::ConfigureAction);
configAction->setData(Plasma::Types::ConfigureAction);
KAction *closeApplet = actions->add<KAction>("remove");
closeApplet->setAutoRepeat(false);
closeApplet->setText(i18n("Remove this Widget"));
closeApplet->setIcon(QIcon::fromTheme("edit-delete"));
closeApplet->setShortcut(KShortcut("alt+d, r"));
closeApplet->setData(Plasma::DestructiveAction);
closeApplet->setData(Plasma::Types::DestructiveAction);
KAction *runAssociatedApplication = actions->add<KAction>("run associated application");
runAssociatedApplication->setAutoRepeat(false);
@ -218,7 +218,7 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
runAssociatedApplication->setShortcut(KShortcut("alt+d, t"));
runAssociatedApplication->setVisible(false);
runAssociatedApplication->setEnabled(false);
runAssociatedApplication->setData(Plasma::ControlAction);
runAssociatedApplication->setData(Plasma::Types::ControlAction);
return actions;
}
@ -317,15 +317,15 @@ QString AppletPrivate::globalName() const
return appletDescription.service()->library();
}
void AppletPrivate::scheduleConstraintsUpdate(Plasma::Constraints c)
void AppletPrivate::scheduleConstraintsUpdate(Plasma::Types::Constraints c)
{
// Don't start up a timer if we're just starting up
// flushPendingConstraints will be called by Corona
if (started && !constraintsTimer.isActive() && !(c & Plasma::StartupCompletedConstraint)) {
if (started && !constraintsTimer.isActive() && !(c & Plasma::Types::StartupCompletedConstraint)) {
constraintsTimer.start(0, q);
}
if (c & Plasma::StartupCompletedConstraint) {
if (c & Plasma::Types::StartupCompletedConstraint) {
started = true;
}

View File

@ -62,7 +62,7 @@ public:
void setIsContainment(bool isContainment, bool forceUpdate = false);
QString globalName() const;
void scheduleConstraintsUpdate(Plasma::Constraints c);
void scheduleConstraintsUpdate(Plasma::Types::Constraints c);
void scheduleModificationNotification();
KConfigGroup *mainConfigGroup();
void resetConfigurationObject();
@ -80,7 +80,7 @@ public:
Applet *q;
// applet attributes
ImmutabilityType immutability;
Types::ImmutabilityType immutability;
QString launchErrorMessage;
// applet info we keep around in case its needed
@ -89,7 +89,7 @@ public:
// bookkeeping
KConfigGroup *mainConfig;
Plasma::Constraints pendingConstraints;
Plasma::Types::Constraints pendingConstraints;
// sripting and package stuff
AppletScript *script;
@ -100,7 +100,7 @@ public:
KActionCollection *actions;
KAction *activationAction;
ItemStatus itemStatus;
Types::ItemStatus itemStatus;
// timerEvent bookkeeping
QBasicTimer constraintsTimer;

View File

@ -69,7 +69,7 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
appletBrowserAction->setText(i18n("Add Widgets..."));
appletBrowserAction->setIcon(QIcon::fromTheme("list-add"));
appletBrowserAction->setShortcut(KShortcut("alt+d, a"));
appletBrowserAction->setData(Plasma::AddAction);
appletBrowserAction->setData(Plasma::Types::AddAction);
}
void ContainmentPrivate::setScreen(int newScreen)
@ -101,8 +101,8 @@ void ContainmentPrivate::setScreen(int newScreen)
//kDebug() << activity() << "setting screen to " << newScreen << "and type is" << type;
Containment *swapScreensWith(0);
const bool isDesktopContainment = type == Plasma::DesktopContainment ||
type == Plasma::CustomContainment;
const bool isDesktopContainment = type == Plasma::Types::DesktopContainment ||
type == Plasma::Types::CustomContainment;
if (isDesktopContainment) {
if (newScreen > -1) {
// sanity check to make sure someone else doesn't have this screen already!
@ -123,7 +123,7 @@ void ContainmentPrivate::setScreen(int newScreen)
int oldScreen = screen;
screen = newScreen;
q->updateConstraints(Plasma::ScreenConstraint);
q->updateConstraints(Plasma::Types::ScreenConstraint);
if (oldScreen != newScreen) {
/*
@ -161,7 +161,7 @@ void ContainmentPrivate::configChanged()
q->setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper));
}
void ContainmentPrivate::checkStatus(Plasma::ItemStatus appletStatus)
void ContainmentPrivate::checkStatus(Plasma::Types::ItemStatus appletStatus)
{
//kDebug() << "================== "<< appletStatus << q->status();
if (appletStatus == q->status()) {
@ -187,16 +187,16 @@ void ContainmentPrivate::triggerShowAddWidgets()
emit q->showAddWidgetsInterface(QPointF());
}
void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constraints)
void ContainmentPrivate::containmentConstraintsEvent(Plasma::Types::Constraints constraints)
{
if (!q->isContainment()) {
return;
}
//kDebug() << "got containmentConstraintsEvent" << constraints;
if (constraints & Plasma::ImmutableConstraint) {
if (constraints & Plasma::Types::ImmutableConstraint) {
//update actions
const bool unlocked = q->immutability() == Mutable;
const bool unlocked = q->immutability() == Types::Mutable;
QAction *action = q->actions()->action("remove");
if (action) {
@ -213,21 +213,21 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
// tell the applets too
foreach (Applet *a, applets) {
a->setImmutability(q->immutability());
a->updateConstraints(ImmutableConstraint);
a->updateConstraints(Types::ImmutableConstraint);
}
}
// pass on the constraints that are relevant here
Constraints appletConstraints = NoConstraint;
if (constraints & FormFactorConstraint) {
appletConstraints |= FormFactorConstraint;
Types::Constraints appletConstraints = Types::NoConstraint;
if (constraints & Types::FormFactorConstraint) {
appletConstraints |= Types::FormFactorConstraint;
}
if (constraints & ScreenConstraint) {
appletConstraints |= ScreenConstraint;
if (constraints & Types::ScreenConstraint) {
appletConstraints |= Types::ScreenConstraint;
}
if (appletConstraints != NoConstraint) {
if (appletConstraints != Types::NoConstraint) {
foreach (Applet *applet, applets) {
applet->updateConstraints(appletConstraints);
}
@ -240,7 +240,7 @@ Applet *ContainmentPrivate::createApplet(const QString &name, const QVariantList
return 0;
}
if (q->immutability() != Mutable) {
if (q->immutability() != Types::Mutable) {
#ifndef NDEBUG
kDebug() << "addApplet for" << name << "requested, but we're currently immutable!";
#endif
@ -271,7 +271,7 @@ void ContainmentPrivate::appletDeleted(Plasma::Applet *applet)
bool ContainmentPrivate::isPanelContainment() const
{
return type == Plasma::PanelContainment || type == Plasma::CustomPanelContainment;
return type == Plasma::Types::PanelContainment || type == Plasma::Types::CustomPanelContainment;
}
}

View File

@ -47,10 +47,10 @@ class ContainmentPrivate
public:
ContainmentPrivate(Containment *c)
: q(c),
formFactor(Planar),
location(Floating),
formFactor(Types::Planar),
location(Types::Floating),
screen(-1), // no screen
type(Plasma::NoContainmentType),
type(Plasma::Types::NoContainmentType),
drawWallpaper(false)
{
}
@ -65,7 +65,7 @@ public:
}
void triggerShowAddWidgets();
void checkStatus(Plasma::ItemStatus status);
void checkStatus(Plasma::Types::ItemStatus status);
void setScreen(int newScreen);
/**
@ -73,7 +73,7 @@ public:
* constraint services common to all containments. Containments should still
* implement their own constraintsEvent method
*/
void containmentConstraintsEvent(Plasma::Constraints constraints);
void containmentConstraintsEvent(Plasma::Types::Constraints constraints);
bool isPanelContainment() const;
void setLockToolText();
@ -95,14 +95,14 @@ public:
static void addDefaultActions(KActionCollection *actions, Containment *c = 0);
Containment *q;
FormFactor formFactor;
Location location;
Types::FormFactor formFactor;
Types::Location location;
QList<Applet *> applets;
QString wallpaper;
QHash<QString, ContainmentActions*> localActionPlugins;
int screen;
QString activityId;
ContainmentType type;
Types::ContainmentType type;
bool drawWallpaper : 1;
static const char defaultWallpaper[];

View File

@ -51,7 +51,7 @@ public:
Corona *q;
Package package;
KConfigGroup desktopDefaultsConfig;
ImmutabilityType immutability;
Types::ImmutabilityType immutability;
QString configName;
KSharedConfigPtr config;
QTimer *configSyncTimer;

View File

@ -25,7 +25,7 @@ namespace Plasma
SignalRelay *DataContainerPrivate::signalRelay(const DataContainer *dc, QObject *visualization,
uint pollingInterval,
Plasma::IntervalAlignment align,
Plasma::Types::IntervalAlignment align,
bool immediateUpdate)
{
QMap<uint, SignalRelay *>::const_iterator relayIt = relays.constFind(pollingInterval);
@ -56,7 +56,7 @@ bool DataContainerPrivate::hasUpdates()
}
SignalRelay::SignalRelay(DataContainer *parent, DataContainerPrivate *data, uint ival,
Plasma::IntervalAlignment align, bool immediateUpdate)
Plasma::Types::IntervalAlignment align, bool immediateUpdate)
: QObject(parent),
dc(parent),
d(data),
@ -67,7 +67,7 @@ SignalRelay::SignalRelay(DataContainer *parent, DataContainerPrivate *data, uint
{
//kDebug() << "signal relay with time of" << m_timerId << "being set up";
m_timerId = startTimer(immediateUpdate ? 0 : m_interval);
if (m_align != Plasma::NoAlignment) {
if (m_align != Plasma::Types::NoAlignment) {
checkAlignment();
}
}
@ -87,12 +87,12 @@ void SignalRelay::checkAlignment()
int newTime = 0;
QTime t = QTime::currentTime();
if (m_align == Plasma::AlignToMinute) {
if (m_align == Plasma::Types::AlignToMinute) {
int seconds = t.second();
if (seconds > 2) {
newTime = ((60 - seconds) * 1000) + 500;
}
} else if (m_align == Plasma::AlignToHour) {
} else if (m_align == Plasma::Types::AlignToHour) {
int minutes = t.minute();
int seconds = t.second();
if (minutes > 1 || seconds > 10) {
@ -147,7 +147,7 @@ void SignalRelay::timerEvent(QTimerEvent *event)
m_resetTimer = false;
}
if (m_align != Plasma::NoAlignment) {
if (m_align != Plasma::Types::NoAlignment) {
checkAlignment();
}

View File

@ -59,7 +59,7 @@ public:
void checkUsage();
SignalRelay *signalRelay(const DataContainer *dc, QObject *visualization,
uint pollingInterval, Plasma::IntervalAlignment align,
uint pollingInterval, Plasma::Types::IntervalAlignment align,
bool immediateUpdate);
bool hasUpdates();
@ -100,7 +100,7 @@ class SignalRelay : public QObject
public:
SignalRelay(DataContainer *parent, DataContainerPrivate *data,
uint ival, Plasma::IntervalAlignment align, bool immediateUpdate);
uint ival, Plasma::Types::IntervalAlignment align, bool immediateUpdate);
int receiverCount() const;
bool isUnused() const;
@ -112,7 +112,7 @@ public:
DataContainer *dc;
DataContainerPrivate *d;
uint m_interval;
Plasma::IntervalAlignment m_align;
Plasma::Types::IntervalAlignment m_align;
int m_timerId;
bool m_resetTimer;
bool m_queued;

View File

@ -38,7 +38,7 @@ class DataEnginePrivate
~DataEnginePrivate();
DataContainer *source(const QString &sourceName, bool createWhenMissing = true);
void connectSource(DataContainer *s, QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment align, bool immediateCall = true);
Plasma::Types::IntervalAlignment align, bool immediateCall = true);
DataContainer *requestSource(const QString &sourceName, bool *newSource = 0);
void internalUpdateSource(DataContainer*);
void setupScriptSupport();

View File

@ -134,7 +134,7 @@ public:
void updateAndSignalSizes();
QSizeF frameSize(FrameData *frame) const;
Location location;
Types::Location location;
QString prefix;
FrameSvg *q;

View File

@ -82,9 +82,11 @@ void GenericPackage::initPackage(Package *package)
package->setDefaultPackageRoot("plasma/packages/");
package->addDirectoryDefinition("images", "images", i18n("Images"));
package->addDirectoryDefinition("theme", "theme", i18n("Themed Images"));
QStringList mimetypes;
mimetypes << "image/svg+xml" << "image/png" << "image/jpeg";
package->setMimeTypes("images", mimetypes);
package->setMimeTypes("theme", mimetypes);
package->addDirectoryDefinition("config", "config", i18n("Configuration Definitions"));
mimetypes.clear();

View File

@ -124,16 +124,36 @@ bool ThemePrivate::useCache()
ThemeConfig config;
cacheSize = config.themeCacheKb();
}
pixmapCache = new KImageCache("plasma_theme_" + themeName, cacheSize * 1024);
if (themeName != systemColorsTheme) {
//check for expired cache
const bool isRegularTheme = themeName != systemColorsTheme;
QString cacheFile = "plasma_theme_" + themeName;
if (isRegularTheme) {
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "desktoptheme/" + themeName + "/metadata.desktop");
const KPluginInfo pluginInfo(path);
// now we check for, and remove if necessary, old caches
const QString cacheFileBase = cacheFile + "*.kcache";
cacheFile += "_v" + pluginInfo.version();
const QString currentCacheFileName = cacheFile + ".kcache";
foreach (const QString &file, QStandardPaths::locateAll(QStandardPaths::CacheLocation, cacheFileBase)) {
if (!file.endsWith(currentCacheFileName)) {
QFile::remove(file);
}
}
}
pixmapCache = new KImageCache(cacheFile, cacheSize * 1024);
// now we do a sanity check: if the metadata.desktop file is newer than the cache, drop
// the cache
if (isRegularTheme) {
// FIXME: when using the system colors, if they change while the application is not running
// the cache should be dropped; we need a way to detect system color change when the
// application is not running.
QFile f(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "desktoptheme/" + themeName + "/metadata.desktop"));
QFileInfo info(f);
if (info.lastModified().toTime_t() > uint(pixmapCache->lastModifiedTime())) {
pixmapCache->clear();
const QFile f(cacheFile);
const QFileInfo fileInfo(f);
if (fileInfo.lastModified().toTime_t() > uint(pixmapCache->lastModifiedTime().toTime_t())) {
discardCache(PixmapCache | SvgElementsCache);
}
}
}

View File

@ -66,7 +66,7 @@ void AppletScript::paintInterface(QPainter *painter,
Q_UNUSED(contentsRect);
}
void AppletScript::constraintsEvent(Plasma::Constraints constraints)
void AppletScript::constraintsEvent(Plasma::Types::Constraints constraints)
{
Q_UNUSED(constraints);
}
@ -146,18 +146,18 @@ void AppletScript::setDrawWallpaper(bool drawWallpaper)
}
}
Plasma::ContainmentType AppletScript::containmentType() const
Plasma::Types::ContainmentType AppletScript::containmentType() const
{
Q_ASSERT(d->applet);
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet);
if (cont) {
return cont->containmentType();
} else {
return Plasma::NoContainmentType;
return Plasma::Types::NoContainmentType;
}
}
void AppletScript::setContainmentType(Plasma::ContainmentType type)
void AppletScript::setContainmentType(Plasma::Types::ContainmentType type)
{
Q_ASSERT(d->applet);
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet);

View File

@ -94,7 +94,7 @@ public:
*
* @param constraints the type of constraints that were updated
*/
virtual void constraintsEvent(Plasma::Constraints constraints);
virtual void constraintsEvent(Plasma::Types::Constraints constraints);
/**
* Returns a list of context-related QAction instances.
@ -143,13 +143,13 @@ public:
* @see Containment
* @since 4.7
*/
Plasma::ContainmentType containmentType() const;
Plasma::Types::ContainmentType containmentType() const;
/**
* @see Containment
* @since 4.7
*/
void setContainmentType(Plasma::ContainmentType type);
void setContainmentType(Plasma::Types::ContainmentType type);
Q_SIGNALS:
/**

View File

@ -61,12 +61,12 @@ QString ScriptEngine::mainScript() const
return QString();
}
QStringList knownLanguages(ComponentTypes types)
QStringList knownLanguages(Types::ComponentTypes types)
{
QString constraintTemplate = "'%1' in [X-Plasma-ComponentTypes]";
QString constraint;
if (types & AppletComponent) {
if (types & Types::AppletComponent) {
// currently this if statement is not needed, but this future proofs
// the code against someone initializing constraint to something
// before we get here.
@ -77,7 +77,7 @@ QStringList knownLanguages(ComponentTypes types)
constraint.append(constraintTemplate.arg("Applet"));
}
if (types & DataEngineComponent) {
if (types & Types::DataEngineComponent) {
if (!constraint.isEmpty()) {
constraint.append(" or ");
}
@ -85,7 +85,7 @@ QStringList knownLanguages(ComponentTypes types)
constraint.append(constraintTemplate.arg("DataEngine"));
}
if (types & RunnerComponent) {
if (types & Types::RunnerComponent) {
if (!constraint.isEmpty()) {
constraint.append(" or ");
}
@ -108,7 +108,7 @@ QStringList knownLanguages(ComponentTypes types)
return languages;
}
KService::List engineOffers(const QString &language, ComponentType type)
KService::List engineOffers(const QString &language, Types::ComponentType type)
{
if (language.isEmpty()) {
return KService::List();
@ -124,13 +124,13 @@ KService::List engineOffers(const QString &language, ComponentType type)
QString component;
switch (type) {
case AppletComponent:
case Types::AppletComponent:
component = "Applet";
break;
case DataEngineComponent:
case Types::DataEngineComponent:
component = "DataEngine";
break;
case RunnerComponent:
case Types::RunnerComponent:
component = "Runner";
break;
default:
@ -152,7 +152,7 @@ KService::List engineOffers(const QString &language, ComponentType type)
return offers;
}
ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *parent)
ScriptEngine *loadEngine(const QString &language, Types::ComponentType type, QObject *parent)
{
KService::List offers = engineOffers(language, type);
@ -162,13 +162,13 @@ ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *p
ScriptEngine *engine = 0;
foreach (const KService::Ptr &service, offers) {
switch (type) {
case AppletComponent:
case Types::AppletComponent:
engine = service->createInstance<Plasma::AppletScript>(parent, args, &error);
break;
case DataEngineComponent:
case Types::DataEngineComponent:
engine = service->createInstance<Plasma::DataEngineScript>(parent, args, &error);
break;
case RunnerComponent:
case Types::RunnerComponent:
engine = service->createInstance<Plasma::RunnerScript>(parent, args, &error);
break;
default:
@ -195,7 +195,7 @@ ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *p
AppletScript *loadScriptEngine(const QString &language, Applet *applet)
{
AppletScript *engine =
static_cast<AppletScript*>(loadEngine(language, AppletComponent, applet));
static_cast<AppletScript*>(loadEngine(language, Types::AppletComponent, applet));
if (engine) {
engine->setApplet(applet);
@ -207,7 +207,7 @@ AppletScript *loadScriptEngine(const QString &language, Applet *applet)
DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngine)
{
DataEngineScript *engine =
static_cast<DataEngineScript*>(loadEngine(language, DataEngineComponent, dataEngine));
static_cast<DataEngineScript*>(loadEngine(language, Types::DataEngineComponent, dataEngine));
if (engine) {
engine->setDataEngine(dataEngine);
@ -218,7 +218,7 @@ DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngi
RunnerScript *loadScriptEngine(const QString &language, AbstractRunner *runner)
{
RunnerScript *engine = static_cast<RunnerScript*>(loadEngine(language, RunnerComponent, runner));
RunnerScript *engine = static_cast<RunnerScript*>(loadEngine(language, Types::RunnerComponent, runner));
if (engine) {
engine->setRunner(runner);

View File

@ -85,7 +85,7 @@ private:
* language support for
* @return a list of all supported languages for the given type(s).
**/
PLASMA_EXPORT QStringList knownLanguages(ComponentTypes types);
PLASMA_EXPORT QStringList knownLanguages(Types::ComponentTypes types);
/**
* Loads an Applet script engine for the given language.

View File

@ -236,7 +236,7 @@ ServiceJob *Service::startOperationCall(const QVariantMap &description, QObject
}
} else {
#ifndef NDEBUG
kDebug() << op << "is not a valid group; valid groups are:" << d->operationsMap->keys();
kDebug() << op << "is not a valid group; valid groups are:" << d->operationsMap.keys();
#endif
}

View File

@ -590,10 +590,10 @@ TrustLevel Signing::trustLevelOf(const QString &keyID) const
return Plasma::UnverifiableTrust;
for (int i = (int)Plasma::UnverifiableTrust; i <= (int)Plasma::UltimatelyTrusted; ++i) {
QList< QByteArray > tmp = d->keys[(Plasma::TrustLevel)i];
QList< QByteArray > tmp = d->keys[(Plasma::Types::TrustLevel)i];
foreach(QByteArray key, tmp) {
if (key.contains(keyID.toAscii().data()))
return (Plasma::TrustLevel)i;
return (Plasma::Types::TrustLevel)i;
}
}

View File

@ -70,7 +70,7 @@ class SigningPrivate;
* QString signer = m_auth->signerOf(plasmoidPath);
*
* // If you need to know the authentication level associated with a specific signer, simply call:
* Plasma::TrustLevel level = m_auth->trustLevelOf(signer)
* Plasma::Types::TrustLevel level = m_auth->trustLevelOf(signer)
*
* // If you need more details about a key with a given keyID, you have to call:
* QString info = m_auth->descriptiveString(keyID);

View File

@ -3,6 +3,7 @@ Name=Test
Name[cs]=Test
Name[de]=Test
Name[es]=Prueba
Name[fi]=Testi
Name[fr]=Test
Name[mr]=
Name[nl]=Test

View File

@ -3,6 +3,7 @@ Name=Test Data Engine
Name[cs]=Testovací datový nástroj
Name[de]=Test-Datentreiber
Name[es]=Motor de datos de pruebas
Name[fi]=Testitietomoottori
Name[fr]=Moteur de données pour faire des tests
Name[mr]= ि
Name[nl]=Testgegevensengine

View File

@ -296,7 +296,7 @@ bool Theme::useGlobalSettings() const
bool Theme::findInCache(const QString &key, QPixmap &pix, unsigned int lastModified)
{
if (lastModified != 0 && d->useCache() && lastModified > uint(d->pixmapCache->lastModifiedTime())) {
if (lastModified != 0 && d->useCache() && lastModified > uint(d->pixmapCache->lastModifiedTime().toTime_t())) {
return false;
}

View File

@ -5,7 +5,7 @@ add_executable(plasmapkg
plasmapkg.cpp
)
target_link_libraries(plasmapkg ${KDE4_KDECORE_LIBS} plasma)
target_link_libraries(plasmapkg kdeqt5staging plasma)
message("INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS}")

View File

@ -18,48 +18,39 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <KCmdLineArgs>
#include <KLocalizedString>
#include <qcommandlineparser.h>
#include <qcommandlineoption.h>
#include "plasmapkg.h"
int main(int argc, char **argv)
{
KLocalizedString description = ki18n("Plasma Package Manager");
QCommandLineParser *parser = new QCommandLineParser;
Plasma::PlasmaPkg app(argc, argv, parser);
const QString description = i18n("Plasma Package Manager");
const char version[] = "2.0";
KCmdLineArgs::init(argc, argv, "plasmapkg", "plasmapkg", ki18n("Plasma Package Manager"), version, description);
KCmdLineOptions options;
options.add("h");
options.add("hash <path>", ki18nc("Do not translate <path>", "Generate a SHA1 hash for the package at <path>"));
options.add("g");
options.add("global", ki18n("For install or remove, operates on packages installed for all users."));
options.add("t");
options.add("type <type>",
ki18nc("theme, wallpaper, etc. are keywords, but they may be translated, as both versions "
app.setApplicationVersion(version);
parser->addVersionOption();
parser->addHelpOption(description);
parser->addOption(QCommandLineOption(QStringList() << "h" << "hash", i18nc("Do not translate <path>", "Generate a SHA1 hash for the package at <path>"), "path"));
parser->addOption(QCommandLineOption(QStringList() << "g" << "global", i18n("For install or remove, operates on packages installed for all users.")));
parser->addOption(QCommandLineOption(QStringList() << "type",
i18nc("theme, wallpaper, etc. are keywords, but they may be translated, as both versions "
"are recognized by the application "
"(if translated, should be same as messages with 'package type' context below)",
"The type of package, e.g. theme, wallpaper, plasmoid, dataengine, runner, layout-template, etc."),
"plasmoid");
//options.add("s");
options.add("i");
options.add("install <path>", ki18nc("Do not translate <path>", "Install the package at <path>"));
options.add("s");
options.add("show <name>", ki18nc("Do not translate <name>", "Show information of package <name>"));
options.add("u");
options.add("upgrade <path>", ki18nc("Do not translate <path>", "Upgrade the package at <path>"));
options.add("l");
options.add("list", ki18n("List installed packages"));
options.add("list-types", ki18n("lists all known Package types that can be installed"));
options.add("r");
options.add("remove <name>", ki18nc("Do not translate <name>", "Remove the package named <name>"));
options.add("p");
options.add("packageroot <path>", ki18n("Absolute path to the package root. If not supplied, then the standard data directories for this KDE session will be searched instead."));
KCmdLineArgs::addCmdLineOptions( options );
"type", false, QStringList() << "plasmoid"));
parser->addOption(QCommandLineOption(QStringList() << "i" << "install", i18nc("Do not translate <path>", "Install the package at <path>"), "path"));
parser->addOption(QCommandLineOption(QStringList() << "s" << "show", i18nc("Do not translate <name>", "Show information of package <name>"), "name"));
parser->addOption(QCommandLineOption(QStringList() << "u" << "upgrade", i18nc("Do not translate <path>", "Upgrade the package at <path>"), "path"));
parser->addOption(QCommandLineOption(QStringList() << "l" << "list", i18n("List installed packages")));
parser->addOption(QCommandLineOption(QStringList() << "list-types", i18n("lists all known Package types that can be installed")));
parser->addOption(QCommandLineOption(QStringList() << "r" << "remove", i18nc("Do not translate <name>", "Remove the package named <name>"), "name"));
parser->addOption(QCommandLineOption(QStringList() << "p" << "packageroot", i18n("Absolute path to the package root. If not supplied, then the standard data directories for this KDE session will be searched instead."), "path"));
Plasma::PlasmaPkg app(argc, argv);
return app.exec();
}

View File

@ -20,7 +20,6 @@
#include "plasmapkg.h"
#include <kcmdlineargs.h>
#include <kdebug.h>
#include <kservice.h>
#include <kservicetypetrader.h>
@ -35,6 +34,7 @@
#include <klocale.h>
#include <kjob.h>
#include <qcommandlineparser.h>
#include <QDir>
#include <QDBusInterface>
#include <QFileInfo>
@ -66,14 +66,15 @@ public:
void renderTypeTable(const QMap<QString, QStringList> &plugins);
void listTypes();
void coutput(const QString &msg);
KCmdLineArgs *args;
QCommandLineParser *parser;
};
PlasmaPkg::PlasmaPkg(int& argc, char** argv) :
PlasmaPkg::PlasmaPkg(int& argc, char** argv, QCommandLineParser *parser) :
QCoreApplication(argc, argv)
{
d = new PlasmaPkgPrivate;
d->parser = parser;
QTimer::singleShot(0, this, SLOT(runMain()));
}
@ -84,11 +85,9 @@ PlasmaPkg::~PlasmaPkg()
void PlasmaPkg::runMain()
{
d->args = KCmdLineArgs::parsedArgs();
Plasma::PackageStructure* structure = new Plasma::PackageStructure;
if (d->args->isSet("hash")) {
const QString path = d->args->getOption("hash");
if (d->parser->isSet("hash")) {
const QString path = d->parser->argument("hash");
Plasma::Package package(structure);
package.setPath(path);
const QString hash = package.contentsHash();
@ -102,44 +101,44 @@ void PlasmaPkg::runMain()
return;
}
if (d->args->isSet("list-types")) {
if (d->parser->isSet("list-types")) {
d->listTypes();
exit(0);
return;
}
QString type = d->args->getOption("type");
QString type = d->parser->argument("type");
QString packageRoot = type;
d->pluginTypes.clear();
d->installer = 0;
if (d->args->isSet("remove")) {
d->package = d->args->getOption("remove");
} else if (d->args->isSet("upgrade")) {
d->package = d->args->getOption("upgrade");
} else if (d->args->isSet("install")) {
d->package = d->args->getOption("install");
} else if (d->args->isSet("show")) {
d->package = d->args->getOption("show");
if (d->parser->isSet("remove")) {
d->package = d->parser->argument("remove");
} else if (d->parser->isSet("upgrade")) {
d->package = d->parser->argument("upgrade");
} else if (d->parser->isSet("install")) {
d->package = d->parser->argument("install");
} else if (d->parser->isSet("show")) {
d->package = d->parser->argument("show");
}
if (!QDir::isAbsolutePath(d->package)) {
d->packageFile = QDir(QDir::currentPath() + '/' + d->package).absolutePath();
d->packageFile = QFileInfo(d->packageFile).canonicalFilePath();
if (d->args->isSet("upgrade")) {
if (d->parser->isSet("upgrade")) {
d->package = d->packageFile;
}
} else {
d->packageFile = d->package;
}
if (!d->packageFile.isEmpty() && (!d->args->isSet("type") ||
if (!d->packageFile.isEmpty() && (!d->parser->isSet("type") ||
type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0 ||
type.compare("wallpaper", Qt::CaseInsensitive) == 0)) {
// Check type for common plasma packages
Plasma::Package package(structure);
QString serviceType;
if (d->args->isSet("remove")) {
if (d->parser->isSet("remove")) {
package.setPath(d->package);
} else {
package.setPath(d->packageFile);
@ -270,21 +269,21 @@ void PlasmaPkg::runMain()
if (!d->installer) {
d->coutput(i18n("Could not load installer for package of type %1. Error reported was: %2",
d->args->getOption("type"), error));
d->parser->argument("type"), error));
return;
}
//d->packageRoot = d->installer->defaultPackageRoot();
//pluginTypes << d->installer->type();
}
if (d->args->isSet("show")) {
if (d->parser->isSet("show")) {
const QString pluginName = d->package;
showPackageInfo(pluginName);
exit(0);
return;
}
if (d->args->isSet("list")) {
if (d->parser->isSet("list")) {
d->coutput(i18n("Listing service types: %1", d->pluginTypes.join(", ")));
listPackages(d->pluginTypes);
exit(0);
@ -298,7 +297,7 @@ void PlasmaPkg::runMain()
d->packageRoot = findPackageRoot(d->package, d->packageRoot);
if (d->args->isSet("remove") || d->args->isSet("upgrade")) {
if (d->parser->isSet("remove") || d->parser->isSet("upgrade")) {
QString pkgPath;
foreach (const QString &t, d->pluginTypes) {
Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage(t);
@ -315,7 +314,7 @@ void PlasmaPkg::runMain()
pkgPath = d->package;
}
if (d->args->isSet("upgrade")) {
if (d->parser->isSet("upgrade")) {
d->installer->setPath(d->package);
}
QString _p = d->packageRoot;
@ -349,13 +348,13 @@ void PlasmaPkg::runMain()
exit(1);
}
}
if (d->args->isSet("install")) {
if (d->parser->isSet("install")) {
KJob *installJob = d->installer->install(d->packageFile, d->packageRoot);
connect(installJob, SIGNAL(result(KJob*)), SLOT(packageInstalled(KJob*)));
return;
}
if (d->package.isEmpty()) {
KCmdLineArgs::usageError(i18nc("No option was given, this is the error message telling the user he needs at least one, do not translate install, remove, upgrade nor list", "One of install, remove, upgrade or list is required."));
qWarning() << i18nc("No option was given, this is the error message telling the user he needs at least one, do not translate install, remove, upgrade nor list", "One of install, remove, upgrade or list is required.");
exit(1);
} else {
d->runKbuildsycoca();
@ -439,16 +438,17 @@ void PlasmaPkg::showPackageInfo(const QString& pluginName)
QString PlasmaPkg::findPackageRoot(const QString& pluginName, const QString& prefix)
{
QString packageRoot;
if (d->args->isSet("packageroot") && d->args->isSet("global")) {
KCmdLineArgs::usageError(i18nc("The user entered conflicting options packageroot and global, this is the error message telling the user he can use only one", "The packageroot and global options conflict each other, please select only one."));
} else if (d->args->isSet("packageroot")) {
packageRoot = d->args->getOption("packageroot");
if (d->parser->isSet("packageroot") && d->parser->isSet("global")) {
qWarning() << i18nc("The user entered conflicting options packageroot and global, this is the error message telling the user he can use only one", "The packageroot and global options conflict each other, please select only one.");
::exit(1);
} else if (d->parser->isSet("packageroot")) {
packageRoot = d->parser->argument("packageroot");
//qDebug() << "(set via arg) d->packageRoot is: " << d->packageRoot;
} else if (d->args->isSet("global")) {
} else if (d->parser->isSet("global")) {
packageRoot = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, d->packageRoot, QStandardPaths::LocateDirectory).last();
//qDebug() << "(set via locateAll) d->packageRoot is: " << d->packageRoot;
} else {
packageRoot = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + d->packageRoot;
packageRoot = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + d->packageRoot;
//qDebug() << "(set via locateLocal) d->packageRoot is: " << d->packageRoot;
}
return packageRoot;
@ -584,7 +584,7 @@ void PlasmaPkg::packageInstalled(KJob *job)
bool success = (job->error() == KJob::NoError);
int exitcode = 0;
if (success) {
if (d->args->isSet("upgrade")) {
if (d->parser->isSet("upgrade")) {
d->coutput(i18n("Successfully upgraded %1", d->packageFile));
} else {
d->coutput(i18n("Successfully installed %1", d->packageFile));
@ -601,7 +601,7 @@ void PlasmaPkg::packageUninstalled(KJob *job)
bool success = (job->error() == KJob::NoError);
int exitcode = 0;
if (success) {
if (d->args->isSet("upgrade")) {
if (d->parser->isSet("upgrade")) {
d->coutput(i18n("Upgrading package from file: %1", d->packageFile));
KJob *installJob = d->installer->install(d->packageFile, d->packageRoot);
connect(installJob, SIGNAL(result(KJob*)), SLOT(packageInstalled(KJob*)));

View File

@ -23,6 +23,7 @@
#include <QCoreApplication>
class QCommandLineParser;
class KJob;
namespace Plasma
@ -35,7 +36,7 @@ class PlasmaPkg : public QCoreApplication
Q_OBJECT
public:
PlasmaPkg(int& argc, char** argv);
PlasmaPkg(int& argc, char** argv, QCommandLineParser *parser);
virtual ~PlasmaPkg();
void listPackages(const QStringList &types);

View File

@ -0,0 +1,10 @@
set(kded_platformstatus_SRCS platformstatus.cpp )
kde4_add_plugin(kded_platformstatus ${kded_platformstatus_SRCS})
target_link_libraries(kded_platformstatus ${KDE4_KDECORE_LIBS} ${KCoreAddons_LIBRARIES} Qt5::DBus)
install(TARGETS kded_platformstatus DESTINATION ${PLUGIN_INSTALL_DIR} )
install( FILES kded-platformstatus.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded )
install( FILES org.kde.platformstatus.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )

View File

@ -0,0 +1,23 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KDEDModule
X-KDE-Library=platformstatus
X-KDE-DBus-ModuleName=plaformstatus
X-KDE-Kded-autoload=true
X-KDE-Kded-load-on-demand=false
Name=Platform Status
Name[nl]=Status van platform
Name[pt]=Estado da Plataforma
Name[pt_BR]=Status da plataforma
Name[sk]=Stav platformy
Name[sv]=Plattformstatus
Name[uk]=Стан платформи
Name[x-test]=xxPlatform Statusxx
Comment=Tracks the current shell package and the platform definition strings.
Comment[nl]=Volgt het huidige shell-pakket en de definitietekenreeksen van platform.
Comment[pt]=Segue o pacote da consola actual e a os textos de definição da plataforma.
Comment[pt_BR]=Segue o pacote do shell atual e as strings de definição da plataforma.
Comment[sk]=Sleduje aktuálny balík shellu a reťazce definície platformy.
Comment[sv]=Följer nuvarande skalpaket och plattformens definitionssträngar
Comment[uk]=Стежить за станом поточного пакунка оболонки та рядками визначення платформи.
Comment[x-test]=xxTracks the current shell package and the platform definition strings.xx

View File

@ -0,0 +1,19 @@
<!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.PlatformStatus">
<property name="shellPackage" type="s" access="read"/>
<property name="runtimePlatform" type="as" access="read"/>
<signal name="shellPackageChanged">
<arg name="package" type="s" direction="out"/>
</signal>
<signal name="runtimePlatformChanged">
<arg name="runtimePlatform" type="as" direction="out"/>
</signal>
<method name="shellPackage">
<arg type="s" direction="out"/>
</method>
<method name="runtimePlatform">
<arg type="as" direction="out"/>
</method>
</interface>
</node>

View File

@ -0,0 +1,79 @@
#include <platformstatus.h>
#include <QDBusConnection>
#include <QStandardPaths>
#include <KConfigGroup>
#include <KDebug>
#include <KDirWatch>
#include <KPluginFactory>
const char *defaultPackage = "org.kde.desktop";
K_PLUGIN_FACTORY(PlatformStatusFactory, registerPlugin<PlatformStatus>();)
K_EXPORT_PLUGIN(PlatformStatusFactory("platformstatus"))
PlatformStatus::PlatformStatus(QObject *parent, const QVariantList &)
: KDEDModule(parent)
{
QDBusConnection::sessionBus().registerObject("/PlatformStatus", this,
QDBusConnection::ExportAllProperties |
QDBusConnection::ExportAllSignals);
findShellPackage(false);
const QString globalrcPath = QStandardPaths::locate(QStandardPaths::ConfigLocation, "kdeglobals");
connect(KDirWatch::self(), SIGNAL(dirty(QString)), this, SLOT(fileDirtied(QString)));
KDirWatch::self()->addFile(globalrcPath);
}
void PlatformStatus::findShellPackage(bool sendSignal)
{
KConfigGroup group(KSharedConfig::openConfig("kdeglobals"), "DesktopShell");
const QString package = group.readEntry("shellPackage", defaultPackage);
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"plasma/shells/" + package + '/',
QStandardPaths::LocateDirectory);
if (path.isEmpty()) {
if (package != defaultPackage) {
group.deleteEntry("ShellPackage");
findShellPackage(sendSignal);
}
return;
}
m_shellPackage = package;
QString runtimePlatform = group.readEntry("RuntimePlatform", QString());
KConfig packageDefaults(path + "contents/defaults", KConfig::SimpleConfig);
group = KConfigGroup(&packageDefaults, "Desktop");
runtimePlatform = group.readEntry("RuntimePlatform", runtimePlatform);
const bool runtimeChanged = runtimePlatform != m_runtimePlatform.join(',');
if (runtimeChanged) {
m_runtimePlatform = runtimePlatform.split(',');
}
if (sendSignal) {
emit shellPackageChanged(m_shellPackage);
emit runtimePlatformChanged(m_runtimePlatform);
}
}
QString PlatformStatus::shellPackage() const
{
return m_shellPackage;
}
QStringList PlatformStatus::runtimePlatform() const
{
return m_runtimePlatform;
}
void PlatformStatus::fileDirtied(const QString &path)
{
if (path.endsWith("kdeglobals")) {
findShellPackage(true);
}
}
#include "platformstatus.moc"

View File

@ -0,0 +1,38 @@
#ifndef PLATFORMSTATUS_H
#define PLATFORMSTATUS_H
#include <KDEDModule>
#include <QStringList>
class PlatformStatus : public KDEDModule
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.PlatformStatus")
Q_PROPERTY(QString shellPackage READ shellPackage NOTIFY shellPackageChanged)
Q_PROPERTY(QStringList runtimePlatform READ runtimePlatform NOTIFY runtimePlatformChanged)
public:
PlatformStatus(QObject *parent, const QVariantList &);
public Q_SLOTS:
QString shellPackage() const;
QStringList runtimePlatform() const;
Q_SIGNALS:
void shellPackageChanged(const QString &package);
void runtimePlatformChanged(const QStringList &runtimePlatform);
private:
void findShellPackage(bool sendSignal);
private Q_SLOTS:
void fileDirtied(const QString &path);
private:
QString m_shellPackage;
QStringList m_runtimePlatform;
};
#endif

View File

@ -2,6 +2,7 @@
Name=Declarative widget
Name[cs]=Deklarativní widget
Name[de]=Deklaratives Bedienelement
Name[fi]=Deklaratiivinen sovelma
Name[fr]=Composant graphique déclaratif
Name[mr]= ि
Name[nl]=Widget voor declaratie

View File

@ -2,6 +2,7 @@
Name=JavaScript Widget
Name[cs]=JavaScript Widget
Name[de]=JavaScript-Programm
Name[fi]=JavaScript-sovelma
Name[fr]=Composant graphique de JavaScript
Name[mr]=ि ि
Name[nl]=JavaScript-widget

View File

@ -3,6 +3,7 @@ Name=JavaScript Runner
Name[cs]=Spouštěč JavaScriptu
Name[de]=JavaScript-Ausführung
Name[es]=Lanzador JavaScript
Name[fi]=JavaScript-suoritusohjelma
Name[fr]=Lanceur de JavaScript
Name[mr]=ि
Name[nl]=JavaScript-runner
@ -16,6 +17,7 @@ Comment=JavaScript Runner
Comment[cs]=Spouštěč JavaScriptu
Comment[de]=JavaScript-Ausführung
Comment[es]=Lanzador JavaScript
Comment[fi]=JavaScript-suoritusohjelma
Comment[fr]=Lanceur de JavaScript
Comment[mr]=ि
Comment[nl]=JavaScript-runner

View File

@ -59,7 +59,7 @@ void AppletContainer::setApplet(QGraphicsWidget *widget)
m_applet = applet;
connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(sizeHintChanged(Qt::SizeHint)));
connect(applet, SIGNAL(statusChanged(Plasma::ItemStatus)), this, SIGNAL(statusChanged()));
connect(applet, SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SIGNAL(statusChanged()));
applet->setParentItem(this);
applet->setGeometry(0, 0, qMax((qreal)16, width()), qMax((qreal)16, height()));
@ -151,7 +151,7 @@ void AppletContainer::setStatus(const AppletContainer::ItemStatus status)
return;
}
m_applet.data()->setStatus((Plasma::ItemStatus)status);
m_applet.data()->setStatus((Plasma::Types::ItemStatus)status);
}
AppletContainer::ItemStatus AppletContainer::status() const

View File

@ -70,8 +70,8 @@ void ToolBoxProxy::init()
d->configureAction = 0;
if (d->containment) {
connect(d->containment, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)),
this, SLOT(immutabilityChanged(Plasma::ImmutabilityType)));
connect(d->containment, SIGNAL(immutabilityChanged(Plasma::Types::ImmutabilityType)),
this, SLOT(immutabilityChanged(Plasma::Types::ImmutabilityType)));
connect(this, SIGNAL(configureRequested(Plasma::Containment*)),
d->containment, SIGNAL(configureRequested(Plasma::Containment*)));
connect(this, SIGNAL(showAddWidgetsInterface(const QPointF&)),
@ -171,7 +171,7 @@ void ToolBoxProxy::setShowing(const bool show)
d->showing = show;
}
void ToolBoxProxy::immutabilityChanged(Plasma::ImmutabilityType immutability)
void ToolBoxProxy::immutabilityChanged(Plasma::Types::ImmutabilityType immutability)
{
Q_UNUSED(immutability);
loadActions();

View File

@ -60,7 +60,7 @@ Q_SIGNALS:
private Q_SLOTS:
void actionDestroyed(QObject *object);
void immutabilityChanged(Plasma::ImmutabilityType immutability);
void immutabilityChanged(Plasma::Types::ImmutabilityType immutability);
private:
void init();

View File

@ -128,12 +128,12 @@ QScriptValue DataEngineReceiver::connectAllSources(QScriptContext *context, QScr
}
int pollingInterval = 0;
Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
Plasma::Types::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
if (context->argumentCount() > 1) {
pollingInterval = context->argument(2).toInt32();
if (context->argumentCount() > 2) {
intervalAlignment = static_cast<Plasma::IntervalAlignment>(context->argument(4).toInt32());
intervalAlignment = static_cast<Plasma::Types::IntervalAlignment>(context->argument(4).toInt32());
}
}
@ -168,12 +168,12 @@ QScriptValue DataEngineReceiver::connectSource(QScriptContext *context, QScriptE
}
int pollingInterval = 0;
Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
Plasma::Types::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
if (context->argumentCount() > 2) {
pollingInterval = context->argument(2).toInt32();
if (context->argumentCount() > 3) {
intervalAlignment = static_cast<Plasma::IntervalAlignment>(context->argument(4).toInt32());
intervalAlignment = static_cast<Plasma::Types::IntervalAlignment>(context->argument(4).toInt32());
}
}

View File

@ -2,6 +2,7 @@
Name=Declarative widget
Name[cs]=Deklarativní widget
Name[de]=Deklaratives Bedienelement
Name[fi]=Deklaratiivinen sovelma
Name[fr]=Composant graphique déclaratif
Name[mr]= ि
Name[nl]=Widget voor declaratie

View File

@ -56,7 +56,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
: QQuickItem(parent),
m_appletScriptEngine(script),
m_actionSignals(0),
m_backgroundHints(Plasma::StandardBackground),
m_backgroundHints(Plasma::Types::StandardBackground),
m_busy(false),
m_expanded(false)
{
@ -65,8 +65,8 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus()));
connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving()));
connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged()));
connect(applet(), SIGNAL(statusChanged(Plasma::ItemStatus)), this, SIGNAL(statusChanged()));
connect(applet(), SIGNAL(immutabilityChanged(Plasma::Types::ImmutabilityType)), this, SIGNAL(immutableChanged()));
connect(applet(), SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SIGNAL(statusChanged()));
connect(m_appletScriptEngine, SIGNAL(formFactorChanged()),
this, SIGNAL(formFactorChanged()));
connect(m_appletScriptEngine, SIGNAL(locationChanged()),
@ -135,9 +135,9 @@ void AppletInterface::init()
Plasma::Containment *pc = qobject_cast<Plasma::Containment *>(applet());
if (pc && !qobject_cast<Plasma::Applet *>(pc->parent())) {
KConfigGroup defaults;
if (pc->containmentType() == Plasma::DesktopContainment) {
if (pc->containmentType() == Plasma::Types::DesktopContainment) {
defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Desktop");
} else if (pc->containmentType() == Plasma::PanelContainment) {
} else if (pc->containmentType() == Plasma::Types::PanelContainment) {
defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Panel");
}
@ -179,14 +179,14 @@ void AppletInterface::init()
emit busyChanged();
}
AppletInterface::FormFactor AppletInterface::formFactor() const
Plasma::Types::FormFactor AppletInterface::formFactor() const
{
return static_cast<FormFactor>(applet()->formFactor());
return applet()->formFactor();
}
AppletInterface::Location AppletInterface::location() const
Plasma::Types::Location AppletInterface::location() const
{
return static_cast<Location>(applet()->location());
return applet()->location();
}
QString AppletInterface::currentActivity() const
@ -256,18 +256,18 @@ void AppletInterface::setExpanded(bool expanded)
emit expandedChanged();
}
AppletInterface::BackgroundHints AppletInterface::backgroundHints() const
Plasma::Types::BackgroundHints AppletInterface::backgroundHints() const
{
return (BackgroundHints)m_backgroundHints;
return m_backgroundHints;
}
void AppletInterface::setBackgroundHints(BackgroundHints hint)
void AppletInterface::setBackgroundHints(Plasma::Types::BackgroundHints hint)
{
if (m_backgroundHints == (Plasma::BackgroundHints)hint) {
if (m_backgroundHints == hint) {
return;
}
m_backgroundHints = (Plasma::BackgroundHints)hint;
m_backgroundHints = hint;
emit backgroundHintsChanged();
}
@ -447,7 +447,7 @@ QAction *AppletInterface::action(QString name) const
bool AppletInterface::immutable() const
{
return applet()->immutability() != Plasma::Mutable;
return applet()->immutability() != Plasma::Types::Mutable;
}
bool AppletInterface::userConfiguring() const
@ -482,14 +482,14 @@ QString AppletInterface::associatedApplication() const
return applet()->associatedApplication();
}
void AppletInterface::setStatus(const AppletInterface::ItemStatus &status)
void AppletInterface::setStatus(const Plasma::Types::ItemStatus &status)
{
applet()->setStatus((Plasma::ItemStatus)status);
applet()->setStatus(status);
}
AppletInterface::ItemStatus AppletInterface::status() const
Plasma::Types::ItemStatus AppletInterface::status() const
{
return (AppletInterface::ItemStatus)((int)(applet()->status()));
return applet()->status();
}
QString AppletInterface::downloadPath(const QString &file)

View File

@ -49,30 +49,23 @@ namespace Plasma
class AppletInterface : public QQuickItem
{
Q_OBJECT
Q_ENUMS(FormFactor)
Q_ENUMS(Location)
Q_ENUMS(BackgroundHints)
Q_ENUMS(AnimationDirection)
Q_ENUMS(IntervalAlignment)
Q_ENUMS(ThemeColors)
Q_ENUMS(ItemStatus)
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
//TODO: writable icon
Q_PROPERTY(QString icon READ icon CONSTANT)
Q_PROPERTY(uint id READ id CONSTANT)
Q_PROPERTY(FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
Q_PROPERTY(Location location READ location NOTIFY locationChanged)
Q_PROPERTY(Plasma::Types::FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
Q_PROPERTY(Plasma::Types::Location location READ location NOTIFY locationChanged)
Q_PROPERTY(QString currentActivity READ currentActivity NOTIFY contextChanged)
Q_PROPERTY(QObject* configuration READ configuration CONSTANT)
Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig)
Q_PROPERTY(bool busy WRITE setBusy READ isBusy NOTIFY busyChanged)
Q_PROPERTY(bool expanded WRITE setExpanded READ isExpanded NOTIFY expandedChanged)
Q_PROPERTY(BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints NOTIFY backgroundHintsChanged)
Q_PROPERTY(Plasma::Types::BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints NOTIFY backgroundHintsChanged)
Q_PROPERTY(bool immutable READ immutable NOTIFY immutableChanged)
Q_PROPERTY(bool userConfiguring READ userConfiguring) // @since 4.5
Q_PROPERTY(int apiVersion READ apiVersion CONSTANT)
Q_PROPERTY(ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
Q_PROPERTY(Plasma::Types::ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication)
public:
@ -82,73 +75,6 @@ public:
//API not intended for the QML part
QmlObject *qmlObject();
//------------------------------------------------------------------
//enums copy&pasted from plasma.h because qtscript is evil
//TODO: all of this should go from here
enum FormFactor {
Planar = 0, /**< The applet lives in a plane and has two
degrees of freedom to grow. Optimize for
desktop, laptop or tablet usage: a high
resolution screen 1-3 feet distant from the
viewer. */
MediaCenter, /**< As with Planar, the applet lives in a plane
but the interface should be optimized for
medium-to-high resolution screens that are
5-15 feet distant from the viewer. Sometimes
referred to as a "ten foot interface".*/
Horizontal, /**< The applet is constrained vertically, but
can expand horizontally. */
Vertical, /**< The applet is constrained horizontally, but
can expand vertically. */
Application /**< The Applet lives in a plane and should be optimized to look as a full application,
for the desktop or the particular device. */
};
enum Location {
Floating = 0, /**< Free floating. Neither geometry or z-ordering
is described precisely by this value. */
Desktop, /**< On the planar desktop layer, extending across
the full screen from edge to edge */
FullScreen, /**< Full screen */
TopEdge, /**< Along the top of the screen*/
BottomEdge, /**< Along the bottom of the screen*/
LeftEdge, /**< Along the left side of the screen */
RightEdge /**< Along the right side of the screen */
};
enum ItemStatus {
UnknownStatus = 0, /**< The status is unknown **/
PassiveStatus = 1, /**< The Item is passive **/
ActiveStatus = 2, /**< The Item is active **/
NeedsAttentionStatus = 3, /**< The Item needs attention **/
AcceptingInputStatus = 4 /**< The Item is accepting input **/
};
enum BackgroundHints {
NoBackground = Plasma::NoBackground,
StandardBackground = Plasma::StandardBackground,
TranslucentBackground = Plasma::TranslucentBackground,
DefaultBackground = Plasma::DefaultBackground
};
enum ThemeColors {
TextColor = Plasma::Theme::TextColor,
HighlightColor = Plasma::Theme::HighlightColor,
BackgroundColor = Plasma::Theme::BackgroundColor,
ButtonTextColor = Plasma::Theme::ButtonTextColor,
ButtonBackgroundColor = Plasma::Theme::ButtonBackgroundColor,
LinkColor = Plasma::Theme::LinkColor,
VisitedLinkColor = Plasma::Theme::VisitedLinkColor
};
enum IntervalAlignment {
NoAlignment = 0,
AlignToMinute,
AlignToHour
};
//QML API-------------------------------------------------------------------
Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
@ -186,9 +112,9 @@ enum IntervalAlignment {
uint id() const;
FormFactor formFactor() const;
Plasma::Types::FormFactor formFactor() const;
Location location() const;
Plasma::Types::Location location() const;
QString currentActivity() const;
@ -200,14 +126,14 @@ enum IntervalAlignment {
bool isExpanded() const;
void setExpanded(bool expanded);
BackgroundHints backgroundHints() const;
void setBackgroundHints(BackgroundHints hint);
Plasma::Types::BackgroundHints backgroundHints() const;
void setBackgroundHints(Plasma::Types::BackgroundHints hint);
void setAssociatedApplication(const QString &string);
QString associatedApplication() const;
void setStatus(const ItemStatus &status);
ItemStatus status() const;
void setStatus(const Plasma::Types::ItemStatus &status);
Plasma::Types::ItemStatus status() const;
QString activeConfig() const;
void setActiveConfig(const QString &name);
@ -253,7 +179,7 @@ private:
QTimer *m_creationTimer;
Plasma::BackgroundHints m_backgroundHints;
Plasma::Types::BackgroundHints m_backgroundHints;
bool m_busy : 1;
bool m_expanded : 1;
};

View File

@ -36,6 +36,7 @@
#include <Plasma/Package>
#include <Plasma/PluginLoader>
#include "kdeclarative/configpropertymap.h"
ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent)
: AppletInterface(parent),
@ -96,7 +97,7 @@ ContainmentInterface::Type ContainmentInterface::containmentType() const
void ContainmentInterface::setContainmentType(ContainmentInterface::Type type)
{
m_appletScriptEngine->setContainmentType((Plasma::ContainmentType)type);
m_appletScriptEngine->setContainmentType((Plasma::Types::ContainmentType)type);
}
int ContainmentInterface::screen() const
@ -167,9 +168,7 @@ void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet)
void ContainmentInterface::loadWallpaper()
{
if (m_appletScriptEngine->drawWallpaper()) {
if (m_wallpaperInterface || containment()->wallpaper().isEmpty()) {
return;
}
delete m_wallpaperInterface;
m_wallpaperInterface = new WallpaperInterface(this);
m_wallpaperInterface->setZ(-1000);
@ -181,6 +180,7 @@ void ContainmentInterface::loadWallpaper()
QQmlProperty prop(m_wallpaperInterface, "anchors.fill");
prop.write(expr.evaluate());
containment()->setProperty("wallpaperGraphicsObject", QVariant::fromValue(m_wallpaperInterface));
} else {
if (m_wallpaperInterface) {
m_wallpaperInterface->deleteLater();
@ -282,7 +282,7 @@ void ContainmentInterface::addAppletActions(KMenu &desktopMenu, Plasma::Applet *
}
}
if (containment()->immutability() == Plasma::Mutable) {
if (containment()->immutability() == Plasma::Types::Mutable) {
QAction *closeApplet = applet->actions()->action("remove");
//kDebug() << "checking for removal" << closeApplet;
if (closeApplet) {
@ -298,7 +298,7 @@ void ContainmentInterface::addAppletActions(KMenu &desktopMenu, Plasma::Applet *
void ContainmentInterface::addContainmentActions(KMenu &desktopMenu, QEvent *event)
{
if (containment()->corona()->immutability() != Plasma::Mutable &&
if (containment()->corona()->immutability() != Plasma::Types::Mutable &&
!KAuthorized::authorizeKAction("plasma/containment_actions")) {
//kDebug() << "immutability";
return;
@ -329,8 +329,8 @@ void ContainmentInterface::addContainmentActions(KMenu &desktopMenu, QEvent *eve
if (actions.isEmpty()) {
//it probably didn't bother implementing the function. give the user a chance to set
//a better plugin. note that if the user sets no-plugin this won't happen...
if ((containment()->containmentType() != Plasma::PanelContainment &&
containment()->containmentType() != Plasma::CustomPanelContainment) &&
if ((containment()->containmentType() != Plasma::Types::PanelContainment &&
containment()->containmentType() != Plasma::Types::CustomPanelContainment) &&
containment()->actions()->action("configure")) {
desktopMenu.addAction(containment()->actions()->action("configure"));
}

View File

@ -129,17 +129,17 @@ QObject *DeclarativeAppletScript::loadui(const QString &filename)
}
void DeclarativeAppletScript::constraintsEvent(Plasma::Constraints constraints)
void DeclarativeAppletScript::constraintsEvent(Plasma::Types::Constraints constraints)
{
if (constraints & Plasma::FormFactorConstraint) {
if (constraints & Plasma::Types::FormFactorConstraint) {
emit formFactorChanged();
}
if (constraints & Plasma::LocationConstraint) {
if (constraints & Plasma::Types::LocationConstraint) {
emit locationChanged();
}
if (constraints & Plasma::ContextConstraint) {
if (constraints & Plasma::Types::ContextConstraint) {
emit contextChanged();
}
}

View File

@ -43,7 +43,7 @@ public:
QList<QAction*> contextualActions();
void constraintsEvent(Plasma::Constraints constraints);
void constraintsEvent(Plasma::Types::Constraints constraints);
bool include(const QString &path);

View File

@ -38,6 +38,7 @@ set(scripting_SRC
scripting/appinterface.cpp
scripting/applet.cpp
scripting/containment.cpp
scripting/configgroup.cpp
scripting/desktopscriptengine.cpp
scripting/i18n.cpp
scripting/layouttemplatepackagestructure.cpp

View File

@ -4,6 +4,7 @@ Keywords=
Name=Applet Test
Name[de]=Miniprogrammtest
Name[es]=Prueba de miniaplicación
Name[fi]=Sovelmatesti
Name[fr]=Applet test
Name[mr]=
Name[nl]=Test van applet

View File

@ -67,10 +67,10 @@ PlasmaComponents.Page {
clearButtonShown: true
}
}
PlasmaComponents.TextArea {
width: parent.width
height: _h*2
}
// PlasmaComponents.TextArea {
// width: parent.width
// height: _h*2
// }
}
}

View File

@ -48,11 +48,11 @@ Item {
id: localeItem
anchors { left: parent.left; right: parent.right; top: tx.bottom; }
}
PlasmaComponents.TextArea {
anchors { left: parent.left; right: parent.right; top: localeItem.bottom; }
width: parent.width
height: 80
}
// PlasmaComponents.TextArea {
// anchors { left: parent.left; right: parent.right; top: localeItem.bottom; }
// width: parent.width
// height: 80
// }
PlasmaComponents.Button {
id: thanks
anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 24; }

View File

@ -4,6 +4,7 @@ Keywords=
Name=Components Test
Name[de]=Komponententest
Name[es]=Prueba de componentes
Name[fi]=Komponenttitesti
Name[fr]=Test des composants
Name[mr]=
Name[nl]=Test van componenten

View File

@ -99,30 +99,30 @@ PlasmaComponents.Page {
}
}
PlasmaComponents.TextArea {
id: editor
anchors {
top: heading.bottom;
topMargin: _s
left: parent.left
right: parent.right
bottom: applyButton.top
bottomMargin: _s
}
// text: { "void main(void) {\
// gl_FragColor = vec4(1.0, 0.0, 0.0, 0.3);\
// }"
// PlasmaComponents.TextArea {
// id: editor
// anchors {
// top: heading.bottom;
// topMargin: _s
// left: parent.left
// right: parent.right
// bottom: applyButton.top
// bottomMargin: _s
//
// }
text:"
void main(void) {
gl_FragColor = vec4(0.2, 0.8, 0.6, 0.3);
}
"
// width: parent.width
// parent.height-height: _h*2
}
// // text: { "void main(void) {\
// // gl_FragColor = vec4(1.0, 0.0, 0.0, 0.3);\
// // }"
// // }
// text:"
// void main(void) {
// gl_FragColor = vec4(0.2, 0.8, 0.6, 0.3);
// }
// "
//
// // width: parent.width
// // parent.height-height: _h*2
// }
PlasmaComponents.Button {
id: applyButton

View File

@ -50,7 +50,7 @@ Item {
PlasmaComponents.TabButton { tab: wobbleExample; text: tab.pageName; }
PlasmaComponents.TabButton { tab: shadowExample; text: tab.pageName; }
PlasmaComponents.TabButton { tab: simpleExample; text: tab.pageName; }
PlasmaComponents.TabButton { tab: vertexPage; iconSource: vertexPage.icon; }
//PlasmaComponents.TabButton { tab: vertexPage; iconSource: vertexPage.icon; }
}
PlasmaComponents.TabGroup {
@ -77,9 +77,9 @@ Item {
SimpleExample {
id: simpleExample
}
EditorPage {
id: vertexPage
}
// EditorPage {
// id: vertexPage
// }
}
}

View File

@ -168,7 +168,7 @@ QVariant ConfigModel::get(int row) const
value["name"] = m_categories.at(row)->name();
value["icon"] = m_categories.at(row)->icon();
if (m_appletInterface) {
value["source"] = QUrl::fromLocalFile(m_appletInterface.data()->package().filePath("components", m_categories.at(row)->source()));
value["source"] = QUrl::fromLocalFile(m_appletInterface.data()->package().filePath("ui", m_categories.at(row)->source()));
} else {
value["source"] = m_categories.at(row)->source();
}
@ -281,19 +281,20 @@ ConfigView::ConfigView(Plasma::Applet *applet, QWindow *parent)
//config model local of the applet
QQmlComponent *component = new QQmlComponent(engine(), QUrl::fromLocalFile(m_applet->package().filePath("configmodel")), this);
QObject *object = component->create(engine()->rootContext());
QObject *object = component->beginCreate(engine()->rootContext());
m_configModel = qobject_cast<ConfigModel *>(object);
if (m_configModel) {
m_configModel->setApplet(m_applet);
} else {
delete object;
}
delete component;
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(m_applet);
engine()->rootContext()->setContextProperty("plasmoid", applet->property("graphicObject").value<QObject*>());
engine()->rootContext()->setContextProperty("configDialog", this);
component->completeCreate();
delete component;
}
ConfigView::~ConfigView()

Some files were not shown because too many files have changed in this diff Show More