Merge branch 'master' into sebas/kplugins

This commit is contained in:
Sebastian Kügler 2013-08-05 16:30:23 +02:00
commit b89451fb25
35 changed files with 308 additions and 57 deletions

View File

@ -1,5 +1,6 @@
[Desktop Entry]
Name=Air
Name[bs]=Vazduh
Name[cs]=Vzduch
Name[de]=Air
Name[es]=Aire
@ -16,6 +17,7 @@ Name[sv]=Luft
Name[uk]=Air
Name[x-test]=xxAirxx
Comment=A breath of fresh air
Comment[bs]=Dašak svježeg vazduha
Comment[cs]=Závan čerstvého vzduchu
Comment[de]=Ein Atemzug frische Luft
Comment[es]=Una bocanada de aire fresco

View File

@ -1,5 +1,6 @@
[Desktop Entry]
Name=Application dashboard
Name[bs]=Aplikacijska kontrolna ploča
Name[cs]=Pracovní plocha aplikace
Name[de]=Anwendungsübersicht
Name[es]=Tablero de mandos de la aplicación
@ -15,6 +16,7 @@ Name[sv]=Instrumentpanel för program
Name[uk]=Панель приладів програм
Name[x-test]=xxApplication dashboardxx
Comment=Intended as Application dashboard default
Comment[bs]=Planirano kao podrazumijevana aplikacijska kontrolna ploča
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

View File

@ -1,5 +1,6 @@
[Desktop Entry]
Name=Oxygen
Name[bs]=kiseonik
Name[cs]=Oxygen
Name[de]=Oxygen
Name[es]=Oxígeno
@ -15,6 +16,7 @@ Name[sv]=Oxygen
Name[uk]=Oxygen
Name[x-test]=xxOxygenxx
Comment=Theme done in the Oxygen style
Comment[bs]=Tema urađena u stilu Kiseonika
Comment[cs]=Motiv ve stylu Oxygen
Comment[de]=Oberflächen-Design im Oxygen-Stil
Comment[es]=Tema realizado al estilo de Oxígeno

View File

@ -34,5 +34,4 @@ set(runnermodeltest_SRCS
qt4_automoc(${runnermodeltest_SRCS})
add_executable(runnermodeltest ${runnermodeltest_SRCS})
target_link_libraries(runnermodeltest ${QT_QTTEST_LIBRARY} ${plasma_LIBRARIES} plasma)
add_test(plasma-runnermodeltest runnermodeltest)
ecm_mark_as_test(runnermodeltest)

View File

@ -108,7 +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", "");
qmlRegisterUncreatableType<Units>(uri, 2, 0, "Units", "");
}

View File

@ -1,5 +1,6 @@
[Desktop Entry]
Name=plasma-kpart
Name[bs]=plasma-kpart
Name[cs]=plasma-kpart
Name[de]=plasma-kpart
Name[es]=plasma-kpart

View File

@ -444,14 +444,14 @@ void AbstractRunnerPrivate::setupScriptSupport()
#ifndef NDEBUG
// qDebug() << "setting up script support, package is in" << package->path()
<< ", main script is" << package->filePath("mainscript");
// << ", main script is" << package->filePath("mainscript");
#endif
const QString translationsPath = package->filePath("translations");
if (!translationsPath.isEmpty()) {
KGlobal::dirs()->addResourceDir("locale", translationsPath);
KLocalizedString::insertCatalog(runnerDescription.pluginName());
}
// FIXME: Replace with ki18n functionality once semantics is clear.
// const QString translationsPath = package->filePath("translations");
// if (!translationsPath.isEmpty()) {
// KGlobal::dirs()->addResourceDir("locale", translationsPath);
// }
}
} // Plasma namespace

View File

@ -3,6 +3,7 @@ Type=ServiceType
X-KDE-ServiceType=Plasma/Applet
Comment=Plasma applet
Comment[bs]=Plazma aplet
Comment[cs]=Aplet Plasma
Comment[de]=Plasma-Miniprogramm
Comment[es]=Miniaplicación para Plasma

View File

@ -3,6 +3,7 @@ Type=ServiceType
X-KDE-ServiceType=Plasma/DataEngine
Comment=Plasma Data Engine
Comment[bs]=Plazma datomotor
Comment[cs]=Datový nástroj plasma
Comment[de]=Plasma-Daten-Treiber
Comment[es]=Motor de datos para Plasma

View File

@ -416,7 +416,7 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info)
if (!script) {
#ifndef NDEBUG
// qDebug() << "Could not create a" << api << "ScriptEngine for the"
<< dataEngineDescription.name() << "DataEngine.";
// << dataEngineDescription.name() << "DataEngine.";
#endif
delete package;
package = 0;
@ -590,11 +590,11 @@ void DataEnginePrivate::setupScriptSupport()
<< ", main script is" << package->filePath("mainscript");
*/
const QString translationsPath = package->filePath("translations");
if (!translationsPath.isEmpty()) {
KGlobal::dirs()->addResourceDir("locale", translationsPath);
KLocalizedString::insertCatalog(dataEngineDescription.pluginName());
}
// FIXME: Replace with ki18n functionality once semantics is clear.
// const QString translationsPath = package->filePath("translations");
// if (!translationsPath.isEmpty()) {
// KGlobal::dirs()->addResourceDir("locale", translationsPath);
// }
}
void DataEnginePrivate::scheduleSourcesUpdated()

View File

@ -195,7 +195,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
if (!offer->property("X-Plasma-API").toString().isEmpty()) {
#ifndef NDEBUG
// qDebug() << "we have a script using the"
<< offer->property("X-Plasma-API").toString() << "API";
// << offer->property("X-Plasma-API").toString() << "API";
#endif
if (isContainment) {
return new Containment(0, allArgs);
@ -575,7 +575,7 @@ QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool vi
if (!appletCategory.isEmpty() && !known.contains(appletCategory.toLower())) {
#ifndef NDEBUG
// qDebug() << "Unknown category: " << applet->name() << "says it is in the"
<< appletCategory << "category which is unknown to us";
// << appletCategory << "category which is unknown to us";
#endif
appletCategory.clear();
}

View File

@ -115,8 +115,8 @@ void AppletPrivate::init(const QString &packagePath)
if (!appletDescription.isValid()) {
#ifndef NDEBUG
// qDebug() << "Check your constructor! "
<< "You probably want to be passing in a Service::Ptr "
<< "or a QVariantList with a valid storageid as arg[0].";
// << "You probably want to be passing in a Service::Ptr "
// << "or a QVariantList with a valid storageid as arg[0].";
#endif
return;
}
@ -295,14 +295,14 @@ void AppletPrivate::setupPackage()
#ifndef NDEBUG
// qDebug() << "setting up script support, package is in" << package->path()
<< ", main script is" << package->filePath("mainscript");
// << ", main script is" << package->filePath("mainscript");
#endif
const QString translationsPath = package->filePath("translations");
if (!translationsPath.isEmpty()) {
KGlobal::dirs()->addResourceDir("locale", translationsPath);
KLocalizedString::insertCatalog(appletDescription.pluginName());
}
// FIXME: Replace with ki18n functionality once semantics is clear.
// const QString translationsPath = package->filePath("translations");
// if (!translationsPath.isEmpty()) {
// KGlobal::dirs()->addResourceDir("locale", translationsPath);
// }
if (!package->filePath("mainconfigui").isEmpty()) {
q->setHasConfigurationInterface(true);

View File

@ -110,8 +110,8 @@ void ContainmentPrivate::setScreen(int newScreen)
#ifndef NDEBUG
// qDebug() << "currently is on screen" << currently->screen()
// << "desktop" << currently->desktop()
<< "and is" << currently->activity()
<< (QObject*)currently << "i'm" << (QObject*)q;
// << "and is" << currently->activity()
// << (QObject*)currently << "i'm" << (QObject*)q;
#endif
currently->setScreen(-1);
swapScreensWith = currently;
@ -125,13 +125,11 @@ void ContainmentPrivate::setScreen(int newScreen)
q->updateConstraints(Plasma::Types::ScreenConstraint);
if (oldScreen != newScreen) {
/*
#ifndef NDEBUG
// qDebug() << "going to signal change for" << q
// << ", old screen & desktop:" << oldScreen
// << ", new:" << screen << desktop;
#endif
<< ", old screen & desktop:" << oldScreen
<< ", new:" << screen << desktop;
*/
KConfigGroup c = q->config();
c.writeEntry("screen", screen);
emit q->configNeedsSaving();

View File

@ -182,7 +182,7 @@ ScriptEngine *loadEngine(const QString &language, Types::ComponentType type, QOb
#ifndef NDEBUG
// qDebug() << "Couldn't load script engine for language " << language
<< "! error reported: " << error;
// << "! error reported: " << error;
#endif
}

View File

@ -1,5 +1,6 @@
[Desktop Entry]
Name=Test
Name[bs]=Test
Name[cs]=Test
Name[de]=Test
Name[es]=Prueba
@ -14,6 +15,7 @@ Name[sv]=Test
Name[uk]=Тест
Name[x-test]=xxTestxx
Comment=A dummy plugin for testing
Comment[bs]=Lažni priključak za probe
Comment[cs]=Falešný zásuvný modul pro testování
Comment[de]=Ein Dummy-Modul zum Testen.
Comment[es]=Un complemento de simulación para hacer pruebas

View File

@ -63,8 +63,8 @@ bool isPluginVersionCompatible(unsigned int version)
if (version < minVersion || version > maxVersion) {
#ifndef NDEBUG
// qDebug() << "plugin is compiled against incompatible Plasma version " << version
<< "This build is compatible with" << PLASMA_VERSION_MAJOR << ".0.0 (" << minVersion
<< ") to" << PLASMA_VERSION_STRING << "(" << maxVersion << ")";
// << "This build is compatible with" << PLASMA_VERSION_MAJOR << ".0.0 (" << minVersion
// << ") to" << PLASMA_VERSION_STRING << "(" << maxVersion << ")";
#endif
return false;
}

View File

@ -1,5 +1,6 @@
[Desktop Entry]
Name=JavaScript DataEngine
Name[bs]=Javascript pogon podataka
Name[cs]=Datový nástroj JavaScript
Name[de]=JavaScript-Datentreiber
Name[fr]=Moteur de données de JavaScript

View File

@ -1,5 +1,6 @@
[Desktop Entry]
Name=JavaScript Runner
Name[bs]=Javascript izvođač
Name[cs]=Spouštěč JavaScriptu
Name[de]=JavaScript-Ausführung
Name[es]=Lanzador JavaScript
@ -14,6 +15,7 @@ Name[sv]=Kör Javascript
Name[uk]=Механізм запуску JavaScript
Name[x-test]=xxJavaScript Runnerxx
Comment=JavaScript Runner
Comment[bs]=Javascript izvođač
Comment[cs]=Spouštěč JavaScriptu
Comment[de]=JavaScript-Ausführung
Comment[es]=Lanzador JavaScript

View File

@ -263,7 +263,7 @@ void JavaScriptDataEngine::reportError(ScriptEnv *env, bool fatal) const
Q_UNUSED(fatal)
// qDebug() << "Error: " << env->engine()->uncaughtException().toString()
<< " at line " << env->engine()->uncaughtExceptionLineNumber() << endl;
// << " at line " << env->engine()->uncaughtExceptionLineNumber() << endl;
// qDebug() << env->engine()->uncaughtExceptionBacktrace();
}

View File

@ -145,7 +145,7 @@ void JavaScriptRunner::reportError(ScriptEnv *env, bool fatal)
{
Q_UNUSED(fatal)
// qDebug() << "Error: " << env->engine()->uncaughtException().toString()
<< " at line " << env->engine()->uncaughtExceptionLineNumber() << endl;
// << " at line " << env->engine()->uncaughtExceptionLineNumber() << endl;
// qDebug() << env->engine()->uncaughtExceptionBacktrace();
}

View File

@ -467,6 +467,59 @@ int AppletInterface::apiVersion() const
return offers.first()->property("X-KDE-PluginInfo-Version", QVariant::Int).toInt();
}
//private api, just an helper
qreal AppletInterface::readGraphicsObjectSizeHint(const char *hint) const
{
if (!m_qmlObject->rootObject()) {
return -1;
}
QVariant prop;
if (m_compactUiObject) {
prop = m_compactUiObject.data()->property(hint);
} else {
prop = m_qmlObject->rootObject()->property(hint);
}
if (prop.isValid() && prop.canConvert<qreal>()) {
return qMax(qreal(1), prop.toReal());
} else {
return -1;
}
}
qreal AppletInterface::minimumWidth() const
{
return readGraphicsObjectSizeHint("minimumWidth");
}
qreal AppletInterface::minimumHeight() const
{
return readGraphicsObjectSizeHint("minimumHeight");
}
qreal AppletInterface::maximumWidth() const
{
return readGraphicsObjectSizeHint("maximumWidth");
}
qreal AppletInterface::maximumHeight() const
{
return readGraphicsObjectSizeHint("maximumHeight");
}
qreal AppletInterface::implicitWidth() const
{
return readGraphicsObjectSizeHint("implicitWidth");
}
qreal AppletInterface::implicitHeight() const
{
return readGraphicsObjectSizeHint("implicitHeight");
}
void AppletInterface::debug(const QString &msg)
{
qDebug() << msg;
@ -521,8 +574,17 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
return;
}
//Read the minimum width of the full representation, not our own, since we could be in collapsed mode
QSizeF minHint(-1, -1);
if (m_qmlObject->rootObject()->property("minimumWidth").canConvert<qreal>()) {
minHint.setWidth(m_qmlObject->rootObject()->property("minimumWidth").toReal());
}
if (m_qmlObject->rootObject()->property("minimumHeight").canConvert<qreal>()) {
minHint.setHeight(m_qmlObject->rootObject()->property("minimumHeight").toReal());
}
//TODO: completely arbitrary for now
if (newGeometry.width() < 100 || newGeometry.height() < 100) {
if (newGeometry.width() < minHint.width() || newGeometry.height() < minHint.height()) {
m_expanded = false;
//we are already an icon: nothing to do
@ -567,6 +629,37 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(m_compactUiObject.data()));
m_compactUiObject.data()->setProperty("applet", QVariant::fromValue(m_qmlObject->rootObject()));
//hook m_compactUiObject size hints to this size hint
//Here we have to use the old connect syntax, because we don't have access to the class type
if (m_qmlObject->rootObject()) {
disconnect(m_qmlObject->rootObject(), 0, this, 0);
}
if (m_compactUiObject.data()->property("minimumWidth").isValid()) {
connect(m_compactUiObject.data(), SIGNAL(minimumWidthChanged()),
this, SIGNAL(minimumWidthChanged()));
}
if (m_compactUiObject.data()->property("minimumHeight").isValid()) {
connect(m_compactUiObject.data(), SIGNAL(minimumHeightChanged()),
this, SIGNAL(minimumHeightChanged()));
}
if (m_compactUiObject.data()->property("maximumWidth").isValid()) {
connect(m_compactUiObject.data(), SIGNAL(maximumWidthChanged()),
this, SIGNAL(maximumWidthChanged()));
}
if (m_compactUiObject.data()->property("maximumHeight").isValid()) {
connect(m_compactUiObject.data(), SIGNAL(maximumHeightChanged()),
this, SIGNAL(maximumHeightChanged()));
}
if (m_compactUiObject.data()->property("implicitWidth").isValid()) {
connect(m_compactUiObject.data(), SIGNAL(implicitWidthChanged()),
this, SIGNAL(implicitWidthChanged()));
}
if (m_compactUiObject.data()->property("implicitHeight").isValid()) {
connect(m_compactUiObject.data(), SIGNAL(implicitHeightChanged()),
this, SIGNAL(implicitHeightChanged()));
}
//failed to create UI, don't do anything, return in expanded status
} else {
m_expanded = true;
@ -583,6 +676,35 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
return;
}
disconnect(m_compactUiObject.data(), 0, this, 0);
//Here we have to use the old connect syntax, because we don't have access to the class type
if (m_qmlObject->rootObject()->property("minimumWidth").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(minimumWidthChanged()),
this, SIGNAL(minimumWidthChanged()));
}
if (m_qmlObject->rootObject()->property("minimumHeight").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(minimumHeightChanged()),
this, SIGNAL(minimumHeightChanged()));
}
if (m_qmlObject->rootObject()->property("maximumWidth").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(maximumWidthChanged()),
this, SIGNAL(maximumWidthChanged()));
}
if (m_qmlObject->rootObject()->property("maximumHeight").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(maximumHeightChanged()),
this, SIGNAL(maximumHeightChanged()));
}
if (m_qmlObject->rootObject()->property("implicitWidth").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(implicitWidthChanged()),
this, SIGNAL(implicitWidthChanged()));
}
if (m_qmlObject->rootObject()->property("implicitHeight").isValid()) {
connect(m_qmlObject->rootObject(), SIGNAL(implicitHeightChanged()),
this, SIGNAL(implicitHeightChanged()));
}
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));
m_compactUiObject.data()->deleteLater();

View File

@ -68,6 +68,14 @@ class AppletInterface : public QQuickItem
Q_PROPERTY(Plasma::Types::ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication)
//Size hints Note that the containments may chose to not respect them.
Q_PROPERTY(qreal minimumWidth READ minimumWidth NOTIFY minimumWidthChanged)
Q_PROPERTY(qreal minimumHeight READ minimumHeight NOTIFY minimumHeightChanged)
Q_PROPERTY(qreal maximumWidth READ maximumWidth NOTIFY maximumWidthChanged)
Q_PROPERTY(qreal maximumHeight READ maximumHeight NOTIFY maximumHeightChanged)
Q_PROPERTY(qreal implicitWidth READ implicitWidth NOTIFY implicitWidthChanged)
Q_PROPERTY(qreal implicitHeight READ implicitHeight NOTIFY implicitHeightChanged)
public:
AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent = 0);
~AppletInterface();
@ -142,6 +150,13 @@ public:
bool userConfiguring() const;
int apiVersion() const;
qreal minimumWidth() const;
qreal minimumHeight() const;
qreal maximumWidth() const;
qreal maximumHeight() const;
qreal implicitWidth() const;
qreal implicitHeight() const;
Q_SIGNALS:
void releaseVisualFocus();
void configNeedsSaving();
@ -157,6 +172,13 @@ Q_SIGNALS:
void busyChanged();
void expandedChanged();
void minimumWidthChanged();
void minimumHeightChanged();
void maximumWidthChanged();
void maximumHeightChanged();
void implicitWidthChanged();
void implicitHeightChanged();
protected:
virtual void init();
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
@ -165,6 +187,9 @@ protected:
DeclarativeAppletScript *m_appletScriptEngine;
private:
//Helper for minimumWidth etc.
qreal readGraphicsObjectSizeHint(const char *hint) const;
QStringList m_actions;
QSignalMapper *m_actionSignals;
QString m_currentConfig;

View File

@ -69,9 +69,6 @@ DeclarativeAppletScript::~DeclarativeAppletScript()
bool DeclarativeAppletScript::init()
{
//FIXME: what replaced this?
//KGlobal::locale()->insertCatalog("plasma_applet_" % description().pluginName());
//make possible to import extensions from the package
//FIXME: probably to be removed, would make possible to use native code from within the package :/
//m_interface->qmlObject()->engine()->addImportPath(package()->path()+"/contents/imports");

View File

@ -28,6 +28,8 @@ Rectangle {
height: 100
radius: 10
smooth: true
property int minimumWidth: units.gridUnit * 20
property int minimumHeight: column.implicitHeight
property Component compactRepresentation: Component {
Rectangle {
@ -39,6 +41,7 @@ Rectangle {
}
Column {
id: column
anchors.centerIn: parent
Text {
text: "I'm an applet"

View File

@ -28,6 +28,8 @@ Item {
width: 100
height: 100
clip: true
property int minimumWidth: units.gridUnit * 20
property int minimumHeight: units.gridUnit * 30
property int _s: theme.iconSizes.small
property int _h: theme.iconSizes.desktop

View File

@ -28,6 +28,8 @@ Item {
width: 400
height: 400
property int minimumWidth: units.gridUnit * 20
property int minimumHeight: units.gridUnit * 30
property int _s: theme.iconSizes.small
property int _h: theme.iconSizes.desktop
property int _m: 12

View File

@ -1,3 +1,3 @@
installPackage(testcontainment org.kde.testcontainment plasma/plasmoids containment)
installPackage(testpanel org.kde.panel applets plasma/plasmoids containment)
installPackage(testpanel org.kde.panel plasma/plasmoids containment)

View File

@ -16,7 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
*/
import QtQuick 2.0
import QtQuick 2.1
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
@ -32,7 +33,7 @@ Item {
Connections {
target: plasmoid
onAppletAdded: {
var container = appletContainerComponent.createObject((plasmoid.formFactor == 3) ? column : row)
var container = appletContainerComponent.createObject((plasmoid.formFactor == PlasmaCore.Types.Vertical) ? column : row)
print("Applet added in test panel: " + applet)
applet.parent = container
container.applet = applet
@ -41,13 +42,17 @@ Item {
container.visible = true
}
onFormFactorChanged: {
if (plasmoid.formFactor == 3) {
if (plasmoid.formFactor == PlasmaCore.Types.Vertical) {
for (var container in row.children) {
container.parent = column
var item = row.children[0];
item.parent = column
item.width = column.width
}
} else {
for (var container in column.children) {
container.parent = row
var item = column.children[0];
item.parent = row
item.height = row.height
}
}
}
@ -59,12 +64,12 @@ Item {
id: container
visible: false
width: Math.min(root.width, root.height)
height: width
Layout.preferredWidth: Math.min(root.width, root.height)
Layout.preferredHeight: Layout.preferredWidth
property Item applet
PlasmaComponents.BusyIndicator {
z: 1000
visible: applet && applet.length > 0 && applet[0].busy
@ -74,7 +79,7 @@ Item {
}
}
Row {
RowLayout {
id: row
anchors {
top: parent.top
@ -82,7 +87,7 @@ Item {
left: parent.left
}
}
Column {
ColumnLayout {
id: column
anchors {
top: parent.top

View File

@ -22,6 +22,8 @@
#include <QAction>
#include <QDebug>
#include <QScreen>
#include <QQmlEngine>
#include <QQmlContext>
#include <KActionCollection>
#include <KWindowSystem>
@ -100,6 +102,8 @@ void PanelView::init()
}
setResizeMode(View::SizeRootObjectToView);
qmlRegisterType<QScreen>();
engine()->rootContext()->setContextProperty("panel", this);
setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Panel.qml")));
positionPanel();
}
@ -367,6 +371,7 @@ void PanelView::restore()
emit maximumLengthChanged();
emit minimumLengthChanged();
emit offsetChanged();
emit alignmentChanged();
}
void PanelView::resizeEvent(QResizeEvent *ev)

View File

@ -35,6 +35,7 @@ class PanelView : public View
Q_PROPERTY(int length READ length WRITE setLength NOTIFY lengthChanged)
Q_PROPERTY(int maximumLength READ maximumLength WRITE setMaximumLength NOTIFY maximumLengthChanged)
Q_PROPERTY(int minimumLength READ minimumLength WRITE setMinimumLength NOTIFY minimumLengthChanged)
Q_PROPERTY(QScreen *screen READ screen NOTIFY screenChanged)
public:
explicit PanelView(DesktopCorona *corona, QWindow *parent = 0);
@ -73,6 +74,7 @@ Q_SIGNALS:
void lengthChanged();
void maximumLengthChanged();
void minimumLengthChanged();
void screenChanged(QScreen *screen);
private Q_SLOTS:
void positionPanel();

View File

@ -25,10 +25,20 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
Item {
id: root
property int minimumWidth: compactRepresentation && compactRepresentation.minimumWidth !== undefined ? compactRepresentation.minimumWidth : -1
property int minimumHeight: compactRepresentation && compactRepresentation.minimumHeight !== undefined ? compactRepresentation.minimumHeight : -1
property int maximumWidth: compactRepresentation && compactRepresentation.maximumWidth !== undefined ? compactRepresentation.maximumWidth : -1
property int maximumHeight: compactRepresentation && compactRepresentation.maximumHeight !== undefined ? compactRepresentation.maximumHeight : -1
property int implicitWidth: compactRepresentation && compactRepresentation.implicitWidth !== undefined ? compactRepresentation.implicitWidth : -1
property int implicitHeight: compactRepresentation && compactRepresentation.implicitHeight !== undefined ? compactRepresentation.implicitHeight : -1
property Item applet
property Item compactRepresentation
onAppletChanged: {
applet.parent = appletParent
applet.anchors.fill = applet.parent
@ -48,7 +58,7 @@ Item {
mainItem: Item {
id: appletParent
width: applet && applet.implicitWidth > 0 ? applet.implicitWidth : theme.mSize(theme.defaultFont).width * 35
width: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.mSize(theme.defaultFont).width * 35
height: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.mSize(theme.defaultFont).height * 25
onWidthChanged: applet.width = width
onHeightChanged: applet.height = height

View File

@ -25,8 +25,8 @@ import org.kde.plasma.configuration 2.0
Item {
id: root
state: parent.state
implicitWidth: childrenRect.width + 20
implicitHeight: childrenRect.height + 20
implicitWidth: column.width + 20
implicitHeight: row.height + 20
PlasmaComponents.ButtonRow {
id: row
spacing: 0

View File

@ -30,6 +30,41 @@ PlasmaCore.FrameSvgItem {
property Item containment
function adjustBorders() {
var borders = PlasmaCore.FrameSvg.AllBorders;
switch (containment.location) {
case PlasmaCore.Types.TopEdge:
borders = borders & ~PlasmaCore.FrameSvg.TopBorder;
break;
case PlasmaCore.Types.LeftEdge:
borders = borders & ~PlasmaCore.FrameSvg.LeftBorder;
break;
case PlasmaCore.Types.RightEdge:
borders = borders & ~PlasmaCore.FrameSvg.RightBorder;
break;
case PlasmaCore.Types.BottomEdge:
default:
borders = borders & ~PlasmaCore.FrameSvg.BottomBorder;
break;
}
if (panel.x <= panel.screen.geometry.x) {
borders = borders & ~PlasmaCore.FrameSvg.LeftBorder;
}
if (panel.x + panel.width >= panel.screen.geometry.x + panel.screen.geometry.width) {
borders = borders & ~PlasmaCore.FrameSvg.RightBorder;
}
if (panel.y <= panel.screen.geometry.y) {
borders = borders & ~PlasmaCore.FrameSvg.TopBorder;
}
if (panel.y + panel.height >= panel.screen.geometry.y + panel.screen.geometry.height) {
borders = borders & ~PlasmaCore.FrameSvg.BottomBorder;
}
root.enabledBorders = borders;
}
onContainmentChanged: {
print("New panel Containment: " + containment)
//containment.parent = root
@ -37,6 +72,36 @@ PlasmaCore.FrameSvgItem {
containment.anchors.fill = root
}
Connections {
target: containment
onLocationChanged: {
adjustBorders()
}
}
Connections {
target: panel
onXChanged: {
adjustBorders();
}
onYChanged: {
adjustBorders();
}
onWidthChanged: {
adjustBorders();
}
onHeightChanged: {
adjustBorders();
}
}
Connections {
target: panel.screen
onGeometryChanged: {
adjustBorders();
}
}
Component.onCompleted: {
print("PanelView QML loaded")
}

View File

@ -12,6 +12,7 @@ Comment[x-test]=xxDesktop view furniturexx
Encoding=UTF-8
Keywords=
Name=Desktop
Name[bs]=Površ
Name[cs]=Pracovní plocha
Name[de]=Arbeitsfläche
Name[es]=Escritorio

View File

@ -2,6 +2,7 @@
Encoding=UTF-8
Keywords=
Name=Autumn
Name[bs]=Jesen
Name[cs]=Podzim
Name[de]=Herbst
Name[es]=Otoño