AccountState: Add helper to find navigation App
authorMichael Schuster <michael@schuster.ms>
Fri, 17 Jan 2020 19:21:42 +0000 (20:21 +0100)
committerMichael Schuster <michael@schuster.ms>
Fri, 17 Jan 2020 19:21:42 +0000 (20:21 +0100)
Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/accountstate.cpp
src/gui/accountstate.h

index 899a7728cc169bb743e76c8fa3d07318cd9ae809..1491db714eed209a5fc9d2e3d966d3aeebd9eaff 100644 (file)
@@ -477,6 +477,18 @@ AccountAppList AccountState::appList() const
     return _apps;
 }
 
+AccountApp* AccountState::findApp(const QString &appId) const
+{
+    if(!appId.isEmpty()) {
+        foreach(AccountApp *app, appList()) {
+            if(app->id() == appId)
+                return app;
+        }
+    }
+
+    return nullptr;
+}
+
 /*-------------------------------------------------------------------------------------*/
 
 AccountApp::AccountApp(const QString &name, const QUrl &url,
index c89c664b0d6835f628f8c4ff10533fb97b643b9f..433fb51161b7f01a9d6c8f6118ee56489527b06c 100644 (file)
@@ -106,6 +106,7 @@ public:
     bool hasTalk() const;
 
     AccountAppList appList() const;
+    AccountApp* findApp(const QString &appId) const;
 
     /** A user-triggered sign out which disconnects, stops syncs
      * for the account and forgets the password. */