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/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) 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/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/abstractrunner.cpp b/src/plasma/abstractrunner.cpp index 960c0fc46..3fe228ec3 100644 --- a/src/plasma/abstractrunner.cpp +++ b/src/plasma/abstractrunner.cpp @@ -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 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/dataengine.cpp b/src/plasma/dataengine.cpp index b35d3d155..209208739 100644 --- a/src/plasma/dataengine.cpp +++ b/src/plasma/dataengine.cpp @@ -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() 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..b7fe4e948 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,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); 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/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 } 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/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/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/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(); } 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/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"); 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/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) diff --git a/src/shell/containments/testpanel/contents/ui/main.qml b/src/shell/containments/testpanel/contents/ui/main.qml index e6054bff8..389a38a9b 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,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 diff --git a/src/shell/panelview.cpp b/src/shell/panelview.cpp index 2d0dac636..3c55b0f1c 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(); } @@ -367,6 +371,7 @@ void PanelView::restore() emit maximumLengthChanged(); emit minimumLengthChanged(); emit offsetChanged(); + emit alignmentChanged(); } void PanelView::resizeEvent(QResizeEvent *ev) diff --git a/src/shell/panelview.h b/src/shell/panelview.h index d8d86a798..4dca67cc2 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); @@ -73,6 +74,7 @@ Q_SIGNALS: void lengthChanged(); void maximumLengthChanged(); void minimumLengthChanged(); + void screenChanged(QScreen *screen); private Q_SLOTS: void positionPanel(); 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 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 diff --git a/src/shell/qmlpackages/desktop/contents/views/Panel.qml b/src/shell/qmlpackages/desktop/contents/views/Panel.qml index dcbc7b3b5..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 @@ -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") } 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