Merge branch 'master' into plasma-components-doc
Conflicts: plasma/declarativeimports/plasmacomponents/qml/Button.qml
This commit is contained in:
commit
d72f2d7c3c
@ -123,6 +123,18 @@ void SortFilterModel::setSortOrder(const Qt::SortOrder order)
|
|||||||
sort(0, order);
|
sort(0, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantHash SortFilterModel::get(int row) const
|
||||||
|
{
|
||||||
|
QModelIndex idx = index(row, 0);
|
||||||
|
QVariantHash hash;
|
||||||
|
|
||||||
|
QHash<int, QByteArray>::const_iterator i;
|
||||||
|
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
|
||||||
|
hash[i.value()] = data(idx, i.key());
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -423,6 +435,19 @@ int DataModel::columnCount(const QModelIndex &parent) const
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantHash DataModel::get(int row) const
|
||||||
|
{
|
||||||
|
QModelIndex idx = index(row, 0);
|
||||||
|
QVariantHash hash;
|
||||||
|
|
||||||
|
QHash<int, QByteArray>::const_iterator i;
|
||||||
|
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
|
||||||
|
hash[i.value()] = data(idx, i.key());
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
int DataModel::roleNameToId(const QString &name)
|
int DataModel::roleNameToId(const QString &name)
|
||||||
{
|
{
|
||||||
if (!m_roleIds.contains(name)) {
|
if (!m_roleIds.contains(name)) {
|
||||||
|
@ -68,6 +68,8 @@ public:
|
|||||||
|
|
||||||
int count() const {return QSortFilterProxyModel::rowCount();}
|
int count() const {return QSortFilterProxyModel::rowCount();}
|
||||||
|
|
||||||
|
Q_INVOKABLE QVariantHash get(int i) const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void countChanged();
|
void countChanged();
|
||||||
|
|
||||||
@ -124,6 +126,8 @@ public:
|
|||||||
|
|
||||||
int count() const {return countItems();}
|
int count() const {return countItems();}
|
||||||
|
|
||||||
|
Q_INVOKABLE QVariantHash get(int i) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setItems(const QString &sourceName, const QVariantList &list);
|
void setItems(const QString &sourceName, const QVariantList &list);
|
||||||
inline int countItems() const;
|
inline int countItems() const;
|
||||||
|
@ -110,11 +110,22 @@ void DataSource::setupData()
|
|||||||
finishedWithEngine(m_dataEngine->pluginName());
|
finishedWithEngine(m_dataEngine->pluginName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It is due little explanation why this is a queued connection:
|
||||||
|
* If sourceAdded arrives immediately, in the case we have a datamodel
|
||||||
|
* with items at source level we connect too soon (before setData for
|
||||||
|
* all roles is done), having a dataupdated in the datamodel with only
|
||||||
|
* the first role, killing off the other roles.
|
||||||
|
* Besides causing a model reset more, unfortunately setRoleNames can be done a single time, so is not possible adding new roles after the
|
||||||
|
* first setRoleNames() is called.
|
||||||
|
* This fixes engines that have 1 item per source like the
|
||||||
|
* recommendations engine.
|
||||||
|
*/
|
||||||
m_dataEngine = engine;
|
m_dataEngine = engine;
|
||||||
connect(m_dataEngine, SIGNAL(sourceAdded(const QString&)), this, SIGNAL(sourcesChanged()));
|
connect(m_dataEngine, SIGNAL(sourceAdded(const QString&)), this, SIGNAL(sourcesChanged()), Qt::QueuedConnection);
|
||||||
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SIGNAL(sourcesChanged()));
|
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SIGNAL(sourcesChanged()));
|
||||||
|
|
||||||
connect(m_dataEngine, SIGNAL(sourceAdded(const QString&)), this, SIGNAL(sourceAdded(const QString&)));
|
connect(m_dataEngine, SIGNAL(sourceAdded(const QString&)), this, SIGNAL(sourceAdded(const QString&)), Qt::QueuedConnection);
|
||||||
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SLOT(removeSource(const QString&)));
|
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SLOT(removeSource(const QString&)));
|
||||||
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SIGNAL(sourceRemoved(const QString&)));
|
connect(m_dataEngine, SIGNAL(sourceRemoved(const QString&)), this, SIGNAL(sourceRemoved(const QString&)));
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,11 @@ void DeclarativeItemContainer::resizeEvent(QGraphicsSceneResizeEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeclarativeItemContainer::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
|
|
||||||
void DeclarativeItemContainer::widthChanged()
|
void DeclarativeItemContainer::widthChanged()
|
||||||
{
|
{
|
||||||
if (!m_declarativeItem) {
|
if (!m_declarativeItem) {
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QGraphicsSceneResizeEvent *event);
|
void resizeEvent(QGraphicsSceneResizeEvent *event);
|
||||||
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void widthChanged();
|
void widthChanged();
|
||||||
|
@ -135,6 +135,11 @@ void DialogProxy::syncMainItem()
|
|||||||
return;
|
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
|
//not have a scene? go up in the hyerarchy until we find something with a scene
|
||||||
QGraphicsScene *scene = m_mainItem.data()->scene();
|
QGraphicsScene *scene = m_mainItem.data()->scene();
|
||||||
if (!scene) {
|
if (!scene) {
|
||||||
@ -178,8 +183,8 @@ void DialogProxy::syncMainItem()
|
|||||||
m_dialog->setGraphicsWidget(widget);
|
m_dialog->setGraphicsWidget(widget);
|
||||||
|
|
||||||
if (!qobject_cast<Plasma::Corona *>(scene)) {
|
if (!qobject_cast<Plasma::Corona *>(scene)) {
|
||||||
offscreenX -= 1024;
|
offscreenX -= 10000;
|
||||||
offscreenY -= 1024;
|
offscreenY -= 10000;
|
||||||
widget->setPos(offscreenX, offscreenY);
|
widget->setPos(offscreenX, offscreenY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +199,6 @@ void DialogProxy::setVisible(const bool visible)
|
|||||||
if (m_dialog->isVisible() != visible) {
|
if (m_dialog->isVisible() != visible) {
|
||||||
m_dialog->setVisible(visible);
|
m_dialog->setVisible(visible);
|
||||||
if (visible) {
|
if (visible) {
|
||||||
m_dialog->setWindowFlags(m_flags);
|
|
||||||
m_dialog->setVisible(visible);
|
m_dialog->setVisible(visible);
|
||||||
m_dialog->raise();
|
m_dialog->raise();
|
||||||
}
|
}
|
||||||
@ -332,15 +336,29 @@ bool DialogProxy::isActiveWindow() const
|
|||||||
return m_activeWindow;
|
return m_activeWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogProxy::activateWindow()
|
||||||
|
{
|
||||||
|
m_dialog->activateWindow();
|
||||||
|
}
|
||||||
|
|
||||||
int DialogProxy::windowFlags() const
|
int DialogProxy::windowFlags() const
|
||||||
{
|
{
|
||||||
return (int)m_dialog->windowFlags();
|
return (int)m_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogProxy::setWindowFlags(const int flags)
|
void DialogProxy::setWindowFlags(const int 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_flags = (Qt::WindowFlags)flags;
|
||||||
m_dialog->setWindowFlags((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
|
int DialogProxy::location() const
|
||||||
|
@ -110,6 +110,8 @@ public:
|
|||||||
|
|
||||||
bool isActiveWindow() const;
|
bool isActiveWindow() const;
|
||||||
|
|
||||||
|
Q_INVOKABLE void activateWindow();
|
||||||
|
|
||||||
//FIXME: passing an int is ugly
|
//FIXME: passing an int is ugly
|
||||||
int windowFlags() const;
|
int windowFlags() const;
|
||||||
void setWindowFlags(const int);
|
void setWindowFlags(const int);
|
||||||
|
@ -92,7 +92,7 @@ void ToolTipProxy::syncTarget()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_declarativeItemContainer) {
|
if (!m_declarativeItemContainer && scene) {
|
||||||
m_declarativeItemContainer = QWeakPointer<DeclarativeItemContainer>(new DeclarativeItemContainer());
|
m_declarativeItemContainer = QWeakPointer<DeclarativeItemContainer>(new DeclarativeItemContainer());
|
||||||
m_declarativeItemContainer.data()->setObjectName("DIContainer");
|
m_declarativeItemContainer.data()->setObjectName("DIContainer");
|
||||||
scene->addItem(m_declarativeItemContainer.data());
|
scene->addItem(m_declarativeItemContainer.data());
|
||||||
@ -163,7 +163,12 @@ void ToolTipProxy::updateToolTip()
|
|||||||
Plasma::ToolTipContent data;
|
Plasma::ToolTipContent data;
|
||||||
data.setMainText(m_mainText);
|
data.setMainText(m_mainText);
|
||||||
data.setSubText(m_subText);
|
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);
|
Plasma::ToolTipManager::self()->setContent(m_widget, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ INCLUDE_DIRECTORIES(
|
|||||||
qt4_automoc(${declarativedragdrop_SRCS})
|
qt4_automoc(${declarativedragdrop_SRCS})
|
||||||
|
|
||||||
|
|
||||||
kde4_add_library(dragdropplugin SHARED ${declarativedragdrop_SRCS})
|
kde4_add_library(draganddropplugin SHARED ${declarativedragdrop_SRCS})
|
||||||
target_link_libraries(dragdropplugin ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
|
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)
|
install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/draganddrop)
|
||||||
|
@ -46,6 +46,7 @@ DeclarativeDragArea::DeclarativeDragArea(QDeclarativeItem *parent)
|
|||||||
m_data(new DeclarativeMimeData()) // m_data is owned by us, and we shouldn't pass it to Qt directly as it will automatically delete it after the drag and drop.
|
m_data(new DeclarativeMimeData()) // m_data is owned by us, and we shouldn't pass it to Qt directly as it will automatically delete it after the drag and drop.
|
||||||
{
|
{
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
|
setFiltersChildEvents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeclarativeDragArea::~DeclarativeDragArea()
|
DeclarativeDragArea::~DeclarativeDragArea()
|
||||||
@ -103,7 +104,7 @@ QDeclarativeItem* DeclarativeDragArea::target() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// data
|
// data
|
||||||
DeclarativeMimeData* DeclarativeDragArea::data() const
|
DeclarativeMimeData* DeclarativeDragArea::mimeData() const
|
||||||
{
|
{
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
@ -184,3 +185,18 @@ void DeclarativeDragArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
Qt::DropAction action = drag->exec(m_supportedActions, m_defaultAction);
|
Qt::DropAction action = drag->exec(m_supportedActions, m_defaultAction);
|
||||||
emit drop(action);
|
emit drop(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DeclarativeDragArea::sceneEventFilter(QGraphicsItem *item, QEvent *event)
|
||||||
|
{
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event->type() == QEvent::GraphicsSceneMouseMove) {
|
||||||
|
QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(event);
|
||||||
|
mouseMoveEvent(me);
|
||||||
|
}
|
||||||
|
|
||||||
|
return QDeclarativeItem::sceneEventFilter(item, event);
|
||||||
|
}
|
@ -35,7 +35,7 @@ class DeclarativeDragArea : public QDeclarativeItem
|
|||||||
Q_PROPERTY(QDeclarativeComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged RESET resetDelegate)
|
Q_PROPERTY(QDeclarativeComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged RESET resetDelegate)
|
||||||
Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged RESET resetSource)
|
Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged RESET resetSource)
|
||||||
Q_PROPERTY(QDeclarativeItem* target READ source NOTIFY targetChanged)
|
Q_PROPERTY(QDeclarativeItem* target READ source NOTIFY targetChanged)
|
||||||
Q_PROPERTY(DeclarativeMimeData* data READ data CONSTANT)
|
Q_PROPERTY(DeclarativeMimeData* mimeData READ mimeData CONSTANT)
|
||||||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) //TODO: Should call setAcceptDrops()
|
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) //TODO: Should call setAcceptDrops()
|
||||||
Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions WRITE setSupportedActions NOTIFY supportedActionsChanged)
|
Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions WRITE setSupportedActions NOTIFY supportedActionsChanged)
|
||||||
Q_PROPERTY(Qt::DropAction defaultAction READ defaultAction WRITE setDefaultAction NOTIFY defaultActionChanged)
|
Q_PROPERTY(Qt::DropAction defaultAction READ defaultAction WRITE setDefaultAction NOTIFY defaultActionChanged)
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
Qt::DropAction defaultAction() const;
|
Qt::DropAction defaultAction() const;
|
||||||
void setDefaultAction(Qt::DropAction action);
|
void setDefaultAction(Qt::DropAction action);
|
||||||
|
|
||||||
DeclarativeMimeData* data() const;
|
DeclarativeMimeData* mimeData() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void delegateChanged();
|
void delegateChanged();
|
||||||
@ -81,6 +81,7 @@ protected:
|
|||||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *) {}
|
void mousePressEvent(QGraphicsSceneMouseEvent *) {}
|
||||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) {}
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *) {}
|
||||||
|
bool sceneEventFilter(QGraphicsItem *item, QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDeclarativeComponent* m_delegate;
|
QDeclarativeComponent* m_delegate;
|
||||||
|
@ -35,7 +35,7 @@ class DeclarativeDragDropEvent : public QObject
|
|||||||
Q_PROPERTY(int y READ y)
|
Q_PROPERTY(int y READ y)
|
||||||
Q_PROPERTY(int buttons READ buttons)
|
Q_PROPERTY(int buttons READ buttons)
|
||||||
Q_PROPERTY(int modifiers READ modifiers)
|
Q_PROPERTY(int modifiers READ modifiers)
|
||||||
Q_PROPERTY(DeclarativeMimeData* data READ data)
|
Q_PROPERTY(DeclarativeMimeData* mimeData READ mimeData)
|
||||||
Q_PROPERTY(Qt::DropActions possibleActions READ possibleActions)
|
Q_PROPERTY(Qt::DropActions possibleActions READ possibleActions)
|
||||||
Q_PROPERTY(Qt::DropAction proposedAction READ proposedAction)
|
Q_PROPERTY(Qt::DropAction proposedAction READ proposedAction)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
int y() const { return m_y; }
|
int y() const { return m_y; }
|
||||||
int buttons() const { return m_buttons; }
|
int buttons() const { return m_buttons; }
|
||||||
int modifiers() const { return m_modifiers; }
|
int modifiers() const { return m_modifiers; }
|
||||||
DeclarativeMimeData* data() { return &m_data; }
|
DeclarativeMimeData* mimeData() { return &m_data; }
|
||||||
Qt::DropAction proposedAction() const { return m_event->proposedAction(); }
|
Qt::DropAction proposedAction() const { return m_event->proposedAction(); }
|
||||||
Qt::DropActions possibleActions() const { return m_event->possibleActions(); }
|
Qt::DropActions possibleActions() const { return m_event->possibleActions(); }
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ DeclarativeMimeData::DeclarativeMimeData(const QMimeData* copy)
|
|||||||
QUrl DeclarativeMimeData::url() const
|
QUrl DeclarativeMimeData::url() const
|
||||||
{
|
{
|
||||||
if ( this->hasUrls() && !this->urls().isEmpty()) {
|
if ( this->hasUrls() && !this->urls().isEmpty()) {
|
||||||
return urls().first();
|
return QMimeData::urls().first();
|
||||||
}
|
}
|
||||||
return QUrl();
|
return QUrl();
|
||||||
}
|
}
|
||||||
@ -79,10 +79,29 @@ void DeclarativeMimeData::setUrl(const QUrl &url)
|
|||||||
|
|
||||||
QList<QUrl> urlList;
|
QList<QUrl> urlList;
|
||||||
urlList.append(url);
|
urlList.append(url);
|
||||||
setUrls(urlList);
|
QMimeData::setUrls(urlList);
|
||||||
emit urlChanged();
|
emit urlChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantList DeclarativeMimeData::urls() const
|
||||||
|
{
|
||||||
|
QVariantList varUrls;
|
||||||
|
foreach (const QUrl &url, QMimeData::urls()) {
|
||||||
|
varUrls << url;
|
||||||
|
}
|
||||||
|
return varUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeclarativeMimeData::setUrls(const QVariantList &urls)
|
||||||
|
{
|
||||||
|
QList<QUrl> urlList;
|
||||||
|
foreach (const QVariant &varUrl, urls) {
|
||||||
|
urlList << varUrl.value<QUrl>();
|
||||||
|
}
|
||||||
|
QMimeData::setUrls(urlList);
|
||||||
|
emit urlsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
// color
|
// color
|
||||||
QColor DeclarativeMimeData::color() const
|
QColor DeclarativeMimeData::color() const
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,8 @@ class DeclarativeMimeData : public QMimeData
|
|||||||
|
|
||||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
||||||
Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged)
|
Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged)
|
||||||
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) //TODO: use QDeclarativeListProperty<QUrls> to return the whole list instead of only the first url
|
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
|
||||||
|
Q_PROPERTY(QVariantList urls READ urls WRITE setUrls NOTIFY urlsChanged)
|
||||||
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
|
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
|
||||||
Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged)
|
Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged)
|
||||||
//TODO: Image property
|
//TODO: Image property
|
||||||
@ -47,12 +48,16 @@ public:
|
|||||||
QUrl url() const;
|
QUrl url() const;
|
||||||
void setUrl(const QUrl &url);
|
void setUrl(const QUrl &url);
|
||||||
|
|
||||||
|
QVariantList urls() const;
|
||||||
|
void setUrls(const QVariantList &urls);
|
||||||
|
|
||||||
QColor color() const;
|
QColor color() const;
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
QDeclarativeItem* source() const;
|
QDeclarativeItem* source() const;
|
||||||
void setSource(QDeclarativeItem* source);
|
void setSource(QDeclarativeItem* source);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QString text() const; //TODO: Reimplement this to issue the onChanged signals
|
QString text() const; //TODO: Reimplement this to issue the onChanged signals
|
||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
@ -64,12 +69,12 @@ signals:
|
|||||||
void textChanged(); //FIXME not being used
|
void textChanged(); //FIXME not being used
|
||||||
void htmlChanged(); //FIXME not being used
|
void htmlChanged(); //FIXME not being used
|
||||||
void urlChanged();
|
void urlChanged();
|
||||||
|
void urlsChanged();
|
||||||
void colorChanged();
|
void colorChanged();
|
||||||
void sourceChanged();
|
void sourceChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDeclarativeItem* m_source;
|
QDeclarativeItem* m_source;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DECLARATIVEMIMEDATA_H
|
#endif // DECLARATIVEMIMEDATA_H
|
||||||
|
@ -28,8 +28,46 @@ install(DIRECTORY qml/ DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/compone
|
|||||||
|
|
||||||
|
|
||||||
#The platform specific stuff, overwrites a copy of the desktop one
|
#The platform specific stuff, overwrites a copy of the desktop one
|
||||||
#it does install some files on top of the old ones, it's pretty hackyu but it's intended since there are no more elegant ways to produce a fallback during a qml import from the most specific files to the general ones if specific were not found
|
#it does install some files on top of the old ones, has to be done file by file since if some component from the generic set is more recent than the specifc ones, it wouldn't be overwritten
|
||||||
|
|
||||||
install(TARGETS plasmacomponentsplugin DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
install(TARGETS plasmacomponentsplugin DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
install(DIRECTORY qml/ DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
|
||||||
|
|
||||||
|
install(FILES qml/AppManager.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/BusyIndicator.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ButtonColumn.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ButtonGroup.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/Button.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ButtonRow.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/CheckBox.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/CommonDialog.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/Dialog.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/DualStateButton.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/Highlight.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/IconLoader.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/Label.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ListItem.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/Page.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/PageStack.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/PageStack.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ProgressBar.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/RadioButton.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ScrollBarDelegate.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ScrollDecoratorDelegate.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/SectionScroller.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/SelectionDialog.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/Slider.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/Switch.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/TabBarLayout.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/TabBar.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/TabButton.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/TabGroup.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/TabGroup.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/TextArea.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/TextField.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ToolBarLayout.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
install(FILES qml/ToolBar.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
|
||||||
|
|
||||||
|
#install platform overrides
|
||||||
install(DIRECTORY platformcomponents/touch/ DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
install(DIRECTORY platformcomponents/touch/ DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components)
|
||||||
|
@ -0,0 +1,164 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2011 Marco Martin <mart@kde.org>
|
||||||
|
**
|
||||||
|
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
** All rights reserved.
|
||||||
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Components project.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:BSD$
|
||||||
|
** You may use this file under the terms of the BSD license as follows:
|
||||||
|
**
|
||||||
|
** "Redistribution and use in source and binary forms, with or without
|
||||||
|
** modification, are permitted provided that the following conditions are
|
||||||
|
** met:
|
||||||
|
** * Redistributions of source code must retain the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer.
|
||||||
|
** * Redistributions in binary form must reproduce the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer in
|
||||||
|
** the documentation and/or other materials provided with the
|
||||||
|
** distribution.
|
||||||
|
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||||
|
** the names of its contributors may be used to endorse or promote
|
||||||
|
** products derived from this software without specific prior written
|
||||||
|
** permission.
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 1.0
|
||||||
|
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||||
|
import "AppManager.js" as Utils
|
||||||
|
import "." 0.1
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property alias title: titleBar.children
|
||||||
|
property alias content: contentItem.children
|
||||||
|
property alias buttons: buttonItem.children
|
||||||
|
// property alias visualParent: dialog.visualParent
|
||||||
|
property int status: DialogStatus.Closed
|
||||||
|
|
||||||
|
|
||||||
|
property alias privateTitleHeight: titleBar.height
|
||||||
|
property alias privateButtonsHeight: buttonItem.height
|
||||||
|
|
||||||
|
signal accepted
|
||||||
|
signal rejected
|
||||||
|
signal clickedOutside
|
||||||
|
|
||||||
|
function open()
|
||||||
|
{
|
||||||
|
var pos = dialog.popupPosition(null, Qt.alignCenter)
|
||||||
|
dialog.x = pos.x
|
||||||
|
dialog.y = pos.y
|
||||||
|
|
||||||
|
dialog.visible = true
|
||||||
|
dialog.activateWindow()
|
||||||
|
}
|
||||||
|
|
||||||
|
function accept()
|
||||||
|
{
|
||||||
|
if (status == DialogStatus.Open) {
|
||||||
|
dialog.visible = false
|
||||||
|
accepted()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function reject() {
|
||||||
|
if (status == DialogStatus.Open) {
|
||||||
|
dialog.visible = false
|
||||||
|
rejected()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
dialog.visible = false
|
||||||
|
}
|
||||||
|
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
PlasmaCore.Dialog {
|
||||||
|
id: dialog
|
||||||
|
windowFlags: Qt.Dialog
|
||||||
|
|
||||||
|
//onFaderClicked: root.clickedOutside()
|
||||||
|
property Item rootItem
|
||||||
|
|
||||||
|
//state: "Hidden"
|
||||||
|
visible: false
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
status = DialogStatus.Open
|
||||||
|
} else {
|
||||||
|
status = DialogStatus.Closed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onActiveWindowChanged: if (!activeWindow) dialog.visible = false
|
||||||
|
|
||||||
|
mainItem: Item {
|
||||||
|
id: mainItem
|
||||||
|
width: theme.defaultFont.mSize.width * 40
|
||||||
|
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 8
|
||||||
|
|
||||||
|
// Consume all key events that are not processed by children
|
||||||
|
Keys.onPressed: event.accepted = true
|
||||||
|
Keys.onReleased: event.accepted = true
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: titleBar
|
||||||
|
|
||||||
|
height: childrenRect.height
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: contentItem
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
onChildrenRectChanged: mainItem.width = Math.max(childrenRect.width, buttonItem.childrenRect.width)
|
||||||
|
anchors {
|
||||||
|
top: titleBar.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: buttonItem.top
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: buttonItem
|
||||||
|
|
||||||
|
height: childrenRect.height
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
bottomMargin: 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
rootItem = Utils.rootObject()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -36,7 +36,7 @@ Item {
|
|||||||
dialog.y = pos.y
|
dialog.y = pos.y
|
||||||
|
|
||||||
dialog.visible = true
|
dialog.visible = true
|
||||||
dialog.focus = true
|
dialog.activateWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
function close()
|
function close()
|
||||||
|
@ -151,11 +151,6 @@ Item {
|
|||||||
}
|
}
|
||||||
sectionLabel.text = Sections.closestSection(y/listView.height)
|
sectionLabel.text = Sections.closestSection(y/listView.height)
|
||||||
}
|
}
|
||||||
Behavior on y {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: 150
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
imagePath: "widgets/tooltip"
|
imagePath: "widgets/tooltip"
|
||||||
@ -163,7 +158,7 @@ Item {
|
|||||||
height: sectionLabel.paintedHeight + margins.top + margins.bottom
|
height: sectionLabel.paintedHeight + margins.top + margins.bottom
|
||||||
Label {
|
Label {
|
||||||
id: sectionLabel
|
id: sectionLabel
|
||||||
font.pointSize: theme.defaultFont.pointSize*3
|
font.pointSize: theme.defaultFont.pointSize * 1.5
|
||||||
x: parent.margins.left
|
x: parent.margins.left
|
||||||
y: parent.margins.top
|
y: parent.margins.top
|
||||||
}
|
}
|
||||||
@ -179,18 +174,11 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*Repeater {
|
|
||||||
id: sectionsRepeater
|
|
||||||
delegate: Label {
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
text: Sections._sections[modelData]
|
|
||||||
y: Sections._sectionData[modelData].index*(listView.height/listView.model.count)
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: dragArea
|
id: dragArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: scrollbar.enabled
|
//enabled: scrollbar.enabled
|
||||||
drag {
|
drag {
|
||||||
target: handle
|
target: handle
|
||||||
axis: Drag.YAxis
|
axis: Drag.YAxis
|
||||||
@ -200,6 +188,7 @@ Item {
|
|||||||
onPressed: {
|
onPressed: {
|
||||||
mouse.accepted = true
|
mouse.accepted = true
|
||||||
handle.y = mouse.y
|
handle.y = mouse.y
|
||||||
|
fadeTimer.running = false
|
||||||
}
|
}
|
||||||
onReleased: fadeTimer.restart()
|
onReleased: fadeTimer.restart()
|
||||||
|
|
||||||
@ -231,8 +220,6 @@ Item {
|
|||||||
|
|
||||||
if (listView.model.itemsRemoved)
|
if (listView.model.itemsRemoved)
|
||||||
listView.model.itemsRemoved.connect(dirtyObserver);
|
listView.model.itemsRemoved.connect(dirtyObserver);
|
||||||
|
|
||||||
sectionsRepeater.model = Sections._sections.length
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,232 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 by Daker Fernandes Pinheiro <dakerfp@gmail.com>
|
||||||
|
* Copyright (C) 2011 by Marco Martin <mart@kde.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Library General Public License for more details
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this program; if not, write to the
|
||||||
|
* Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import QtQuick 1.1
|
||||||
|
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: button
|
||||||
|
|
||||||
|
// Commmon API
|
||||||
|
property bool flat: true
|
||||||
|
property bool checked: defaultAction ? defaultAction.checked : false
|
||||||
|
property bool checkable: defaultAction ? defaultAction.checkable : false
|
||||||
|
property alias pressed: mouse.pressed
|
||||||
|
property alias text: label.text
|
||||||
|
property alias iconSource: icon.source
|
||||||
|
property alias font: label.font
|
||||||
|
|
||||||
|
signal clicked()
|
||||||
|
|
||||||
|
// Plasma extensiuons
|
||||||
|
property QtObject defaultAction
|
||||||
|
|
||||||
|
onFlatChanged: {
|
||||||
|
if (!flat) {
|
||||||
|
delegate.opacity = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enabled: defaultAction==undefined||defaultAction.enabled
|
||||||
|
|
||||||
|
implicitWidth: {
|
||||||
|
if (label.paintedWidth == 0) {
|
||||||
|
return implicitHeight
|
||||||
|
} else {
|
||||||
|
return Math.max(theme.defaultFont.mSize.width*12, icon.width + label.paintedWidth + delegate.margins.left + delegate.margins.right) + ((icon.valid) ? delegate.margins.left : 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
implicitHeight: Math.max(theme.defaultFont.mSize.height*1.6, Math.max(icon.height, label.paintedHeight) + delegate.margins.top/2 + delegate.margins.bottom/2)
|
||||||
|
|
||||||
|
// TODO: needs to define if there will be specific graphics for
|
||||||
|
// disabled buttons
|
||||||
|
opacity: enabled ? 1.0 : 0.5
|
||||||
|
|
||||||
|
Keys.onSpacePressed: internal.userPressed = true
|
||||||
|
Keys.onReturnPressed: internal.userPressed = true
|
||||||
|
Keys.onReleased: {
|
||||||
|
internal.userPressed = false
|
||||||
|
if (event.key == Qt.Key_Space ||
|
||||||
|
event.key == Qt.Key_Return)
|
||||||
|
internal.clickButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: internal
|
||||||
|
property bool userPressed: false
|
||||||
|
|
||||||
|
function clickButton()
|
||||||
|
{
|
||||||
|
if (!button.enabled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defaultAction && defaultAction.checkable) {
|
||||||
|
defaultAction.checked = !defaultAction.checked
|
||||||
|
} else if (button.checkable) {
|
||||||
|
button.checked = !button.checked
|
||||||
|
}
|
||||||
|
|
||||||
|
button.clicked()
|
||||||
|
button.forceActiveFocus()
|
||||||
|
|
||||||
|
if (defaultAction) {
|
||||||
|
defaultAction.trigger()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: delegate
|
||||||
|
anchors.fill:parent
|
||||||
|
property QtObject margins: item.margins
|
||||||
|
sourceComponent: {
|
||||||
|
if (label.paintedWidth == 0 && !flat) {
|
||||||
|
return roundButtonComponent
|
||||||
|
} else {
|
||||||
|
return buttonComponent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: buttonComponent
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
property alias margins: surface.margins
|
||||||
|
ButtonShadow {
|
||||||
|
id: shadow
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: !flat
|
||||||
|
state: (internal.userPressed || checked) ? "hidden" : "shadow"
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.FrameSvgItem {
|
||||||
|
id: surface
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
imagePath: "widgets/button"
|
||||||
|
prefix: (internal.userPressed || checked) ? "pressed" : "normal"
|
||||||
|
//internal: if there is no hover status, don't paint on mouse over in touchscreens
|
||||||
|
opacity: (internal.userPressed || checked || !flat || (shadow.hasOverState && mouse.containsMouse)) ? 1 : 0
|
||||||
|
Behavior on opacity {
|
||||||
|
PropertyAnimation { duration: 250 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: roundButtonComponent
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
property QtObject margins: QtObject {
|
||||||
|
property int left: 8
|
||||||
|
property int top: 8
|
||||||
|
property int right: 8
|
||||||
|
property int bottom: 8
|
||||||
|
}
|
||||||
|
RoundShadow {
|
||||||
|
anchors.fill: parent
|
||||||
|
state: (internal.userPressed || checked) ? "hidden" : "shadow"
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.Svg {
|
||||||
|
id: buttonSvg
|
||||||
|
imagePath: "widgets/actionbutton"
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.SvgItem {
|
||||||
|
id: buttonItem
|
||||||
|
svg: buttonSvg
|
||||||
|
elementId: (internal.userPressed || checked) ? "pressed" : "normal"
|
||||||
|
width: parent.height
|
||||||
|
height: width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors {
|
||||||
|
fill: parent
|
||||||
|
leftMargin: delegate.margins.left
|
||||||
|
topMargin: delegate.margins.top
|
||||||
|
rightMargin: delegate.margins.right
|
||||||
|
bottomMargin: delegate.margins.bottom
|
||||||
|
}
|
||||||
|
scale: internal.userPressed ? 0.9 : 1
|
||||||
|
Behavior on scale {
|
||||||
|
PropertyAnimation { duration: 100 }
|
||||||
|
}
|
||||||
|
|
||||||
|
IconLoader {
|
||||||
|
id: icon
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: label.text ? parent.left : undefined
|
||||||
|
horizontalCenter: label.text ? undefined : parent.horizontalCenter
|
||||||
|
}
|
||||||
|
width: label.text ? implicitWidth : roundToStandardSize(parent.width)
|
||||||
|
height: width
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: label
|
||||||
|
|
||||||
|
//FIXME: why this is needed?
|
||||||
|
onPaintedWidthChanged: {
|
||||||
|
icon.anchors.horizontalCenter = label.paintedWidth > 0 ? undefined : icon.parent.horizontalCenter
|
||||||
|
icon.anchors.left = label.paintedWidth > 0 ? icon.parent.left : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: icon.valid ? icon.right : parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
font.capitalization: theme.defaultFont.capitalization
|
||||||
|
font.family: theme.defaultFont.family
|
||||||
|
font.italic: theme.defaultFont.italic
|
||||||
|
font.letterSpacing: theme.defaultFont.letterSpacing
|
||||||
|
font.pointSize: theme.defaultFont.pointSize
|
||||||
|
font.strikeout: theme.defaultFont.strikeout
|
||||||
|
font.underline: theme.defaultFont.underline
|
||||||
|
font.weight: theme.defaultFont.weight
|
||||||
|
font.wordSpacing: theme.defaultFont.wordSpacing
|
||||||
|
color: theme.buttonTextColor
|
||||||
|
horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouse
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
|
onPressed: internal.userPressed = true
|
||||||
|
onReleased: internal.userPressed = false
|
||||||
|
onClicked: internal.clickButton()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,37 +6,32 @@ ButtonColumn 0.1 ButtonColumn.qml
|
|||||||
ButtonGroup 0.1 ButtonGroup.js
|
ButtonGroup 0.1 ButtonGroup.js
|
||||||
ButtonRow 0.1 ButtonRow.qml
|
ButtonRow 0.1 ButtonRow.qml
|
||||||
CheckBox 0.1 CheckBox.qml
|
CheckBox 0.1 CheckBox.qml
|
||||||
FlashingLabel 0.1 FlashingLabel.qml
|
CommonDialog 0.1 CommonDialog.qml
|
||||||
Frame 0.1 Frame.qml
|
ContextMenu 0.1 Menu.qml
|
||||||
|
Dialog 0.1 Dialog.qml
|
||||||
Highlight 0.1 Highlight.qml
|
Highlight 0.1 Highlight.qml
|
||||||
IconWidget 0.1 IconWidget.qml
|
|
||||||
Label 0.1 Label.qml
|
Label 0.1 Label.qml
|
||||||
|
ListItem 0.1 ListItem.qml
|
||||||
|
Menu 0.1 Menu.qml
|
||||||
|
MenuItem 0.1 MenuItem.qml
|
||||||
|
Page 0.1 Page.qml
|
||||||
|
PageStack 0.1 PageStack.qml
|
||||||
ProgressBar 0.1 ProgressBar.qml
|
ProgressBar 0.1 ProgressBar.qml
|
||||||
PushButton 0.1 PushButton.qml
|
PushButton 0.1 PushButton.qml
|
||||||
|
QueryDialog 0.1 QueryDialog.qml
|
||||||
RadioButton 0.1 RadioButton.qml
|
RadioButton 0.1 RadioButton.qml
|
||||||
ScrollBar 0.1 ScrollBar.qml
|
ScrollBar 0.1 ScrollBar.qml
|
||||||
ScrollDecorator 0.1 ScrollDecorator.qml
|
ScrollDecorator 0.1 ScrollDecorator.qml
|
||||||
|
SectionScroller 0.1 SectionScroller.qml
|
||||||
|
SelectionDialog 0.1 SelectionDialog.qml
|
||||||
Slider 0.1 Slider.qml
|
Slider 0.1 Slider.qml
|
||||||
Switch 0.1 Switch.qml
|
Switch 0.1 Switch.qml
|
||||||
TextArea 0.1 TextArea.qml
|
|
||||||
TextField 0.1 TextField.qml
|
|
||||||
ToolBar 0.1 ToolBar.qml
|
|
||||||
ToolButton 0.1 ToolButton.qml
|
|
||||||
ListItem 0.1 ListItem.qml
|
|
||||||
|
|
||||||
CommonDialog 0.1 CommonDialog.qml
|
|
||||||
QueryDialog 0.1 QueryDialog.qml
|
|
||||||
SelectionDialog 0.1 SelectionDialog.qml
|
|
||||||
Window 0.1 Window.qml
|
|
||||||
ToolBarLayout 0.1 ToolBarLayout.qml
|
|
||||||
Menu 0.1 Menu.qml
|
|
||||||
ContextMenu 0.1 Menu.qml
|
|
||||||
MenuItem 0.1 MenuItem.qml
|
|
||||||
|
|
||||||
Page 0.1 Page.qml
|
|
||||||
PageStack 0.1 PageStack.qml
|
|
||||||
|
|
||||||
TabBar 0.1 TabBar.qml
|
TabBar 0.1 TabBar.qml
|
||||||
TabButton 0.1 TabButton.qml
|
TabButton 0.1 TabButton.qml
|
||||||
TabGroup 0.1 TabGroup.qml
|
TabGroup 0.1 TabGroup.qml
|
||||||
SectionScroller 0.1 SectionScroller.qml
|
TextArea 0.1 TextArea.qml
|
||||||
|
TextField 0.1 TextField.qml
|
||||||
|
ToolBar 0.1 ToolBar.qml
|
||||||
|
ToolBarLayout 0.1 ToolBarLayout.qml
|
||||||
|
ToolButton 0.1 ToolButton.qml
|
||||||
|
Window 0.1 Window.qml
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**Documentanted API
|
/**Documentanted API
|
||||||
Inherits:
|
Inherits:
|
||||||
Item
|
Item
|
||||||
@ -66,7 +67,9 @@ Signals:
|
|||||||
onClicked:
|
onClicked:
|
||||||
This handler is called when there is a click.
|
This handler is called when there is a click.
|
||||||
**/
|
**/
|
||||||
import QtQuick 1.0
|
|
||||||
|
import QtQuick 1.1
|
||||||
|
|
||||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -82,14 +85,15 @@ Item {
|
|||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
width: {
|
implicitWidth: {
|
||||||
if (label.paintedWidth == 0) {
|
if (label.paintedWidth == 0) {
|
||||||
return height
|
return height
|
||||||
} else {
|
} else {
|
||||||
|
//return Math.max(theme.defaultFont.mSize.width*12, label.paintedWidth)
|
||||||
return Math.max(theme.defaultFont.mSize.width*12, icon.width + label.paintedWidth + surfaceNormal.margins.left + surfaceNormal.margins.right) + ((icon.valid) ? surfaceNormal.margins.left : 0)
|
return Math.max(theme.defaultFont.mSize.width*12, icon.width + label.paintedWidth + surfaceNormal.margins.left + surfaceNormal.margins.right) + ((icon.valid) ? surfaceNormal.margins.left : 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
height: Math.max(theme.defaultFont.mSize.height*1.8, Math.max(icon.height, label.paintedHeight) + surfaceNormal.margins.top + surfaceNormal.margins.bottom)
|
implicitHeight: Math.max(theme.defaultFont.mSize.height*1.6, Math.max(icon.height, label.paintedHeight) + surfaceNormal.margins.top/2 + surfaceNormal.margins.bottom/2)
|
||||||
|
|
||||||
// TODO: needs to define if there will be specific graphics for
|
// TODO: needs to define if there will be specific graphics for
|
||||||
// disabled buttons
|
// disabled buttons
|
||||||
@ -106,12 +110,7 @@ Item {
|
|||||||
&& button.parent.exclusive
|
&& button.parent.exclusive
|
||||||
}
|
}
|
||||||
|
|
||||||
function pressButton()
|
function clickButton()
|
||||||
{
|
|
||||||
userPressed = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function releaseButton()
|
|
||||||
{
|
{
|
||||||
userPressed = false
|
userPressed = false
|
||||||
if (!button.enabled) {
|
if (!button.enabled) {
|
||||||
@ -127,12 +126,13 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onSpacePressed: internal.pressButton()
|
Keys.onSpacePressed: internal.userPressed = true
|
||||||
Keys.onReturnPressed: internal.pressButton()
|
Keys.onReturnPressed: internal.userPressed = true
|
||||||
Keys.onReleased: {
|
Keys.onReleased: {
|
||||||
|
internal.userPressed = false
|
||||||
if (event.key == Qt.Key_Space ||
|
if (event.key == Qt.Key_Space ||
|
||||||
event.key == Qt.Key_Return)
|
event.key == Qt.Key_Return)
|
||||||
internal.releaseButton();
|
internal.clickButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonShadow {
|
ButtonShadow {
|
||||||
@ -173,6 +173,10 @@ Item {
|
|||||||
Item {
|
Item {
|
||||||
id: buttonContent
|
id: buttonContent
|
||||||
state: (internal.userPressed || checked) ? "pressed" : "normal"
|
state: (internal.userPressed || checked) ? "pressed" : "normal"
|
||||||
|
scale: state == "pressed" ? 0.9 : 1
|
||||||
|
Behavior on scale {
|
||||||
|
PropertyAnimation { duration: 100 }
|
||||||
|
}
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State { name: "normal" },
|
State { name: "normal" },
|
||||||
@ -210,14 +214,20 @@ Item {
|
|||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: label.text ? parent.left : undefined
|
left: label.paintedWidth > 0 ? parent.left : undefined
|
||||||
horizontalCenter: label.text ? undefined : parent.horizontalCenter
|
horizontalCenter: label.paintedWidth > 0 ? undefined : parent.horizontalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: label
|
id: label
|
||||||
|
|
||||||
|
//FIXME: why this is needed?
|
||||||
|
onPaintedWidthChanged: {
|
||||||
|
icon.anchors.horizontalCenter = label.paintedWidth > 0 ? undefined : icon.parent.horizontalCenter
|
||||||
|
icon.anchors.left = label.paintedWidth > 0 ? icon.parent.left : undefined
|
||||||
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
@ -246,8 +256,9 @@ Item {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onPressed: internal.pressButton()
|
onPressed: internal.userPressed = true
|
||||||
onReleased: internal.releaseButton()
|
onReleased: internal.userPressed = false
|
||||||
onCanceled: internal.releaseButton()
|
onCanceled: internal.userPressed = false
|
||||||
|
onClicked: internal.clickButton()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,14 +82,14 @@ Dialog {
|
|||||||
QtObject {
|
QtObject {
|
||||||
id: internal
|
id: internal
|
||||||
|
|
||||||
function buttonWidth() {
|
/*function buttonWidth() {
|
||||||
switch (buttonTexts.length) {
|
switch (buttonTexts.length) {
|
||||||
case 0: return 0
|
case 0: return 0
|
||||||
case 1: return Math.round((800 - 3 * 4) / 2)
|
case 1: return Math.round((800 - 3 * 4) / 2)
|
||||||
default: return (buttonContainer.width - (buttonTexts.length + 1) *
|
default: return (buttonContainer.width - (buttonTexts.length + 1) *
|
||||||
4) / buttonTexts.length
|
4) / buttonTexts.length
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
function iconSource() {
|
function iconSource() {
|
||||||
return root.titleIcon
|
return root.titleIcon
|
||||||
@ -107,7 +107,7 @@ Dialog {
|
|||||||
LayoutMirroring.enabled: privateCloseIcon ? false : undefined
|
LayoutMirroring.enabled: privateCloseIcon ? false : undefined
|
||||||
LayoutMirroring.childrenInherit: true
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
Item {
|
Column {
|
||||||
id: titleLayoutHelper // needed to make the text mirror correctly
|
id: titleLayoutHelper // needed to make the text mirror correctly
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
@ -123,11 +123,7 @@ Dialog {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: titleAreaText
|
id: titleAreaText
|
||||||
|
|
||||||
LayoutMirroring.enabled: root.LayoutMirroring.enabled
|
LayoutMirroring.enabled: root.LayoutMirroring.enabled
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
@ -145,20 +141,13 @@ Dialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons: Item {
|
buttons: Row {
|
||||||
id: buttonContainer
|
id: buttonRow
|
||||||
|
|
||||||
LayoutMirroring.enabled: false
|
LayoutMirroring.enabled: false
|
||||||
LayoutMirroring.childrenInherit: true
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
width: parent.width
|
|
||||||
height: buttonTexts.length ? 48 + 2 * 2 : 0
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: buttonRow
|
|
||||||
objectName: "buttonRow"
|
objectName: "buttonRow"
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 4
|
spacing: 4
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ Item {
|
|||||||
dialog.y = pos.y
|
dialog.y = pos.y
|
||||||
|
|
||||||
dialog.visible = true
|
dialog.visible = true
|
||||||
dialog.focus = true
|
dialog.activateWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
function accept()
|
function accept()
|
||||||
@ -95,6 +95,7 @@ Item {
|
|||||||
|
|
||||||
PlasmaCore.Dialog {
|
PlasmaCore.Dialog {
|
||||||
id: dialog
|
id: dialog
|
||||||
|
windowFlags: Qt.Dialog
|
||||||
|
|
||||||
|
|
||||||
//onFaderClicked: root.clickedOutside()
|
//onFaderClicked: root.clickedOutside()
|
||||||
@ -111,8 +112,9 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mainItem: Item {
|
mainItem: Item {
|
||||||
|
id: mainItem
|
||||||
width: theme.defaultFont.mSize.width * 40
|
width: theme.defaultFont.mSize.width * 40
|
||||||
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height
|
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 8
|
||||||
|
|
||||||
// Consume all key events that are not processed by children
|
// Consume all key events that are not processed by children
|
||||||
Keys.onPressed: event.accepted = true
|
Keys.onPressed: event.accepted = true
|
||||||
@ -132,12 +134,15 @@ Item {
|
|||||||
Item {
|
Item {
|
||||||
id: contentItem
|
id: contentItem
|
||||||
|
|
||||||
|
onChildrenRectChanged: mainItem.width = Math.max(childrenRect.width, buttonItem.childrenRect.width)
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
anchors {
|
anchors {
|
||||||
top: titleBar.bottom
|
top: titleBar.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
bottom: buttonItem.top
|
bottom: buttonItem.top
|
||||||
|
bottomMargin: 8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,11 +150,11 @@ Item {
|
|||||||
id: buttonItem
|
id: buttonItem
|
||||||
|
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
clip: true
|
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
|
bottomMargin: 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ Item {
|
|||||||
property alias shadow: shadowLoader.sourceComponent
|
property alias shadow: shadowLoader.sourceComponent
|
||||||
|
|
||||||
width: surfaceLoader.width + label.paintedWidth
|
width: surfaceLoader.width + label.paintedWidth
|
||||||
height: theme.defaultFont.mSize.height*1.8
|
height: theme.defaultFont.mSize.height*1.6
|
||||||
// TODO: needs to define if there will be specific graphics for
|
// TODO: needs to define if there will be specific graphics for
|
||||||
// disabled buttons
|
// disabled buttons
|
||||||
opacity: dualButton.enabled ? 1.0 : 0.5
|
opacity: dualButton.enabled ? 1.0 : 0.5
|
||||||
|
@ -54,7 +54,11 @@ Item {
|
|||||||
valid = false
|
valid = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svgIcon.imagePath = "toolbar-icons/"+root.source.split("-")[0]
|
||||||
|
if (!svgIcon.isValid() || !svgIcon.hasElement(root.source)) {
|
||||||
svgIcon.imagePath = "icons/"+root.source.split("-")[0]
|
svgIcon.imagePath = "icons/"+root.source.split("-")[0]
|
||||||
|
}
|
||||||
|
|
||||||
if (svgIcon.isValid() && svgIcon.hasElement(root.source)) {
|
if (svgIcon.isValid() && svgIcon.hasElement(root.source)) {
|
||||||
imageLoader.sourceComponent = svgComponent
|
imageLoader.sourceComponent = svgComponent
|
||||||
} else if (root.source.indexOf(".") == -1 && root.source.indexOf(":") == -1) {
|
} else if (root.source.indexOf(".") == -1 && root.source.indexOf(":") == -1) {
|
||||||
@ -72,6 +76,23 @@ Item {
|
|||||||
id: svgIcon
|
id: svgIcon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function roundToStandardSize(size)
|
||||||
|
{
|
||||||
|
if (size >= theme.enormousIconSize) {
|
||||||
|
return theme.enormousIconSize
|
||||||
|
} else if (size >= theme.hugeIconSize) {
|
||||||
|
return theme.hugeIconSize
|
||||||
|
} else if (size >= theme.largeIconSize) {
|
||||||
|
return theme.largeIconSize
|
||||||
|
} else if (size >= theme.mediumIconSize) {
|
||||||
|
return theme.mediumIconSize
|
||||||
|
} else if (size >= theme.smallMediumIconSize) {
|
||||||
|
return theme.smallMediumIconSize
|
||||||
|
} else {
|
||||||
|
return theme.smallIconSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: imageLoader
|
id: imageLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -83,6 +104,7 @@ Item {
|
|||||||
svg: svgIcon
|
svg: svgIcon
|
||||||
elementId: root.source
|
elementId: root.source
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
smooth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import org.kde.plasma.core 0.1 as PlasmaCore
|
|||||||
Text {
|
Text {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
height: theme.defaultFont.mSize.height*1.8
|
height: Math.max(paintedHeight, theme.defaultFont.mSize.height*1.6)
|
||||||
//FIXME: wait to rely on 1.1 for lineCount > 1
|
//FIXME: wait to rely on 1.1 for lineCount > 1
|
||||||
verticalAlignment: paintedHeight > theme.defaultFont.mSize.height*1.5 ? Text.AlignTop : Text.AlignVCenter
|
verticalAlignment: paintedHeight > theme.defaultFont.mSize.height*1.5 ? Text.AlignTop : Text.AlignVCenter
|
||||||
|
|
||||||
@ -49,6 +49,4 @@ Text {
|
|||||||
font.weight: theme.defaultFont.weight
|
font.weight: theme.defaultFont.weight
|
||||||
font.wordSpacing: theme.defaultFont.wordSpacing
|
font.wordSpacing: theme.defaultFont.wordSpacing
|
||||||
color: theme.textColor
|
color: theme.textColor
|
||||||
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
}
|
}
|
||||||
|
@ -148,17 +148,23 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onInitialPageChanged: {
|
onInitialPageChanged: {
|
||||||
|
if (!internal.completed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (initialPage) {
|
if (initialPage) {
|
||||||
if (depth == 0)
|
if (depth == 0) {
|
||||||
push(initialPage, null, true)
|
push(initialPage, null, true)
|
||||||
else if (depth == 1)
|
} else if (depth == 1) {
|
||||||
replace(initialPage, null, true)
|
replace(initialPage, null, true)
|
||||||
else
|
} else {
|
||||||
console.log("Cannot update PageStack.initialPage")
|
console.log("Cannot update PageStack.initialPage")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
internal.completed = true
|
||||||
if (initialPage && depth == 0)
|
if (initialPage && depth == 0)
|
||||||
push(initialPage, null, true)
|
push(initialPage, null, true)
|
||||||
}
|
}
|
||||||
@ -169,6 +175,9 @@ Item {
|
|||||||
// The number of ongoing transitions.
|
// The number of ongoing transitions.
|
||||||
property int ongoingTransitionCount: 0
|
property int ongoingTransitionCount: 0
|
||||||
|
|
||||||
|
//FIXME: there should be a way to access to theh without storing it in an ugly way
|
||||||
|
property bool completed: false
|
||||||
|
|
||||||
// Sets the page status.
|
// Sets the page status.
|
||||||
function setPageStatus(page, status)
|
function setPageStatus(page, status)
|
||||||
{
|
{
|
||||||
|
@ -83,8 +83,8 @@ Item {
|
|||||||
property bool pressed: internalLoader.item.mouseArea?internalLoader.item.mouseArea.pressed:false
|
property bool pressed: internalLoader.item.mouseArea?internalLoader.item.mouseArea.pressed:false
|
||||||
property real scrollButtonInterval: 50
|
property real scrollButtonInterval: 50
|
||||||
|
|
||||||
implicitWidth: internalLoader.isVertical ? (interactive ? 22 : 12) : 200
|
implicitWidth: internalLoader.isVertical ? (interactive ? 16 : 12) : 200
|
||||||
implicitHeight: internalLoader.isVertical ? 200 : (interactive ? 22 : 12)
|
implicitHeight: internalLoader.isVertical ? 200 : (interactive ? 16 : 12)
|
||||||
// TODO: needs to define if there will be specific graphics for
|
// TODO: needs to define if there will be specific graphics for
|
||||||
// disabled scroll bars
|
// disabled scroll bars
|
||||||
opacity: enabled ? 1.0 : 0.5
|
opacity: enabled ? 1.0 : 0.5
|
||||||
|
@ -48,19 +48,38 @@ PlasmaCore.FrameSvgItem {
|
|||||||
imagePath:"widgets/scrollbar"
|
imagePath:"widgets/scrollbar"
|
||||||
prefix: "slider"
|
prefix: "slider"
|
||||||
|
|
||||||
function length() {
|
function length()
|
||||||
|
{
|
||||||
|
var nh, ny;
|
||||||
|
|
||||||
if (internalLoader.isVertical) {
|
if (internalLoader.isVertical) {
|
||||||
var overshoot = 0
|
nh = flickableItem.visibleArea.heightRatio * internalLoader.height
|
||||||
if (flickableItem.atYBeginning || flickableItem.atYEnd) {
|
|
||||||
overshoot = Math.abs(flickableItem.visibleArea.yPosition * parent.height)
|
|
||||||
}
|
|
||||||
return (flickableItem.visibleArea.heightRatio * parent.height) - overshoot
|
|
||||||
} else {
|
} else {
|
||||||
var overshoot = 0
|
nh = flickableItem.visibleArea.widthRatio * internalLoader.width
|
||||||
if (flickableItem.atXBeginning || flickableItem.atXEnd) {
|
|
||||||
overshoot = Math.abs(flickableItem.visibleArea.xPosition * parent.width)
|
|
||||||
}
|
}
|
||||||
return (flickableItem.visibleArea.widthRatio * parent.width) - overshoot
|
|
||||||
|
if (internalLoader.isVertical) {
|
||||||
|
ny = flickableItem.visibleArea.yPosition * internalLoader.height
|
||||||
|
} else {
|
||||||
|
ny = flickableItem.visibleArea.xPosition * internalLoader.width
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ny > 3) {
|
||||||
|
var t
|
||||||
|
|
||||||
|
if (internalLoader.isVertical) {
|
||||||
|
t = Math.ceil(internalLoader.height - 3 - ny)
|
||||||
|
} else {
|
||||||
|
t = Math.ceil(internalLoader.width - 3 - ny)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nh > t) {
|
||||||
|
return t
|
||||||
|
} else {
|
||||||
|
return nh
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return nh + ny
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
import QtQuick 1.1
|
import QtQuick 1.1
|
||||||
|
import org.kde.plasma.core 0.1 as PlasmaCore
|
||||||
|
|
||||||
import "." 0.1
|
import "." 0.1
|
||||||
|
|
||||||
@ -58,7 +59,8 @@ CommonDialog {
|
|||||||
id: defaultDelegate
|
id: defaultDelegate
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
//platformInverted: root.platformInverted
|
visible: modelData.search(RegExp(filterField.filterText, "i")) != -1
|
||||||
|
height: visible? paintedHeight*2 : 0
|
||||||
text: modelData
|
text: modelData
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -77,19 +79,37 @@ CommonDialog {
|
|||||||
|
|
||||||
content: Item {
|
content: Item {
|
||||||
id: contentItem
|
id: contentItem
|
||||||
|
property alias filterText: filterField.filterText
|
||||||
width: theme.defaultFont.mSize.width * 40
|
implicitWidth: theme.defaultFont.mSize.width * 40
|
||||||
height: theme.defaultFont.mSize.height * 12
|
height: theme.defaultFont.mSize.height * 12
|
||||||
|
|
||||||
Item {
|
TextField {
|
||||||
// Clipping item with bottom margin added to align content with rounded background graphics
|
id: filterField
|
||||||
id: clipItem
|
property string filterText
|
||||||
anchors.fill: parent
|
onTextChanged: searchTimer.restart()
|
||||||
anchors.bottomMargin: 4
|
clearButtonShown: true
|
||||||
clip: true
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
Timer {
|
||||||
|
id: searchTimer
|
||||||
|
running: false
|
||||||
|
repeat: false
|
||||||
|
interval: 500
|
||||||
|
onTriggered: filterField.filterText = filterField.text
|
||||||
|
}
|
||||||
|
}
|
||||||
ListView {
|
ListView {
|
||||||
id: listView
|
id: listView
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: filterField.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
currentIndex : -1
|
currentIndex : -1
|
||||||
width: contentItem.width
|
width: contentItem.width
|
||||||
height: contentItem.height
|
height: contentItem.height
|
||||||
@ -106,13 +126,13 @@ CommonDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ScrollBar {
|
ScrollBar {
|
||||||
id: scrollBar
|
id: scrollBar
|
||||||
flickableItem: listView
|
flickableItem: listView
|
||||||
visible: listView.contentHeight > contentItem.height
|
visible: listView.contentHeight > contentItem.height
|
||||||
//platformInverted: root.platformInverted
|
//platformInverted: root.platformInverted
|
||||||
anchors { top: clipItem.top; right: clipItem.right }
|
anchors { top: contentItem.top; right: contentItem.right }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,22 +101,16 @@ Item {
|
|||||||
property string valueIndicatorText: value
|
property string valueIndicatorText: value
|
||||||
|
|
||||||
// Plasma API
|
// Plasma API
|
||||||
property bool animated: false
|
|
||||||
property alias inverted: range.inverted
|
property alias inverted: range.inverted
|
||||||
property bool updateValueWhileDragging: true
|
|
||||||
property real handleSize: 22
|
|
||||||
|
|
||||||
// Convenience API
|
width: contents.isVertical ? theme.defaultFont.mSize.height*1.6 : 200
|
||||||
property bool _isVertical: orientation == Qt.Vertical
|
height: contents.isVertical ? 200 : theme.defaultFont.mSize.height*1.6
|
||||||
|
|
||||||
width: _isVertical ? theme.defaultFont.mSize.height*1.8 : 200
|
|
||||||
height: _isVertical ? 200 : theme.defaultFont.mSize.height*1.8
|
|
||||||
// TODO: needs to define if there will be specific graphics for
|
// TODO: needs to define if there will be specific graphics for
|
||||||
// disabled sliders
|
// disabled sliders
|
||||||
opacity: enabled ? 1.0 : 0.5
|
opacity: enabled ? 1.0 : 0.5
|
||||||
|
|
||||||
Keys.onUpPressed: {
|
Keys.onUpPressed: {
|
||||||
if (!enabled || !_isVertical)
|
if (!enabled || !contents.isVertical)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (inverted)
|
if (inverted)
|
||||||
@ -129,7 +123,7 @@ Item {
|
|||||||
if (!enabled || !enabled)
|
if (!enabled || !enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_isVertical)
|
if (!contents.isVertical)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (inverted)
|
if (inverted)
|
||||||
@ -139,7 +133,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Keys.onLeftPressed: {
|
Keys.onLeftPressed: {
|
||||||
if (!enabled || _isVertical)
|
if (!enabled || contents.isVertical)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (inverted)
|
if (inverted)
|
||||||
@ -149,7 +143,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Keys.onRightPressed: {
|
Keys.onRightPressed: {
|
||||||
if (!enabled || _isVertical)
|
if (!enabled || contents.isVertical)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (inverted)
|
if (inverted)
|
||||||
@ -161,9 +155,17 @@ Item {
|
|||||||
Item {
|
Item {
|
||||||
id: contents
|
id: contents
|
||||||
|
|
||||||
width: _isVertical ? slider.height : slider.width
|
// Plasma API
|
||||||
height: _isVertical ? slider.width : slider.height
|
property bool animated: true
|
||||||
rotation: _isVertical ? -90 : 0
|
property bool updateValueWhileDragging: true
|
||||||
|
property real handleSize: theme.defaultFont.mSize.height*1.3
|
||||||
|
|
||||||
|
// Convenience API
|
||||||
|
property bool isVertical: orientation == Qt.Vertical
|
||||||
|
|
||||||
|
width: contents.isVertical ? slider.height : slider.width
|
||||||
|
height: contents.isVertical ? slider.width : slider.height
|
||||||
|
rotation: contents.isVertical ? -90 : 0
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
@ -224,8 +226,8 @@ Item {
|
|||||||
anchors {
|
anchors {
|
||||||
verticalCenter: groove.verticalCenter
|
verticalCenter: groove.verticalCenter
|
||||||
}
|
}
|
||||||
width: handleSize
|
width: contents.handleSize
|
||||||
height: handleSize
|
height: contents.handleSize
|
||||||
svg: PlasmaCore.Svg { imagePath: "widgets/slider" }
|
svg: PlasmaCore.Svg { imagePath: "widgets/slider" }
|
||||||
elementId: "horizontal-slider-handle"
|
elementId: "horizontal-slider-handle"
|
||||||
|
|
||||||
|
@ -108,5 +108,10 @@ Item {
|
|||||||
rightMargin: backgroundFrame.margins.right + buttonFrame.margins.right
|
rightMargin: backgroundFrame.margins.right + buttonFrame.margins.right
|
||||||
bottomMargin: backgroundFrame.margins.bottom + buttonFrame.margins.bottom
|
bottomMargin: backgroundFrame.margins.bottom + buttonFrame.margins.bottom
|
||||||
}
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (!root.currentTab) {
|
||||||
|
root.currentTab = tabBarLayout.children[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,8 +112,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (internal.tabGroup.currentTab == tab) {
|
if (internal.tabGroup && internal.tabGroup.currentTab == tab) {
|
||||||
parent.parent.currentTab = root
|
internal.tabGroup.currentTab = tab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,6 +276,11 @@ Item {
|
|||||||
visible: textEdit.text == "" && !textArea.activeFocus
|
visible: textEdit.text == "" && !textArea.activeFocus
|
||||||
opacity: 0.5
|
opacity: 0.5
|
||||||
}
|
}
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if (!textField.activeFocus) {
|
||||||
|
textInput.closeSoftwareInputPanel()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ Item {
|
|||||||
|
|
||||||
// TODO: fix default size
|
// TODO: fix default size
|
||||||
implicitWidth: theme.defaultFont.mSize.width*12
|
implicitWidth: theme.defaultFont.mSize.width*12
|
||||||
implicitHeight: theme.defaultFont.mSize.height*1.8
|
implicitHeight: theme.defaultFont.mSize.height*1.6
|
||||||
// TODO: needs to define if there will be specific graphics for
|
// TODO: needs to define if there will be specific graphics for
|
||||||
// disabled text fields
|
// disabled text fields
|
||||||
opacity: enabled ? 1.0 : 0.5
|
opacity: enabled ? 1.0 : 0.5
|
||||||
@ -227,12 +227,17 @@ Item {
|
|||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
// TODO: see what is the correct policy for margins
|
// TODO: see what is the correct policy for margins
|
||||||
leftMargin: 2 * base.margins.left
|
leftMargin: 2 * base.margins.left
|
||||||
rightMargin: 2 * base.margins.right
|
rightMargin: 2 * base.margins.right + (clearButton.opacity > 0 ? clearButton.width : 0)
|
||||||
}
|
}
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
color: theme.textColor
|
color: theme.textColor
|
||||||
enabled: textField.enabled
|
enabled: textField.enabled
|
||||||
clip: true
|
clip: true
|
||||||
|
onActiveFocusChanged: {
|
||||||
|
if (!textField.activeFocus) {
|
||||||
|
textInput.closeSoftwareInputPanel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Proxying keys events is not required by the
|
// Proxying keys events is not required by the
|
||||||
// common API but is desired in the plasma API.
|
// common API but is desired in the plasma API.
|
||||||
@ -241,6 +246,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.SvgItem {
|
PlasmaCore.SvgItem {
|
||||||
|
id: clearButton
|
||||||
svg: PlasmaCore.Svg {imagePath: "widgets/lineedit"}
|
svg: PlasmaCore.Svg {imagePath: "widgets/lineedit"}
|
||||||
elementId: "clearbutton"
|
elementId: "clearbutton"
|
||||||
width: textInput.height
|
width: textInput.height
|
||||||
|
@ -47,7 +47,7 @@ import org.kde.plasma.core 0.1 as PlasmaCore
|
|||||||
Item{
|
Item{
|
||||||
id: toolBar
|
id: toolBar
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: (tools && enabled) ? theme.defaultFont.mSize.height*2 + frameSvg.margins.top + frameSvg.margins.bottom : 0
|
height: (tools && enabled) ? tools.height + frameSvg.margins.top + frameSvg.margins.bottom : 0
|
||||||
visible: height > 0
|
visible: height > 0
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
@ -148,8 +148,7 @@ Item{
|
|||||||
|
|
||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
id: frameSvg
|
id: frameSvg
|
||||||
imagePath: "widgets/frame"
|
imagePath: "widgets/toolbar"
|
||||||
prefix: "raised"
|
|
||||||
anchors {
|
anchors {
|
||||||
fill: parent
|
fill: parent
|
||||||
leftMargin: -margins.left
|
leftMargin: -margins.left
|
||||||
|
@ -63,8 +63,8 @@ Item {
|
|||||||
|
|
||||||
// Commmon API
|
// Commmon API
|
||||||
property bool flat: true
|
property bool flat: true
|
||||||
property bool checked: false
|
property bool checked: defaultAction ? defaultAction.checked : false
|
||||||
property bool checkable: false
|
property bool checkable: defaultAction ? defaultAction.checkable : false
|
||||||
property alias pressed: mouse.pressed
|
property alias pressed: mouse.pressed
|
||||||
property alias text: label.text
|
property alias text: label.text
|
||||||
property alias iconSource: icon.source
|
property alias iconSource: icon.source
|
||||||
@ -72,6 +72,11 @@ Item {
|
|||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
|
// Plasma extensiuons
|
||||||
|
property QtObject defaultAction
|
||||||
|
|
||||||
|
|
||||||
|
enabled: defaultAction==undefined||defaultAction.enabled
|
||||||
|
|
||||||
onFlatChanged: {
|
onFlatChanged: {
|
||||||
surface.opacity = 1
|
surface.opacity = 1
|
||||||
@ -85,18 +90,19 @@ Item {
|
|||||||
return Math.max(theme.defaultFont.mSize.width*12, icon.width + label.paintedWidth + surface.margins.left + surface.margins.right) + ((icon.valid) ? surface.margins.left : 0)
|
return Math.max(theme.defaultFont.mSize.width*12, icon.width + label.paintedWidth + surface.margins.left + surface.margins.right) + ((icon.valid) ? surface.margins.left : 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
implicitHeight: Math.max(theme.defaultFont.mSize.height*1.8, Math.max(icon.height, label.paintedHeight) + surface.margins.top + surface.margins.bottom)
|
implicitHeight: Math.max(theme.defaultFont.mSize.height*1.6, Math.max(icon.height, label.paintedHeight) + surface.margins.top/2 + surface.margins.bottom/2)
|
||||||
|
|
||||||
// TODO: needs to define if there will be specific graphics for
|
// TODO: needs to define if there will be specific graphics for
|
||||||
// disabled buttons
|
// disabled buttons
|
||||||
opacity: enabled ? 1.0 : 0.5
|
opacity: enabled ? 1.0 : 0.5
|
||||||
|
|
||||||
Keys.onSpacePressed: internal.pressButton()
|
Keys.onSpacePressed: internal.userPressed = true
|
||||||
Keys.onReturnPressed: internal.pressButton()
|
Keys.onReturnPressed: internal.userPressed = true
|
||||||
Keys.onReleased: {
|
Keys.onReleased: {
|
||||||
|
internal.userPressed = false
|
||||||
if (event.key == Qt.Key_Space ||
|
if (event.key == Qt.Key_Space ||
|
||||||
event.key == Qt.Key_Return)
|
event.key == Qt.Key_Return)
|
||||||
internal.releaseButton()
|
internal.clickButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
@ -113,24 +119,24 @@ Item {
|
|||||||
id: internal
|
id: internal
|
||||||
property bool userPressed: false
|
property bool userPressed: false
|
||||||
|
|
||||||
function pressButton()
|
function clickButton()
|
||||||
{
|
{
|
||||||
userPressed = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function releaseButton()
|
|
||||||
{
|
|
||||||
userPressed = false
|
|
||||||
if (!button.enabled) {
|
if (!button.enabled) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button.checkable) {
|
if (defaultAction && defaultAction.checkable) {
|
||||||
|
defaultAction.checked = !defaultAction.checked
|
||||||
|
} else if (button.checkable) {
|
||||||
button.checked = !button.checked
|
button.checked = !button.checked
|
||||||
}
|
}
|
||||||
|
|
||||||
button.clicked()
|
button.clicked()
|
||||||
button.forceActiveFocus()
|
button.forceActiveFocus()
|
||||||
|
|
||||||
|
if (defaultAction) {
|
||||||
|
defaultAction.trigger()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +155,7 @@ Item {
|
|||||||
//internal: if there is no hover status, don't paint on mouse over in touchscreens
|
//internal: if there is no hover status, don't paint on mouse over in touchscreens
|
||||||
opacity: (internal.userPressed || checked || !flat || (shadow.hasOverState && mouse.containsMouse)) ? 1 : 0
|
opacity: (internal.userPressed || checked || !flat || (shadow.hasOverState && mouse.containsMouse)) ? 1 : 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
PropertyAnimation { duration: 250 }
|
PropertyAnimation { duration: 100 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +167,10 @@ Item {
|
|||||||
rightMargin: surface.margins.right
|
rightMargin: surface.margins.right
|
||||||
bottomMargin: surface.margins.bottom
|
bottomMargin: surface.margins.bottom
|
||||||
}
|
}
|
||||||
|
scale: internal.userPressed ? 0.9 : 1
|
||||||
|
Behavior on scale {
|
||||||
|
PropertyAnimation { duration: 250 }
|
||||||
|
}
|
||||||
|
|
||||||
IconLoader {
|
IconLoader {
|
||||||
id: icon
|
id: icon
|
||||||
@ -175,6 +185,12 @@ Item {
|
|||||||
Text {
|
Text {
|
||||||
id: label
|
id: label
|
||||||
|
|
||||||
|
//FIXME: why this is needed?
|
||||||
|
onPaintedWidthChanged: {
|
||||||
|
icon.anchors.horizontalCenter = label.paintedWidth > 0 ? undefined : icon.parent.horizontalCenter
|
||||||
|
icon.anchors.left = label.paintedWidth > 0 ? icon.parent.left : undefined
|
||||||
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
@ -202,9 +218,9 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
onPressed: internal.pressButton();
|
onPressed: internal.userPressed = true
|
||||||
|
onReleased: internal.userPressed = false
|
||||||
onReleased: internal.releaseButton();
|
onClicked: internal.clickButton()
|
||||||
|
|
||||||
onEntered: {
|
onEntered: {
|
||||||
if (!flat) {
|
if (!flat) {
|
||||||
|
@ -6,31 +6,26 @@ ButtonColumn 0.1 ButtonColumn.qml
|
|||||||
ButtonGroup 0.1 ButtonGroup.js
|
ButtonGroup 0.1 ButtonGroup.js
|
||||||
ButtonRow 0.1 ButtonRow.qml
|
ButtonRow 0.1 ButtonRow.qml
|
||||||
CheckBox 0.1 CheckBox.qml
|
CheckBox 0.1 CheckBox.qml
|
||||||
FlashingLabel 0.1 FlashingLabel.qml
|
CommonDialog 0.1 CommonDialog.qml
|
||||||
Frame 0.1 Frame.qml
|
Dialog 0.1 Dialog.qml
|
||||||
Highlight 0.1 Highlight.qml
|
Highlight 0.1 Highlight.qml
|
||||||
IconWidget 0.1 IconWidget.qml
|
|
||||||
Label 0.1 Label.qml
|
Label 0.1 Label.qml
|
||||||
|
ListItem 0.1 ListItem.qml
|
||||||
|
Page 0.1 Page.qml
|
||||||
|
PageStack 0.1 PageStack.qml
|
||||||
ProgressBar 0.1 ProgressBar.qml
|
ProgressBar 0.1 ProgressBar.qml
|
||||||
PushButton 0.1 PushButton.qml
|
PushButton 0.1 PushButton.qml
|
||||||
RadioButton 0.1 RadioButton.qml
|
RadioButton 0.1 RadioButton.qml
|
||||||
ScrollBar 0.1 ScrollBar.qml
|
ScrollBar 0.1 ScrollBar.qml
|
||||||
|
SectionScroller 0.1 SectionScroller.qml
|
||||||
|
SelectionDialog 0.1 SelectionDialog.qml
|
||||||
Slider 0.1 Slider.qml
|
Slider 0.1 Slider.qml
|
||||||
Switch 0.1 Switch.qml
|
Switch 0.1 Switch.qml
|
||||||
TextArea 0.1 TextArea.qml
|
|
||||||
TextField 0.1 TextField.qml
|
|
||||||
ToolBar 0.1 ToolBar.qml
|
|
||||||
ToolButton 0.1 ToolButton.qml
|
|
||||||
ListItem 0.1 ListItem.qml
|
|
||||||
|
|
||||||
CommonDialog 0.1 CommonDialog.qml
|
|
||||||
SelectionDialog 0.1 SelectionDialog.qml
|
|
||||||
ToolBarLayout 0.1 ToolBarLayout.qml
|
|
||||||
|
|
||||||
Page 0.1 Page.qml
|
|
||||||
PageStack 0.1 PageStack.qml
|
|
||||||
|
|
||||||
TabBar 0.1 TabBar.qml
|
TabBar 0.1 TabBar.qml
|
||||||
TabButton 0.1 TabButton.qml
|
TabButton 0.1 TabButton.qml
|
||||||
TabGroup 0.1 TabGroup.qml
|
TabGroup 0.1 TabGroup.qml
|
||||||
SectionScroller 0.1 SectionScroller.qml
|
TextArea 0.1 TextArea.qml
|
||||||
|
TextField 0.1 TextField.qml
|
||||||
|
ToolBar 0.1 ToolBar.qml
|
||||||
|
ToolBarLayout 0.1 ToolBarLayout.qml
|
||||||
|
ToolButton 0.1 ToolButton.qml
|
||||||
|
@ -13,6 +13,7 @@ Name[en_GB]=plasma-kpart
|
|||||||
Name[es]=plasma-kpart
|
Name[es]=plasma-kpart
|
||||||
Name[et]=plasma-kpart
|
Name[et]=plasma-kpart
|
||||||
Name[eu]=plasma-kpart
|
Name[eu]=plasma-kpart
|
||||||
|
Name[fa]=plasma-kpart
|
||||||
Name[fi]=plasma-kpart
|
Name[fi]=plasma-kpart
|
||||||
Name[fr]=plasma-kpart
|
Name[fr]=plasma-kpart
|
||||||
Name[he]=plasma-kpart
|
Name[he]=plasma-kpart
|
||||||
@ -28,6 +29,7 @@ Name[km]=plasma-kpart
|
|||||||
Name[kn]=plasma-kpart
|
Name[kn]=plasma-kpart
|
||||||
Name[ko]=plasma-kpart
|
Name[ko]=plasma-kpart
|
||||||
Name[lt]=plasma-kpart
|
Name[lt]=plasma-kpart
|
||||||
|
Name[lv]=plasma-kpart
|
||||||
Name[nb]=plasma-kpart
|
Name[nb]=plasma-kpart
|
||||||
Name[nds]=Kpart för Plasma
|
Name[nds]=Kpart för Plasma
|
||||||
Name[nl]=plasma-kpart
|
Name[nl]=plasma-kpart
|
||||||
|
@ -87,6 +87,7 @@ Description[kk]=Қашықтағы Plasma виджеттер ережелері
|
|||||||
Description[km]=ការពារប្រព័ន្ធមិនឲ្យរក្សាទុកគោលនយោបាយរបស់ធាតុក្រាហ្វិកប្លាស្មាពីចម្ងាយ
|
Description[km]=ការពារប្រព័ន្ធមិនឲ្យរក្សាទុកគោលនយោបាយរបស់ធាតុក្រាហ្វិកប្លាស្មាពីចម្ងាយ
|
||||||
Description[ko]=Plasma 원격 위젯 정책을 저장하지 못하도록 합니다
|
Description[ko]=Plasma 원격 위젯 정책을 저장하지 못하도록 합니다
|
||||||
Description[lt]=Neleidžia sistemai išsaugoti nutolusių plazmos valdiklių taisyklių
|
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[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[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
|
Description[nl]=Voorkomt het opslaan door het systeem van beleidsregels voor widgets op afstand
|
||||||
|
@ -21,11 +21,15 @@
|
|||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
#include <KDesktopFile>
|
||||||
#include <KGlobalSettings>
|
#include <KGlobalSettings>
|
||||||
|
#include <KIO/CopyJob>
|
||||||
#include <KIO/Job>
|
#include <KIO/Job>
|
||||||
#include <KRun>
|
#include <KRun>
|
||||||
#include <KStandardDirs>
|
#include <KStandardDirs>
|
||||||
|
|
||||||
|
#include <Plasma/Package>
|
||||||
|
|
||||||
QScriptValue ScriptEnv::openUrl(QScriptContext *context, QScriptEngine *engine)
|
QScriptValue ScriptEnv::openUrl(QScriptContext *context, QScriptEngine *engine)
|
||||||
{
|
{
|
||||||
Q_UNUSED(engine)
|
Q_UNUSED(engine)
|
||||||
@ -87,6 +91,67 @@ QScriptValue ScriptEnv::getUrl(QScriptContext *context, QScriptEngine *engine)
|
|||||||
return engine->newQObject(job);
|
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)
|
QScriptValue ScriptEnv::userDataPath(QScriptContext *context, QScriptEngine *engine)
|
||||||
{
|
{
|
||||||
Q_UNUSED(engine)
|
Q_UNUSED(engine)
|
||||||
|
@ -68,7 +68,6 @@ void ScriptEnv::setupGlobalObject()
|
|||||||
// property is hidden from scripts.
|
// property is hidden from scripts.
|
||||||
global.setProperty("__plasma_scriptenv", m_engine->newQObject(this),
|
global.setProperty("__plasma_scriptenv", m_engine->newQObject(this),
|
||||||
QScriptValue::ReadOnly|QScriptValue::Undeletable|QScriptValue::SkipInEnumeration);
|
QScriptValue::ReadOnly|QScriptValue::Undeletable|QScriptValue::SkipInEnumeration);
|
||||||
|
|
||||||
// Add utility functions
|
// Add utility functions
|
||||||
#ifndef DECLARATIVE
|
#ifndef DECLARATIVE
|
||||||
global.setProperty("print", m_engine->newFunction(ScriptEnv::print));
|
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("userDataPath", m_engine->newFunction(ScriptEnv::userDataPath));
|
||||||
obj.setProperty("runCommand", m_engine->newFunction(ScriptEnv::runCommand));
|
obj.setProperty("runCommand", m_engine->newFunction(ScriptEnv::runCommand));
|
||||||
return true;
|
return true;
|
||||||
|
} else if ("download" == extension) {
|
||||||
|
obj.setProperty("download", m_engine->newFunction(ScriptEnv::download));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
|
|
||||||
#include "authorization.h"
|
#include "authorization.h"
|
||||||
|
|
||||||
|
namespace Plasma
|
||||||
|
{
|
||||||
|
class Package;
|
||||||
|
} // namespace Plasma
|
||||||
|
|
||||||
class ScriptEnv : public QObject
|
class ScriptEnv : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -87,6 +92,7 @@ private:
|
|||||||
static QScriptValue applicationExists(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue applicationExists(QScriptContext *context, QScriptEngine *engine);
|
||||||
static QScriptValue openUrl(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue openUrl(QScriptContext *context, QScriptEngine *engine);
|
||||||
static QScriptValue getUrl(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 userDataPath(QScriptContext *context, QScriptEngine *engine);
|
||||||
static QScriptValue listAddons(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue listAddons(QScriptContext *context, QScriptEngine *engine);
|
||||||
static QScriptValue loadAddon(QScriptContext *context, QScriptEngine *engine);
|
static QScriptValue loadAddon(QScriptContext *context, QScriptEngine *engine);
|
||||||
|
@ -13,6 +13,7 @@ Name[en_GB]=Plasma JavaScript Addon
|
|||||||
Name[es]=Complemento de JavaScript para Plasma
|
Name[es]=Complemento de JavaScript para Plasma
|
||||||
Name[et]=Plasma JavaScripti lisa
|
Name[et]=Plasma JavaScripti lisa
|
||||||
Name[eu]=Plasma JavaScript gehigarria
|
Name[eu]=Plasma JavaScript gehigarria
|
||||||
|
Name[fa]=افزودنی جاوااسکریپت پلاسما
|
||||||
Name[fi]=Plasma JavaScript -lisäosa
|
Name[fi]=Plasma JavaScript -lisäosa
|
||||||
Name[fr]=Module complémentaire Javascript de Plasma
|
Name[fr]=Module complémentaire Javascript de Plasma
|
||||||
Name[he]=תוסף עבור JavaScript של Plasma
|
Name[he]=תוסף עבור JavaScript של Plasma
|
||||||
@ -28,6 +29,7 @@ Name[km]=ផ្នែកបន្ថែម Plasma JavaScript
|
|||||||
Name[kn]=ಪ್ಲಾಸ್ಮಾ ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಆಡ್ಆನ್
|
Name[kn]=ಪ್ಲಾಸ್ಮಾ ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಆಡ್ಆನ್
|
||||||
Name[ko]=Plasma 자바스크립트 추가 기능
|
Name[ko]=Plasma 자바스크립트 추가 기능
|
||||||
Name[lt]=Plasma JavaScript priedas
|
Name[lt]=Plasma JavaScript priedas
|
||||||
|
Name[lv]=Plasma JavaScript papildinājums
|
||||||
Name[nb]=Plasma JavaScript-tillegg
|
Name[nb]=Plasma JavaScript-tillegg
|
||||||
Name[nds]=JavaScript-Verwiedern för Plasma
|
Name[nds]=JavaScript-Verwiedern för Plasma
|
||||||
Name[nl]=Addon voor Plasma JavaScript
|
Name[nl]=Addon voor Plasma JavaScript
|
||||||
|
@ -13,6 +13,7 @@ Name[en_GB]=Javascript Addon
|
|||||||
Name[es]=Complemento de JavaScript
|
Name[es]=Complemento de JavaScript
|
||||||
Name[et]=JavaScripti lisa
|
Name[et]=JavaScripti lisa
|
||||||
Name[eu]=Javascript gehigarria
|
Name[eu]=Javascript gehigarria
|
||||||
|
Name[fa]=افزودنی جاوااسکریپت
|
||||||
Name[fi]=Javascript-lisäosa
|
Name[fi]=Javascript-lisäosa
|
||||||
Name[fr]=Module complémentaire Javascript
|
Name[fr]=Module complémentaire Javascript
|
||||||
Name[he]=תוסף JavaScript
|
Name[he]=תוסף JavaScript
|
||||||
@ -28,6 +29,7 @@ Name[km]=ផ្នែកបន្ថែម Javascript
|
|||||||
Name[kn]=ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಆಡ್ಆನ್
|
Name[kn]=ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಆಡ್ಆನ್
|
||||||
Name[ko]=자바스크립트 추가 기능
|
Name[ko]=자바스크립트 추가 기능
|
||||||
Name[lt]=Javascript priedas
|
Name[lt]=Javascript priedas
|
||||||
|
Name[lv]=JavaScript papildinājums
|
||||||
Name[nb]=JavaScript-tillegg
|
Name[nb]=JavaScript-tillegg
|
||||||
Name[nds]=JavaScript-Verwiedern
|
Name[nds]=JavaScript-Verwiedern
|
||||||
Name[nl]=Addon voor JavaScript
|
Name[nl]=Addon voor JavaScript
|
||||||
@ -82,6 +84,7 @@ Comment[kk]=Javascript Plasma плагиніне қосымшасы
|
|||||||
Comment[km]=កម្មវិធីបន្ថែមសម្រាប់កម្មវិធីជំនួយ Javascript Plasma
|
Comment[km]=កម្មវិធីបន្ថែមសម្រាប់កម្មវិធីជំនួយ Javascript Plasma
|
||||||
Comment[ko]=자바스크립트 Plasma 플러그인을 위한 추가 기능
|
Comment[ko]=자바스크립트 Plasma 플러그인을 위한 추가 기능
|
||||||
Comment[lt]=Javascript Plasma papildinio priedai
|
Comment[lt]=Javascript Plasma papildinio priedai
|
||||||
|
Comment[lv]=Papildinājumi Javascript Plasma spraudņiem
|
||||||
Comment[nb]=Tillegg for JavaSript Plasma-programtillegg
|
Comment[nb]=Tillegg for JavaSript Plasma-programtillegg
|
||||||
Comment[nds]=Verwiedern för Plasma sien JavaScript-Modulen
|
Comment[nds]=Verwiedern för Plasma sien JavaScript-Modulen
|
||||||
Comment[nl]=Addons voor Javascript Plasma plugins
|
Comment[nl]=Addons voor Javascript Plasma plugins
|
||||||
|
@ -24,6 +24,7 @@ Name[kk]=Мәлімдеме виджеті
|
|||||||
Name[km]=ធាតុក្រាហ្វិកដែលប្រកាស
|
Name[km]=ធាតុក្រាហ្វិកដែលប្រកាស
|
||||||
Name[ko]=Declarative 위젯
|
Name[ko]=Declarative 위젯
|
||||||
Name[lt]=Deklaratyvus valdiklis
|
Name[lt]=Deklaratyvus valdiklis
|
||||||
|
Name[lv]=Deklaratīvais sīkrīks
|
||||||
Name[nb]=Deklarativt skjermelement
|
Name[nb]=Deklarativt skjermelement
|
||||||
Name[nds]=Stüerelement för Verkloren
|
Name[nds]=Stüerelement för Verkloren
|
||||||
Name[nl]=Widget voor declaratie
|
Name[nl]=Widget voor declaratie
|
||||||
@ -77,6 +78,7 @@ Comment[km]=ធាតុក្រាហ្វិកប្លាស្
|
|||||||
Comment[kn]=QML ಹಾಗು ಜಾವಾ ಸ್ಕ್ರಿಪ್ಟ್ ನಲ್ಲಿ ಬರೆಯಲಾದ ಸ್ವಾಭಾವಿಕ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
|
Comment[kn]=QML ಹಾಗು ಜಾವಾ ಸ್ಕ್ರಿಪ್ಟ್ ನಲ್ಲಿ ಬರೆಯಲಾದ ಸ್ವಾಭಾವಿಕ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
|
||||||
Comment[ko]=QML과 자바스크립트로 작성된 Plasma 위젯
|
Comment[ko]=QML과 자바스크립트로 작성된 Plasma 위젯
|
||||||
Comment[lt]=Nuosavas Plasma valdiklis parašytas QML ir JavaScript kalba
|
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[nb]=Plasmaelement for dette systemet, skrevet i QML og JavaScript
|
||||||
Comment[nds]=En orginaal Plasmaelement, schreven in QML un JavaScript
|
Comment[nds]=En orginaal Plasmaelement, schreven in QML un JavaScript
|
||||||
Comment[nl]=Hier thuishorend Plasma-widget geschreven in QML en JavaScript
|
Comment[nl]=Hier thuishorend Plasma-widget geschreven in QML en JavaScript
|
||||||
|
@ -18,6 +18,7 @@ Name[eo]=Ĝavaskripta fenestraĵo
|
|||||||
Name[es]=Elemento gráfico JavaScript
|
Name[es]=Elemento gráfico JavaScript
|
||||||
Name[et]=JavaScripti vidin
|
Name[et]=JavaScripti vidin
|
||||||
Name[eu]=JavaScript trepeta
|
Name[eu]=JavaScript trepeta
|
||||||
|
Name[fa]=ویجت جاوااسکریپت
|
||||||
Name[fi]=JavaScript-sovelma
|
Name[fi]=JavaScript-sovelma
|
||||||
Name[fr]=Composant graphique JavaScript
|
Name[fr]=Composant graphique JavaScript
|
||||||
Name[fy]=JavaSkript Widget
|
Name[fy]=JavaSkript Widget
|
||||||
|
@ -16,6 +16,7 @@ Name[eo]=Ĝavaskripta Datummodulo
|
|||||||
Name[es]=Motor de datos JavaScript
|
Name[es]=Motor de datos JavaScript
|
||||||
Name[et]=JavaScripti andmemootor
|
Name[et]=JavaScripti andmemootor
|
||||||
Name[eu]=JavaScript datu-motorea
|
Name[eu]=JavaScript datu-motorea
|
||||||
|
Name[fa]=موتور دادهی جاوااسکریپت
|
||||||
Name[fi]=JavaScript-datakone
|
Name[fi]=JavaScript-datakone
|
||||||
Name[fr]=Moteur de données JavaScript
|
Name[fr]=Moteur de données JavaScript
|
||||||
Name[fy]=JavaSkript gegevens motor
|
Name[fy]=JavaSkript gegevens motor
|
||||||
|
@ -76,7 +76,6 @@ QNetworkReply *PackageAccessManager::createRequest(QNetworkAccessManager::Operat
|
|||||||
(!m_auth->authorizeRequiredExtension("networkio"))) {
|
(!m_auth->authorizeRequiredExtension("networkio"))) {
|
||||||
return new ErrorReply(op, req);
|
return new ErrorReply(op, req);
|
||||||
} else {
|
} else {
|
||||||
return KIO::AccessManager::createRequest(op, req, outgoingData);
|
|
||||||
#ifndef PLASMA_NO_KIO
|
#ifndef PLASMA_NO_KIO
|
||||||
return KIO::AccessManager::createRequest(op, req, outgoingData);
|
return KIO::AccessManager::createRequest(op, req, outgoingData);
|
||||||
#else
|
#else
|
||||||
|
@ -22,12 +22,14 @@
|
|||||||
#include "appletinterface.h"
|
#include "appletinterface.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QScriptEngine>
|
#include <QScriptEngine>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include <KDebug>
|
#include <KDebug>
|
||||||
|
#include <KGlobalSettings>
|
||||||
#include <KIcon>
|
#include <KIcon>
|
||||||
#include <KService>
|
#include <KService>
|
||||||
#include <KServiceTypeTrader>
|
#include <KServiceTypeTrader>
|
||||||
@ -412,6 +414,23 @@ AppletInterface::ItemStatus AppletInterface::status() const
|
|||||||
return (AppletInterface::ItemStatus)((int)(applet()->status()));
|
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()
|
void AppletInterface::gc()
|
||||||
{
|
{
|
||||||
QTimer::singleShot(0, m_appletScriptEngine, SLOT(collectGarbage()));
|
QTimer::singleShot(0, m_appletScriptEngine, SLOT(collectGarbage()));
|
||||||
@ -421,6 +440,7 @@ void AppletInterface::gc()
|
|||||||
PopupAppletInterface::PopupAppletInterface(AbstractJsAppletScript *parent)
|
PopupAppletInterface::PopupAppletInterface(AbstractJsAppletScript *parent)
|
||||||
: APPLETSUPERCLASS(parent)
|
: APPLETSUPERCLASS(parent)
|
||||||
{
|
{
|
||||||
|
connect(m_appletScriptEngine, SIGNAL(popupEvent(bool)), this, SIGNAL(popupEvent(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupAppletInterface::setPopupIcon(const QIcon &icon)
|
void PopupAppletInterface::setPopupIcon(const QIcon &icon)
|
||||||
|
@ -304,6 +304,9 @@ enum IntervalAlignment {
|
|||||||
void setStatus(const ItemStatus &status);
|
void setStatus(const ItemStatus &status);
|
||||||
ItemStatus status() const;
|
ItemStatus status() const;
|
||||||
|
|
||||||
|
// Q_INVOKABLE QString downloadPath(const QString &file);
|
||||||
|
Q_INVOKABLE QStringList downloadedFiles() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void releaseVisualFocus();
|
void releaseVisualFocus();
|
||||||
void configNeedsSaving();
|
void configNeedsSaving();
|
||||||
@ -367,6 +370,9 @@ public:
|
|||||||
void setPopupWidget(QGraphicsWidget *widget);
|
void setPopupWidget(QGraphicsWidget *widget);
|
||||||
QGraphicsWidget *popupWidget();
|
QGraphicsWidget *popupWidget();
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void popupEvent(bool);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void setPopupIconByName(const QString &name);
|
void setPopupIconByName(const QString &name);
|
||||||
void togglePopup();
|
void togglePopup();
|
||||||
|
@ -390,6 +390,10 @@ void DeclarativeAppletScript::setupObjects()
|
|||||||
|
|
||||||
QScriptValue global = m_engine->globalObject();
|
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 = m_engine->newQObject(m_interface);
|
||||||
m_self.setScope(global);
|
m_self.setScope(global);
|
||||||
global.setProperty("plasmoid", m_self);
|
global.setProperty("plasmoid", m_self);
|
||||||
|
@ -510,6 +510,10 @@ void SimpleJavaScriptApplet::setupObjects()
|
|||||||
global.setProperty("AnimationGroup", m_engine->newFunction(SimpleJavaScriptApplet::animationGroup));
|
global.setProperty("AnimationGroup", m_engine->newFunction(SimpleJavaScriptApplet::animationGroup));
|
||||||
global.setProperty("ParallelAnimationGroup", m_engine->newFunction(SimpleJavaScriptApplet::parallelAnimationGroup));
|
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
|
// Bindings for data engine
|
||||||
|
|
||||||
bindI18N(m_engine);
|
bindI18N(m_engine);
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
|
|
||||||
#include <QtCore/QSharedData>
|
#include <QtCore/QSharedData>
|
||||||
|
|
||||||
|
#include <QPixmap>
|
||||||
|
Q_DECLARE_METATYPE(QPixmap*)
|
||||||
|
Q_DECLARE_METATYPE(QPixmap)
|
||||||
|
|
||||||
#define DECLARE_SELF(Class, __fn__) \
|
#define DECLARE_SELF(Class, __fn__) \
|
||||||
Class* self = qscriptvalue_cast<Class*>(ctx->thisObject()); \
|
Class* self = qscriptvalue_cast<Class*>(ctx->thisObject()); \
|
||||||
if (!self) { \
|
if (!self) { \
|
||||||
|
@ -50,6 +50,14 @@ static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
{
|
{
|
||||||
if (ctx->argumentCount() > 0) {
|
if (ctx->argumentCount() > 0) {
|
||||||
QPaintDevice *device = qscriptvalue_cast<QPaintDevice*>(ctx->argument(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));
|
return newPainter(eng, new QPainter(device));
|
||||||
} else {
|
} else {
|
||||||
return newPainter(eng, new QPainter());
|
return newPainter(eng, new QPainter());
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#include "backportglobal.h"
|
#include "backportglobal.h"
|
||||||
#include "plasmoid/appletinterface.h"
|
#include "plasmoid/appletinterface.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QPixmap*)
|
|
||||||
Q_DECLARE_METATYPE(QPixmap)
|
|
||||||
|
|
||||||
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
if (ctx->argumentCount() == 1 && ctx->argument(0).isString()) {
|
if (ctx->argumentCount() == 1 && ctx->argument(0).isString()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user