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

View File

@ -1,5 +1,6 @@
[Desktop Entry] [Desktop Entry]
Name=Application dashboard Name=Application dashboard
Name[bs]=Aplikacijska kontrolna ploča
Name[cs]=Pracovní plocha aplikace Name[cs]=Pracovní plocha aplikace
Name[de]=Anwendungsübersicht Name[de]=Anwendungsübersicht
Name[es]=Tablero de mandos de la aplicación Name[es]=Tablero de mandos de la aplicación
@ -15,6 +16,7 @@ Name[sv]=Instrumentpanel för program
Name[uk]=Панель приладів програм Name[uk]=Панель приладів програм
Name[x-test]=xxApplication dashboardxx Name[x-test]=xxApplication dashboardxx
Comment=Intended as Application dashboard default 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[cs]=Zamýšleno jako výchozí pracovní plocha aplikace
Comment[de]=Als Voreinstellung für Anwendungsübersicht angedacht Comment[de]=Als Voreinstellung für Anwendungsübersicht angedacht
Comment[es]=Pensado como tablero de mandos por omisión de la aplicación Comment[es]=Pensado como tablero de mandos por omisión de la aplicación

View File

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

View File

@ -34,5 +34,4 @@ set(runnermodeltest_SRCS
qt4_automoc(${runnermodeltest_SRCS}) qt4_automoc(${runnermodeltest_SRCS})
add_executable(runnermodeltest ${runnermodeltest_SRCS}) add_executable(runnermodeltest ${runnermodeltest_SRCS})
target_link_libraries(runnermodeltest ${QT_QTTEST_LIBRARY} ${plasma_LIBRARIES} plasma) target_link_libraries(runnermodeltest ${QT_QTTEST_LIBRARY} ${plasma_LIBRARIES} plasma)
add_test(plasma-runnermodeltest runnermodeltest)
ecm_mark_as_test(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<DialogStatus>(uri, 2, 0, "DialogStatus", "");
qmlRegisterUncreatableType<PageOrientation>(uri, 2, 0, "PageOrientation", ""); qmlRegisterUncreatableType<PageOrientation>(uri, 2, 0, "PageOrientation", "");
qmlRegisterUncreatableType<PageStatus>(uri, 2, 0, "PageStatus", ""); 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] [Desktop Entry]
Name=plasma-kpart Name=plasma-kpart
Name[bs]=plasma-kpart
Name[cs]=plasma-kpart Name[cs]=plasma-kpart
Name[de]=plasma-kpart Name[de]=plasma-kpart
Name[es]=plasma-kpart Name[es]=plasma-kpart

View File

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

View File

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

View File

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

View File

@ -416,7 +416,7 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info)
if (!script) { if (!script) {
#ifndef NDEBUG #ifndef NDEBUG
// qDebug() << "Could not create a" << api << "ScriptEngine for the" // qDebug() << "Could not create a" << api << "ScriptEngine for the"
<< dataEngineDescription.name() << "DataEngine."; // << dataEngineDescription.name() << "DataEngine.";
#endif #endif
delete package; delete package;
package = 0; package = 0;
@ -590,11 +590,11 @@ void DataEnginePrivate::setupScriptSupport()
<< ", main script is" << package->filePath("mainscript"); << ", main script is" << package->filePath("mainscript");
*/ */
const QString translationsPath = package->filePath("translations"); // FIXME: Replace with ki18n functionality once semantics is clear.
if (!translationsPath.isEmpty()) { // const QString translationsPath = package->filePath("translations");
KGlobal::dirs()->addResourceDir("locale", translationsPath); // if (!translationsPath.isEmpty()) {
KLocalizedString::insertCatalog(dataEngineDescription.pluginName()); // KGlobal::dirs()->addResourceDir("locale", translationsPath);
} // }
} }
void DataEnginePrivate::scheduleSourcesUpdated() 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()) { if (!offer->property("X-Plasma-API").toString().isEmpty()) {
#ifndef NDEBUG #ifndef NDEBUG
// qDebug() << "we have a script using the" // qDebug() << "we have a script using the"
<< offer->property("X-Plasma-API").toString() << "API"; // << offer->property("X-Plasma-API").toString() << "API";
#endif #endif
if (isContainment) { if (isContainment) {
return new Containment(0, allArgs); return new Containment(0, allArgs);
@ -575,7 +575,7 @@ QStringList PluginLoader::listAppletCategories(const QString &parentApp, bool vi
if (!appletCategory.isEmpty() && !known.contains(appletCategory.toLower())) { if (!appletCategory.isEmpty() && !known.contains(appletCategory.toLower())) {
#ifndef NDEBUG #ifndef NDEBUG
// qDebug() << "Unknown category: " << applet->name() << "says it is in the" // 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 #endif
appletCategory.clear(); appletCategory.clear();
} }

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
[Desktop Entry] [Desktop Entry]
Name=Test Name=Test
Name[bs]=Test
Name[cs]=Test Name[cs]=Test
Name[de]=Test Name[de]=Test
Name[es]=Prueba Name[es]=Prueba
@ -14,6 +15,7 @@ Name[sv]=Test
Name[uk]=Тест Name[uk]=Тест
Name[x-test]=xxTestxx Name[x-test]=xxTestxx
Comment=A dummy plugin for testing 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[cs]=Falešný zásuvný modul pro testování
Comment[de]=Ein Dummy-Modul zum Testen. Comment[de]=Ein Dummy-Modul zum Testen.
Comment[es]=Un complemento de simulación para hacer pruebas 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) { if (version < minVersion || version > maxVersion) {
#ifndef NDEBUG #ifndef NDEBUG
// qDebug() << "plugin is compiled against incompatible Plasma version " << version // qDebug() << "plugin is compiled against incompatible Plasma version " << version
<< "This build is compatible with" << PLASMA_VERSION_MAJOR << ".0.0 (" << minVersion // << "This build is compatible with" << PLASMA_VERSION_MAJOR << ".0.0 (" << minVersion
<< ") to" << PLASMA_VERSION_STRING << "(" << maxVersion << ")"; // << ") to" << PLASMA_VERSION_STRING << "(" << maxVersion << ")";
#endif #endif
return false; return false;
} }

View File

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

View File

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

View File

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

View File

@ -145,7 +145,7 @@ void JavaScriptRunner::reportError(ScriptEnv *env, bool fatal)
{ {
Q_UNUSED(fatal) Q_UNUSED(fatal)
// qDebug() << "Error: " << env->engine()->uncaughtException().toString() // qDebug() << "Error: " << env->engine()->uncaughtException().toString()
<< " at line " << env->engine()->uncaughtExceptionLineNumber() << endl; // << " at line " << env->engine()->uncaughtExceptionLineNumber() << endl;
// qDebug() << env->engine()->uncaughtExceptionBacktrace(); // 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(); 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) void AppletInterface::debug(const QString &msg)
{ {
qDebug() << msg; qDebug() << msg;
@ -521,8 +574,17 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
return; 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 //TODO: completely arbitrary for now
if (newGeometry.width() < 100 || newGeometry.height() < 100) { if (newGeometry.width() < minHint.width() || newGeometry.height() < minHint.height()) {
m_expanded = false; m_expanded = false;
//we are already an icon: nothing to do //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 //build the icon representation
if (m_compactUiObject) { if (m_compactUiObject) {
QQmlComponent *compactComponent = m_qmlObject->rootObject()->property("compactRepresentation").value<QQmlComponent *>(); QQmlComponent *compactComponent = m_qmlObject->rootObject()->property("compactRepresentation").value<QQmlComponent *>();
if (compactComponent) { if (compactComponent) {
compactRepresentation = compactComponent->create(m_qmlObject->engine()->rootContext()); compactRepresentation = compactComponent->create(m_qmlObject->engine()->rootContext());
} else { } else {
@ -563,10 +625,41 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_compactUiObject.data(), "parent"); QQmlExpression expr(m_qmlObject->engine()->rootContext(), m_compactUiObject.data(), "parent");
QQmlProperty prop(m_compactUiObject.data(), "anchors.fill"); QQmlProperty prop(m_compactUiObject.data(), "anchors.fill");
prop.write(expr.evaluate()); prop.write(expr.evaluate());
m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(m_compactUiObject.data())); m_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(m_compactUiObject.data()));
m_compactUiObject.data()->setProperty("applet", QVariant::fromValue(m_qmlObject->rootObject())); 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 //failed to create UI, don't do anything, return in expanded status
} else { } else {
m_expanded = true; m_expanded = true;
@ -583,6 +676,35 @@ void AppletInterface::geometryChanged(const QRectF &newGeometry, const QRectF &o
return; 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_qmlObject->rootObject()->setProperty("parent", QVariant::fromValue(this));
m_compactUiObject.data()->deleteLater(); 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(Plasma::Types::ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication) 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: public:
AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent = 0); AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent = 0);
~AppletInterface(); ~AppletInterface();
@ -142,6 +150,13 @@ public:
bool userConfiguring() const; bool userConfiguring() const;
int apiVersion() const; int apiVersion() const;
qreal minimumWidth() const;
qreal minimumHeight() const;
qreal maximumWidth() const;
qreal maximumHeight() const;
qreal implicitWidth() const;
qreal implicitHeight() const;
Q_SIGNALS: Q_SIGNALS:
void releaseVisualFocus(); void releaseVisualFocus();
void configNeedsSaving(); void configNeedsSaving();
@ -157,6 +172,13 @@ Q_SIGNALS:
void busyChanged(); void busyChanged();
void expandedChanged(); void expandedChanged();
void minimumWidthChanged();
void minimumHeightChanged();
void maximumWidthChanged();
void maximumHeightChanged();
void implicitWidthChanged();
void implicitHeightChanged();
protected: protected:
virtual void init(); virtual void init();
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
@ -165,6 +187,9 @@ protected:
DeclarativeAppletScript *m_appletScriptEngine; DeclarativeAppletScript *m_appletScriptEngine;
private: private:
//Helper for minimumWidth etc.
qreal readGraphicsObjectSizeHint(const char *hint) const;
QStringList m_actions; QStringList m_actions;
QSignalMapper *m_actionSignals; QSignalMapper *m_actionSignals;
QString m_currentConfig; QString m_currentConfig;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,3 @@
installPackage(testcontainment org.kde.testcontainment plasma/plasmoids containment) 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. * 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.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 2.0 as PlasmaComponents
@ -32,7 +33,7 @@ Item {
Connections { Connections {
target: plasmoid target: plasmoid
onAppletAdded: { 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) print("Applet added in test panel: " + applet)
applet.parent = container applet.parent = container
container.applet = applet container.applet = applet
@ -41,13 +42,17 @@ Item {
container.visible = true container.visible = true
} }
onFormFactorChanged: { onFormFactorChanged: {
if (plasmoid.formFactor == 3) { if (plasmoid.formFactor == PlasmaCore.Types.Vertical) {
for (var container in row.children) { for (var container in row.children) {
container.parent = column var item = row.children[0];
item.parent = column
item.width = column.width
} }
} else { } else {
for (var container in column.children) { 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 id: container
visible: false visible: false
width: Math.min(root.width, root.height) Layout.preferredWidth: Math.min(root.width, root.height)
height: width Layout.preferredHeight: Layout.preferredWidth
property Item applet property Item applet
PlasmaComponents.BusyIndicator { PlasmaComponents.BusyIndicator {
z: 1000 z: 1000
visible: applet && applet.length > 0 && applet[0].busy visible: applet && applet.length > 0 && applet[0].busy
@ -74,7 +79,7 @@ Item {
} }
} }
Row { RowLayout {
id: row id: row
anchors { anchors {
top: parent.top top: parent.top
@ -82,7 +87,7 @@ Item {
left: parent.left left: parent.left
} }
} }
Column { ColumnLayout {
id: column id: column
anchors { anchors {
top: parent.top top: parent.top

View File

@ -22,6 +22,8 @@
#include <QAction> #include <QAction>
#include <QDebug> #include <QDebug>
#include <QScreen> #include <QScreen>
#include <QQmlEngine>
#include <QQmlContext>
#include <KActionCollection> #include <KActionCollection>
#include <KWindowSystem> #include <KWindowSystem>
@ -100,6 +102,8 @@ void PanelView::init()
} }
setResizeMode(View::SizeRootObjectToView); setResizeMode(View::SizeRootObjectToView);
qmlRegisterType<QScreen>();
engine()->rootContext()->setContextProperty("panel", this);
setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Panel.qml"))); setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Panel.qml")));
positionPanel(); positionPanel();
} }
@ -367,6 +371,7 @@ void PanelView::restore()
emit maximumLengthChanged(); emit maximumLengthChanged();
emit minimumLengthChanged(); emit minimumLengthChanged();
emit offsetChanged(); emit offsetChanged();
emit alignmentChanged();
} }
void PanelView::resizeEvent(QResizeEvent *ev) 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 length READ length WRITE setLength NOTIFY lengthChanged)
Q_PROPERTY(int maximumLength READ maximumLength WRITE setMaximumLength NOTIFY maximumLengthChanged) Q_PROPERTY(int maximumLength READ maximumLength WRITE setMaximumLength NOTIFY maximumLengthChanged)
Q_PROPERTY(int minimumLength READ minimumLength WRITE setMinimumLength NOTIFY minimumLengthChanged) Q_PROPERTY(int minimumLength READ minimumLength WRITE setMinimumLength NOTIFY minimumLengthChanged)
Q_PROPERTY(QScreen *screen READ screen NOTIFY screenChanged)
public: public:
explicit PanelView(DesktopCorona *corona, QWindow *parent = 0); explicit PanelView(DesktopCorona *corona, QWindow *parent = 0);
@ -73,6 +74,7 @@ Q_SIGNALS:
void lengthChanged(); void lengthChanged();
void maximumLengthChanged(); void maximumLengthChanged();
void minimumLengthChanged(); void minimumLengthChanged();
void screenChanged(QScreen *screen);
private Q_SLOTS: private Q_SLOTS:
void positionPanel(); void positionPanel();

View File

@ -25,10 +25,20 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
Item { Item {
id: root 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 applet
property Item compactRepresentation property Item compactRepresentation
onAppletChanged: { onAppletChanged: {
applet.parent = appletParent applet.parent = appletParent
applet.anchors.fill = applet.parent applet.anchors.fill = applet.parent
@ -48,7 +58,7 @@ Item {
mainItem: Item { mainItem: Item {
id: appletParent 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 height: applet && applet.implicitHeight > 0 ? applet.implicitHeight : theme.mSize(theme.defaultFont).height * 25
onWidthChanged: applet.width = width onWidthChanged: applet.width = width
onHeightChanged: applet.height = height onHeightChanged: applet.height = height

View File

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

View File

@ -30,6 +30,41 @@ PlasmaCore.FrameSvgItem {
property Item containment 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: { onContainmentChanged: {
print("New panel Containment: " + containment) print("New panel Containment: " + containment)
//containment.parent = root //containment.parent = root
@ -37,6 +72,36 @@ PlasmaCore.FrameSvgItem {
containment.anchors.fill = root 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: { Component.onCompleted: {
print("PanelView QML loaded") print("PanelView QML loaded")
} }

View File

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

View File

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