I have made the following changes intended for :
  CE:UX:MTF / lipstick

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/7372

Thank You,
vesuri

[This message was auto-generated]

---

Request # 7372:

Messages from BOSS:

State: review at 2012-11-13T09:33:29 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:vesuri:branches:CE:UX:MTF / lipstick -> CE:UX:MTF / lipstick
  
changes files:
--------------
--- lipstick.changes
+++ lipstick.changes
@@ -0,0 +1,3 @@
+* Tue Nov 13 2012 Vesa Halttunen <[email protected]> - 0.4.11
+- Allow LauncherItems to be instantiated from the QML side (from Vesa)
+

old:
----
  lipstick-0.4.10.tar.bz2

new:
----
  lipstick-0.4.11.tar.bz2

spec files:
-----------
--- lipstick.spec
+++ lipstick.spec
@@ -9,7 +9,7 @@
 # << macros
 
 Summary:    QML toolkit for homescreen creation
-Version:    0.4.10
+Version:    0.4.11
 Release:    1
 Group:      System/Libraries
 License:    LGPLv2.1

other changes:
--------------

++++++ lipstick-0.4.10.tar.bz2 -> lipstick-0.4.11.tar.bz2
--- plugin/lipstickplugin.cpp
+++ plugin/lipstickplugin.cpp
@@ -42,9 +42,9 @@
     qmlRegisterType<StatusBar>("org.nemomobile.lipstick", 0, 1, "StatusBar");
     qmlRegisterType<NotificationListModel>("org.nemomobile.lipstick", 0, 1, 
"NotificationListModel");
     qmlRegisterType<Notification>("org.nemomobile.lipstick", 0, 1, 
"Notification");
+    qmlRegisterType<LauncherItem>("org.nemomobile.lipstick", 0, 1, 
"LauncherItem");
     
qmlRegisterUncreatableType<NotificationPreviewPresenter>("org.nemomobile.lipstick",
 0, 1, "NotificationPreviewPresenter", "This type is initialized by 
HomeApplication");
     qmlRegisterUncreatableType<WindowInfo>("org.nemomobile.lipstick", 0, 1, 
"WindowInfo", "This type is initialized by SwitcherModel");
-    qmlRegisterUncreatableType<LauncherItem>("org.nemomobile.lipstick", 0, 1, 
"LauncherItem", "This type is initialized by LauncherModel");
     qmlRegisterUncreatableType<WindowManager>("org.nemomobile.lipstick", 0, 1, 
"WindowManager", "This type should be accessed through a context property.");
 }
 
--- src/components/launcheritem.cpp
+++ src/components/launcheritem.cpp
@@ -37,12 +37,13 @@
 #define LAUNCHER_DEBUG(things)
 #endif
 
-LauncherItem::LauncherItem(const QString &path, QObject *parent)
+LauncherItem::LauncherItem(const QString &filePath, QObject *parent)
     : QObject(parent)
-    , _desktopEntry(new MDesktopEntry(path))
     , _isLaunching(false)
 {
-    emit this->itemChanged();
+    if (!filePath.isEmpty()) {
+        setFilePath(filePath);
+    }
 
     // TODO: instead of this, match the PID of the window thumbnails with the 
launcher processes
     // Launching animation will be disabled if the window of the launched app 
shows up
@@ -53,39 +54,50 @@
 {
 }
 
+void LauncherItem::setFilePath(const QString &filePath)
+{
+    if (!filePath.isEmpty()) {
+        _desktopEntry = QSharedPointer<MDesktopEntry>(new 
MDesktopEntry(filePath));
+    } else {
+        _desktopEntry.clear();
+    }
+
+    emit this->itemChanged();
+}
+
 QString LauncherItem::filePath() const
 {
-    return _desktopEntry->fileName();
+    return !_desktopEntry.isNull() ? _desktopEntry->fileName() : QString();
 }
 
 QString LauncherItem::title() const
 {
-    return _desktopEntry->name();
+    return !_desktopEntry.isNull() ? _desktopEntry->name() : QString();
 }
 
 QString LauncherItem::entryType() const
 {
-    return _desktopEntry->type();
+    return !_desktopEntry.isNull() ? _desktopEntry->type() : QString();
 }
 
 QString LauncherItem::iconId() const
 {
-    return _desktopEntry->icon();
+    return !_desktopEntry.isNull() ? _desktopEntry->icon() : QString();
 }
 
 QStringList LauncherItem::desktopCategories() const
 {
-    return _desktopEntry->categories();
+    return !_desktopEntry.isNull() ? _desktopEntry->categories() : 
QStringList();
 }
 
 bool LauncherItem::shouldDisplay() const
 {
-    return !_desktopEntry->noDisplay();
+    return !_desktopEntry.isNull() ? !_desktopEntry->noDisplay() : false;
 }
 
 bool LauncherItem::isValid() const
 {
-    return _desktopEntry->isValid();
+    return !_desktopEntry.isNull() ? _desktopEntry->isValid() : false;
 }
 
 bool LauncherItem::isLaunching() const
@@ -103,6 +115,9 @@
 
 void LauncherItem::launchApplication()
 {
+    if (_desktopEntry.isNull())
+        return;
+
 #if defined(HAVE_CONTENTACTION)
     LAUNCHER_DEBUG("launching content action for" << _desktopEntry->name());
     ContentAction::Action action = 
ContentAction::Action::launcherAction(_desktopEntry, QStringList());
--- src/components/launcheritem.h
+++ src/components/launcheritem.h
@@ -31,7 +31,7 @@
     Q_OBJECT
     Q_DISABLE_COPY(LauncherItem)
 
-    Q_PROPERTY(QString filePath READ filePath NOTIFY itemChanged)
+    Q_PROPERTY(QString filePath READ filePath WRITE setFilePath NOTIFY 
itemChanged)
     Q_PROPERTY(QString title READ title NOTIFY itemChanged)
     Q_PROPERTY(QString entryType READ entryType NOTIFY itemChanged)
     Q_PROPERTY(QString iconId READ iconId NOTIFY itemChanged)
@@ -47,9 +47,10 @@
     void disableIsLaunching();
 
 public:
-    explicit LauncherItem(const QString &path, QObject *parent = 0);
+    explicit LauncherItem(const QString &filePath = QString(), QObject *parent 
= 0);
     virtual ~LauncherItem();
 
+    void setFilePath(const QString &filePath);
     QString filePath() const;
     QString title() const;
     QString entryType() const;
--- src/src.pro
+++ src/src.pro
@@ -2,7 +2,7 @@
 
 TEMPLATE = lib
 TARGET = lipstick
-VERSION = 0.4.10
+VERSION = 0.4.11
 
 DEFINES += LIPSTICK_BUILD_LIBRARY DEBUG_NOTIFICATIONS VERSION=\\\"$$VERSION\\\"
 

++++++ lipstick.yaml
--- lipstick.yaml
+++ lipstick.yaml
@@ -1,6 +1,6 @@
 Name: lipstick
 Summary: QML toolkit for homescreen creation
-Version: 0.4.10
+Version: 0.4.11
 Release: 1
 Group: System/Libraries
 License: LGPLv2.1



Reply via email to