I have made the following changes intended for :
  CE:MW:Shared / nemo-qml-plugin-messages-internal

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/8167

Thank You,
John Brooks

[This message was auto-generated]

---

Request # 8167:

Messages from BOSS:

State: review at 2013-02-21T08:51:51 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:special:branches:CE:MW:Shared / 
nemo-qml-plugin-messages-internal -> CE:MW:Shared / 
nemo-qml-plugin-messages-internal
  
changes files:
--------------
--- nemo-qml-plugin-messages-internal.changes
+++ nemo-qml-plugin-messages-internal.changes
@@ -0,0 +1,3 @@
+* Wed Feb 20 2013 John Brooks <[email protected]> - 0.0.3
+- Extend AccountsModel API to allow querying an account by local UID
+

old:
----
  nemo-qml-plugin-messages-0.0.2.tar.bz2

new:
----
  nemo-qml-plugin-messages-0.0.3.tar.bz2

spec files:
-----------
--- nemo-qml-plugin-messages-internal.spec
+++ nemo-qml-plugin-messages-internal.spec
@@ -9,7 +9,7 @@
 # << macros
 
 Summary:    QML plugin for internal messages functionality
-Version:    0.0.2
+Version:    0.0.3
 Release:    1
 Group:      System/Libraries
 License:    BSD

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

++++++ nemo-qml-plugin-messages-0.0.2.tar.bz2 -> 
nemo-qml-plugin-messages-0.0.3.tar.bz2
--- src/accountsmodel.cpp
+++ src/accountsmodel.cpp
@@ -40,7 +40,7 @@
 Q_DECLARE_METATYPE(Tp::AccountPtr)
 
 AccountsModel::AccountsModel(QObject *parent)
-    : QAbstractListModel(parent)
+    : QAbstractListModel(parent), mReady(false)
 {
     QHash<int,QByteArray> roles;
     roles[Qt::DisplayRole] = "name";
@@ -58,6 +58,8 @@
 {
     foreach (const Tp::AccountPtr &account, mAccountManager->allAccounts())
         newAccount(account);
+    mReady = true;
+    emit readyChanged();
 }
 
 void AccountsModel::newAccount(const Tp::AccountPtr &account)
@@ -69,6 +71,16 @@
     emit countChanged();
 }
 
+int AccountsModel::indexOfAccount(const QString &localUid) const
+{
+    for (int i = 0; i < mAccounts.size(); i++) {
+        if (mAccounts[i]->objectPath() == localUid)
+            return i;
+    }
+
+    return -1;
+}
+
 int AccountsModel::rowCount(const QModelIndex &parent) const
 {
     if (parent.isValid())
--- src/accountsmodel.h
+++ src/accountsmodel.h
@@ -46,6 +46,7 @@
     // The Qt Components dialog expects the model to have a count
     // property, and won't show any items if it doesn't.
     Q_PROPERTY(int count READ count NOTIFY countChanged);
+    Q_PROPERTY(bool ready READ isReady NOTIFY readyChanged);
 
 public:
     enum Roles {
@@ -63,10 +64,19 @@
         return data(index(row, 0), role);
     }
 
+    Q_INVOKABLE QVariant get(const QString &uid, int role = Qt::DisplayRole) 
const
+    {
+        return get(indexOfAccount(uid), role);
+    }
+
+    Q_INVOKABLE int indexOfAccount(const QString &localUid) const;
+
     int count() const { return rowCount(); }
+    bool isReady() const { return mReady; }
 
 signals:
     void countChanged();
+    void readyChanged();
 
 private slots:
     void accountManagerReady(Tp::PendingOperation *op);
@@ -75,6 +85,7 @@
 private:
     Tp::AccountManagerPtr mAccountManager;
     QList<Tp::AccountPtr> mAccounts;
+    bool mReady;
 };
 
 #endif

++++++ nemo-qml-plugin-messages-internal.yaml
--- nemo-qml-plugin-messages-internal.yaml
+++ nemo-qml-plugin-messages-internal.yaml
@@ -2,7 +2,7 @@
 Summary: QML plugin for internal messages functionality
 Group: System/Libraries
 Description: QML plugin for internal messages functionality in Nemo
-Version: 0.0.2
+Version: 0.0.3
 Release: 1
 Sources:
     - "nemo-qml-plugin-messages-%{version}.tar.bz2"



Reply via email to