diff --git a/declarativeimports/core/datamodel.h b/declarativeimports/core/datamodel.h index 719500061..780ea6144 100644 --- a/declarativeimports/core/datamodel.h +++ b/declarativeimports/core/datamodel.h @@ -38,12 +38,34 @@ class DataModel; class SortFilterModel : public QSortFilterProxyModel { Q_OBJECT + /** + * The source model of this sorting proxy model. It has to inherit QAbstractItemModel (ListModel is not supported) + */ Q_PROPERTY(QObject *sourceModel READ sourceModel WRITE setModel) + /** + * The regular expression for the filter, only items with their filterRole matching filterRegExp will be displayed + */ Q_PROPERTY(QString filterRegExp READ filterRegExp WRITE setFilterRegExp) + + /** + * The role of the sourceModel on which filterRegExp must be applied. + */ Q_PROPERTY(QString filterRole READ filterRole WRITE setFilterRole) + + /** + * The role of the sourceModel that will be used for sorting. if empty the order will be left unaltered + */ Q_PROPERTY(QString sortRole READ sortRole WRITE setSortRole) + + /** + * One of Qt.Ascending or Qt.Descending + */ Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder) + + /** + * How many items are in this model + */ Q_PROPERTY(int count READ count NOTIFY countChanged) friend class DataModel; @@ -68,6 +90,13 @@ public: int count() const {return QSortFilterProxyModel::rowCount();} + /** + * Returns the item at index in the list model. + * This allows the item data to be accessed (but not modified) from JavaScript. + * It returns an Object with a property for each role. + * + * @arg int i the row we want + */ Q_INVOKABLE QVariantHash get(int i) const; Q_SIGNALS: @@ -88,9 +117,26 @@ private: class DataModel : public QAbstractItemModel { Q_OBJECT + + /** + * The instance of DataSource to construct this model on + */ Q_PROPERTY(QObject *dataSource READ dataSource WRITE setDataSource) + + /** + * It's a regular expression. Only data with keys that match this filter expression will be inserted in the model + */ Q_PROPERTY(QString keyRoleFilter READ keyRoleFilter WRITE setKeyRoleFilter) + + /** + * it's a regular expression. If the DataSource is connected to more than one source, only inserts data from sources matching this filter expression in the model. + * If we want to have a source watch all sources beginning with say "name:", the required regexp would be sourceFilter: "name:.*" + */ Q_PROPERTY(QString sourceFilter READ sourceFilter WRITE setSourceFilter) + + /** + * How many items are in this model + */ Q_PROPERTY(int count READ count NOTIFY countChanged) public: @@ -126,6 +172,13 @@ public: int count() const {return countItems();} + /** + * Returns the item at index in the list model. + * This allows the item data to be accessed (but not modified) from JavaScript. + * It returns an Object with a property for each role. + * + * @arg int i the row we want + */ Q_INVOKABLE QVariantHash get(int i) const; protected: diff --git a/declarativeimports/core/datasource.h b/declarativeimports/core/datasource.h index 371fd6e3a..f32fc877a 100644 --- a/declarativeimports/core/datasource.h +++ b/declarativeimports/core/datasource.h @@ -54,31 +54,61 @@ public: DataSource(QObject* parent=0); + /** + * true if the connection to the Plasma DataEngine is valid + */ Q_PROPERTY(bool valid READ valid) bool valid() const {return m_dataEngine && m_dataEngine->isValid();} + /** + * Polling interval in milliseconds when the data will be fetched again. If 0 no polling will be done. + */ Q_PROPERTY(int interval READ interval WRITE setInterval NOTIFY intervalChanged) int interval() const {return m_interval;} void setInterval(const int interval); + /** + * Plugin name of the Plasma DataEngine + */ Q_PROPERTY(QString dataEngine READ engine WRITE setEngine NOTIFY engineChanged) Q_PROPERTY(QString engine READ engine WRITE setEngine NOTIFY engineChanged) QString engine() const {return m_engine;} void setEngine(const QString &e); + /** + * String array of all the source names connected to the DataEngine + */ Q_PROPERTY(QStringList connectedSources READ connectedSources WRITE setConnectedSources NOTIFY connectedSourcesChanged) QStringList connectedSources() const {return m_connectedSources;} void setConnectedSources(const QStringList &s); + /** + * Read only string array of all the sources available from the DataEngine (connected or not) + */ Q_PROPERTY(QStringList sources READ sources NOTIFY sourcesChanged) QStringList sources() const {if (m_dataEngine) return m_dataEngine->sources(); else return QStringList();} + /** + * All the data fetched by this dataengine. + * This is an hash of hashes. At the first level, there are the source names, at the secons, they keys set by the DataEngine + */ Q_PROPERTY(QVariantHash data READ data NOTIFY dataChanged); QVariantHash data() const {return m_data;} + /** + * @returns a Plasma::Service given a source name + * @arg QString source source name we want a service of + */ Q_INVOKABLE Plasma::Service *serviceForSource(const QString &source); + /** + * Connect a new source. It adds it to connectedSources + */ Q_INVOKABLE void connectSource(const QString &source); + + /** + * Disconnects from a DataEngine Source. It also removes it from connectedSources + */ Q_INVOKABLE void disconnectSource(const QString &source); protected Q_SLOTS: diff --git a/declarativeimports/core/declarativeitemcontainer.cpp b/declarativeimports/core/declarativeitemcontainer.cpp index 4d5ed88e1..ef0eb77d0 100644 --- a/declarativeimports/core/declarativeitemcontainer.cpp +++ b/declarativeimports/core/declarativeitemcontainer.cpp @@ -59,6 +59,11 @@ void DeclarativeItemContainer::resizeEvent(QGraphicsSceneResizeEvent *event) } } +void DeclarativeItemContainer::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + event->ignore(); +} + void DeclarativeItemContainer::widthChanged() { if (!m_declarativeItem) { diff --git a/declarativeimports/core/declarativeitemcontainer_p.h b/declarativeimports/core/declarativeitemcontainer_p.h index a92ce19bb..d900fff94 100644 --- a/declarativeimports/core/declarativeitemcontainer_p.h +++ b/declarativeimports/core/declarativeitemcontainer_p.h @@ -39,6 +39,7 @@ public: protected: void resizeEvent(QGraphicsSceneResizeEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *event); protected Q_SLOTS: void widthChanged(); diff --git a/declarativeimports/core/dialog.cpp b/declarativeimports/core/dialog.cpp index 7327503cf..1d6c2ca1d 100644 --- a/declarativeimports/core/dialog.cpp +++ b/declarativeimports/core/dialog.cpp @@ -237,6 +237,10 @@ QPoint DialogProxy::popupPosition(QGraphicsObject *item, int alignment) return corona->popupPosition(actualItem, m_dialog->size(), (Qt::AlignmentFlag)alignment); } else { + if (!actualItem->scene()) { + return QPoint(); + } + QList views = actualItem->scene()->views(); diff --git a/declarativeimports/core/dialog.h b/declarativeimports/core/dialog.h index 50158a45c..33ab07af2 100644 --- a/declarativeimports/core/dialog.h +++ b/declarativeimports/core/dialog.h @@ -38,9 +38,24 @@ class DialogMargins : public QObject { Q_OBJECT + /** + * Width in pixels of the left margin + */ Q_PROPERTY(int left READ left NOTIFY leftChanged) + + /** + * Height in pixels of the top margin + */ Q_PROPERTY(int top READ top NOTIFY topChanged) + + /** + * Width in pixels of the right margin + */ Q_PROPERTY(int right READ right NOTIFY rightChanged) + + /** + * Height in pixels of the bottom margin + */ Q_PROPERTY(int bottom READ bottom NOTIFY bottomChanged) public: @@ -73,16 +88,56 @@ class DialogProxy : public QObject { Q_OBJECT + /** + * The main QML item that will be displayed in the Dialog + */ Q_PROPERTY(QGraphicsObject *mainItem READ mainItem WRITE setMainItem NOTIFY mainItemChanged) + + /** + * Visibility of the Dialog window. Doesn't have anything to do with the visibility of the mainItem. + */ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) + + /** + * X position of the dialog window in screen coordinates. + */ Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged) + + /** + * X position of the dialog window in screen coordinates. + */ Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged) //to set the size try to force doing so from the inner item + + /** + * Read only width of the dialog window. It depends from the width of the mainItem + */ Q_PROPERTY(int width READ width NOTIFY widthChanged) + + /** + * Read only height of the dialog window. It depends from the height of the mainItem + */ Q_PROPERTY(int height READ height NOTIFY heightChanged) + + /** + * Window flags of the Dialog window + */ Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags) + + /** + * Margins of the dialog around the mainItem. + * @see DialogMargins + */ Q_PROPERTY(QObject *margins READ margins CONSTANT) + + /** + * True if the dialog window is the active one in the window manager. + */ Q_PROPERTY(bool activeWindow READ isActiveWindow NOTIFY activeWindowChanged) + + /** + * Plasma Location of the dialog window. Useful if this dialog is apopup for a panel + */ Q_PROPERTY(int location READ location WRITE setLocation NOTIFY locationChanged) public: @@ -110,6 +165,10 @@ public: bool isActiveWindow() const; + /** + * Ask the window manager to activate the window. + * The window manager may or may not accept the activiation request + */ Q_INVOKABLE void activateWindow(); //FIXME: passing an int is ugly @@ -128,6 +187,13 @@ public: */ //FIXME: alignment should be Qt::AlignmentFlag Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item, int alignment=Qt::AlignLeft) ; + + /** + * Set a Qt.WidgetAttribute to the dialog window + * + * @arg int attribute see Qt.WidgetAttribute + * @arg bool on activate or deactivate the atrtibute + */ //FIXME:: Qt::WidgetAttribute should be already Q_INVOKABLE void setAttribute(int attribute, bool on); diff --git a/declarativeimports/core/framesvgitem.h b/declarativeimports/core/framesvgitem.h index f6cf16284..7baf0cf3c 100644 --- a/declarativeimports/core/framesvgitem.h +++ b/declarativeimports/core/framesvgitem.h @@ -31,9 +31,24 @@ class FrameSvgItemMargins : public QObject { Q_OBJECT + /** + * width in pixels of the left margin + */ Q_PROPERTY(qreal left READ left NOTIFY marginsChanged) + + /** + * height in pixels of the top margin + */ Q_PROPERTY(qreal top READ top NOTIFY marginsChanged) + + /** + * width in pixels of the right margin + */ Q_PROPERTY(qreal right READ right NOTIFY marginsChanged) + + /** + * height in pixels of the bottom margin + */ Q_PROPERTY(qreal bottom READ bottom NOTIFY marginsChanged) public: @@ -55,11 +70,33 @@ class FrameSvgItem : public QDeclarativeItem { Q_OBJECT + /** + * Theme relative path of the svg, like "widgets/background" + */ Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath) + + /** + * prefix for the 9 piece svg, like "pushed" or "normal" for the button + * see http://techbase.kde.org/Development/Tutorials/Plasma/ThemeDetails + * for a list of paths and prefixes + */ Q_PROPERTY(QString prefix READ prefix WRITE setPrefix) + + /** + * The margins of the frame, read only + * @see FrameSvgItemMargins + */ Q_PROPERTY(QObject *margins READ margins CONSTANT) Q_FLAGS(Plasma::FrameSvg::EnabledBorders) + /** + * The borders that will be rendered, it's a flag combination of: + * NoBorder + * TopBorder + * BottomBorder + * LeftBorder + * RightBorder + */ Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders) public: diff --git a/declarativeimports/core/svgitem.h b/declarativeimports/core/svgitem.h index d9ad33e33..21dac7015 100644 --- a/declarativeimports/core/svgitem.h +++ b/declarativeimports/core/svgitem.h @@ -29,9 +29,31 @@ class SvgItem : public QDeclarativeItem { Q_OBJECT + /** + * The sub element of the svg we want to render. If empty the whole svg document will be painted. + */ Q_PROPERTY(QString elementId READ elementId WRITE setElementId) + + /** + * Svg class that is the source of the image, use it like that: + * + * SvgItem { + * svg: Svg {imagePath: "widgets/arrows"} + * elementId: "arrow-left" + * } + * + * Instead of a Svg declaration it can also be the id of a Svg declared elsewhere, useful to share Svg instances. + */ Q_PROPERTY(Plasma::Svg * svg READ svg WRITE setSvg) + + /** + * The natural, unscaled size of the svg document or the element. useful if a pixel perfect rendering of outlines is needed. + */ Q_PROPERTY(QSizeF naturalSize READ naturalSize NOTIFY naturalSizeChanged) + + /** + * If true enable antialiasing in paint: default off, better quality but less performance. + */ Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) public: diff --git a/declarativeimports/core/theme.h b/declarativeimports/core/theme.h index 389cfb5cb..aa38b66f0 100644 --- a/declarativeimports/core/theme.h +++ b/declarativeimports/core/theme.h @@ -30,17 +30,76 @@ class FontProxy : public QObject { Q_OBJECT + + /** + * true if the font is bold + */ Q_PROPERTY(bool bold READ bold NOTIFY boldChanged) + + /** + * One of + * MixedCase: The text is not changed + * AllUppercase: the text becomes UPPERCASE + * AllLowercase: the text becomes all lowercase + * SmallCaps: the lowercase characters becomes smaller uppercase ones + * Capitalize: the first letter of all words are uppercase + */ Q_PROPERTY(Capitalization capitalization READ capitalization NOTIFY capitalizationChanged ) + + /** + * name of the font family + */ Q_PROPERTY(QString family READ family NOTIFY familyChanged ) + + /** + * true if the font is italic + */ Q_PROPERTY(bool italic READ italic NOTIFY italicChanged ) + + /** + * horizontal space between letters + */ Q_PROPERTY(qreal letterSpacing READ letterSpacing NOTIFY letterSpacingChanged ) + + /** + * Size of the font in pixels: settings this is strongly discouraged. + * @see pointSize + */ Q_PROPERTY(int pixelSize READ pixelSize NOTIFY pixelSizeChanged ) + + /** + * Size of the font in points + */ Q_PROPERTY(qreal pointSize READ pointSize NOTIFY pointSizeChanged ) + + /** + * True if the text is striked out with an horizontal line + */ Q_PROPERTY(bool strikeout READ strikeout NOTIFY strikeoutChanged ) + + /** + * True if all the text will be underlined + */ Q_PROPERTY(bool underline READ underline NOTIFY underlineChanged ) + + /** + * One of: + * Light + * Normal + * DemiBold + * Bold + * Black + */ Q_PROPERTY(Weight weight READ weight NOTIFY weightChanged ) + + /** + * Horizontal space between words + */ Q_PROPERTY(qreal wordSpacing READ wordSpacing NOTIFY wordSpacingChanged ) + + /** + * Size in pixels of an uppercase "M" letter + */ Q_PROPERTY(QSize mSize READ mSize NOTIFY mSizeChanged ) Q_ENUMS(Capitalization) diff --git a/declarativeimports/core/tooltip.h b/declarativeimports/core/tooltip.h index 59658582e..3c8a93076 100644 --- a/declarativeimports/core/tooltip.h +++ b/declarativeimports/core/tooltip.h @@ -32,9 +32,24 @@ class ToolTipProxy : public QObject { Q_OBJECT + /** + * The item that will display this tooltip on mouse over + */ Q_PROPERTY(QGraphicsObject *target READ target WRITE setTarget NOTIFY targetChanged) + + /** + * The title of the tooltip, not more that 2-3 words + */ Q_PROPERTY(QString mainText READ mainText WRITE setMainText NOTIFY mainTextChanged) + + /** + * subtitle of the tooltip. needed if a longer description is needed + */ Q_PROPERTY(QString subText READ subText WRITE setSubText NOTIFY subTextChanged) + + /** + * Image to display in the tooltip, can be an image full path or a Freedesktop icon name + */ Q_PROPERTY(QString image READ image WRITE setImage NOTIFY imageChanged) public: diff --git a/declarativeimports/draganddrop/DeclarativeDragArea.cpp b/declarativeimports/draganddrop/DeclarativeDragArea.cpp index 93943e609..7af74414c 100644 --- a/declarativeimports/draganddrop/DeclarativeDragArea.cpp +++ b/declarativeimports/draganddrop/DeclarativeDragArea.cpp @@ -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. { setAcceptedMouseButtons(Qt::LeftButton); + setFiltersChildEvents(true); } DeclarativeDragArea::~DeclarativeDragArea() @@ -103,7 +104,7 @@ QDeclarativeItem* DeclarativeDragArea::target() const } // data -DeclarativeMimeData* DeclarativeDragArea::data() const +DeclarativeMimeData* DeclarativeDragArea::mimeData() const { return m_data; } @@ -184,3 +185,18 @@ void DeclarativeDragArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) Qt::DropAction action = drag->exec(m_supportedActions, m_defaultAction); emit drop(action); } + + +bool DeclarativeDragArea::sceneEventFilter(QGraphicsItem *item, QEvent *event) +{ + if (!isEnabled()) { + return false; + } + + if (event->type() == QEvent::GraphicsSceneMouseMove) { + QGraphicsSceneMouseEvent *me = static_cast(event); + mouseMoveEvent(me); + } + + return QDeclarativeItem::sceneEventFilter(item, event); +} \ No newline at end of file diff --git a/declarativeimports/draganddrop/DeclarativeDragArea.h b/declarativeimports/draganddrop/DeclarativeDragArea.h index f2f638c14..31206917c 100644 --- a/declarativeimports/draganddrop/DeclarativeDragArea.h +++ b/declarativeimports/draganddrop/DeclarativeDragArea.h @@ -31,14 +31,49 @@ class DeclarativeMimeData; class DeclarativeDragArea : public QDeclarativeItem { - Q_OBJECT - 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* target READ source NOTIFY targetChanged) - Q_PROPERTY(DeclarativeMimeData* data READ data CONSTANT) - 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::DropAction defaultAction READ defaultAction WRITE setDefaultAction NOTIFY defaultActionChanged) + Q_OBJECT + + /** + * The delegate is the item that will be displayed next to the mouse cursor during the drag and drop operation. + * It usually consists of a large, semi-transparent icon representing the data being dragged. + */ + Q_PROPERTY(QDeclarativeComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged RESET resetDelegate) + + /** + * The QML element that is the source of the resulting drag and drop operation. This can be defined to any item, and will + * be available to the DropArea as event.data.source + */ + Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged RESET resetSource) + + //TODO: to be implemented + Q_PROPERTY(QDeclarativeItem* target READ source NOTIFY targetChanged) + + /** + * the mime data of the drag operation + * @see DeclarativeMimeData + */ + Q_PROPERTY(DeclarativeMimeData* mimeData READ mimeData CONSTANT) + + /** + * If false no drag operation will be generate + */ + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) //TODO: Should call setAcceptDrops() + + /** + * Supported operations, a combination of + * Qt.CopyAction + * Qt.MoveAction + * Qt.LinkAction + * Qt.ActionMask + * Qt.IgnoreAction + * Qt.TargetMoveAction + */ + Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions WRITE setSupportedActions NOTIFY supportedActionsChanged) + + /** + * The default action will be performed during a drag when no modificators are pressed. + */ + Q_PROPERTY(Qt::DropAction defaultAction READ defaultAction WRITE setDefaultAction NOTIFY defaultActionChanged) public: @@ -65,7 +100,7 @@ public: Qt::DropAction defaultAction() const; void setDefaultAction(Qt::DropAction action); - DeclarativeMimeData* data() const; + DeclarativeMimeData* mimeData() const; signals: void delegateChanged(); @@ -81,6 +116,7 @@ protected: void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *) {} void mouseReleaseEvent(QGraphicsSceneMouseEvent *) {} + bool sceneEventFilter(QGraphicsItem *item, QEvent *event); private: QDeclarativeComponent* m_delegate; diff --git a/declarativeimports/draganddrop/DeclarativeDragDropEvent.h b/declarativeimports/draganddrop/DeclarativeDragDropEvent.h index 824650541..27da31d94 100644 --- a/declarativeimports/draganddrop/DeclarativeDragDropEvent.h +++ b/declarativeimports/draganddrop/DeclarativeDragDropEvent.h @@ -30,37 +30,90 @@ class DeclarativeDragDropEvent : public QObject { - Q_OBJECT - Q_PROPERTY(int x READ x) - Q_PROPERTY(int y READ y) - Q_PROPERTY(int buttons READ buttons) - Q_PROPERTY(int modifiers READ modifiers) - Q_PROPERTY(DeclarativeMimeData* data READ data) - Q_PROPERTY(Qt::DropActions possibleActions READ possibleActions) - Q_PROPERTY(Qt::DropAction proposedAction READ proposedAction) + Q_OBJECT + + /** + * The mouse X position of the event relative to the view that sent the event. + */ + Q_PROPERTY(int x READ x) + + /** + * The mouse Y position of the event relative to the view that sent the event. + */ + Q_PROPERTY(int y READ y) + + /** + * The pressed mouse buttons. + * A combination of: + * Qt.NoButton The button state does not refer to any button (see QMouseEvent::button()). + * Qt.LeftButton The left button is pressed, or an event refers to the left button. (The left button may be the right button on left-handed mice.) + * Qt.RightButton The right button. + * Qt.MidButton The middle button. + * Qt.MiddleButton MidButton The middle button. + * Qt.XButton1 The first X button. + * Qt.XButton2 The second X button. + */ + Q_PROPERTY(int buttons READ buttons) + + /** + * Pressed keyboard modifiers, a combination of: + * Qt.NoModifier No modifier key is pressed. + * Qt.ShiftModifier A Shift key on the keyboard is pressed. + * Qt.ControlModifier A Ctrl key on the keyboard is pressed. + * Qt.AltModifier An Alt key on the keyboard is pressed. + * Qt.MetaModifier A Meta key on the keyboard is pressed. + * Qt.KeypadModifier A keypad button is pressed. + * Qt.GroupSwitchModifier X11 only. A Mode_switch key on the keyboard is pressed. + */ + Q_PROPERTY(int modifiers READ modifiers) + + /** + * The mime data of this operation + * @see DeclarativeMimeData + */ + Q_PROPERTY(DeclarativeMimeData* mimeData READ mimeData) + + /** + * The possible different kind of action that can be done in the drop, is a combination of: + * Qt.CopyAction 0x1 Copy the data to the target. + * Qt.MoveAction 0x2 Move the data from the source to the target. + * Qt.LinkAction 0x4 Create a link from the source to the target. + * Qt.ActionMask 0xff + * Qt.IgnoreAction 0x0 Ignore the action (do nothing with the data). + * Qt.TargetMoveAction 0x8002 On Windows, this value is used when the ownership of the D&D data should be taken over by the target application, i.e., the source application should not delete the data. + * On X11 this value is used to do a move. + * TargetMoveAction is not used on the Mac. + */ + Q_PROPERTY(Qt::DropActions possibleActions READ possibleActions) + + /** + * Default action + * @see possibleActions + */ + Q_PROPERTY(Qt::DropAction proposedAction READ proposedAction) public: - DeclarativeDragDropEvent(QGraphicsSceneDragDropEvent* e, QObject* parent = 0); + DeclarativeDragDropEvent(QGraphicsSceneDragDropEvent* e, QObject* parent = 0); - int x() const { return m_x; } - int y() const { return m_y; } - int buttons() const { return m_buttons; } - int modifiers() const { return m_modifiers; } - DeclarativeMimeData* data() { return &m_data; } - Qt::DropAction proposedAction() const { return m_event->proposedAction(); } - Qt::DropActions possibleActions() const { return m_event->possibleActions(); } + int x() const { return m_x; } + int y() const { return m_y; } + int buttons() const { return m_buttons; } + int modifiers() const { return m_modifiers; } + DeclarativeMimeData* mimeData() { return &m_data; } + Qt::DropAction proposedAction() const { return m_event->proposedAction(); } + Qt::DropActions possibleActions() const { return m_event->possibleActions(); } -public slots: - void accept(int action); +public Q_SLOTS: + void accept(int action); private: - int m_x; - int m_y; - Qt::MouseButtons m_buttons; - Qt::KeyboardModifiers m_modifiers; - DeclarativeMimeData m_data; - QGraphicsSceneDragDropEvent* m_event; + int m_x; + int m_y; + Qt::MouseButtons m_buttons; + Qt::KeyboardModifiers m_modifiers; + DeclarativeMimeData m_data; + QGraphicsSceneDragDropEvent* m_event; }; #endif // DECLARATIVEDRAGDROPEVENT_H diff --git a/declarativeimports/draganddrop/DeclarativeDropArea.h b/declarativeimports/draganddrop/DeclarativeDropArea.h index 0394ecf6b..f562cff1c 100644 --- a/declarativeimports/draganddrop/DeclarativeDropArea.h +++ b/declarativeimports/draganddrop/DeclarativeDropArea.h @@ -30,27 +30,49 @@ class DeclarativeDragDropEvent; class DeclarativeDropArea : public QDeclarativeItem { - Q_OBJECT - Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) + Q_OBJECT + + /** + * If false the area will receive no drop events + */ + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) public: - DeclarativeDropArea(QDeclarativeItem *parent=0); - bool isEnabled() const; - void setEnabled(bool enabled); + DeclarativeDropArea(QDeclarativeItem *parent=0); + bool isEnabled() const; + void setEnabled(bool enabled); -signals: - void dragEnter(DeclarativeDragDropEvent* event); - void dragLeave(DeclarativeDragDropEvent* event); - void drop(DeclarativeDragDropEvent* event); - void enabledChanged(); +Q_SIGNALS: + /** + * Emitted when the mouse cursor dragging something enters in the drag area + * @arg DeclarativeDragDropEvent description of the dragged content + * @see DeclarativeDragDropEvent + */ + void dragEnter(DeclarativeDragDropEvent* event); + + /** + * Emitted when the mouse cursor dragging something leaves the drag area + * @arg DeclarativeDragDropEvent description of the dragged content + * @see DeclarativeDragDropEvent + */ + void dragLeave(DeclarativeDragDropEvent* event); + + /** + * Emitted when the user drops something in the area + * @arg DeclarativeDragDropEvent description of the dragged content + * @see DeclarativeDragDropEvent + */ + void drop(DeclarativeDragDropEvent* event); + + void enabledChanged(); protected: - void dragEnterEvent(QGraphicsSceneDragDropEvent *event); - void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); - void dropEvent(QGraphicsSceneDragDropEvent *event); + void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + void dropEvent(QGraphicsSceneDragDropEvent *event); private: - bool m_enabled; + bool m_enabled; }; #endif diff --git a/declarativeimports/draganddrop/DeclarativeMimeData.cpp b/declarativeimports/draganddrop/DeclarativeMimeData.cpp index 09dbef02d..69fafd944 100644 --- a/declarativeimports/draganddrop/DeclarativeMimeData.cpp +++ b/declarativeimports/draganddrop/DeclarativeMimeData.cpp @@ -68,7 +68,7 @@ DeclarativeMimeData::DeclarativeMimeData(const QMimeData* copy) QUrl DeclarativeMimeData::url() const { if ( this->hasUrls() && !this->urls().isEmpty()) { - return urls().first(); + return QMimeData::urls().first(); } return QUrl(); } @@ -79,10 +79,29 @@ void DeclarativeMimeData::setUrl(const QUrl &url) QList urlList; urlList.append(url); - setUrls(urlList); + QMimeData::setUrls(urlList); 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 urlList; + foreach (const QVariant &varUrl, urls) { + urlList << varUrl.value(); + } + QMimeData::setUrls(urlList); + emit urlsChanged(); +} + // color QColor DeclarativeMimeData::color() const { @@ -99,6 +118,11 @@ void DeclarativeMimeData::setColor(const QColor &color) } } +void DeclarativeMimeData::setData(const QString &mimeType, const QString &data) +{ + QMimeData::setData(mimeType, data.toLatin1()); +} + /*! \qmlproperty item MimeData::source diff --git a/declarativeimports/draganddrop/DeclarativeMimeData.h b/declarativeimports/draganddrop/DeclarativeMimeData.h index 1c9b1cd5b..7cec9aaac 100644 --- a/declarativeimports/draganddrop/DeclarativeMimeData.h +++ b/declarativeimports/draganddrop/DeclarativeMimeData.h @@ -33,11 +33,36 @@ class DeclarativeMimeData : public QMimeData { Q_OBJECT - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) - Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) //TODO: use QDeclarativeListProperty to return the whole list instead of only the first url - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) - Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged) + /** + * A plain text (MIME type text/plain) representation of the data. + */ + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) + + /** + * A string if the data stored in the object is HTML (MIME type text/html); otherwise returns an empty string. + */ + Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) + + /** + * Url contained in the mimedata + */ + Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) + + /** + * A list of URLs contained within the MIME data object. + * URLs correspond to the MIME type text/uri-list. + */ + Q_PROPERTY(QVariantList urls READ urls WRITE setUrls NOTIFY urlsChanged) + + /** + * A color if the data stored in the object represents a color (MIME type application/x-color); otherwise QColor(). + */ + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + + /** + * The graphical item on the scene that started the drag event. It may be null. + */ + Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged) //TODO: Image property public: @@ -47,12 +72,18 @@ public: QUrl url() const; void setUrl(const QUrl &url); + QVariantList urls() const; + void setUrls(const QVariantList &urls); + QColor color() const; void setColor(const QColor &color); + Q_INVOKABLE void setData(const QString &mimeType, const QString &data); + QDeclarativeItem* source() const; void setSource(QDeclarativeItem* source); + /* QString text() const; //TODO: Reimplement this to issue the onChanged signals void setText(const QString &text); @@ -64,12 +95,12 @@ signals: void textChanged(); //FIXME not being used void htmlChanged(); //FIXME not being used void urlChanged(); + void urlsChanged(); void colorChanged(); void sourceChanged(); private: - QDeclarativeItem* m_source; - + QDeclarativeItem* m_source; }; #endif // DECLARATIVEMIMEDATA_H diff --git a/declarativeimports/plasmacomponents/CMakeLists.txt b/declarativeimports/plasmacomponents/CMakeLists.txt index bb43f9ca9..239894801 100644 --- a/declarativeimports/plasmacomponents/CMakeLists.txt +++ b/declarativeimports/plasmacomponents/CMakeLists.txt @@ -1,12 +1,14 @@ project(plasmacomponents) set(plasmacomponents_SRCS + fullscreendialog.cpp plasmacomponentsplugin.cpp qrangemodel.cpp enums.cpp qmenu.cpp qmenuitem.cpp kdialogproxy.cpp + ../core/declarativeitemcontainer.cpp ) INCLUDE_DIRECTORIES( @@ -19,7 +21,7 @@ qt4_automoc(${plasmacomponents_SRCS}) add_library(plasmacomponentsplugin SHARED ${plasmacomponents_SRCS}) -target_link_libraries(plasmacomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBRARY}) +target_link_libraries(plasmacomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBRARY} ${KDE4_PLASMA_LIBS}) install(TARGETS plasmacomponentsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/components) @@ -32,8 +34,6 @@ install(DIRECTORY qml/ DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/compone install(TARGETS plasmacomponentsplugin 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) @@ -42,26 +42,18 @@ install(FILES qml/ButtonRow.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimport 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) @@ -69,5 +61,17 @@ install(FILES qml/ToolBarLayout.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformim install(FILES qml/ToolBar.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components) +#Now install the private stuff! +install(FILES qml/private/DualStateButton.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/IconLoader.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/PageStack.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/TabGroup.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/ScrollBarDelegate.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/ScrollDecoratorDelegate.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/SectionScroller.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/AppManager.js DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/TabBarLayout.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) +install(FILES qml/private/TextFieldFocus.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components/private) + #install platform overrides install(DIRECTORY platformcomponents/touch/ DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/components) diff --git a/declarativeimports/plasmacomponents/fullscreendialog.cpp b/declarativeimports/plasmacomponents/fullscreendialog.cpp new file mode 100644 index 000000000..dae1c2582 --- /dev/null +++ b/declarativeimports/plasmacomponents/fullscreendialog.cpp @@ -0,0 +1,304 @@ +/*************************************************************************** + * Copyright 2012 Marco Martin * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * + * * + * You should have received a copy of the GNU 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 . * + ***************************************************************************/ + +#include "fullscreendialog.h" +#include "../core/declarativeitemcontainer_p.h" +#include "plasmacomponentsplugin.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + + +uint FullScreenDialog::s_numItems = 0; + +FullScreenDialog::FullScreenDialog(QDeclarativeItem *parent) + : QDeclarativeItem(parent), + m_declarativeItemContainer(0) +{ + m_view = new QGraphicsView(); + m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_view->installEventFilter(this); + m_view->setAutoFillBackground(false); + m_view->viewport()->setAutoFillBackground(false); + m_view->setAttribute(Qt::WA_TranslucentBackground); + m_view->setAttribute(Qt::WA_NoSystemBackground); + m_view->viewport()->setAttribute(Qt::WA_NoSystemBackground); + m_view->setCacheMode(QGraphicsView::CacheNone); + m_view->setWindowFlags(m_view->windowFlags() | Qt::FramelessWindowHint | Qt::CustomizeWindowHint); + m_view->setFrameShape(QFrame::NoFrame); + KWindowSystem::setOnAllDesktops(m_view->winId(), true); + unsigned long state = NET::Sticky | NET::StaysOnTop | NET::KeepAbove | NET::SkipTaskbar | NET::SkipPager | NET::MaxVert | NET::MaxHoriz; + KWindowSystem::setState(m_view->effectiveWinId(), state); + + //Try to figure out the path of the dialog component + QString componentsPlatform = getenv("KDE_PLASMA_COMPONENTS_PLATFORM"); + if (componentsPlatform.isEmpty()) { + KConfigGroup cg(KSharedConfig::openConfig("kdeclarativerc"), "Components-platform"); + componentsPlatform = cg.readEntry("name", "desktop"); + } + + QString filePath; + if (componentsPlatform == "desktop") { + foreach(const QString &importPath, KGlobal::dirs()->findDirs("module", "imports/")) { + filePath = importPath % "org/kde/plasma/components/Dialog.qml"; + QFile f(filePath); + if (f.exists()) { + break; + } + } + } else { + foreach(const QString &importPath, KGlobal::dirs()->findDirs("module", "platformimports/" % componentsPlatform)) { + filePath = importPath % "org/kde/plasma/components/Dialog.qml"; + QFile f(filePath); + if (f.exists()) { + break; + } + } + } + + + QDeclarativeEngine *engine = EngineBookKeeping::self()->engineFor(this); + QDeclarativeComponent *component = new QDeclarativeComponent(engine, filePath, this); + + QDeclarativeContext *creationContext = component->creationContext(); + m_rootObject = component->create(creationContext); + if (component->status() == QDeclarativeComponent::Error) { + kWarning()<errors(); + } + + if (m_rootObject) { + setMainItem(qobject_cast(m_rootObject.data())); + connect(m_rootObject.data(), SIGNAL(statusChanged()), this, SLOT(statusHasChanged())); + connect(m_rootObject.data(), SIGNAL(accepted()), this, SIGNAL(accepted())); + connect(m_rootObject.data(), SIGNAL(rejected()), this, SIGNAL(rejected())); + connect(m_rootObject.data(), SIGNAL(clickedOutside()), this, SIGNAL(clickedOutside())); + } +} + +FullScreenDialog::~FullScreenDialog() +{ + delete m_view; +} + +QGraphicsObject *FullScreenDialog::mainItem() const +{ + return m_mainItem.data(); +} + +void FullScreenDialog::setMainItem(QGraphicsObject *mainItem) +{ + if (m_mainItem.data() != mainItem) { + if (m_mainItem) { + m_mainItem.data()->setParent(mainItem->parent()); + m_mainItem.data()->removeEventFilter(this); + m_mainItem.data()->setY(0); + m_scene = 0; + } + m_mainItem = mainItem; + if (mainItem) { + mainItem->setParentItem(0); + mainItem->setParent(this); + m_scene = mainItem->scene(); + } + + mainItem->installEventFilter(this); + + //if this is called in Compenent.onCompleted we have to wait a loop the item is added to a scene + QTimer::singleShot(0, this, SLOT(syncMainItem())); + } +} + +void FullScreenDialog::syncMainItem() +{ + if (!m_mainItem) { + return; + } + + //not have a scene? go up in the hyerarchy until we find something with a scene + QGraphicsScene *scene = m_mainItem.data()->scene(); + if (!scene) { + QObject *parent = m_mainItem.data(); + while ((parent = parent->parent())) { + QGraphicsObject *qo = qobject_cast(parent); + if (qo) { + scene = qo->scene(); + + if (scene) { + scene->addItem(m_mainItem.data()); + ++s_numItems; + Plasma::Corona *corona = qobject_cast(scene); + QDeclarativeItem *di = qobject_cast(m_mainItem.data()); + + if (corona && di) { + if (!m_declarativeItemContainer) { + m_declarativeItemContainer = new DeclarativeItemContainer(); + scene->addItem(m_declarativeItemContainer); + corona->addOffscreenWidget(m_declarativeItemContainer); + } + m_declarativeItemContainer->setDeclarativeItem(di); + } else { + m_mainItem.data()->setY(-10000*s_numItems); + m_mainItem.data()->setY(10000*s_numItems); + } + break; + } + } + } + } + + if (!scene) { + return; + } + + m_view->setScene(scene); + + + if (m_declarativeItemContainer) { + m_declarativeItemContainer->resize(m_view->size()); + m_view->setSceneRect(m_declarativeItemContainer->geometry()); + } else { + m_mainItem.data()->setProperty("width", m_view->size().width()); + m_mainItem.data()->setProperty("height", m_view->size().height()); + QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()), + QSizeF(m_mainItem.data()->boundingRect().size())); + m_view->setSceneRect(itemGeometry); + } +} + +bool FullScreenDialog::isVisible() const +{ + return m_view->isVisible(); +} + +void FullScreenDialog::setVisible(const bool visible) +{ + if (m_view->isVisible() != visible) { + m_view->setVisible(visible); + if (visible) { + unsigned long state = NET::Sticky | NET::StaysOnTop | NET::KeepAbove | NET::SkipTaskbar | NET::SkipPager | NET::MaxVert | NET::MaxHoriz; + m_view->setVisible(visible); + KWindowSystem::setState(m_view->effectiveWinId(), state); + m_view->raise(); + } + } +} + +QDeclarativeListProperty FullScreenDialog::title() +{ + if (m_rootObject) { + return m_rootObject.data()->property("title").value >(); + } else { + return QDeclarativeListProperty(this, m_dummyTitleElements); + } +} + +QDeclarativeListProperty FullScreenDialog::content() +{ + if (m_rootObject) { + return m_rootObject.data()->property("content").value >(); + } else { + return QDeclarativeListProperty(this, m_dummyContentElements); + } +} + +QDeclarativeListProperty FullScreenDialog::buttons() +{ + if (m_rootObject) { + return m_rootObject.data()->property("buttons").value >(); + } else { + return QDeclarativeListProperty(this, m_dummyButtonsElements); + } +} + +DialogStatus::Status FullScreenDialog::status() const +{ + if (m_rootObject) { + return (DialogStatus::Status)m_rootObject.data()->property("status").toInt(); + } else { + return DialogStatus::Closed; + } +} + + +void FullScreenDialog::statusHasChanged() +{ + if (status() == DialogStatus::Closed) { + setVisible(false); + } else { + setVisible(true); + } + emit statusChanged(); +} + +void FullScreenDialog::open() +{ + if (m_rootObject) { + QMetaObject::invokeMethod(m_rootObject.data(), "open"); + } +} + +void FullScreenDialog::accept() +{ + if (m_rootObject) { + QMetaObject::invokeMethod(m_rootObject.data(), "accept"); + } +} + +void FullScreenDialog::reject() +{ + if (m_rootObject) { + QMetaObject::invokeMethod(m_rootObject.data(), "reject"); + } +} + +void FullScreenDialog::close() +{ + if (m_rootObject) { + QMetaObject::invokeMethod(m_rootObject.data(), "close"); + } +} + + + + +bool FullScreenDialog::eventFilter(QObject *watched, QEvent *event) +{ + if (watched == m_view && + (event->type() == QEvent::Resize || event->type() == QEvent::Move)) { + syncMainItem(); + } + return false; +} + + + +#include "fullscreendialog.moc" + diff --git a/declarativeimports/plasmacomponents/fullscreendialog.h b/declarativeimports/plasmacomponents/fullscreendialog.h new file mode 100644 index 000000000..da79fe6a3 --- /dev/null +++ b/declarativeimports/plasmacomponents/fullscreendialog.h @@ -0,0 +1,96 @@ +/*************************************************************************** + * Copyright 2012 Marco Martin * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. * + * * + * You should have received a copy of the GNU 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 . * + ***************************************************************************/ +#ifndef FULLSCREENDIALOG_P +#define FULLSCREENDIALOG_P + +#include +#include +#include +#include +#include +#include + +#include "enums.h" + +class QGraphicsObject; +class QGraphicsView; +class QGraphicsScene; +class DeclarativeItemContainer; + +class FullScreenDialog : public QDeclarativeItem +{ + Q_OBJECT + + Q_PROPERTY(QDeclarativeListProperty title READ title DESIGNABLE false) + Q_PROPERTY(QDeclarativeListProperty content READ content DESIGNABLE false) + Q_PROPERTY(QDeclarativeListProperty buttons READ buttons DESIGNABLE false) + Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged) + + +public: + FullScreenDialog(QDeclarativeItem *parent = 0); + ~FullScreenDialog(); + + QGraphicsObject *mainItem() const; + void setMainItem(QGraphicsObject *mainItem); + + bool isVisible() const; + void setVisible(const bool visible); + + + //QML properties + QDeclarativeListProperty title(); + QDeclarativeListProperty content(); + QDeclarativeListProperty buttons(); + DialogStatus::Status status() const; + + Q_INVOKABLE void open(); + Q_INVOKABLE void accept(); + Q_INVOKABLE void reject(); + Q_INVOKABLE void close(); + +Q_SIGNALS: + void accepted(); + void rejected(); + void clickedOutside(); + void statusChanged(); + + +private Q_SLOTS: + void syncMainItem(); + void statusHasChanged(); + +protected: + bool eventFilter(QObject *watched, QEvent *event); + +private: + QGraphicsView *m_view; + QWeakPointer m_mainItem; + DeclarativeItemContainer *m_declarativeItemContainer; + QGraphicsScene *m_scene; + QWeakPointer m_rootObject; + static uint s_numItems; + + //those only used in case of error, to not make plasma crash + QList m_dummyTitleElements; + QList m_dummyContentElements; + QList m_dummyButtonsElements; +}; + +#endif diff --git a/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp b/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp index b1bee475e..615cfe845 100644 --- a/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp +++ b/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp @@ -21,15 +21,65 @@ #include #include +#include +#include #include "qrangemodel.h" #include +#include #include "enums.h" #include "qmenu.h" #include "qmenuitem.h" #include "kdialogproxy.h" +#include "fullscreendialog.h" + +Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin) + +class BKSingleton +{ +public: + EngineBookKeeping self; +}; +K_GLOBAL_STATIC(BKSingleton, privateBKSelf) + +EngineBookKeeping::EngineBookKeeping() +{ +} + +EngineBookKeeping *EngineBookKeeping::self() +{ + return &privateBKSelf->self; +} + +QDeclarativeEngine *EngineBookKeeping::engineFor(QObject *item) const +{return m_engines.values().first(); + foreach (QDeclarativeEngine *engine, m_engines) { + QObject *root = engine->rootContext()->contextObject(); + QObject *candidate = item; + while (candidate) { + if (candidate == root) { + return engine; + } + candidate = candidate->parent(); + } + } + return 0; +} + +void EngineBookKeeping::insertEngine(QDeclarativeEngine *engine) +{ + m_engines.insert(engine); +} + + + +void PlasmaComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) +{ + QDeclarativeExtensionPlugin::initializeEngine(engine, uri); + EngineBookKeeping::self()->insertEngine(engine); +} void PlasmaComponentsPlugin::registerTypes(const char *uri) { @@ -41,12 +91,15 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri) componentsPlatform = cg.readEntry("name", "desktop"); } + //platform specific c++ components if (componentsPlatform == "desktop") { qmlRegisterType(uri, 0, 1, "QueryDialog"); qmlRegisterType(uri, 0, 1, "Menu"); - qmlRegisterType(uri, 0, 1, "ContextMenu"); qmlRegisterType(uri, 0, 1, "MenuItem"); + //on touch systems the dialog is fullscreen, c++ needed to do that + } else { + qmlRegisterType(uri, 0, 1, "Dialog"); } qmlRegisterType(uri, 0, 1, "RangeModel"); diff --git a/declarativeimports/plasmacomponents/plasmacomponentsplugin.h b/declarativeimports/plasmacomponents/plasmacomponentsplugin.h index 65ca8bdca..11b19ea5f 100644 --- a/declarativeimports/plasmacomponents/plasmacomponentsplugin.h +++ b/declarativeimports/plasmacomponents/plasmacomponentsplugin.h @@ -21,15 +21,32 @@ #define PLASMACOMPONENTSPLUGIN_H #include +#include + +class QDeclarativeEngine; +class QDeclarativeItem; +class PlasmaComponentsPlugin; + +class EngineBookKeeping +{ +public: + EngineBookKeeping(); + static EngineBookKeeping *self(); + + void insertEngine(QDeclarativeEngine *engine); + QDeclarativeEngine *engineFor(QObject *item) const; + +private: + QSet m_engines; +}; class PlasmaComponentsPlugin : public QDeclarativeExtensionPlugin { Q_OBJECT public: + void initializeEngine(QDeclarativeEngine *engine, const char *uri); void registerTypes(const char *uri); }; -Q_EXPORT_PLUGIN2(plasmacomponentsplugin, PlasmaComponentsPlugin) - #endif diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml index f81ca6b5f..e9af7b8cf 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml @@ -64,58 +64,76 @@ Item { function open() { - var pos = dialog.popupPosition(null, Qt.alignCenter) - dialog.x = pos.x - dialog.y = pos.y - - dialog.visible = true - dialog.activateWindow() + status = DialogStatus.Opening + delayOpenTimer.restart() } function accept() { if (status == DialogStatus.Open) { - dialog.visible = false + status = DialogStatus.Closing accepted() + dialog.state = "closed" } } - function reject() { + function reject() + { if (status == DialogStatus.Open) { - dialog.visible = false + status = DialogStatus.Closing + dialog.state = "closed" rejected() } } - function close() { - dialog.visible = false + function close() + { + dialog.state = "closed" } - 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 - } + Rectangle { + id: fader + property double alpha: 0 + color: Qt.rgba(0.0, 0.0, 0.0, alpha) + anchors.fill: parent + } + MouseArea { + anchors.fill: parent + onClicked: { + clickedOutside() + close() } - onActiveWindowChanged: if (!activeWindow) dialog.visible = false + } + Timer { + id: delayOpenTimer + running: false + interval: 100 + onTriggered: dialog.state = "" + } - mainItem: Item { + PlasmaCore.FrameSvgItem { + id: dialog + width: mainItem.width + margins.left + margins.right + height: mainItem.height + margins.top + margins.bottom + anchors.centerIn: parent + imagePath: "dialogs/background" + + state: "closed" + + transform: Translate { + id: dialogTransform + y: root.height - dialog.y + } + //state: "Hidden" + + Item { id: mainItem + x: dialog.margins.left + y: dialog.margins.top 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 @@ -160,5 +178,70 @@ Item { Component.onCompleted: { rootItem = Utils.rootObject() } + + states: [ + State { + name: "closed" + PropertyChanges { + target: dialogTransform + y: root.height - dialog.y + } + PropertyChanges { + target: fader + alpha: 0 + } + }, + State { + name: "" + PropertyChanges { + target: dialogTransform + y: 0 + } + PropertyChanges { + target: fader + alpha: 0.6 + } + } + ] + + transitions: [ + // Transition between open and closed states. + Transition { + from: "" + to: "closed" + reversible: false + SequentialAnimation { + ScriptAction { + script: root.status = DialogStatus.Closing + } + PropertyAnimation { + properties: "y, alpha" + easing.type: Easing.InOutQuad + duration: 250 + } + ScriptAction { + script: root.status = DialogStatus.Closed + } + } + }, + Transition { + from: "closed" + to: "" + reversible: false + SequentialAnimation { + ScriptAction { + script: root.status = DialogStatus.Opening + } + PropertyAnimation { + properties: "y, alpha" + easing.type: Easing.InOutQuad + duration: 250 + } + ScriptAction { + script: root.status = DialogStatus.Open + } + } + } + ] } } diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml index 995404668..9e71a8094 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/Menu.qml @@ -24,10 +24,30 @@ import "." 0.1 Item { id: root - default property alias content: visualModel.children + default property alias content: menuColumn.children property Item visualParent property int status: DialogStatus.Closed + onVisualParentChanged: { + //if is a menuitem move to menuColumn + if (visualParent.separator !== undefined) { + var obj = arrowComponent.createObject(visualParent) + } + } + + Component { + id: arrowComponent + PlasmaCore.SvgItem { + svg: PlasmaCore.Svg {imagePath: "widgets/arrows"} + elementId: "right-arrow" + width: naturalSize.width + height: naturalSize.height + anchors { + right: parent.right + verticalCenter: parent.verticalCenter + } + } + } function open() { var parent = root.visualParent ? root.visualParent : root.parent @@ -44,6 +64,21 @@ Item { dialog.visible = false } + function addMenuItem(item) + { + item.parent = menuColumn + } + + onChildrenChanged: { + for (var i = 0; i < children.length; ++i) { + var item = children[i] + //if is a menuitem move to menuColumn + if (item.separator !== undefined) { + item.parent = menuColumn + } + } + } + visible: false PlasmaCore.Dialog { @@ -61,19 +96,20 @@ Item { mainItem: Item { id: contentItem - width: theme.defaultFont.mSize.width * 12 - height: Math.min(listView.contentHeight, theme.defaultFont.mSize.height * 25) + width: Math.max(menuColumn.width, theme.defaultFont.mSize.width * 12) + height: Math.min(menuColumn.height, theme.defaultFont.mSize.height * 25) - ListView { + + Flickable { id: listView anchors.fill: parent - currentIndex : -1 clip: true - model: VisualItemModel { - id: visualModel + Column { + id: menuColumn + spacing: 4 onChildrenChanged: { for (var i = 0; i < children.length; ++i) { if (children[i].clicked != undefined) diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/MenuItem.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/MenuItem.qml index 9ef171d5c..e9408355c 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/MenuItem.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/MenuItem.qml @@ -38,8 +38,9 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private Item { id: root @@ -48,17 +49,57 @@ Item { signal clicked - property int implicitWidth: textArea.paintedWidth + 6 - width: parent.width - height: textArea.paintedHeight + 6 + implicitWidth: textArea.paintedWidth + iconLoader.width*2 + 6 + implicitHeight: Math.max(theme.smallIconSize, textArea.paintedHeight + 6) + width: Math.max(implicitWidth, parent.width) + property bool separator: false + onSeparatorChanged: { + if (separator) { + internal.separatorItem = separatorComponent.createObject(root) + } else { + internal.separatorItem.destroy() + } + } + property alias icon: iconLoader.source + + enabled: !separator + + Private.IconLoader { + id: iconLoader + width: parent.height + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + top: parent.top + bottom: parent.bottom + } + } Label { id: textArea anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight } + QtObject { + id: internal + property Item separatorItem + } + Component { + id: separatorComponent + PlasmaCore.FrameSvgItem { + imagePath: "widgets/viewitem" + prefix: "normal" + height: text ? parent.height : margins.top+margins.bottom + anchors { + right: parent.right + left: parent.left + verticalCenter: parent.verticalCenter + } + } + } MouseArea { id: mouseArea diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/ScrollBar.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/ScrollBar.qml index ccb8ac494..25c7e08ba 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/ScrollBar.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/ScrollBar.qml @@ -20,6 +20,7 @@ import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private /** @@ -52,7 +53,7 @@ Item { anchors { right: flickableItem.right - left: (orientation == Qt.Vertical) ? undefined : flickableItem.left + left: (orientation == Qt.Vertical) ? undefined : flickableItem.left top: (orientation == Qt.Vertical) ? flickableItem.top : undefined bottom: flickableItem.bottom } diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/ToolButton.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/ToolButton.qml index ef66cfcea..633c016e3 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/ToolButton.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/ToolButton.qml @@ -20,6 +20,7 @@ import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private Item { id: button @@ -176,7 +177,7 @@ Item { PropertyAnimation { duration: 100 } } - IconLoader { + Private.IconLoader { id: icon anchors { diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/qmldir b/declarativeimports/plasmacomponents/platformcomponents/touch/qmldir index d523958b8..463f326e0 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/qmldir +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/qmldir @@ -17,7 +17,6 @@ MenuItem 0.1 MenuItem.qml Page 0.1 Page.qml PageStack 0.1 PageStack.qml ProgressBar 0.1 ProgressBar.qml -PushButton 0.1 PushButton.qml QueryDialog 0.1 QueryDialog.qml RadioButton 0.1 RadioButton.qml ScrollBar 0.1 ScrollBar.qml diff --git a/declarativeimports/plasmacomponents/qmenu.cpp b/declarativeimports/plasmacomponents/qmenu.cpp index db613ee7b..6e00dbace 100644 --- a/declarativeimports/plasmacomponents/qmenu.cpp +++ b/declarativeimports/plasmacomponents/qmenu.cpp @@ -26,11 +26,14 @@ #include #include +#include "plasmacomponentsplugin.h" QMenuProxy::QMenuProxy (QObject *parent) : QObject(parent), m_status(DialogStatus::Closed) { m_menu = new QMenu(0); + connect(m_menu, SIGNAL(triggered(QAction *)), + this, SLOT(itemTriggered(QAction *))); } QMenuProxy::~QMenuProxy() @@ -38,7 +41,7 @@ QMenuProxy::~QMenuProxy() delete m_menu; } -QDeclarativeListProperty QMenuProxy::items() +QDeclarativeListProperty QMenuProxy::content() { return QDeclarativeListProperty(this, m_items); } @@ -58,21 +61,103 @@ DialogStatus::Status QMenuProxy::status() const return m_status; } -QDeclarativeItem *QMenuProxy::visualParent() const +QObject *QMenuProxy::visualParent() const { return m_visualParent.data(); } -void QMenuProxy::setVisualParent(QDeclarativeItem *parent) +void QMenuProxy::setVisualParent(QObject *parent) { if (m_visualParent.data() == parent) { return; } + //if the old parent was a QAction, disconnect the menu from it + QAction *action = qobject_cast(m_visualParent.data()); + if (action) { + action->setMenu(0); + m_menu->clear(); + } + //if parent is a QAction, become a submenu + action = qobject_cast(parent); + if (action) { + action->setMenu(m_menu); + m_menu->clear(); + foreach(QMenuItem* item, m_items) { + m_menu->addAction(item); + } + m_menu->updateGeometry(); + } + m_visualParent = parent; emit visualParentChanged(); } +bool QMenuProxy::event(QEvent *event) +{ + switch (event->type()) { + case QEvent::ChildAdded: { + QChildEvent *ce = static_cast(event); + QMenuItem *mi = qobject_cast(ce->child()); + //FIXME: linear complexity here + if (mi && !m_items.contains(mi)) { + m_menu->addAction(mi); + m_items << mi; + } + break; + } + + case QEvent::ChildRemoved: { + QChildEvent *ce = static_cast(event); + QMenuItem *mi = qobject_cast(ce->child()); + + //FIXME: linear complexity here + if (mi) { + m_menu->removeAction(mi); + m_items.removeAll(mi); + } + break; + } + + default: + break; + } + + return QObject::event(event); +} + +void QMenuProxy::clearMenuItems() +{ + qDeleteAll(m_items); + m_items.clear(); +} + +void QMenuProxy::addMenuItem(const QString &text) +{ + QMenuItem *item = new QMenuItem(this); + item->setText(text); + m_menu->addAction(item); + m_items << item; +} + +void QMenuProxy::addMenuItem(QMenuItem *item) +{ + m_menu->addAction(item); + m_items << item; +} + +void QMenuProxy::itemTriggered(QAction *action) +{ + QMenuItem *item = qobject_cast(action); + if (item) { + emit triggered(item); + int index = m_items.indexOf(item); + if (index > -1) { + emit triggeredIndex(index); + } + } +} + void QMenuProxy::showMenu(int x, int y) { m_menu->clear(); @@ -97,9 +182,9 @@ void QMenuProxy::open() QGraphicsObject *parentItem; if (m_visualParent) { - parentItem = qobject_cast(parent()); + parentItem = qobject_cast(m_visualParent.data()); } else { - parentItem = m_visualParent.data(); + parentItem = qobject_cast(parent()); } if (!parentItem || !parentItem->scene()) { diff --git a/declarativeimports/plasmacomponents/qmenu.h b/declarativeimports/plasmacomponents/qmenu.h index 0f503efaf..ddb0f07e6 100644 --- a/declarativeimports/plasmacomponents/qmenu.h +++ b/declarativeimports/plasmacomponents/qmenu.h @@ -32,36 +32,51 @@ class QMenuProxy : public QObject { Q_OBJECT - Q_PROPERTY(QDeclarativeListProperty items READ items CONSTANT) - Q_CLASSINFO("DefaultProperty", "items") - Q_PROPERTY(QDeclarativeItem *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged()) + Q_PROPERTY(QDeclarativeListProperty content READ content CONSTANT) + Q_CLASSINFO("DefaultProperty", "content") + + /** + * the visualParent is used to position the menu. it can be an item on the scene, like a button (that will open the menu on clicked) or another menuitem (in this case this will be a submenu) + */ + Q_PROPERTY(QObject *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged()) Q_PROPERTY(DialogStatus::Status status READ status NOTIFY statusChanged) public: QMenuProxy(QObject *parent = 0); ~QMenuProxy(); - QDeclarativeListProperty items(); + QDeclarativeListProperty content(); int actionCount() const; QMenuItem *action(int) const; DialogStatus::Status status() const; - QDeclarativeItem *visualParent() const; - void setVisualParent(QDeclarativeItem *parent); + QObject *visualParent() const; + void setVisualParent(QObject *parent); void showMenu(int x, int y); Q_INVOKABLE void open(); Q_INVOKABLE void close(); + Q_INVOKABLE void clearMenuItems(); + Q_INVOKABLE void addMenuItem(const QString &text); + Q_INVOKABLE void addMenuItem(QMenuItem *item); + +protected: + bool event(QEvent *event); Q_SIGNALS: void statusChanged(); void visualParentChanged(); + void triggered(QMenuItem *item); + void triggeredIndex(int index); + +private Q_SLOTS: + void itemTriggered(QAction *item); private: QList m_items; QMenu *m_menu; DialogStatus::Status m_status; - QWeakPointer m_visualParent; + QWeakPointer m_visualParent; }; #endif //QMENU_PROXY_H diff --git a/declarativeimports/plasmacomponents/qmenuitem.h b/declarativeimports/plasmacomponents/qmenuitem.h index 94f805195..ef01fcc43 100644 --- a/declarativeimports/plasmacomponents/qmenuitem.h +++ b/declarativeimports/plasmacomponents/qmenuitem.h @@ -27,6 +27,7 @@ class QMenuItem : public QAction { Q_OBJECT + Q_PROPERTY(QObject *parent READ parent WRITE setParent) Q_PROPERTY(bool separator READ isSeparator WRITE setSeparator) public: diff --git a/declarativeimports/plasmacomponents/qml/BusyIndicator.qml b/declarativeimports/plasmacomponents/qml/BusyIndicator.qml index c036b1117..aa303763d 100644 --- a/declarativeimports/plasmacomponents/qml/BusyIndicator.qml +++ b/declarativeimports/plasmacomponents/qml/BusyIndicator.qml @@ -18,6 +18,31 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + org.kde.plasma.core + QtQuick 1.1 + +Description: + It is just a simple Busy Indicator, it is used to indicate a task which duration is unknown. If the task duration/number of steps is known, a ProgressBar should be used instead. + TODO An image has to be added! + +Properties: + + bool running: + This property holds whether the busy animation is running. + The default value is false. + + bool smoothAnimation: + Set this property if you don't want to apply a filter to smooth + the busy icon while animating. + Smooth filtering gives better visual quality, but is slower. + The default value is true. +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore diff --git a/declarativeimports/plasmacomponents/qml/Button.qml b/declarativeimports/plasmacomponents/qml/Button.qml index 0038c0a4a..6aab1b2d1 100644 --- a/declarativeimports/plasmacomponents/qml/Button.qml +++ b/declarativeimports/plasmacomponents/qml/Button.qml @@ -19,8 +19,60 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/**Documented API +Inherits: + Item + +Imports: + org.kde.plasma.core + QtQuick 1.0 + +Description: + A simple button, with optional label and icon which uses the plasma theme. + This button component can also be used as a checkable button by using the checkable + and checked properties for that. + Plasma theme is the theme which changes via the systemsetting-workspace appearence + -desktop theme. + +Properties: + * bool checked: + This property holds wheter this button is checked or not. + The button must be in the checkable state for enable users check or uncheck it. + The default value is false. + See also checkable property. + + * bool checkable: + This property holds if the button is acting like a checkable button or not. + The default value is false. + + * bool pressed: + This property holds if the button is pressed or not. + Read-only. + + * string text: + This property holds the text label for the button. + For example,the ok button has text 'ok'. + The default value for this property is an empty string. + + * url iconSource: + This property holds the source url for the Button's icon. + The default value is an empty url, which displays no icon. + It can be any image from any protocol supported by the Image element, or a freedesktop-compatible icon name + + * font font: + This property holds the font used by the button label. + See also Qt documentation for font type. + +Signals: + * clicked(): + This handler is called when there is a click. +**/ + import QtQuick 1.1 + import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private Item { id: button @@ -85,7 +137,7 @@ Item { internal.clickButton(); } - ButtonShadow { + Private.ButtonShadow { id: shadow anchors.fill: parent state: { @@ -159,7 +211,7 @@ Item { bottomMargin: surfaceNormal.margins.bottom } - IconLoader { + Private.IconLoader { id: icon anchors { @@ -167,6 +219,8 @@ Item { left: label.paintedWidth > 0 ? parent.left : undefined horizontalCenter: label.paintedWidth > 0 ? undefined : parent.horizontalCenter } + height: roundToStandardSize(parent.height) + width: height } Text { @@ -211,4 +265,4 @@ Item { onCanceled: internal.userPressed = false onClicked: internal.clickButton() } -} \ No newline at end of file +} diff --git a/declarativeimports/plasmacomponents/qml/ButtonColumn.qml b/declarativeimports/plasmacomponents/qml/ButtonColumn.qml index 752481c26..7be4d81db 100644 --- a/declarativeimports/plasmacomponents/qml/ButtonColumn.qml +++ b/declarativeimports/plasmacomponents/qml/ButtonColumn.qml @@ -39,39 +39,44 @@ ** ****************************************************************************/ +/**Documented API +Inherits: + Column + +Imports: + ButtonGroup.js + Qt 4.7 + + +Description: + A ButtonColumn allows you to group Buttons in a column. It provides a selection-behavior as well. + Note: This component don't support the enabled property. + If you need to disable it you should disable all the buttons inside it. + This is an example, + + ButtonColumn { + Button { text: "Top" } + Button { text: "Bottom" } + } + + +Properties: + bool exclusive: + Specifies the grouping behavior. If enabled, the checked property on buttons contained + in the group will be exclusive.The default value is true. + Note that a button in an exclusive group will allways be checkable + + Item checkedButton: + Returns the last checked button. +**/ import Qt 4.7 import "ButtonGroup.js" as Behavior -/* - Class: ButtonColumn - A ButtonColumn allows you to group Buttons in a column. It provides a selection-behavior as well. - - Note: This component don't support the enabled property. - If you need to disable it you should disable all the buttons inside it. - - - ButtonColumn { - Button { text: "Top" } - Button { text: "Bottom" } - } - -*/ Column { id: root - /* - * Property: exclusive - * [bool=true] Specifies the grouping behavior. If enabled, the checked property on buttons contained - * in the group will be exclusive. - * - * Note that a button in an exclusive group will allways be checkable - */ property bool exclusive: true - /* - * Property: checkedButton - * [string] Contains the last checked Button. - */ property Item checkedButton; Component.onCompleted: { diff --git a/declarativeimports/plasmacomponents/qml/ButtonRow.qml b/declarativeimports/plasmacomponents/qml/ButtonRow.qml index e88b015d4..17191e220 100644 --- a/declarativeimports/plasmacomponents/qml/ButtonRow.qml +++ b/declarativeimports/plasmacomponents/qml/ButtonRow.qml @@ -39,39 +39,48 @@ ** ****************************************************************************/ +/**Documented API +Inherits: + Row + +Imports: + ButtonGroup.js + QtQuick 1.1 + + +Description: + A ButtonRow allows you to group Buttons in a row. It provides a selection-behavior as well. + + Note: This component don't support the enabled property. + If you need to disable it you should disable all the buttons inside it. + + This is an example, + + ButtonRow { + Button { text: "Left" } + Button { text: "Right" } + } + + +Properties: + bool exclusive: + Specifies the grouping behavior. If enabled, the checked property on buttons contained + in the group will be exclusive.The default value is true. + + Note that a button in an exclusive group will allways be checkable + + Item checkedButton: + Returns the last checked button. + **/ + import QtQuick 1.1 import "ButtonGroup.js" as Behavior -/* - Class: ButtonRow - A ButtonRow allows you to group Buttons in a row. It provides a selection-behavior as well. - - Note: This component don't support the enabled property. - If you need to disable it you should disable all the buttons inside it. - - - ButtonRow { - Button { text: "Left" } - Button { text: "Right" } - } - -*/ Row { id: root - /* - * Property: exclusive - * [bool=true] Specifies the grouping behavior. If enabled, the checked property on buttons contained - * in the group will be exclusive. - * - * Note that a button in an exclusive group will allways be checkable - */ property bool exclusive: true - /* - * Property: checkedButton - * [string] Contains the last checked Button. - */ property Item checkedButton; Component.onCompleted: { diff --git a/declarativeimports/plasmacomponents/qml/CheckBox.qml b/declarativeimports/plasmacomponents/qml/CheckBox.qml index 331f8891e..d6556338a 100644 --- a/declarativeimports/plasmacomponents/qml/CheckBox.qml +++ b/declarativeimports/plasmacomponents/qml/CheckBox.qml @@ -17,10 +17,37 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + The private DualStateButton +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + A check box is a component that can be switched on (checked) or off (unchecked). Check boxes are typically used to represent features in an application that can be enabled or disabled without affecting others, but different types of behavior can be implemented. When a check box is checked or unchecked it sends a clicked signal for the application to handle. + When a check box has the focus, its state can be toggled using the Qt.Key_Select, Qt.Key_Return, and Qt.Key_Enter hardware keys that send the clicked signal. + +Properties: + bool checked: + If the button is checked, its checked property is true; otherwise false. The property is false by default. + + bool pressed: + If the button is pressed, its pressed property is true. + See also clicked. + + string text: + The text is shown beside the check box. By default text is an empty string. +Signals: + clicked(): + Emitted when the user clicked a mouse button over the checkbox (or tapped on the touch screen) +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private -DualStateButton { +Private.DualStateButton { id: checkBox view: PlasmaCore.FrameSvgItem { imagePath: "widgets/button" @@ -48,5 +75,5 @@ DualStateButton { } } - shadow: ButtonShadow {} + shadow: Private.ButtonShadow {} } \ No newline at end of file diff --git a/declarativeimports/plasmacomponents/qml/CommonDialog.qml b/declarativeimports/plasmacomponents/qml/CommonDialog.qml index b9c150186..512c894e4 100644 --- a/declarativeimports/plasmacomponents/qml/CommonDialog.qml +++ b/declarativeimports/plasmacomponents/qml/CommonDialog.qml @@ -42,15 +42,44 @@ import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private import "." 0.1 + +/**Documented API +Inherits: + Dialog + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + CommonDialog is a convenience component that provides a dialog with the platform-style title area. You only have to define titleText. CommonDialog handles its layout automatically. + Note: This component is experimental, so it may be changed or removed in future releases. + +Properties: + string titleText: + the title of the dialog. + + string titleIcon: + the name or path of the dialog title icon + + Array variant buttonTexts: + the texts of all the buttons + +Signals: + buttonClicked(int index): + Emitted when the user clicks on a button + @arg int index: the index of the clicked button: buttonTexts[index] will hold the text of the clicked button. + +**/ Dialog { id: root property alias titleText: titleAreaText.text property string titleIcon property variant buttonTexts: [] - property bool privateCloseIcon: false signal buttonClicked(int index) @@ -104,7 +133,6 @@ Dialog { //FIXME: +5 because of Plasma::Dialog margins height: titleAreaText.paintedHeight + margins.top + margins.bottom - LayoutMirroring.enabled: privateCloseIcon ? false : undefined LayoutMirroring.childrenInherit: true Column { @@ -130,7 +158,7 @@ Dialog { } } - IconLoader { + Private.IconLoader { id: titleAreaIcon width: theme.iconSizeSmall height: theme.iconSizeSmall diff --git a/declarativeimports/plasmacomponents/qml/ContextMenu.qml b/declarativeimports/plasmacomponents/qml/ContextMenu.qml new file mode 100644 index 000000000..7856cca36 --- /dev/null +++ b/declarativeimports/plasmacomponents/qml/ContextMenu.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Marco Martin +** +** 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$ +** +****************************************************************************/ + +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + org.kde.plasma.components + +Description: + Provides a component with list of options that the user can choose from. + +Properties: + * QtObject model: + This property holds the model providing data for the menu. + The model provides the set of data that is used to create the items in the view. + Each model item must have a property called "text" or "display". + +Methods: + * void rebuildMenu(): + Rebuild the menu if property model is defined. +**/ + +import QtQuick 1.1 +import org.kde.plasma.components 0.1 + +Menu { + id: root +} diff --git a/declarativeimports/plasmacomponents/qml/Dialog.qml b/declarativeimports/plasmacomponents/qml/Dialog.qml index 8045914aa..76bf53d43 100644 --- a/declarativeimports/plasmacomponents/qml/Dialog.qml +++ b/declarativeimports/plasmacomponents/qml/Dialog.qml @@ -40,9 +40,70 @@ ** ****************************************************************************/ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + Provides a top-level window for short-term tasks and brief interaction with the user. + A dialog floats on the top layer of the application view, usually overlapping the area reserved for the application content. Normally, a dialog provides information and gives warnings to the user, or asks the user to answer a question or select an option. + +Properties: + list buttons: + A list of items in the dialog's button area. For example, you can use Row or Button components but you can also use any number of components that are based on Item component. + + list content: + A list of items in the dialog's content area. You can use any component that is based on Item. For example, you can use ListView, so that the user can select from a list of names. + + int status: + Indicates the dialog's phase in its life cycle. The values are as follows: + - DialogStatus.Opening - the dialog is opening + - DialogStatus.Open - the dialog is open and visible to the user + - DialogStatus.Closing - the dialog is closing + - DialogStatus.Closed - the dialog is closed and not visible to the user + The dialog's initial status is DialogStatus.Closed. + + list title: + A list of items in the dialog's title area. You can use a Text component but also any number of components that are based on Item. For example, you can use Text and Image components. + + Item visualParent: + The item that is dimmed when the dialog opens. By default the root parent object is visualParent. + +Signals: + accepted(): + This signal is emitted when the user accepts the dialog's request or the accept() method is called. + See also rejected(). + + clickedOutside(): This signal is emitted when the user taps in the area that is inside the dialog's visual parent area but outside the dialog's area. Normally the visual parent is the root object. In that case this signal is emitted if the user taps anywhere outside the dialog's area. + See also visualParent. + + rejected(): + This signal is emitted when the user rejects the dialog's request or the reject() method is called. + See also accepted(). + +Methods: + void accept(): + Accepts the dialog's request without any user interaction. The method emits the accepted() signal and closes the dialog. + See also reject(). + + void close(): + Closes the dialog without any user interaction. + + void open(): + Shows the dialog to the user. + + void reject(): + Rejects the dialog's request without any user interaction. The method emits the rejected() signal and closes the dialog. + See also accept(). +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore -import "AppManager.js" as Utils +import "private/AppManager.js" as Utils import "." 0.1 Item { diff --git a/declarativeimports/plasmacomponents/qml/Highlight.qml b/declarativeimports/plasmacomponents/qml/Highlight.qml index c539ec18a..142eeb40b 100644 --- a/declarativeimports/plasmacomponents/qml/Highlight.qml +++ b/declarativeimports/plasmacomponents/qml/Highlight.qml @@ -1,4 +1,4 @@ -/* + /* * Copyright 2011 Daker Fernandes Pinheiro * * This program is free software; you can redistribute it and/or modify @@ -16,6 +16,26 @@ * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + org.kde.plasma.core + +Description: + Used to highlight an item of a list. to be used only as the "highlight" property of the ListView and GridView primitive QML components (or their derivates) + +Properties: + bool hover: + true if the user is hovering over the component + + bool pressed: + true if the mouse button is pressed over the component. +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore diff --git a/declarativeimports/plasmacomponents/qml/Label.qml b/declarativeimports/plasmacomponents/qml/Label.qml index 0f483d724..fbab27be6 100644 --- a/declarativeimports/plasmacomponents/qml/Label.qml +++ b/declarativeimports/plasmacomponents/qml/Label.qml @@ -17,15 +17,40 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 1.0 +/**Documented API +Inherits: + Text + +Imports: + QtQuick 1.1 + org.kde.plasma.core + +Description: + This is a label which uses the plasma theme. + The characteristics of the text will be automatically seted + according to the plasma theme. If you need a more customized + text,then you can use the Text component from QtQuick. + +Properties: + string text: + The most important property is "text". + For the other ones see the primitive QML Text element + +Methods: + See the primitive QML Text element + +Signals: + See the primitive QML Text element +**/ + +import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore Text { id: root height: Math.max(paintedHeight, theme.defaultFont.mSize.height*1.6) - //FIXME: wait to rely on 1.1 for lineCount > 1 - verticalAlignment: paintedHeight > theme.defaultFont.mSize.height*1.5 ? Text.AlignTop : Text.AlignVCenter + verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter font.capitalization: theme.defaultFont.capitalization font.family: theme.defaultFont.family diff --git a/declarativeimports/plasmacomponents/qml/ListItem.qml b/declarativeimports/plasmacomponents/qml/ListItem.qml index 45c1e6e2c..756ab10e9 100644 --- a/declarativeimports/plasmacomponents/qml/ListItem.qml +++ b/declarativeimports/plasmacomponents/qml/ListItem.qml @@ -17,6 +17,32 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + org.kde.plasma.core + QtQuick 1.0 + +Description: + An item delegate for the primitive ListView component. It's intended to make all listview look coherent + +Properties: + * bool checked: + If true makes the list item look as checked or pressed. It has to be set from the code, it won't change by itself. + + * bool sectionDelegate: + If true the item will be a delegate for a section, so will look like a "title" for the otems under it. + +Signals: + * clicked(): + This handler is called when there is a click. + + * pressAndHold(): + The user pressed the item with the mouse and didn't release it for a certain amount of time. +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore diff --git a/declarativeimports/plasmacomponents/qml/Page.qml b/declarativeimports/plasmacomponents/qml/Page.qml index f9496ab38..1bed9461b 100644 --- a/declarativeimports/plasmacomponents/qml/Page.qml +++ b/declarativeimports/plasmacomponents/qml/Page.qml @@ -38,6 +38,37 @@ ** ****************************************************************************/ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + everything in the same dir which are version 0.1 + +Description: + Defines the content of a piece of the user interface, it's meant to be loaded by a PageStack or TabGroup element. + The typical use can be in small plasmoids or mobile devices where the whole screen is a series of interchangeable and flickable pages, of which the user navigates across. + + +Properties: + * int status: + The current status of the page. It can be one of the following values: + PageStatus.Inactive (default) - the page is not visible. + PageStatus.Activating - the page is becoming to the active page. + PageStatus.Active - the page is the currently active page. + PageStatus.Deactivating - the page is becoming to inactive page. + + * PageStack pageStack: + The page stack that this page is owned by. + + * int orientationLock: + Sets the orientation for the Page + + * Item tools: + Defines the toolbar contents for the page. If the page stack is set up using a toolbar instance, it automatically shows the currently active page's toolbar contents in the toolbar. The default value is null resulting in the page's toolbar to be invisible when the page is active. +**/ + import QtQuick 1.1 import "." 0.1 diff --git a/declarativeimports/plasmacomponents/qml/PageStack.qml b/declarativeimports/plasmacomponents/qml/PageStack.qml index cced8a908..39ea75b5c 100644 --- a/declarativeimports/plasmacomponents/qml/PageStack.qml +++ b/declarativeimports/plasmacomponents/qml/PageStack.qml @@ -43,9 +43,70 @@ // The PageStack item defines a container for pages and a stack-based // navigation model. Pages can be defined as QML items or components. +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + . + PageStack.js + +Description: + The PageStack component provides a stack-based navigation model that you can use in your application. A stack-based navigation model means that a page of content for your application is pushed onto a stack when the user navigates deeper into the application page hierarchy. The user can then go back to the previous page (or several pages back) by popping a page (or several pages) off the top of the stack. + +Properties: + * int depth: + The number of pages on the page stack. + + * Item currentPage: + The page in the stack that is currently visible. + + * ToolBar toolBar: + The toolbar container for the tools associated with each page. If a toolbar is specified, the tools set for the current page is shown to the user. + If toolbar is null, then no tools are shown even if a page does have tools. + + * variant initialPage: + The page to be automatically loaded when this PageStack component gets instantiated. + + * bool busy: + Indicates whether there is an ongoing page transition. + +Methods: + * clear(): + Clears the page stack of all pages. + + * find(function): + This iterates, top to bottom, through all the pages in the page stack and passes each page to the given function. If the specified function returns true, the iterating stops and this function returns the page that produced the true result. If no matching page is found in the page stack, null is returned. + + * pop(page, immediate): + When you use pop() with no arguments, it pops the top page off the stack and returns that page to the caller. The normal pop transition animation is performed. If the page popped off the stack is based on the Item element, the page is re-parented back to its original parent. + If you give a page argument, the stack is unwound to the given page. Any Item-based pages popped off the stack are re-parented to their original parent. + If the given page is not found in the stack, the stack is unwound to the first page in the stack. However, if you specifically want to unwind the page stack to the first page in the stack, it is best to be explicit about what you are doing and use pop(null) rather than guessing a page that is not on the stack. + The immediate argument defaults to false which means the normal transition animation is performed when a page is popped. If you do not want the transition animation to be performed pass a value of true for immediate. + Note: A pop() on a stack with that contains 0 or 1 pages is a no-operation. + Returns: The page that was top-most on the stack before the pop operation. + + * push(page, properties, immediate): + Pushes the given page onto the page stack. You can use a component, item or string for the page. If the page is based on the Item element, the page is re-parented. If a string is used then it is interpreted as a URL that is used to load a page component. The push operation results in the appropriate transition animation being run. If you are pushing an array of pages, the transition animation is only shown for the last page. + Returns: The new top page on the stack. + The page argument can also be an array of pages. In this case, all the pages in the array are pushed onto the stack. The items in the array can be components, items or strings just like for pushing a single page. + The page argument can also be an object that specifies a page with properties or even an array of pages with properties. + The properties argument is optional and allows you to specify values for properties in the page being pushed. + The immediate argument defaults to false which means the normal transition animation is performed when a page is pushed. If you do not want the transition animation to be performed pass a value of true for immediate. + Note: When the stack is empty, a push() or replace() does not perform a transition animation because there is no page to transition from. The only time this normally happens is when an application is starting up so it is not appropriate to have a transition animation anyway. + See also Page. + + * replace(page, properties, immediate): + Replaces the top-most page on the stack with page. As in the push() operation, you can use a component, item or string for the page, or even an array of pages. If the page is based on the Item element, the page is re- parented. As in the pop() operation, the replaced page on the stack is re- parented back to its original parent. + Returns: The new top page on the stack. + See also push(). + +**/ + import QtQuick 1.1 import "." 0.1 -import "PageStack.js" as Engine +import "private/PageStack.js" as Engine Item { id: root diff --git a/declarativeimports/plasmacomponents/qml/ProgressBar.qml b/declarativeimports/plasmacomponents/qml/ProgressBar.qml index 3de9d919a..4f88cba6f 100644 --- a/declarativeimports/plasmacomponents/qml/ProgressBar.qml +++ b/declarativeimports/plasmacomponents/qml/ProgressBar.qml @@ -17,6 +17,40 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API + Inherits: + Item + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + It is a simple progressBar which is using the plasma theme. + Some operations take a period of time to be performed and the user needs a confirmation that the operation is still ongoing. If the user does not get any confirmation, they might suspect that they did something wrong or that the device has broken. A progress bar is one of available mechanisms for providing this reassurance to the user. + +Properties: + * real minimumValue: + Minimum Value for the progressBar + + * real maximumValue: + Maximum value for the progressBar + + real value: + Current value of the progressBar + + * bool indeterminate: + Indicates whether the operation's duration is known or not. The property can have the following values: + true - the operation's duration is unknown, so the progress bar is animated. The value, minimum, and maximum properties are ignored. + false - the operation's duration is known, so the progress bar is drawn to indicate progress between the minimum and maximum values. + The default value is false. + + * int orientation: + Orientation of the progressBar: + Qt.Horizontal or + Qt.Vertical +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.qtextracomponents 0.1 diff --git a/declarativeimports/plasmacomponents/qml/RadioButton.qml b/declarativeimports/plasmacomponents/qml/RadioButton.qml index 2bac0e457..d9e77ae74 100644 --- a/declarativeimports/plasmacomponents/qml/RadioButton.qml +++ b/declarativeimports/plasmacomponents/qml/RadioButton.qml @@ -17,12 +17,39 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + The private DualStateButton + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + A radio button component consists of a radio button and a line of text. Only one item in a list may be selected at a time. Once an item is selected, it can be deselected only by selecting another item. Initial item selection may be set at the list creation. If not set, the list is shown without a selection. + +Properties: + bool checked: + If the button is checked, its checked property is true; otherwise false. The property is false by default. + + bool pressed: + If the button is pressed, its pressed property is true. + See also clicked. + + string text: + The text is shown beside the check box. By default text is an empty string. + +Signals: + clicked(): + Emitted when the user clicked a mouse button over the checkbox (or tapped on the touch screen) +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore - +import "private" as Private //FIXME: this should be round, DualStateButton shouldn't draw the shadow -DualStateButton { +Private.DualStateButton { id: radioButton view: PlasmaCore.SvgItem { svg: PlasmaCore.Svg { @@ -52,5 +79,5 @@ DualStateButton { } } - shadow: RoundShadow {} + shadow: Private.RoundShadow {} } \ No newline at end of file diff --git a/declarativeimports/plasmacomponents/qml/ScrollBar.qml b/declarativeimports/plasmacomponents/qml/ScrollBar.qml index 4ba61bed1..8afaaea3f 100644 --- a/declarativeimports/plasmacomponents/qml/ScrollBar.qml +++ b/declarativeimports/plasmacomponents/qml/ScrollBar.qml @@ -18,9 +18,71 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + org.kde.plasma.core + QtQuick 1.1 + +Description: + Just a simple Scroll Bar which is using the plasma theme. + This component does not belongs to the QtComponents API specification + but it was base on ScrollDecorator component. + You should not use it for touch interfaces, use a flickable and a + ScrollDecorator instead. + By default, this component will look and behave like a scroll decorator + on touchscreens + +Properties: + + enumeration orientation: + This property holds the orientation where the ScrollBar will scroll. + The orientation can be either Qt.Horizontal or Qt.Vertical + The default value is Qt.Vertical. + + bool inverted: + This property holds if the ScrollBar will increase the Flickable + content in the normal direction (Left to Right or Top to Bottom) or + if this will be inverted. + The default value is false. + + bool updateValueWhileDragging: + This property holds if the Scrollbar will update the Flickeble + position while dragging or only when released. + The default value is true. + + real stepSize: + This property holds how many steps exists while moving the handler. + If you want the ScrollBar buttons to appear you must set this property + with a value bigger than 0. + The default value is 0. + + bool pressed: + This property holds if the ScrollBar is pressed. + + real scrollButtonInterval: + This property holds the interval time used by the ScrollBar button + to increase or decrease steps. + + Flickable flickableItem: + This property holds the Flickable component which the ScrollBar will + interact with. + + bool interactive: + This property holds if the ScrollBar is interactive. + The default value is true. + + bool enabeld: + This property holds if the button will be enabled for user + interaction. + The default value is true. +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore - +import "private" as Private /** * A generic ScrollBar/ScrollDecorator component: @@ -42,8 +104,8 @@ Item { property bool pressed: internalLoader.item.mouseArea?internalLoader.item.mouseArea.pressed:false property real scrollButtonInterval: 50 - implicitWidth: internalLoader.isVertical ? (interactive ? 22 : 12) : 200 - implicitHeight: internalLoader.isVertical ? 200 : (interactive ? 22 : 12) + implicitWidth: internalLoader.isVertical ? (interactive ? 16 : 12) : 200 + implicitHeight: internalLoader.isVertical ? 200 : (interactive ? 16 : 12) // TODO: needs to define if there will be specific graphics for // disabled scroll bars opacity: enabled ? 1.0 : 0.5 @@ -52,7 +114,7 @@ Item { anchors { right: flickableItem.right - left: (orientation == Qt.Vertical) ? undefined : flickableItem.left + left: (orientation == Qt.Vertical) ? undefined : flickableItem.left top: (orientation == Qt.Vertical) ? flickableItem.top : undefined bottom: flickableItem.bottom } @@ -78,6 +140,9 @@ Item { } } + // FIXME: there's a binding loop occurrence here somewhere...(RangeModel) : property: value + // try flicking a view with a scrollbar in it, and flick it past it's contents + // a few times and try using the mousewheel..you'll find the warning then.. RangeModel { id: range @@ -131,6 +196,6 @@ Item { } } - source: interactive ? "ScrollBarDelegate.qml" : "ScrollDecoratorDelegate.qml" + source: interactive ? "private/ScrollBarDelegate.qml" : "private/ScrollDecoratorDelegate.qml" } } diff --git a/declarativeimports/plasmacomponents/qml/SectionScroller.qml b/declarativeimports/plasmacomponents/qml/SectionScroller.qml index 8aaddff69..3a7dd18b6 100644 --- a/declarativeimports/plasmacomponents/qml/SectionScroller.qml +++ b/declarativeimports/plasmacomponents/qml/SectionScroller.qml @@ -37,21 +37,32 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + org.kde.plasma.core + +Description: + It's similar to a ScrollBar or a ScrollDecorator. + It's interactive and works on ListViews that have section.property set, + so its contents are categorized. + An indicator will say to what category the user scrolled to. + Useful for things like address books or things sorted by date. + Don't use with models too big (thousands of items) because implies + loading all the items to memory, as well loses precision. + +Properties: + ListView listView: + As The ScrollBar, this is the listview the sectionScroller will operate on. This component doesn't work with simple Flickable or GridView. +**/ import QtQuick 1.1 -import "SectionScroller.js" as Sections +import "private/SectionScroller.js" as Sections import org.kde.plasma.core 0.1 as PlasmaCore -/** - * It's similar to a ScrollBar or a ScrollDecorator. - * It's interactive and works on ListViews that have section.property set, - * so its contents are categorized. - * An indicator will say to what category the user scrolled to. - * - * Useful for things like address books or things sorted by date. - * Don't use with models too big (thousands of items) because implies - * loading all the items to memory, as well loses precision. - */ Item { id: root diff --git a/declarativeimports/plasmacomponents/qml/SelectionDialog.qml b/declarativeimports/plasmacomponents/qml/SelectionDialog.qml index 1f0f8b721..6eddf2d3c 100644 --- a/declarativeimports/plasmacomponents/qml/SelectionDialog.qml +++ b/declarativeimports/plasmacomponents/qml/SelectionDialog.qml @@ -40,6 +40,35 @@ ** ****************************************************************************/ +/**Documentanted API +Inherits: + CommonDialog + +Imports: + org.kde.plasma.core + QtQuick 1.1 + "." 0.1 + +Description: + This is plasma themed SelectionDialog, with which you can customize the visual representation + of the selectable items' list by overriding the ListView delegate. + By default SelectionDialog provides a scrollable list of textual menu items. + The user can choose one item from the list at a time. + +Properties: + QtObject: listView.model: + The model of selectionDialog. + Can be a simple model or a custom QAbstractItemModel + + int selectedIndex: -1 + It returns the index that the user has selected. + The default value is -1. + + Component delegate: + This is a common delegate with which,you will choose + how your items will be displayed. +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore @@ -53,8 +82,6 @@ CommonDialog { property int selectedIndex: -1 property Component delegate: defaultDelegate - privateCloseIcon: true - Component { id: defaultDelegate diff --git a/declarativeimports/plasmacomponents/qml/Slider.qml b/declarativeimports/plasmacomponents/qml/Slider.qml index 9080aa252..447dbb16a 100644 --- a/declarativeimports/plasmacomponents/qml/Slider.qml +++ b/declarativeimports/plasmacomponents/qml/Slider.qml @@ -17,8 +17,75 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + An interactive slider component with Plasma look and feel. + +Properties: + int stepSize: range.stepSize + This property holds in how many steps the slider value can be selected within it's + range value. + + real minimumValue: + This property holds the minimun value that the slider's value can assume. + The default value is 0. + + real maximumValue: + This property holds the maximum value that the slider's value can assume. + The default value is 1. + + real value: + This property holds the value selected inside the minimun to maximum range of value. + The default value is 0. + + enumeration orientation: + This property holds the orientation for this component. + The orientation can assume Qt.Horizontal and Qt.Vertical values. + The default is Qt.Horizontal. + + bool pressed: + This property holds if the Slider is being pressed or not. + Read-only. + + bool valueIndicatorVisible: + This property holds if a value indicator element will be shown while is dragged or not. + ! The value indicator is not implemented in the Plasma Slider. + The default value is false. + + string valueIndicatorText: + This property holds the text being displayed in the value indicator. + ! The value indicator is not implemented in the Plasma Slider. + Read-only. + +Plasma Properties: + + bool animated: + This property holds if the slider will animate or not when other point is clicked, + and the slider handler is not being dragged. + The default value is false. + + alias inverted: + This property holds if the slider visualizations has an inverted direction. + The default value is false. + + bool updateValueWhileDragging: + This property holds if the value is updated while dragging or if it applies only + when the slider's handler is released. + + real handleSize: + This property holds the size of the Slider's handle. +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private // TODO: create a value indicator for plasma? Item { @@ -143,7 +210,7 @@ Item { visible: range.position > 0 && slider.enabled } - RoundShadow { + Private.RoundShadow { id: shadow imagePath: "widgets/slider" focusElement: "horizontal-slider-focus" diff --git a/declarativeimports/plasmacomponents/qml/Switch.qml b/declarativeimports/plasmacomponents/qml/Switch.qml index 5b1d48f07..ce74dc5ed 100644 --- a/declarativeimports/plasmacomponents/qml/Switch.qml +++ b/declarativeimports/plasmacomponents/qml/Switch.qml @@ -17,10 +17,43 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + DualStateButton + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + You can bind the Switch component to a feature that the application + has to enable or disable depending on the user's input, for example. + Switch has similar usage and API as CheckBox, except that Switch does + not provide a built-in label. + +Properties: + bool checked: + Returns true if the Button is checked, otherwise + it returns false. + + bool pressed: + Returns true if the Button is pressed, otherwise + it returns false. + + string text: + Sets the text for the switch. + The default value is empty.No text + will be displayed. + +Signals: + onClicked: + The signal is emited when the button is clicked! +**/ import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private -DualStateButton { +Private.DualStateButton { id: switchItem view: PlasmaCore.FrameSvgItem { @@ -52,7 +85,7 @@ DualStateButton { bottomMargin: -margins.bottom } } - + PlasmaCore.FrameSvgItem { id: button imagePath: "widgets/button" diff --git a/declarativeimports/plasmacomponents/qml/TabBar.qml b/declarativeimports/plasmacomponents/qml/TabBar.qml index 9a1acb381..d642ea779 100644 --- a/declarativeimports/plasmacomponents/qml/TabBar.qml +++ b/declarativeimports/plasmacomponents/qml/TabBar.qml @@ -40,8 +40,33 @@ ** ****************************************************************************/ +/**Documented API +Inherits: + DualStateButton + +Imports: + QtQuick 1.1 + org.kde.plasma.core + +Description: + TabBar is a plasma themed component that you can + use as a container for the tab buttons. + +Properties: + Item currentTab: + Returns the current tabbar button. + + default alias content: + This property represends the the content of + the TabBarLayout. + + Item tabBarLayout: + This is an alias for the layout of the tabbar. +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private Item { id: root @@ -79,7 +104,7 @@ Item { } } - TabBarLayout { + Private.TabBarLayout { id: tabBarLayout anchors { fill: parent @@ -88,5 +113,10 @@ Item { rightMargin: backgroundFrame.margins.right + buttonFrame.margins.right bottomMargin: backgroundFrame.margins.bottom + buttonFrame.margins.bottom } + Component.onCompleted: { + if (!root.currentTab) { + root.currentTab = tabBarLayout.children[0] + } + } } } diff --git a/declarativeimports/plasmacomponents/qml/TabButton.qml b/declarativeimports/plasmacomponents/qml/TabButton.qml index 00ef0db75..5a3605501 100644 --- a/declarativeimports/plasmacomponents/qml/TabButton.qml +++ b/declarativeimports/plasmacomponents/qml/TabButton.qml @@ -40,8 +40,43 @@ ** ****************************************************************************/ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + AppManager.js + +Description: + A simple tab button which is using the plasma theme. + +Properties: + Item tab: + The reference to the tab content (one of the children of a TabGroup, + usually a Page) that is activated when this TabButton is clicked. + + bool checked: + True if the button is checked,otherwise false. + + bool pressed: + True if the button is being pressed,otherwise false. + + string text: + Sets the text for the button. + + string iconSource: + Icon for the button. It can be a Freedesktop icon name, a full path to a ong/svg file, + or any name for which the application has an image handler registered. + +Signals: + onClicked: + The signal is emmited when the button is clicked. +**/ + import QtQuick 1.1 -import "AppManager.js" as Utils +import "private/AppManager.js" as Utils +import "private" as Private Item { id: root @@ -65,6 +100,7 @@ Item { //TabBar is the granparent root.parent.parent.currentTab = root } + onVisibleChanged: root.parent.childrenChanged() } QtObject { @@ -81,8 +117,8 @@ Item { } Component.onCompleted: { - if (internal.tabGroup.currentTab == tab) { - parent.parent.currentTab = root + if (internal.tabGroup && internal.tabGroup.currentTab == tab) { + internal.tabGroup.currentTab = tab } } } @@ -104,7 +140,7 @@ Item { verticalAlignment: Text.AlignVCenter } - IconLoader { + Private.IconLoader { id: imageLoader implicitWidth: theme.smallIconSize diff --git a/declarativeimports/plasmacomponents/qml/TabGroup.qml b/declarativeimports/plasmacomponents/qml/TabGroup.qml index 4507cbc77..158ae88fb 100644 --- a/declarativeimports/plasmacomponents/qml/TabGroup.qml +++ b/declarativeimports/plasmacomponents/qml/TabGroup.qml @@ -38,8 +38,27 @@ ** ****************************************************************************/ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + +Description: + Provides a set of pages for a tab-based interface. + A tabbed interface is made up of tab buttons plus content for each button. A TabGroup component has, as its children, each page of content in the interface. These pages can be any QML items but are typically Page components for a single page of content or PageStack components when a hierarchical navigation system is required for the tab content. + If you use Page components for your tab content, the status property of each page is updated appropriately when the current tab is changed: the current page has status PageStatus.Active and other pages have the status PageStatus.Inactive. During page transitions, PageStatus.Activating (for the page that is becoming the current page) and PageStatus.Deactivating (for the page that was the current page) statuses are also set. + +Properties: + Item currentTab: + The tab that is currently active and visible to the user. + The currentTab property is initialized to null and is automatically set to point to the first tab when content is added. You can set the currentTab at any time to activate a particular tab. + +**/ + import QtQuick 1.1 -import "TabGroup.js" as Engine +import "private/TabGroup.js" as Engine import "." 0.1 diff --git a/declarativeimports/plasmacomponents/qml/TextArea.qml b/declarativeimports/plasmacomponents/qml/TextArea.qml index d3d426993..2f3834d20 100644 --- a/declarativeimports/plasmacomponents/qml/TextArea.qml +++ b/declarativeimports/plasmacomponents/qml/TextArea.qml @@ -17,8 +17,159 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + org.kde.plasma.core 0.1 + +Description: + Creates a simple plasma theme based text area. + Like kates.. + +Properties: + * font font: + This property holds the font used in the text field. + The default font value is the font from plasma desktop theme. + + * Qt::InputMethodHints inputMethodHints: + This property holds the the currently supported input method hints + for the text field. + The default values is Qt.ImhNone. + + * bool errorHighlight: + This property holds if the text field is highlighted or not + If it is true then the problematic lines will be highlighted. + This feature is defined in the Common API but is unimplemented in plasma components. + + * int cursorPosition: + This property holds the current cursor position. + + * enumeration horizontalAlignment: + * enumeration verticalAlignment: + Sets the horizontal and vertical alignment of the text within the TextArea item's width and height. + By default, the text alignment follows the natural alignment of the text, + for example text that is read from left to right will be aligned to the left. + + Valid values for horizontalAlignment are: + + * TextEdit.AlignLeft (default) + * TextEdit.AlignRight + * TextEdit.AlignHCenter + * TextEdit.AlignJustify + + Valid values for verticalAlignment are: + + * TextEdit.AlignTop (default) + * TextEdit.AlignBottom + * TextEdit.AlignVCenter + + * bool readOnly: + This property holds if the TextArea can be modified by the user interaction. + The default value is false. + + * string selectedText: + This property holds the text selected by the user. + If no text is selected it holds an empty string. + This property is read-only. + + * int selectionEnd: + This property holds the cursor position after the last character in the current selection. + This property is read-only. + + * int selectionStart: + This property holds the cursor position before the first character in the current selection. + This property is read-only. + + * string text: + This property holds the entire text in the TextArea. + + * enumeration textFormat: + The way the text property should be displayed. + + * TextEdit.AutoText + * TextEdit.PlainText + * TextEdit.RichText + * TextEdit.StyledText + + The default is TextEdit.AutoText. If the text format is TextEdit.AutoText the text edit will automatically determine whether the text should be treated as rich text. This determination is made using Qt::mightBeRichText(). + + * enumeration wrapMode: + Set this property to wrap the text to the TextArea item's width. The text will only wrap if an explicit width has been set. + * TextEdit.NoWrap - no wrapping will be performed. + If the text contains insufficient newlines, then implicitWidth will exceed a set width. + * TextEdit.WordWrap - wrapping is done on word boundaries only. + If a word is too long, implicitWidth will exceed a set width. + * TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. + * TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. + + The default is TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap. + + * string placeholderText: + This property holds the text displayed in when the text is empty. + The default value is empty string, meaning no placeholderText shown. + + +Plasma properties: + + * bool interactive: + This property describes whether the user can interact with the TextArea flicking content. + A user cannot drag or flick a TextArea that is not interactive. + This property is useful for temporarily disabling flicking. + + * int contentMaxWidth: + This property holds the maximum width that the text content can have. + + * int contentMaxHeight: + This property holds the maximum height that the text content can have. + + * property real scrollWidth: + This property holds the stepSize of the ScrollBar present at the TextArea + when it's content are bigger than it's size. + +Methods: + * void copy(): + Copies the currently selected text to the system clipboard. + + * void cut(): + Moves the currently selected text to the system clipboard. + + * void deselect(): + Removes active text selection. + + * void paste(): + Replaces the currently selected text by the contents of the system clipboard. + + * void select(int start, int end): + Causes the text from start to end to be selected. + If either start or end is out of range, the selection is not changed. + After calling this, selectionStart will become the lesser and selectionEnd will become the greater + (regardless of the order passed to this method). + + * void selectAll(): + Causes all text to be selected. + + * void selectWord(): + Causes the word closest to the current cursor position to be selected. + + * void positionAt(int position): + This function returns the character position at x pixels from the left of the TextArea. + Position 0 is before the first character, position 1 is after the first character but before the second, + and so on until position text.length, which is after all characters. + This means that for all x values before the first character this function returns 0, + and for all x values after the last character this function returns text.length. + + * rectangle positionToRectangle(position): + Returns the rectangle at the given position in the text. + The x, y, and height properties correspond to the cursor that would describe that position. + +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private Item { id: textArea @@ -65,11 +216,11 @@ Item { } function positionAt(pos) { - textEdit.positionAt(pos); + return textEdit.positionAt(pos); } function positionToRectangle(pos) { - textEdit.positionToRectangle(pos); + return textEdit.positionToRectangle(pos); } // Plasma API @@ -88,7 +239,7 @@ Item { opacity: enabled ? 1.0 : 0.5 - TextFieldFocus { + Private.TextFieldFocus { id: hover state: textArea.activeFocus ? "focus" : (mouseWatcher.containsMouse ? "hover" : "hidden") anchors.fill: base diff --git a/declarativeimports/plasmacomponents/qml/TextField.qml b/declarativeimports/plasmacomponents/qml/TextField.qml index 90e147df7..fcbc8fdc6 100644 --- a/declarativeimports/plasmacomponents/qml/TextField.qml +++ b/declarativeimports/plasmacomponents/qml/TextField.qml @@ -17,8 +17,143 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + +Description: + Creates a simple plasma theme based text field widget. + +Properties: + * font font: + This property holds the font used in the text field. + The default font value is the font from plasma desktop theme. + + * Qt::InputMethodHints inputMethodHints: + This property holds the the currently supported input method hints + for the text field. + The default values is Qt.ImhNone. + + * bool errorHighlight: + This property holds if the text field is highlighted or not + If it is true then the problematic lines will be highlighted. + This feature is defined in the Common API but is unimplemented in plasma components. + + * int cursorPosition: + This property holds the current cursor position. + + * bool readOnly: + This property holds if the text field can be modified by the user interaction. + The default value is false. + + * string selectedText: + This property holds the text selected by the user. + If no text is selected it holds an empty string. + This property is read-only. + + * int selectionEnd: + This property holds the cursor position after the last character in the current selection. + This property is read-only. + + * int selectionStart: + This property holds the cursor position before the first character in the current selection. + This property is read-only. + + * string text: + This property holds the entire text in the text field. + + * string placeholderText: + This property holds the text displayed in when the text is empty. + The default value is empty string, meaning no placeholderText shown. + + * enumeration echoMode: + This property specifies how the text should be displayed in the TextField. + The acceptable values are: + - TextInput.Normal - Displays the text as it is. (Default) + - TextInput.Password - Displays asterixes instead of characters. + - TextInput.NoEcho - Displays nothing. + - TextInput.PasswordEchoOnEdit - Displays all but the current character as asterixes. + The default value is TextInput.Normal + + * string inputMask: + Allows you to set an input mask on the TextField, restricting the allowable text inputs. + See QLineEdit::inputMask for further details, as the exact same mask strings are used by TextInput. + + * Validator validator: + Allows you to set a validator on the TextField. When a validator is set the TextField + will only accept input which leaves the text property in an acceptable or intermediate state. + The accepted signal will only be sent if the text is in an acceptable state when enter is pressed. + Currently supported validators are IntValidator, DoubleValidator and RegExpValidator. + An example of using validators is shown below, which allows input of integers + between 11 and 31 into the text input: + + import QtQuick 1.0 + TextInput { + validator: IntValidator{bottom: 11; top: 31;} + focus: true + } + + + * int maximumLength: + The maximum permitted length of the text in the TextField. + If the text is too long, it is truncated at the limit. + By default, this property contains a value of 32767. + + * bool acceptableInput: + This property is always true unless a validator or input mask has been set. + If a validator or input mask has been set, this property will only be true if the current + text is acceptable to the validator or input mask as a final string (not as an intermediate string). + This property is always true unless a validator has been set. + If a validator has been set, this property will only be true if the current text is acceptable to the + validator as a final string (not as an intermediate string). + This property is read-only. + + * bool clearButtonShown: + Holds if the button to clear the text from TextField is visible. + +Methods: + * void copy(): + Copies the currently selected text to the system clipboard. + + * void cut(): + Moves the currently selected text to the system clipboard. + + * void deselect(): + Removes active text selection. + + * void paste(): + Replaces the currently selected text by the contents of the system clipboard. + + * void select(int start, int end): + Causes the text from start to end to be selected. + If either start or end is out of range, the selection is not changed. + After calling this, selectionStart will become the lesser and selectionEnd will become the greater + (regardless of the order passed to this method). + + * void selectAll(): + Causes all text to be selected. + + * void selectWord(): + Causes the word closest to the current cursor position to be selected. + + * void positionAt(int position): + This function returns the character position at x pixels from the left of the TextField. + Position 0 is before the first character, position 1 is after the first character but before the second, + and so on until position text.length, which is after all characters. + This means that for all x values before the first character this function returns 0, + and for all x values after the last character this function returns text.length. + + * rectangle positionToRectangle(position): + Returns the rectangle at the given position in the text. + The x, y, and height properties correspond to the cursor that would describe that position. +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private Item { id: textField @@ -69,11 +204,11 @@ Item { } function positionAt(pos) { - textInput.positionAt(pos); + return textInput.positionAt(pos); } function positionToRectangle(pos) { - textInput.positionToRectangle(pos); + return textInput.positionToRectangle(pos); } @@ -93,7 +228,7 @@ Item { // disabled text fields opacity: enabled ? 1.0 : 0.5 - TextFieldFocus { + Private.TextFieldFocus { id: hover state: textInput.activeFocus ? "focus" : (mouseWatcher.containsMouse ? "hover" : "hidden") anchors.fill: base @@ -160,11 +295,6 @@ Item { textInput.closeSoftwareInputPanel() } } - - // Proxying keys events is not required by the - // common API but is desired in the plasma API. - Keys.onPressed: textField.Keys.pressed(event); - Keys.onReleased: textField.Keys.released(event); } PlasmaCore.SvgItem { @@ -193,4 +323,4 @@ Item { } } } -} \ No newline at end of file +} diff --git a/declarativeimports/plasmacomponents/qml/ToolBar.qml b/declarativeimports/plasmacomponents/qml/ToolBar.qml index 6c9e75470..57da8968f 100644 --- a/declarativeimports/plasmacomponents/qml/ToolBar.qml +++ b/declarativeimports/plasmacomponents/qml/ToolBar.qml @@ -17,6 +17,42 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + PlasmaCore.FrameSvgItem + +Imports: + QtQuick 1.1 + org.kde.plasma.core + +Description: + A plasma theme based toolbar. + +Properties: + + Item tools: + The ToolBarLayout that contains the ToolButton components that + are contained in the ToolBar. ToolBarLayout is not mandatory. + The default value is NULL. + + + string transition: + The type of transition to be used for the ToolBar when + the page changes on the relevant PageStack. + The possible values can be one of the following: + set an instantaneous change (default) + push follows page stack push animation + pop follows page stack pop animation + replace follows page stack replace animation + +Methods: + void setTools( tools, transition ): + This sets the tools for the ToolBar and the transition type that + will be used when the page changes on the relevant PageStack. + @arg Item tools see tool property + @arg string transition see transition property +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore diff --git a/declarativeimports/plasmacomponents/qml/ToolBarLayout.qml b/declarativeimports/plasmacomponents/qml/ToolBarLayout.qml index 47bf2e9f2..a6145d6ec 100644 --- a/declarativeimports/plasmacomponents/qml/ToolBarLayout.qml +++ b/declarativeimports/plasmacomponents/qml/ToolBarLayout.qml @@ -21,6 +21,17 @@ // ToolBarLayout is a container for items on a toolbar that automatically // implements an appropriate layout for its children. +/**Documented API +Inherits: + Row + +Imports: + QtQuick 1.1 + +Description: + ToolBarLayout is a container for items on a toolbar that automatically implements an appropriate layout for its children. +**/ + import QtQuick 1.1 import "." 0.1 diff --git a/declarativeimports/plasmacomponents/qml/ToolButton.qml b/declarativeimports/plasmacomponents/qml/ToolButton.qml index 4d55599e0..288b64625 100644 --- a/declarativeimports/plasmacomponents/qml/ToolButton.qml +++ b/declarativeimports/plasmacomponents/qml/ToolButton.qml @@ -18,8 +18,47 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + org.kde.plasma.core + +Description: + A plasma theme based toolbutton. + +Properties: + bool flat: + Returns true if the button is flat. + + bool checked: false + Returns true if the button is checked. + + bool checkable: + Returns true if the button is checkable. + + alias pressed: + Returns true if the button is pressed. + alias text: + Sets the text for the button. + + alias iconSource: + Sets the icon for the button. + It can be any image from any protocol supported by the Image element, or a freedesktop-compatible icon name + + alias font: + Sets the font for the button. + +Signals: + onClicked: + The signal is being emmited when the button is being clicked. +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore +import "private" as Private Item { id: button @@ -103,7 +142,7 @@ Item { } } - ButtonShadow { + Private.ButtonShadow { id: shadow anchors.fill: parent visible: !flat @@ -135,7 +174,7 @@ Item { PropertyAnimation { duration: 250 } } - IconLoader { + Private.IconLoader { id: icon anchors { @@ -143,6 +182,8 @@ Item { left: label.text ? parent.left : undefined horizontalCenter: label.text ? undefined : parent.horizontalCenter } + height: roundToStandardSize(parent.height) + width: height } Text { diff --git a/declarativeimports/plasmacomponents/qml/AppManager.js b/declarativeimports/plasmacomponents/qml/private/AppManager.js similarity index 100% rename from declarativeimports/plasmacomponents/qml/AppManager.js rename to declarativeimports/plasmacomponents/qml/private/AppManager.js diff --git a/declarativeimports/plasmacomponents/qml/ButtonShadow.qml b/declarativeimports/plasmacomponents/qml/private/ButtonShadow.qml similarity index 95% rename from declarativeimports/plasmacomponents/qml/ButtonShadow.qml rename to declarativeimports/plasmacomponents/qml/private/ButtonShadow.qml index 4c65f907f..bf9e1b731 100644 --- a/declarativeimports/plasmacomponents/qml/ButtonShadow.qml +++ b/declarativeimports/plasmacomponents/qml/private/ButtonShadow.qml @@ -18,6 +18,21 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: +TODO i need more info here + + +Properties: +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore diff --git a/declarativeimports/plasmacomponents/qml/DualStateButton.qml b/declarativeimports/plasmacomponents/qml/private/DualStateButton.qml similarity index 82% rename from declarativeimports/plasmacomponents/qml/DualStateButton.qml rename to declarativeimports/plasmacomponents/qml/private/DualStateButton.qml index 27b303098..1579e8826 100644 --- a/declarativeimports/plasmacomponents/qml/DualStateButton.qml +++ b/declarativeimports/plasmacomponents/qml/private/DualStateButton.qml @@ -17,6 +17,40 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + TODO i need more info here + +Properties: + bool checked: + Returns if the Button is checked or not. + + alias pressed: + TODO i need more info here + + alias text: + Sets the text for the button + + QtObject theme: + TODO needs info + + alias view: + TODO needs info + + alias shadow: + TODO needs info +Signals: + clicked: + The signal is emited when the button is clicked! +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore diff --git a/declarativeimports/plasmacomponents/qml/IconLoader.qml b/declarativeimports/plasmacomponents/qml/private/IconLoader.qml similarity index 80% rename from declarativeimports/plasmacomponents/qml/IconLoader.qml rename to declarativeimports/plasmacomponents/qml/private/IconLoader.qml index 49bdd845b..e9760a871 100644 --- a/declarativeimports/plasmacomponents/qml/IconLoader.qml +++ b/declarativeimports/plasmacomponents/qml/private/IconLoader.qml @@ -17,6 +17,26 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + org.kde.plasma.core + org.kde.qtextracomponents + +Description: + TODO i need more info here + +Properties: + bool valid: + Returns if the icon is valid or not. + + string source: + Returns the dir,in which the icon exists. +**/ + import QtQuick 1.1 import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.qtextracomponents 0.1 @@ -26,10 +46,15 @@ Item { property bool valid: false - property string source + property variant source onSourceChanged: { - if (source == "") { + //is it a qicon? + if (typeof source != "string") { + imageLoader.sourceComponent = iconComponent + valid = true + return + } else if (source == "") { imageLoader.sourceComponent = null valid = false } @@ -41,7 +66,7 @@ Item { if (svgIcon.isValid() && svgIcon.hasElement(root.source)) { imageLoader.sourceComponent = svgComponent - } else if (root.source.indexOf(".") == -1 && root.source.indexOf(":") == -1) { + } else if ((root.source.indexOf(".") == -1 && root.source.indexOf(":") == -1)) { imageLoader.sourceComponent = iconComponent } else { imageLoader.sourceComponent = imageComponent @@ -92,7 +117,7 @@ Item { id: iconComponent QIconItem { - icon: QIcon(root.source) + icon: (typeof source == "string") ? QIcon(root.source) : root.source smooth: true anchors.fill: parent } diff --git a/declarativeimports/plasmacomponents/qml/PageStack.js b/declarativeimports/plasmacomponents/qml/private/PageStack.js similarity index 100% rename from declarativeimports/plasmacomponents/qml/PageStack.js rename to declarativeimports/plasmacomponents/qml/private/PageStack.js diff --git a/declarativeimports/plasmacomponents/qml/RoundShadow.qml b/declarativeimports/plasmacomponents/qml/private/RoundShadow.qml similarity index 91% rename from declarativeimports/plasmacomponents/qml/RoundShadow.qml rename to declarativeimports/plasmacomponents/qml/private/RoundShadow.qml index f11e54de9..b94cc6bf1 100644 --- a/declarativeimports/plasmacomponents/qml/RoundShadow.qml +++ b/declarativeimports/plasmacomponents/qml/private/RoundShadow.qml @@ -18,6 +18,22 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.0 + org.kde.plasma.core + +Description: + It is a simple Radio button which is using the plasma theme. + TODO Do we need more info? + +Properties: + TODO needs more info?? +**/ + import QtQuick 1.0 import org.kde.plasma.core 0.1 as PlasmaCore diff --git a/declarativeimports/plasmacomponents/qml/ScrollBarDelegate.qml b/declarativeimports/plasmacomponents/qml/private/ScrollBarDelegate.qml similarity index 100% rename from declarativeimports/plasmacomponents/qml/ScrollBarDelegate.qml rename to declarativeimports/plasmacomponents/qml/private/ScrollBarDelegate.qml diff --git a/declarativeimports/plasmacomponents/qml/ScrollDecoratorDelegate.qml b/declarativeimports/plasmacomponents/qml/private/ScrollDecoratorDelegate.qml similarity index 100% rename from declarativeimports/plasmacomponents/qml/ScrollDecoratorDelegate.qml rename to declarativeimports/plasmacomponents/qml/private/ScrollDecoratorDelegate.qml diff --git a/declarativeimports/plasmacomponents/qml/SectionScroller.js b/declarativeimports/plasmacomponents/qml/private/SectionScroller.js similarity index 100% rename from declarativeimports/plasmacomponents/qml/SectionScroller.js rename to declarativeimports/plasmacomponents/qml/private/SectionScroller.js diff --git a/declarativeimports/plasmacomponents/qml/TabBarLayout.qml b/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml similarity index 87% rename from declarativeimports/plasmacomponents/qml/TabBarLayout.qml rename to declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml index 2602b1c1f..4837280e0 100644 --- a/declarativeimports/plasmacomponents/qml/TabBarLayout.qml +++ b/declarativeimports/plasmacomponents/qml/private/TabBarLayout.qml @@ -40,6 +40,20 @@ ** ****************************************************************************/ +/**Documented API +Inherits: + Item + +Imports: + QtQuick 1.1 + +Description: + TODO + +Properties: + +**/ + import QtQuick 1.1 Item { @@ -92,16 +106,29 @@ Item { function layoutChildren() { var childCount = root.children.length + var visibleChildCount = childCount var contentWidth = 0 var contentHeight = 0 if (childCount != 0) { - var itemWidth = (root.width - (childCount-1)*10) / childCount + //not too much efficient but the loop over children needs to be done two times to get the proper child width + for (var i = 0; i < childCount; ++i) { + if (!root.children[i].visible) { + --visibleChildCount + } + } + var itemWidth = (root.width - (childCount-1)*10) / visibleChildCount var itemIndex = mirrored ? childCount - 1 : 0 var increment = mirrored ? - 1 : 1 + var visibleIndex = 0 for (var i = 0; i < childCount; ++i, itemIndex += increment) { var child = root.children[itemIndex] - child.x = i * itemWidth + i*10 + if (!child.visible) { + continue + } + + child.x = visibleIndex * itemWidth + visibleIndex*10 + ++visibleIndex child.y = 0 child.width = itemWidth child.height = root.height diff --git a/declarativeimports/plasmacomponents/qml/TabGroup.js b/declarativeimports/plasmacomponents/qml/private/TabGroup.js similarity index 100% rename from declarativeimports/plasmacomponents/qml/TabGroup.js rename to declarativeimports/plasmacomponents/qml/private/TabGroup.js diff --git a/declarativeimports/plasmacomponents/qml/TextFieldFocus.qml b/declarativeimports/plasmacomponents/qml/private/TextFieldFocus.qml similarity index 100% rename from declarativeimports/plasmacomponents/qml/TextFieldFocus.qml rename to declarativeimports/plasmacomponents/qml/private/TextFieldFocus.qml diff --git a/declarativeimports/plasmacomponents/qml/qmldir b/declarativeimports/plasmacomponents/qml/qmldir index 934081bd6..c5619981a 100644 --- a/declarativeimports/plasmacomponents/qml/qmldir +++ b/declarativeimports/plasmacomponents/qml/qmldir @@ -7,6 +7,7 @@ ButtonGroup 0.1 ButtonGroup.js ButtonRow 0.1 ButtonRow.qml CheckBox 0.1 CheckBox.qml CommonDialog 0.1 CommonDialog.qml +ContextMenu 0.1 ContextMenu.qml Dialog 0.1 Dialog.qml Highlight 0.1 Highlight.qml Label 0.1 Label.qml @@ -14,7 +15,6 @@ ListItem 0.1 ListItem.qml Page 0.1 Page.qml PageStack 0.1 PageStack.qml ProgressBar 0.1 ProgressBar.qml -PushButton 0.1 PushButton.qml RadioButton 0.1 RadioButton.qml ScrollBar 0.1 ScrollBar.qml SectionScroller 0.1 SectionScroller.qml diff --git a/kpart/plasma-kpart.desktop b/kpart/plasma-kpart.desktop index 7ceef9936..20f17c78d 100644 --- a/kpart/plasma-kpart.desktop +++ b/kpart/plasma-kpart.desktop @@ -16,6 +16,7 @@ Name[eu]=plasma-kpart Name[fa]=plasma-kpart Name[fi]=plasma-kpart Name[fr]=plasma-kpart +Name[ga]=plasma-kpart Name[he]=plasma-kpart Name[hi]=plasma-kpart Name[hr]=plasma-kpart diff --git a/scriptengines/javascript/data/plasma-javascriptaddon.desktop b/scriptengines/javascript/data/plasma-javascriptaddon.desktop index 3d281ba6c..f06ce5363 100644 --- a/scriptengines/javascript/data/plasma-javascriptaddon.desktop +++ b/scriptengines/javascript/data/plasma-javascriptaddon.desktop @@ -13,8 +13,10 @@ Name[en_GB]=Plasma JavaScript Addon Name[es]=Complemento de JavaScript para Plasma Name[et]=Plasma JavaScripti lisa Name[eu]=Plasma JavaScript gehigarria +Name[fa]=افزودنی جاوااسکریپت پلاسما Name[fi]=Plasma JavaScript -lisäosa Name[fr]=Module complémentaire Javascript de Plasma +Name[ga]=Breiseán JavaScript Plasma Name[he]=תוסף עבור JavaScript של Plasma Name[hi]=प्लाज़मा जावा-स्क्रिप्ट एडोन Name[hr]=Dodatak JavaScripta Plasmi diff --git a/scriptengines/javascript/data/plasma-packagestructure-javascript-addon.desktop b/scriptengines/javascript/data/plasma-packagestructure-javascript-addon.desktop index 653ec911d..c397bcb79 100644 --- a/scriptengines/javascript/data/plasma-packagestructure-javascript-addon.desktop +++ b/scriptengines/javascript/data/plasma-packagestructure-javascript-addon.desktop @@ -13,8 +13,10 @@ Name[en_GB]=Javascript Addon Name[es]=Complemento de JavaScript Name[et]=JavaScripti lisa Name[eu]=Javascript gehigarria +Name[fa]=افزودنی جاوااسکریپت Name[fi]=Javascript-lisäosa Name[fr]=Module complémentaire Javascript +Name[ga]=Breiseán JavaScript Name[he]=תוסף JavaScript Name[hi]=जावास्क्रिप्ट एडोन Name[hr]=Dodadak za Javascript diff --git a/scriptengines/javascript/data/plasma-scriptengine-applet-declarative.desktop b/scriptengines/javascript/data/plasma-scriptengine-applet-declarative.desktop index d78e7e46b..228658931 100644 --- a/scriptengines/javascript/data/plasma-scriptengine-applet-declarative.desktop +++ b/scriptengines/javascript/data/plasma-scriptengine-applet-declarative.desktop @@ -13,6 +13,7 @@ Name[en_GB]=Declarative widget Name[es]=Elemento gráfico declarativo Name[et]=Deklaratiivne vidin Name[eu]=Trepeta ezagutarazlea +Name[fi]=Deklaratiivinen sovelma Name[fr]=Composant graphique « Declarative » Name[he]=ווידג׳ט מוצהר Name[hr]=Deklarativni widget @@ -29,6 +30,7 @@ Name[nb]=Deklarativt skjermelement Name[nds]=Stüerelement för Verkloren Name[nl]=Widget voor declaratie Name[nn]=Deklarativt skjermelement +Name[pa]=ਡਿਕਲਰੇਟਿਵ ਵਿਦਜੈੱਟ Name[pl]=Deklaratywny element interfejsu Name[pt]=Item declarativo Name[pt_BR]=Widget declarativo @@ -66,6 +68,7 @@ Comment[et]=QML-is ja JavaScriptis kirjutatud Plasma vidin Comment[eu]=Plasma jatorrizko trepeta QML eta JavaScript-en idatzia Comment[fi]=Natiivi, QML-pohjainen Plasma-sovelma Comment[fr]=Composant graphique natif de Plasma écrit en QML et JavaScript +Comment[ga]=Giuirléid dhúchasach Plasma, scríofa in QML agus JavaScript Comment[he]=ווידג׳טים של Plasma הנכתבים ב־QML וב־JavaScript Comment[hr]=Izvorni Plasma widget napisan u QML-u i JavaScriptu Comment[hu]=QML-ben és JavaScriptben írt natív Plazma-widget diff --git a/scriptengines/javascript/data/plasma-scriptengine-applet-simple-javascript.desktop b/scriptengines/javascript/data/plasma-scriptengine-applet-simple-javascript.desktop index 0da857f2a..8fcaeb2c5 100644 --- a/scriptengines/javascript/data/plasma-scriptengine-applet-simple-javascript.desktop +++ b/scriptengines/javascript/data/plasma-scriptengine-applet-simple-javascript.desktop @@ -18,6 +18,7 @@ Name[eo]=Ĝavaskripta fenestraĵo Name[es]=Elemento gráfico JavaScript Name[et]=JavaScripti vidin Name[eu]=JavaScript trepeta +Name[fa]=ویجت جاوااسکریپت Name[fi]=JavaScript-sovelma Name[fr]=Composant graphique JavaScript Name[fy]=JavaSkript Widget diff --git a/scriptengines/javascript/data/plasma-scriptengine-dataengine-javascript.desktop b/scriptengines/javascript/data/plasma-scriptengine-dataengine-javascript.desktop index 088e0a121..9a48dc4ac 100644 --- a/scriptengines/javascript/data/plasma-scriptengine-dataengine-javascript.desktop +++ b/scriptengines/javascript/data/plasma-scriptengine-dataengine-javascript.desktop @@ -16,6 +16,7 @@ Name[eo]=Ĝavaskripta Datummodulo Name[es]=Motor de datos JavaScript Name[et]=JavaScripti andmemootor Name[eu]=JavaScript datu-motorea +Name[fa]=موتور داده‌ی جاوااسکریپت Name[fi]=JavaScript-datakone Name[fr]=Moteur de données JavaScript Name[fy]=JavaSkript gegevens motor @@ -58,7 +59,7 @@ Name[sv]=Javascript-datagränssnitt Name[tg]=Маълумоти муҳаррики JavaScript Name[th]=กลไกข้อมูลของจาวาสคริปต์ Name[tr]=JavaScript Veri Motoru -Name[ug]=JavaScript سانلىق مەلۇمات ماتورى +Name[ug]=JavaScript سانلىق-مەلۇمات ماتورى Name[uk]=Рушій даних JavaScript Name[wa]=Moteur di dnêyes JavaScript Name[x-test]=xxJavaScript DataEnginexx diff --git a/tools/plasmapkg/main.cpp b/tools/plasmapkg/main.cpp index dbfd1568a..f699eece2 100644 --- a/tools/plasmapkg/main.cpp +++ b/tools/plasmapkg/main.cpp @@ -257,9 +257,9 @@ int main(int argc, char **argv) package.setPath(packageFile); QString serviceType = package.metadata().serviceType(); if (!serviceType.isEmpty()) { - if (serviceType == "Plasma/Applet" || - serviceType == "Plasma/Containment" || - serviceType == "Plasma/PopupApplet") { + if (serviceType.contains("Plasma/Applet") || + serviceType.contains("Plasma/PopupApplet") || + serviceType.contains("Plasma/Containment")) { type = "plasmoid"; } else if (serviceType == "Plasma/DataEngine") { type = "dataengine";