From 767cd813ae47c44f15110e465478d7989228b64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 1 Aug 2013 11:47:01 +0200 Subject: [PATCH 01/17] Fix qDebug/kDebug port Kevin, this apparently wasn't caught by your script. Just so you know. :) CCMAIL:ervin@kde.org --- src/plasma/abstractrunner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plasma/abstractrunner.cpp b/src/plasma/abstractrunner.cpp index 960c0fc46..b0e2eee33 100644 --- a/src/plasma/abstractrunner.cpp +++ b/src/plasma/abstractrunner.cpp @@ -444,7 +444,7 @@ 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"); From d9aa851e17ba0dc4ec3ce893fe7a11e46fcc1d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 1 Aug 2013 12:15:38 +0200 Subject: [PATCH 02/17] Fix fallout from qDebug -> kDebug porting * Multi-line debug statements were essentially broken * There's still a bunch of #include "QDebug" in there, which seems wrong * It's not necessary to comment most occurrences in src/plasma, since they're wrapped wiht #ifdef NDEBUG already. CCMAIL:ervin@kde.org --- src/plasma/dataengine.cpp | 2 +- src/plasma/pluginloader.cpp | 4 ++-- src/plasma/private/applet_p.cpp | 6 +++--- src/plasma/private/containment_p.cpp | 10 ++++------ src/plasma/version.cpp | 4 ++-- .../javascript/dataengine/javascriptdataengine.cpp | 2 +- .../javascript/runner/javascriptrunner.cpp | 2 +- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/plasma/dataengine.cpp b/src/plasma/dataengine.cpp index f7e16182f..431378b52 100644 --- a/src/plasma/dataengine.cpp +++ b/src/plasma/dataengine.cpp @@ -406,7 +406,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; diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp index 7ab428070..a1bf557e6 100644 --- a/src/plasma/pluginloader.cpp +++ b/src/plasma/pluginloader.cpp @@ -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(); } diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp index e73e23f81..3fc4c8499 100644 --- a/src/plasma/private/applet_p.cpp +++ b/src/plasma/private/applet_p.cpp @@ -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,7 +295,7 @@ 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"); diff --git a/src/plasma/private/containment_p.cpp b/src/plasma/private/containment_p.cpp index acdf9633b..5bbdbd2b9 100644 --- a/src/plasma/private/containment_p.cpp +++ b/src/plasma/private/containment_p.cpp @@ -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(); diff --git a/src/plasma/version.cpp b/src/plasma/version.cpp index cecb18bf0..5560fbc3a 100644 --- a/src/plasma/version.cpp +++ b/src/plasma/version.cpp @@ -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; } diff --git a/src/scriptengines/javascript/dataengine/javascriptdataengine.cpp b/src/scriptengines/javascript/dataengine/javascriptdataengine.cpp index 5874849f5..4c44af782 100644 --- a/src/scriptengines/javascript/dataengine/javascriptdataengine.cpp +++ b/src/scriptengines/javascript/dataengine/javascriptdataengine.cpp @@ -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(); } diff --git a/src/scriptengines/javascript/runner/javascriptrunner.cpp b/src/scriptengines/javascript/runner/javascriptrunner.cpp index 20fe92785..0d8ad94b7 100644 --- a/src/scriptengines/javascript/runner/javascriptrunner.cpp +++ b/src/scriptengines/javascript/runner/javascriptrunner.cpp @@ -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(); } From 3e35fe8baa073dc2b4fd417966b91fd887869887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 1 Aug 2013 12:20:29 +0200 Subject: [PATCH 03/17] Fix multiline qDebug --- src/plasma/scripting/scriptengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plasma/scripting/scriptengine.cpp b/src/plasma/scripting/scriptengine.cpp index 03189412a..66b3aa19d 100644 --- a/src/plasma/scripting/scriptengine.cpp +++ b/src/plasma/scripting/scriptengine.cpp @@ -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 } From 3eaa4d83f456a3c92283b21631cbd7eb5711afa6 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Thu, 1 Aug 2013 12:38:32 +0200 Subject: [PATCH 04/17] runnermodeltest is manual not automated --- src/declarativeimports/core/tests/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarativeimports/core/tests/CMakeLists.txt b/src/declarativeimports/core/tests/CMakeLists.txt index db76e279e..574eafbad 100644 --- a/src/declarativeimports/core/tests/CMakeLists.txt +++ b/src/declarativeimports/core/tests/CMakeLists.txt @@ -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) From 07181e036c455c67f705ac3b7466cc0e5b0a1d37 Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Fri, 2 Aug 2013 04:25:21 +0000 Subject: [PATCH 05/17] SVN_SILENT made messages (.desktop file) --- desktoptheme/air/metadata.desktop | 2 ++ desktoptheme/appdashboard/metadata.desktop | 2 ++ desktoptheme/oxygen/metadata.desktop | 2 ++ src/kpart/plasma-kpart.desktop | 1 + src/plasma/data/servicetypes/plasma-applet.desktop | 1 + src/plasma/data/servicetypes/plasma-dataengine.desktop | 1 + .../plasma-containmentactions-test.desktop | 2 ++ .../data/plasma-scriptengine-dataengine-javascript.desktop | 1 + .../data/plasma-scriptengine-runner-javascript.desktop | 2 ++ src/shell/qmlpackages/desktop/metadata.desktop | 1 + src/shell/qmlpackages/wallpapers/autumn/metadata.desktop | 1 + 11 files changed, 16 insertions(+) diff --git a/desktoptheme/air/metadata.desktop b/desktoptheme/air/metadata.desktop index 84bcc2c2b..0cb3e44ab 100644 --- a/desktoptheme/air/metadata.desktop +++ b/desktoptheme/air/metadata.desktop @@ -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 diff --git a/desktoptheme/appdashboard/metadata.desktop b/desktoptheme/appdashboard/metadata.desktop index 318c47aa3..fe44aa9ad 100644 --- a/desktoptheme/appdashboard/metadata.desktop +++ b/desktoptheme/appdashboard/metadata.desktop @@ -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 diff --git a/desktoptheme/oxygen/metadata.desktop b/desktoptheme/oxygen/metadata.desktop index 8585885ba..d9fc3792f 100644 --- a/desktoptheme/oxygen/metadata.desktop +++ b/desktoptheme/oxygen/metadata.desktop @@ -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 diff --git a/src/kpart/plasma-kpart.desktop b/src/kpart/plasma-kpart.desktop index a9aeffaee..170f656e0 100644 --- a/src/kpart/plasma-kpart.desktop +++ b/src/kpart/plasma-kpart.desktop @@ -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 diff --git a/src/plasma/data/servicetypes/plasma-applet.desktop b/src/plasma/data/servicetypes/plasma-applet.desktop index 87d2d8eb4..548cee7d4 100644 --- a/src/plasma/data/servicetypes/plasma-applet.desktop +++ b/src/plasma/data/servicetypes/plasma-applet.desktop @@ -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 diff --git a/src/plasma/data/servicetypes/plasma-dataengine.desktop b/src/plasma/data/servicetypes/plasma-dataengine.desktop index f4e5a7356..cf65354bd 100644 --- a/src/plasma/data/servicetypes/plasma-dataengine.desktop +++ b/src/plasma/data/servicetypes/plasma-dataengine.desktop @@ -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 diff --git a/src/plasma/tests/testcontainmentactionsplugin/plasma-containmentactions-test.desktop b/src/plasma/tests/testcontainmentactionsplugin/plasma-containmentactions-test.desktop index 804a75e1d..37857fcd5 100644 --- a/src/plasma/tests/testcontainmentactionsplugin/plasma-containmentactions-test.desktop +++ b/src/plasma/tests/testcontainmentactionsplugin/plasma-containmentactions-test.desktop @@ -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 diff --git a/src/scriptengines/javascript/data/plasma-scriptengine-dataengine-javascript.desktop b/src/scriptengines/javascript/data/plasma-scriptengine-dataengine-javascript.desktop index 33fa4015c..e9cd85828 100644 --- a/src/scriptengines/javascript/data/plasma-scriptengine-dataengine-javascript.desktop +++ b/src/scriptengines/javascript/data/plasma-scriptengine-dataengine-javascript.desktop @@ -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 diff --git a/src/scriptengines/javascript/data/plasma-scriptengine-runner-javascript.desktop b/src/scriptengines/javascript/data/plasma-scriptengine-runner-javascript.desktop index b37b15e3e..ce0cd1041 100644 --- a/src/scriptengines/javascript/data/plasma-scriptengine-runner-javascript.desktop +++ b/src/scriptengines/javascript/data/plasma-scriptengine-runner-javascript.desktop @@ -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 diff --git a/src/shell/qmlpackages/desktop/metadata.desktop b/src/shell/qmlpackages/desktop/metadata.desktop index 06c5d0d23..3037d0257 100644 --- a/src/shell/qmlpackages/desktop/metadata.desktop +++ b/src/shell/qmlpackages/desktop/metadata.desktop @@ -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 diff --git a/src/shell/qmlpackages/wallpapers/autumn/metadata.desktop b/src/shell/qmlpackages/wallpapers/autumn/metadata.desktop index 86febdf97..fef80c0b0 100644 --- a/src/shell/qmlpackages/wallpapers/autumn/metadata.desktop +++ b/src/shell/qmlpackages/wallpapers/autumn/metadata.desktop @@ -2,6 +2,7 @@ Encoding=UTF-8 Keywords= Name=Autumn +Name[bs]=Jesen Name[cs]=Podzim Name[de]=Herbst Name[es]=Otoño From e5eb38faad87dd47d7cc2c32d224fdcdd311bdc2 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 2 Aug 2013 16:26:36 +0200 Subject: [PATCH 06/17] enable borders based on location --- .../desktop/contents/views/Panel.qml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/shell/qmlpackages/desktop/contents/views/Panel.qml b/src/shell/qmlpackages/desktop/contents/views/Panel.qml index dcbc7b3b5..06fed2175 100644 --- a/src/shell/qmlpackages/desktop/contents/views/Panel.qml +++ b/src/shell/qmlpackages/desktop/contents/views/Panel.qml @@ -37,6 +37,31 @@ PlasmaCore.FrameSvgItem { containment.anchors.fill = root } + Connections { + target: containment + onLocationChanged: { + 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; + } + + root.enabledBorders = borders; + } + } + Component.onCompleted: { print("PanelView QML loaded") } From 3065e806796fbad0ee1d70dd6f40b11c79e66e03 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 2 Aug 2013 17:33:57 +0200 Subject: [PATCH 07/17] adjust borders when the panel moves --- src/shell/panelview.cpp | 4 + src/shell/panelview.h | 1 + .../desktop/contents/views/Panel.qml | 74 ++++++++++++++----- 3 files changed, 62 insertions(+), 17 deletions(-) diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 2d0dac636..9598c2129 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -100,6 +102,8 @@ void PanelView::init() } setResizeMode(View::SizeRootObjectToView); + qmlRegisterType(); + engine()->rootContext()->setContextProperty("panel", this); setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Panel.qml"))); positionPanel(); } diff --git a/src/shell/panelview.h b/src/shell/panelview.h index d8d86a798..d9deb1db7 100644 --- a/src/shell/panelview.h +++ b/src/shell/panelview.h @@ -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); diff --git a/src/shell/qmlpackages/desktop/contents/views/Panel.qml b/src/shell/qmlpackages/desktop/contents/views/Panel.qml index 06fed2175..f57327829 100644 --- a/src/shell/qmlpackages/desktop/contents/views/Panel.qml +++ b/src/shell/qmlpackages/desktop/contents/views/Panel.qml @@ -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 @@ -40,25 +75,30 @@ PlasmaCore.FrameSvgItem { Connections { target: containment onLocationChanged: { - var borders = PlasmaCore.FrameSvg.AllBorders; + adjustBorders() + } + } - 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; - } + Connections { + target: panel + onXChanged: { + adjustBorders(); + } + onYChanged: { + adjustBorders(); + } + onWidthChanged: { + adjustBorders(); + } + onHeightChanged: { + adjustBorders(); + } + } - root.enabledBorders = borders; + Connections { + target: panel.screen + onGeometryChanged: { + adjustBorders(); } } From 66b974be5915c1b48b2aa0a9a43306528d5c765e Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 2 Aug 2013 17:35:18 +0200 Subject: [PATCH 08/17] reexport screenchanged signal --- src/shell/panelview.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shell/panelview.h b/src/shell/panelview.h index d9deb1db7..4dca67cc2 100644 --- a/src/shell/panelview.h +++ b/src/shell/panelview.h @@ -35,7 +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*/) + Q_PROPERTY(QScreen *screen READ screen NOTIFY screenChanged) public: explicit PanelView(DesktopCorona *corona, QWindow *parent = 0); @@ -74,6 +74,7 @@ Q_SIGNALS: void lengthChanged(); void maximumLengthChanged(); void minimumLengthChanged(); + void screenChanged(QScreen *screen); private Q_SLOTS: void positionPanel(); From c0f5a1818496cd4cb6d8e7978c9165626dff5029 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 2 Aug 2013 20:38:12 +0200 Subject: [PATCH 09/17] proper resize --- .../contents/configuration/panelconfiguration/ToolBar.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/ToolBar.qml b/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/ToolBar.qml index 18ddf50a6..86ab24d88 100644 --- a/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/ToolBar.qml +++ b/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/ToolBar.qml @@ -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 From 83e5e962780ac503405ac7cff1f1943ed8c22fb6 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 5 Aug 2013 10:47:59 +0200 Subject: [PATCH 10/17] use controls layouts --- .../containments/testpanel/contents/ui/main.qml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/shell/containments/testpanel/contents/ui/main.qml b/src/shell/containments/testpanel/contents/ui/main.qml index e6054bff8..52bd8730c 100644 --- a/src/shell/containments/testpanel/contents/ui/main.qml +++ b/src/shell/containments/testpanel/contents/ui/main.qml @@ -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,9 +42,10 @@ Item { container.visible = true } onFormFactorChanged: { - if (plasmoid.formFactor == 3) { + if (plasmoid.formFactor == PlasmaCore.Types.Vertical) { for (var container in row.children) { container.parent = column + print("AAAA"+container) } } else { for (var container in column.children) { @@ -74,7 +76,7 @@ Item { } } - Row { + RowLayout { id: row anchors { top: parent.top @@ -82,7 +84,7 @@ Item { left: parent.left } } - Column { + ColumnLayout { id: column anchors { top: parent.top From 2e7c58b987c2d8d5435a23a1950697033fb24b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chusslove=20Illich=20=28=D0=A7=D0=B0=D1=81=D0=BB=D0=B0?= =?UTF-8?q?=D0=B2=20=D0=98=D0=BB=D0=B8=D1=9B=29?= Date: Mon, 5 Aug 2013 11:19:11 +0200 Subject: [PATCH 11/17] Temporary fix for translations location binding. insertCatalog calls will not be used either way. --- src/plasma/abstractrunner.cpp | 10 +++++----- src/plasma/dataengine.cpp | 10 +++++----- src/plasma/private/applet_p.cpp | 10 +++++----- .../qml/plasmoid/declarativeappletscript.cpp | 3 --- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/plasma/abstractrunner.cpp b/src/plasma/abstractrunner.cpp index b0e2eee33..3fe228ec3 100644 --- a/src/plasma/abstractrunner.cpp +++ b/src/plasma/abstractrunner.cpp @@ -447,11 +447,11 @@ void AbstractRunnerPrivate::setupScriptSupport() // << ", 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 diff --git a/src/plasma/dataengine.cpp b/src/plasma/dataengine.cpp index 431378b52..d529536b9 100644 --- a/src/plasma/dataengine.cpp +++ b/src/plasma/dataengine.cpp @@ -580,11 +580,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() diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp index 3fc4c8499..b7fe4e948 100644 --- a/src/plasma/private/applet_p.cpp +++ b/src/plasma/private/applet_p.cpp @@ -298,11 +298,11 @@ void AppletPrivate::setupPackage() // << ", 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); diff --git a/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp b/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp index 5509222d6..050734008 100644 --- a/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp +++ b/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp @@ -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"); From ca2f8a7a3a9d1695b0168a861e52da5c2be2542f Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 5 Aug 2013 13:28:32 +0200 Subject: [PATCH 12/17] install in the right place --- src/shell/containments/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shell/containments/CMakeLists.txt b/src/shell/containments/CMakeLists.txt index b0764bcc3..aac88c663 100644 --- a/src/shell/containments/CMakeLists.txt +++ b/src/shell/containments/CMakeLists.txt @@ -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) From a4d9a394db1a9d79640faeb616a89a0a4bbc314b Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 5 Aug 2013 13:42:11 +0200 Subject: [PATCH 13/17] correctly update layout when the formfactor changes --- src/shell/containments/testpanel/contents/ui/main.qml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/shell/containments/testpanel/contents/ui/main.qml b/src/shell/containments/testpanel/contents/ui/main.qml index 52bd8730c..52f0224b4 100644 --- a/src/shell/containments/testpanel/contents/ui/main.qml +++ b/src/shell/containments/testpanel/contents/ui/main.qml @@ -42,14 +42,18 @@ Item { container.visible = true } onFormFactorChanged: { + print("bbb"+plasmoid.formFactor) if (plasmoid.formFactor == PlasmaCore.Types.Vertical) { for (var container in row.children) { - container.parent = column - print("AAAA"+container) + 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 } } } From 838c8569f9ca4fdbcd797cf834cfff594e0fb633 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 5 Aug 2013 13:44:23 +0200 Subject: [PATCH 14/17] less noise --- src/shell/containments/testpanel/contents/ui/main.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/shell/containments/testpanel/contents/ui/main.qml b/src/shell/containments/testpanel/contents/ui/main.qml index 52f0224b4..86ed8fecb 100644 --- a/src/shell/containments/testpanel/contents/ui/main.qml +++ b/src/shell/containments/testpanel/contents/ui/main.qml @@ -42,7 +42,6 @@ Item { container.visible = true } onFormFactorChanged: { - print("bbb"+plasmoid.formFactor) if (plasmoid.formFactor == PlasmaCore.Types.Vertical) { for (var container in row.children) { var item = row.children[0]; From 16ad4d7a1427e9483cbcb57c90178aac65aae472 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 5 Aug 2013 13:50:36 +0200 Subject: [PATCH 15/17] sunc alignment too --- src/shell/panelview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 9598c2129..3c55b0f1c 100644 --- a/src/shell/panelview.cpp +++ b/src/shell/panelview.cpp @@ -371,6 +371,7 @@ void PanelView::restore() emit maximumLengthChanged(); emit minimumLengthChanged(); emit offsetChanged(); + emit alignmentChanged(); } void PanelView::resizeEvent(QResizeEvent *ev) From ea4267889570775a44400146506f8d069f41d56b Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 5 Aug 2013 15:37:21 +0200 Subject: [PATCH 16/17] make minimumWidth/maximum/implicit exportable both the applet and its compact representation can now export minimumWidth,implicitWidth etc and those are exported to the root graphics item. the minimum width of the applet is used to collapse in popup --- .../plasmacomponentsplugin.cpp | 2 +- .../qml/plasmoid/appletinterface.cpp | 130 +++++++++++++++++- .../qml/plasmoid/appletinterface.h | 25 ++++ .../applets/testapplet/contents/ui/main.qml | 3 + .../contents/ui/testcomponents.qml | 2 + .../contents/ui/testshaderapplet.qml | 2 + .../testpanel/contents/ui/main.qml | 6 +- 7 files changed, 162 insertions(+), 8 deletions(-) diff --git a/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp b/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp index 25bee2a7e..961f8a4ce 100644 --- a/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp +++ b/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp @@ -108,7 +108,7 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri) qmlRegisterUncreatableType(uri, 2, 0, "DialogStatus", ""); qmlRegisterUncreatableType(uri, 2, 0, "PageOrientation", ""); qmlRegisterUncreatableType(uri, 2, 0, "PageStatus", ""); - qmlRegisterUncreatableType(uri, 0, 1, "Units", ""); + qmlRegisterUncreatableType(uri, 2, 0, "Units", ""); } diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index 7a2f7388f..8304347ad 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -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()) { + 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()) { + minHint.setWidth(m_qmlObject->rootObject()->property("minimumWidth").toReal()); + } + if (m_qmlObject->rootObject()->property("minimumHeight").canConvert()) { + 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 @@ -537,7 +599,7 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o //build the icon representation if (m_compactUiObject) { QQmlComponent *compactComponent = m_qmlObject->rootObject()->property("compactRepresentation").value(); - + if (compactComponent) { compactRepresentation = compactComponent->create(m_qmlObject->engine()->rootContext()); } else { @@ -563,10 +625,41 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_compactUiObject.data(), "parent"); QQmlProperty prop(m_compactUiObject.data(), "anchors.fill"); prop.write(expr.evaluate()); - + 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(); diff --git a/src/scriptengines/qml/plasmoid/appletinterface.h b/src/scriptengines/qml/plasmoid/appletinterface.h index 58dfecf1d..8de54ad4c 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.h +++ b/src/scriptengines/qml/plasmoid/appletinterface.h @@ -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; diff --git a/src/shell/applets/testapplet/contents/ui/main.qml b/src/shell/applets/testapplet/contents/ui/main.qml index b1de00497..31681130c 100644 --- a/src/shell/applets/testapplet/contents/ui/main.qml +++ b/src/shell/applets/testapplet/contents/ui/main.qml @@ -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" diff --git a/src/shell/applets/testcomponentsapplet/contents/ui/testcomponents.qml b/src/shell/applets/testcomponentsapplet/contents/ui/testcomponents.qml index 1ecb6795b..2c04eb6d2 100644 --- a/src/shell/applets/testcomponentsapplet/contents/ui/testcomponents.qml +++ b/src/shell/applets/testcomponentsapplet/contents/ui/testcomponents.qml @@ -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 diff --git a/src/shell/applets/testshaderapplet/contents/ui/testshaderapplet.qml b/src/shell/applets/testshaderapplet/contents/ui/testshaderapplet.qml index 4648e0a39..f61ec9cb7 100644 --- a/src/shell/applets/testshaderapplet/contents/ui/testshaderapplet.qml +++ b/src/shell/applets/testshaderapplet/contents/ui/testshaderapplet.qml @@ -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 diff --git a/src/shell/containments/testpanel/contents/ui/main.qml b/src/shell/containments/testpanel/contents/ui/main.qml index 86ed8fecb..389a38a9b 100644 --- a/src/shell/containments/testpanel/contents/ui/main.qml +++ b/src/shell/containments/testpanel/contents/ui/main.qml @@ -64,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 From 100c940a63ccf7cb0b7d7232f8e8992e77a4f0b3 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 5 Aug 2013 15:46:36 +0200 Subject: [PATCH 17/17] propagate size hints from compact representation --- .../desktop/contents/applet/CompactApplet.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/shell/qmlpackages/desktop/contents/applet/CompactApplet.qml b/src/shell/qmlpackages/desktop/contents/applet/CompactApplet.qml index fe6346b0c..18200304e 100644 --- a/src/shell/qmlpackages/desktop/contents/applet/CompactApplet.qml +++ b/src/shell/qmlpackages/desktop/contents/applet/CompactApplet.qml @@ -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