gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r33502 - in gnunet-qt/SecureShare: . core core/identity qml


From: gnunet
Subject: [GNUnet-SVN] r33502 - in gnunet-qt/SecureShare: . core core/identity qml
Date: Wed, 4 Jun 2014 06:38:23 +0200

Author: bratao
Date: 2014-06-04 06:38:23 +0200 (Wed, 04 Jun 2014)
New Revision: 33502

Modified:
   gnunet-qt/SecureShare/core/identity/identityService.cpp
   gnunet-qt/SecureShare/core/identity/identityService.h
   gnunet-qt/SecureShare/core/psyccore.h
   gnunet-qt/SecureShare/psyc.cpp
   gnunet-qt/SecureShare/qml/NewEgo.qml
   gnunet-qt/SecureShare/qml/Splash.qml
Log:
Finished Ego creation

Modified: gnunet-qt/SecureShare/core/identity/identityService.cpp
===================================================================
--- gnunet-qt/SecureShare/core/identity/identityService.cpp     2014-06-04 
03:48:08 UTC (rev 33501)
+++ gnunet-qt/SecureShare/core/identity/identityService.cpp     2014-06-04 
04:38:23 UTC (rev 33502)
@@ -21,6 +21,10 @@
 
     this->m_config = config;
 
+    QObject::connect(this, &IdentityService::createEgoSignal, this,
+                     IdentityService::createEgoSlot, Qt::QueuedConnection);
+
+
     m_identityHandle = GNUNET_IDENTITY_connect (config,
                                                 &addEgoCallback,
                                                 this);
@@ -48,7 +52,46 @@
 
 }
 
+/**
+ * Identity operation was finished, clean up.
+ *
+ * @param cls the 'struct OperationContext'
+ * @param emsg error message (NULL on success)
+ */
 void
+IdentityService::operationFinished (void *cls,
+            const char *emsg)
+{
+
+    //NOP
+}
+
+
+
+
+void
+IdentityService::createEgo(QString ego)
+{
+    emit createEgoSignal(ego);
+}
+
+void
+IdentityService::createEgoSlot(QString ego)
+{
+
+
+    QByteArray byteArray = ego.toUtf8();
+    const char* cString = byteArray.constData();
+
+    GNUNET_IDENTITY_create (m_identityHandle,
+                         cString,
+                         &operationFinished,
+                         NULL);
+}
+
+
+
+void
 IdentityService::addEgo(struct GNUNET_IDENTITY_Ego *ego,
                         void **ego_ctx,
                         const char *name)

Modified: gnunet-qt/SecureShare/core/identity/identityService.h
===================================================================
--- gnunet-qt/SecureShare/core/identity/identityService.h       2014-06-04 
03:48:08 UTC (rev 33501)
+++ gnunet-qt/SecureShare/core/identity/identityService.h       2014-06-04 
04:38:23 UTC (rev 33502)
@@ -14,11 +14,13 @@
     static void addEgoCallback(void *cls, struct GNUNET_IDENTITY_Ego *ego, 
void **ego_ctx, const char *name);
 
     void addEgo(GNUNET_IDENTITY_Ego *ego, void **ego_ctx, const char *name);
+    Q_INVOKABLE void createEgo(QString ego);
+    static void operationFinished(void *cls, const char *emsg);
 signals:
-
+    void createEgoSignal(QString ego);
 public slots:
+    void createEgoSlot(QString ego);
 
-
 private:
         struct GNUNET_CONFIGURATION_Handle *m_config;
         /**

Modified: gnunet-qt/SecureShare/core/psyccore.h
===================================================================
--- gnunet-qt/SecureShare/core/psyccore.h       2014-06-04 03:48:08 UTC (rev 
33501)
+++ gnunet-qt/SecureShare/core/psyccore.h       2014-06-04 04:38:23 UTC (rev 
33502)
@@ -11,12 +11,17 @@
 {
     Q_OBJECT
     Q_PROPERTY(Models * models READ models CONSTANT)
+    Q_PROPERTY(GNUNet * gnunet READ gnunet CONSTANT)
     Q_PROPERTY(bool connected READ isConnected WRITE setConnected NOTIFY 
connectedChanged)
 
 public:
     explicit PsycCore(QObject *parent = 0);
 
 
+
+    GNUNet* gnunet() const
+        { return m_gnunet; }
+
     Models* models() const
         { return m_models; }
 

Modified: gnunet-qt/SecureShare/psyc.cpp
===================================================================
--- gnunet-qt/SecureShare/psyc.cpp      2014-06-04 03:48:08 UTC (rev 33501)
+++ gnunet-qt/SecureShare/psyc.cpp      2014-06-04 04:38:23 UTC (rev 33502)
@@ -6,6 +6,9 @@
 #include "models/PlacesModel.h"
 #include "models/IdentityModel.h"
 
+#include "core/gnunet/gnunet.h"
+#include "core/identity/identityService.h"
+
 #include <QQmlEngine>
 #include <QtQml/qqml.h>
 
@@ -59,6 +62,8 @@
     qmlRegisterUncreatableType<PlacesModel>(URI, 1, 0, "PlacesModel", 
QLatin1String("Use calling the psyc method."));
     qmlRegisterUncreatableType<IdentityModel>(URI, 1, 0, "IdentityModel", 
QLatin1String("Use calling the psyc method."));
 
+    qmlRegisterUncreatableType<GNUNet>(URI, 1, 0, "GNUNet", QLatin1String("Use 
calling the psyc method."));
+    qmlRegisterUncreatableType<IdentityService>(URI, 1, 0, "IdentityService", 
QLatin1String("Use calling the psyc method."));
 
 
 }

Modified: gnunet-qt/SecureShare/qml/NewEgo.qml
===================================================================
--- gnunet-qt/SecureShare/qml/NewEgo.qml        2014-06-04 03:48:08 UTC (rev 
33501)
+++ gnunet-qt/SecureShare/qml/NewEgo.qml        2014-06-04 04:38:23 UTC (rev 
33502)
@@ -2,13 +2,19 @@
 import QtQuick 2.2
 import QtQuick.Controls 1.1
 import QtQuick.Layouts 1.1
+import Psyc 1.0
+
 Window {
     title: "Create Ego";
-    width: 200;
-    height: 50;
+    width: 300;
+    height: 60;
+    id: newEgoWnd
 
 
     RowLayout{
+        anchors.fill: parent
+        anchors.margins: 10
+        spacing: 5
         Label {
             text: "Ego Name"
         }
@@ -17,6 +23,13 @@
             id:newName
 
         }
+        Button{
+            text: "Ok"
+            onPressedChanged: {
+                Psyc.gnunet.identity.createEgo(newName.text)
+                newEgoWnd.close();
+            }
+        }
     }
 
 }

Modified: gnunet-qt/SecureShare/qml/Splash.qml
===================================================================
--- gnunet-qt/SecureShare/qml/Splash.qml        2014-06-04 03:48:08 UTC (rev 
33501)
+++ gnunet-qt/SecureShare/qml/Splash.qml        2014-06-04 04:38:23 UTC (rev 
33502)
@@ -38,6 +38,7 @@
                 width: 200
                 model: Psyc.models.identityModel
                 textRole: "name"
+                currentIndex: -1
 
                 onActivated: {
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]