Merge branch 'master' into editbubble
This commit is contained in:
commit
da7412252e
@ -135,6 +135,11 @@ void DialogProxy::syncMainItem()
|
||||
return;
|
||||
}
|
||||
|
||||
if (static_cast<QGraphicsObject *>(m_dialog->graphicsWidget()) == m_mainItem.data() ||
|
||||
(m_declarativeItemContainer && m_declarativeItemContainer->declarativeItem() == m_mainItem.data())) {
|
||||
return;
|
||||
}
|
||||
|
||||
//not have a scene? go up in the hyerarchy until we find something with a scene
|
||||
QGraphicsScene *scene = m_mainItem.data()->scene();
|
||||
if (!scene) {
|
||||
@ -194,7 +199,6 @@ void DialogProxy::setVisible(const bool visible)
|
||||
if (m_dialog->isVisible() != visible) {
|
||||
m_dialog->setVisible(visible);
|
||||
if (visible) {
|
||||
m_dialog->setWindowFlags(Qt::FramelessWindowHint|m_flags);
|
||||
m_dialog->setVisible(visible);
|
||||
m_dialog->raise();
|
||||
}
|
||||
@ -339,13 +343,22 @@ void DialogProxy::activateWindow()
|
||||
|
||||
int DialogProxy::windowFlags() const
|
||||
{
|
||||
return (int)m_dialog->windowFlags();
|
||||
return (int)m_flags;
|
||||
}
|
||||
|
||||
void DialogProxy::setWindowFlags(const int flags)
|
||||
{
|
||||
m_flags = (Qt::WindowFlags)flags;
|
||||
m_dialog->setWindowFlags((Qt::WindowFlags)flags);
|
||||
/*X misbehaviour: the only way to make a window with the Popup flag working, is to create it with that flag from the beginning*/
|
||||
if (((Qt::WindowFlags)flags & Qt::Popup) != (m_flags & Qt::Popup)) {
|
||||
delete m_dialog;
|
||||
m_flags = (Qt::WindowFlags)flags;
|
||||
m_dialog = new Plasma::Dialog(0, Qt::FramelessWindowHint|m_flags);
|
||||
m_margins = new DialogMargins(m_dialog, this);
|
||||
m_dialog->installEventFilter(this);
|
||||
} else {
|
||||
m_flags = (Qt::WindowFlags)flags;
|
||||
m_dialog->setWindowFlags(Qt::FramelessWindowHint|m_flags);
|
||||
}
|
||||
}
|
||||
|
||||
int DialogProxy::location() const
|
||||
|
@ -163,7 +163,12 @@ void ToolTipProxy::updateToolTip()
|
||||
Plasma::ToolTipContent data;
|
||||
data.setMainText(m_mainText);
|
||||
data.setSubText(m_subText);
|
||||
data.setImage(KIcon(m_image).pixmap(IconSize(KIconLoader::Desktop)));
|
||||
if (!m_image.isEmpty()) {
|
||||
KIcon icon(m_image);
|
||||
if (!icon.isNull()) {
|
||||
data.setImage(icon.pixmap(IconSize(KIconLoader::Desktop)));
|
||||
}
|
||||
}
|
||||
Plasma::ToolTipManager::self()->setContent(m_widget, data);
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,9 @@ INCLUDE_DIRECTORIES(
|
||||
qt4_automoc(${declarativedragdrop_SRCS})
|
||||
|
||||
|
||||
kde4_add_library(dragdropplugin SHARED ${declarativedragdrop_SRCS})
|
||||
target_link_libraries(dragdropplugin ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
||||
kde4_add_library(draganddropplugin SHARED ${declarativedragdrop_SRCS})
|
||||
target_link_libraries(draganddropplugin ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
||||
|
||||
install(TARGETS dragdropplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/draganddrop)
|
||||
install(TARGETS draganddropplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/draganddrop)
|
||||
|
||||
install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/draganddrop)
|
||||
|
@ -187,6 +187,11 @@ Item {
|
||||
visible: textEdit.text == "" && !textArea.activeFocus
|
||||
opacity: 0.5
|
||||
}
|
||||
onActiveFocusChanged: {
|
||||
if (!textField.activeFocus) {
|
||||
textInput.closeSoftwareInputPanel()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,12 +149,17 @@ Item {
|
||||
verticalCenter: parent.verticalCenter
|
||||
// TODO: see what is the correct policy for margins
|
||||
leftMargin: 2 * base.margins.left
|
||||
rightMargin: 2 * base.margins.right
|
||||
rightMargin: 2 * base.margins.right + (clearButton.opacity > 0 ? clearButton.width : 0)
|
||||
}
|
||||
selectByMouse: true
|
||||
color: theme.textColor
|
||||
enabled: textField.enabled
|
||||
clip: true
|
||||
onActiveFocusChanged: {
|
||||
if (!textField.activeFocus) {
|
||||
textInput.closeSoftwareInputPanel()
|
||||
}
|
||||
}
|
||||
|
||||
// Proxying keys events is not required by the
|
||||
// common API but is desired in the plasma API.
|
||||
@ -163,6 +168,7 @@ Item {
|
||||
}
|
||||
|
||||
PlasmaCore.SvgItem {
|
||||
id: clearButton
|
||||
svg: PlasmaCore.Svg {imagePath: "widgets/lineedit"}
|
||||
elementId: "clearbutton"
|
||||
width: textInput.height
|
||||
|
@ -124,8 +124,7 @@ Item{
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: frameSvg
|
||||
imagePath: "widgets/frame"
|
||||
prefix: "raised"
|
||||
imagePath: "widgets/toolbar"
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: -margins.left
|
||||
|
@ -13,6 +13,7 @@ Name[en_GB]=plasma-kpart
|
||||
Name[es]=plasma-kpart
|
||||
Name[et]=plasma-kpart
|
||||
Name[eu]=plasma-kpart
|
||||
Name[fa]=plasma-kpart
|
||||
Name[fi]=plasma-kpart
|
||||
Name[fr]=plasma-kpart
|
||||
Name[he]=plasma-kpart
|
||||
@ -28,6 +29,7 @@ Name[km]=plasma-kpart
|
||||
Name[kn]=plasma-kpart
|
||||
Name[ko]=plasma-kpart
|
||||
Name[lt]=plasma-kpart
|
||||
Name[lv]=plasma-kpart
|
||||
Name[nb]=plasma-kpart
|
||||
Name[nds]=Kpart för Plasma
|
||||
Name[nl]=plasma-kpart
|
||||
|
@ -87,6 +87,7 @@ Description[kk]=Қашықтағы Plasma виджеттер ережелері
|
||||
Description[km]=ការពារប្រព័ន្ធមិនឲ្យរក្សាទុកគោលនយោបាយរបស់ធាតុក្រាហ្វិកប្លាស្មាពីចម្ងាយ
|
||||
Description[ko]=Plasma 원격 위젯 정책을 저장하지 못하도록 합니다
|
||||
Description[lt]=Neleidžia sistemai išsaugoti nutolusių plazmos valdiklių taisyklių
|
||||
Description[lv]=Liedz sistēmai saglabāt plasma attālināto sīkrīku politikas
|
||||
Description[nb]=Hindrer at systemet lagrer praksiser for plasmaelementer på nettverket
|
||||
Description[nds]=Höllt dat Systeem vun't Sekern vun de Regeln för feern Plasma-Lüttprogrammen af
|
||||
Description[nl]=Voorkomt het opslaan door het systeem van beleidsregels voor widgets op afstand
|
||||
|
@ -21,11 +21,15 @@
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include <KDesktopFile>
|
||||
#include <KGlobalSettings>
|
||||
#include <KIO/CopyJob>
|
||||
#include <KIO/Job>
|
||||
#include <KRun>
|
||||
#include <KStandardDirs>
|
||||
|
||||
#include <Plasma/Package>
|
||||
|
||||
QScriptValue ScriptEnv::openUrl(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
Q_UNUSED(engine)
|
||||
@ -87,6 +91,67 @@ QScriptValue ScriptEnv::getUrl(QScriptContext *context, QScriptEngine *engine)
|
||||
return engine->newQObject(job);
|
||||
}
|
||||
|
||||
QScriptValue ScriptEnv::download(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
if (context->argumentCount() == 0) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
QScriptValue v = context->argument(0);
|
||||
KUrl url = v.isString() ? KUrl(v.toString()) : qscriptvalue_cast<KUrl>(v);
|
||||
|
||||
if (!url.isValid()) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
QString requestedFileName;
|
||||
if (context->argumentCount() > 1) {
|
||||
requestedFileName = context->argument(1).toString();
|
||||
}
|
||||
|
||||
ScriptEnv *env = ScriptEnv::findScriptEnv(engine);
|
||||
if (!env) {
|
||||
//kDebug() << "findScriptEnv failed";
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
QStringList protocols;
|
||||
protocols << "http" << "https" << "ftp" << "ftps";
|
||||
if (!protocols.contains(url.protocol())) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
QScriptContext *c = engine->currentContext();
|
||||
QString destination;
|
||||
while (c) {
|
||||
QScriptValue v = c->activationObject().property("__plasma_package");
|
||||
if (v.isVariant()) {
|
||||
KDesktopFile config(v.toVariant().value<Plasma::Package>().path() + "/metadata.desktop");
|
||||
KConfigGroup cg = config.desktopGroup();
|
||||
const QString pluginName = cg.readEntry("X-KDE-PluginInfo-Name", QString());
|
||||
destination = KGlobalSettings::downloadPath() + "Plasma/" + pluginName + '/';
|
||||
break;
|
||||
}
|
||||
|
||||
c = c->parentContext();
|
||||
}
|
||||
|
||||
if (destination.isEmpty()) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
requestedFileName.prepend(destination);
|
||||
QDir dir(requestedFileName);
|
||||
dir.mkpath(destination);
|
||||
if (!dir.absolutePath().startsWith(destination)) {
|
||||
requestedFileName = destination;
|
||||
}
|
||||
|
||||
//TODO: allow showing desktop progress info?
|
||||
KIO::CopyJob *job = KIO::copy(url, KUrl(requestedFileName), KIO::HideProgressInfo);
|
||||
return engine->newQObject(job);
|
||||
}
|
||||
|
||||
QScriptValue ScriptEnv::userDataPath(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
Q_UNUSED(engine)
|
||||
|
@ -68,7 +68,6 @@ void ScriptEnv::setupGlobalObject()
|
||||
// property is hidden from scripts.
|
||||
global.setProperty("__plasma_scriptenv", m_engine->newQObject(this),
|
||||
QScriptValue::ReadOnly|QScriptValue::Undeletable|QScriptValue::SkipInEnumeration);
|
||||
|
||||
// Add utility functions
|
||||
#ifndef DECLARATIVE
|
||||
global.setProperty("print", m_engine->newFunction(ScriptEnv::print));
|
||||
@ -182,6 +181,9 @@ bool ScriptEnv::importBuiltinExtension(const QString &extension, QScriptValue &o
|
||||
obj.setProperty("userDataPath", m_engine->newFunction(ScriptEnv::userDataPath));
|
||||
obj.setProperty("runCommand", m_engine->newFunction(ScriptEnv::runCommand));
|
||||
return true;
|
||||
} else if ("download" == extension) {
|
||||
obj.setProperty("download", m_engine->newFunction(ScriptEnv::download));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -27,6 +27,11 @@
|
||||
|
||||
#include "authorization.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
class Package;
|
||||
} // namespace Plasma
|
||||
|
||||
class ScriptEnv : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -87,6 +92,7 @@ private:
|
||||
static QScriptValue applicationExists(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue openUrl(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue getUrl(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue download(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue userDataPath(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue listAddons(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue loadAddon(QScriptContext *context, QScriptEngine *engine);
|
||||
|
@ -28,6 +28,7 @@ Name[km]=ផ្នែកបន្ថែម Plasma JavaScript
|
||||
Name[kn]=ಪ್ಲಾಸ್ಮಾ ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಆಡ್ಆನ್
|
||||
Name[ko]=Plasma 자바스크립트 추가 기능
|
||||
Name[lt]=Plasma JavaScript priedas
|
||||
Name[lv]=Plasma JavaScript papildinājums
|
||||
Name[nb]=Plasma JavaScript-tillegg
|
||||
Name[nds]=JavaScript-Verwiedern för Plasma
|
||||
Name[nl]=Addon voor Plasma JavaScript
|
||||
|
@ -28,6 +28,7 @@ Name[km]=ផ្នែកបន្ថែម Javascript
|
||||
Name[kn]=ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಆಡ್ಆನ್
|
||||
Name[ko]=자바스크립트 추가 기능
|
||||
Name[lt]=Javascript priedas
|
||||
Name[lv]=JavaScript papildinājums
|
||||
Name[nb]=JavaScript-tillegg
|
||||
Name[nds]=JavaScript-Verwiedern
|
||||
Name[nl]=Addon voor JavaScript
|
||||
@ -82,6 +83,7 @@ Comment[kk]=Javascript Plasma плагиніне қосымшасы
|
||||
Comment[km]=កម្មវិធីបន្ថែមសម្រាប់កម្មវិធីជំនួយ Javascript Plasma
|
||||
Comment[ko]=자바스크립트 Plasma 플러그인을 위한 추가 기능
|
||||
Comment[lt]=Javascript Plasma papildinio priedai
|
||||
Comment[lv]=Papildinājumi Javascript Plasma spraudņiem
|
||||
Comment[nb]=Tillegg for JavaSript Plasma-programtillegg
|
||||
Comment[nds]=Verwiedern för Plasma sien JavaScript-Modulen
|
||||
Comment[nl]=Addons voor Javascript Plasma plugins
|
||||
|
@ -24,6 +24,7 @@ Name[kk]=Мәлімдеме виджеті
|
||||
Name[km]=ធាតុក្រាហ្វិកដែលប្រកាស
|
||||
Name[ko]=Declarative 위젯
|
||||
Name[lt]=Deklaratyvus valdiklis
|
||||
Name[lv]=Deklaratīvais sīkrīks
|
||||
Name[nb]=Deklarativt skjermelement
|
||||
Name[nds]=Stüerelement för Verkloren
|
||||
Name[nl]=Widget voor declaratie
|
||||
@ -77,6 +78,7 @@ Comment[km]=ធាតុក្រាហ្វិកប្លាស្
|
||||
Comment[kn]=QML ಹಾಗು ಜಾವಾ ಸ್ಕ್ರಿಪ್ಟ್ ನಲ್ಲಿ ಬರೆಯಲಾದ ಸ್ವಾಭಾವಿಕ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
|
||||
Comment[ko]=QML과 자바스크립트로 작성된 Plasma 위젯
|
||||
Comment[lt]=Nuosavas Plasma valdiklis parašytas QML ir JavaScript kalba
|
||||
Comment[lv]=Plasma sīkrīks, rakstīts QML un JavaScript valodās
|
||||
Comment[nb]=Plasmaelement for dette systemet, skrevet i QML og JavaScript
|
||||
Comment[nds]=En orginaal Plasmaelement, schreven in QML un JavaScript
|
||||
Comment[nl]=Hier thuishorend Plasma-widget geschreven in QML en JavaScript
|
||||
|
@ -76,7 +76,6 @@ QNetworkReply *PackageAccessManager::createRequest(QNetworkAccessManager::Operat
|
||||
(!m_auth->authorizeRequiredExtension("networkio"))) {
|
||||
return new ErrorReply(op, req);
|
||||
} else {
|
||||
return KIO::AccessManager::createRequest(op, req, outgoingData);
|
||||
#ifndef PLASMA_NO_KIO
|
||||
return KIO::AccessManager::createRequest(op, req, outgoingData);
|
||||
#else
|
||||
|
@ -22,12 +22,14 @@
|
||||
#include "appletinterface.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QScriptEngine>
|
||||
#include <QSignalMapper>
|
||||
#include <QTimer>
|
||||
|
||||
#include <KDebug>
|
||||
#include <KGlobalSettings>
|
||||
#include <KIcon>
|
||||
#include <KService>
|
||||
#include <KServiceTypeTrader>
|
||||
@ -412,6 +414,23 @@ AppletInterface::ItemStatus AppletInterface::status() const
|
||||
return (AppletInterface::ItemStatus)((int)(applet()->status()));
|
||||
}
|
||||
|
||||
/*
|
||||
QString AppletInterface::downloadPath(const QString &file)
|
||||
{
|
||||
KDesktopFile config(v.toVariant().value<Plasma::Package>().path() + "/metadata.desktop");
|
||||
KConfigGroup cg = config.desktopGroup();
|
||||
const QString pluginName = cg.readEntry("X-KDE-PluginInfo-Name", QString());
|
||||
destination = KGlobalSettings::downloadPath() + "/Plasma/" + pluginName + '/';
|
||||
}
|
||||
*/
|
||||
|
||||
QStringList AppletInterface::downloadedFiles() const
|
||||
{
|
||||
const QString downloadDir = KGlobalSettings::downloadPath() + "/Plasma/" + applet()->pluginName();
|
||||
QDir dir(downloadDir);
|
||||
return dir.entryList(QDir::Files | QDir::NoSymLinks | QDir::Readable);
|
||||
}
|
||||
|
||||
void AppletInterface::gc()
|
||||
{
|
||||
QTimer::singleShot(0, m_appletScriptEngine, SLOT(collectGarbage()));
|
||||
|
@ -304,6 +304,9 @@ enum IntervalAlignment {
|
||||
void setStatus(const ItemStatus &status);
|
||||
ItemStatus status() const;
|
||||
|
||||
// Q_INVOKABLE QString downloadPath(const QString &file);
|
||||
Q_INVOKABLE QStringList downloadedFiles() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void releaseVisualFocus();
|
||||
void configNeedsSaving();
|
||||
|
@ -390,6 +390,10 @@ void DeclarativeAppletScript::setupObjects()
|
||||
|
||||
QScriptValue global = m_engine->globalObject();
|
||||
|
||||
QScriptValue v = m_engine->newVariant(QVariant::fromValue(*applet()->package()));
|
||||
global.setProperty("__plasma_package", v,
|
||||
QScriptValue::ReadOnly | QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
|
||||
|
||||
m_self = m_engine->newQObject(m_interface);
|
||||
m_self.setScope(global);
|
||||
global.setProperty("plasmoid", m_self);
|
||||
|
@ -510,6 +510,10 @@ void SimpleJavaScriptApplet::setupObjects()
|
||||
global.setProperty("AnimationGroup", m_engine->newFunction(SimpleJavaScriptApplet::animationGroup));
|
||||
global.setProperty("ParallelAnimationGroup", m_engine->newFunction(SimpleJavaScriptApplet::parallelAnimationGroup));
|
||||
|
||||
QScriptValue v = m_engine->newVariant(QVariant::fromValue(*applet()->package()));
|
||||
global.setProperty("__plasma_package", v,
|
||||
QScriptValue::ReadOnly | QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
|
||||
|
||||
// Bindings for data engine
|
||||
|
||||
bindI18N(m_engine);
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
#include <QtCore/QSharedData>
|
||||
|
||||
#include <QPixmap>
|
||||
Q_DECLARE_METATYPE(QPixmap*)
|
||||
Q_DECLARE_METATYPE(QPixmap)
|
||||
|
||||
#define DECLARE_SELF(Class, __fn__) \
|
||||
Class* self = qscriptvalue_cast<Class*>(ctx->thisObject()); \
|
||||
if (!self) { \
|
||||
|
@ -50,6 +50,14 @@ static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
if (ctx->argumentCount() > 0) {
|
||||
QPaintDevice *device = qscriptvalue_cast<QPaintDevice*>(ctx->argument(0));
|
||||
if (!device) {
|
||||
QPixmap *pixmap = qscriptvalue_cast<QPixmap *>(ctx->argument(0));
|
||||
if (pixmap) {
|
||||
return newPainter(eng, new QPainter(pixmap));
|
||||
} else {
|
||||
return newPainter(eng, new QPainter());
|
||||
}
|
||||
}
|
||||
return newPainter(eng, new QPainter(device));
|
||||
} else {
|
||||
return newPainter(eng, new QPainter());
|
||||
|
@ -23,9 +23,6 @@
|
||||
#include "backportglobal.h"
|
||||
#include "plasmoid/appletinterface.h"
|
||||
|
||||
Q_DECLARE_METATYPE(QPixmap*)
|
||||
Q_DECLARE_METATYPE(QPixmap)
|
||||
|
||||
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
||||
{
|
||||
if (ctx->argumentCount() == 1 && ctx->argument(0).isString()) {
|
||||
|
Loading…
Reference in New Issue
Block a user