]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Update liblightdm-qt API to match liblightdm-gobject
authorRobert Ancell <robert.ancell@canonical.com>
Tue, 19 Jul 2011 04:44:22 +0000 (14:44 +1000)
committerRobert Ancell <robert.ancell@canonical.com>
Tue, 19 Jul 2011 04:44:22 +0000 (14:44 +1000)
liblightdm-qt/QLightDM/greeter.h
liblightdm-qt/QLightDM/language.h
liblightdm-qt/QLightDM/sessionsmodel.h
liblightdm-qt/QLightDM/user.h
liblightdm-qt/QLightDM/usersmodel.h
liblightdm-qt/greeter.cpp

index d99b371e6597aabfaa7da44ffdaff824afcddea6..9f8d05e56b8ffa868d753a6376eb482f074d3dc0 100644 (file)
  * license.
  */
 
-#ifndef QLIGTHDM_GREETER_H
-#define QLIGTHDM_GREETER_H
+#ifndef QLIGHTDM_GREETER_H
+#define QLIGHTDM_GREETER_H
 
 #include <QtCore/QObject>
 #include <QtCore/QVariant>
-
-#include "user.h"
-#include "language.h"
-//#include "layout.h"
+#include "QLightDM/User"
+#include "QLightDM/Language"
 
 class GreeterPrivate;
 
 namespace QLightDM
 {
+  typedef enum
+  {
+    PROMPT_TYPE_QUESTION,
+    PROMPT_TYPE_SECRET
+  } PromptType;
+
+  typedef enum
+  {
+    MESSAGE_TYPE_INFO,
+    MESSAGE_TYPE_ERROR
+  } MessageType;
+
   class Q_DECL_EXPORT Greeter : public QObject
   {
     Q_OBJECT
@@ -47,7 +57,6 @@ namespace QLightDM
         QList<QLightDM::Language> languages() const;
         QString defaultLanguage() const;
 
-        //QList<LdmLayout> layouts() const;
         QString layout() const;
 
         QString getHint(QString name) const;
@@ -77,6 +86,7 @@ namespace QLightDM
 
         void connectToServer();
         void login(const QString &username);
+        void loginWithUserPrompt();
         void loginAsGuest();
         void respond(const QString &response);
         void cancelAuthentication();
@@ -84,12 +94,11 @@ namespace QLightDM
 
     signals:
         void connected();
-        void showPrompt(QString prompt);
-        void showMessage(QString message);
-        void showError(QString message);
-        void authenticationComplete(bool isAuthenticated);
+        void showPrompt(QString prompt, PromptType type);
+        void showMessage(QString message, MessageType type);
+        void authenticationComplete();
         void sessionFailed();
-        void timedLogin(QString username);
+        void autologinTimerExpired();
         void quit();
 
     private slots:
@@ -105,7 +114,6 @@ namespace QLightDM
         int readInt(int *offset);
         QString readString(int *offset);
     };
+};
 
-};//end namespace
-
-#endif // QLIGHDM_GREETER_H
+#endif // QLIGHTDM_GREETER_H
index cdda5b6ec341919fd9fb56f29c9e8fb1ef761ba0..5ba16c8ba2f85f44d6c0c5baf9dd198f514de0ec 100644 (file)
@@ -9,8 +9,8 @@
  * license.
  */
 
-#ifndef QLIGTHDM_LANGUAGE_H
-#define QLIGTHDM_LANGUAGE_H
+#ifndef QLIGHTDM_LANGUAGE_H
+#define QLIGHTDM_LANGUAGE_H
 
 #include <QString>
 
index 82ff14e50096484f0b1b2c23336e394f7d468a91..62191c7f0394eabf608c6a7a9f0df3c167d313da 100644 (file)
@@ -9,8 +9,8 @@
  * license.
  */
 
-#ifndef QLIGTHDM_SESSIONSMODEL_H
-#define QLIGTHDM_SESSIONSMODEL_H
+#ifndef QLIGHTDM_SESSIONSMODEL_H
+#define QLIGHTDM_SESSIONSMODEL_H
 
 #include <QtCore/QAbstractListModel>
 
index 9b45f74d83748fb6d8a43f721ec17243c110e871..e6d3a9846829bcf4bba823d20ddc7d3625b02e10 100644 (file)
@@ -9,8 +9,8 @@
  * license.
  */
 
-#ifndef QLIGTHDM_USER_H
-#define QLIGTHDM_USER_H
+#ifndef QLIGHTDM_USER_H
+#define QLIGHTDM_USER_H
 
 #include <QtCore/QString>
 #include <QtCore/QSharedDataPointer>
@@ -57,4 +57,4 @@ namespace QLightDM
     };
 }
 
-#endif // LDMUSER_H
+#endif // QLIGHTDM_USER_H
index 449144ef36b93f5cf7a8809fae28dbccef71d7b3..b1baf6fb464df74c81a9b4f82be85f47e1a2f411 100644 (file)
@@ -25,8 +25,7 @@ class Q_DECL_EXPORT UsersModel : public QAbstractListModel
 public:
     enum UserModelRoles {NameRole = Qt::UserRole,
                          RealNameRole,
-                         LoggedInRole
-                        };
+                         LoggedInRole};
 
     explicit UsersModel(QObject *parent = 0);
     ~UsersModel();
index a986513883898708b8c8e05839fa4bca09eca72a..249a910c12d1c51e5d820be6cde0dfbfceb2e791 100644 (file)
@@ -173,7 +173,7 @@ QString Greeter::readString(int *offset)
 void Greeter::connectToServer()
 {
     QDBusConnection busType = QDBusConnection::systemBus();
-    QString ldmBus(qgetenv("LDM_BUS"));
+    QString ldmBus(qgetenv("LIGHTDM_BUS"));
     if(ldmBus == QLatin1String("SESSION")) {
         busType = QDBusConnection::sessionBus();
     }
@@ -360,14 +360,16 @@ void Greeter::onRead(int fd)
                 switch (msg_style)
                 {
                 case PAM_PROMPT_ECHO_OFF:
+                    emit showPrompt(msg, PROMPT_TYPE_SECRET);
+                    break;
                 case PAM_PROMPT_ECHO_ON:
-                    emit showPrompt(msg);
+                    emit showPrompt(msg, PROMPT_TYPE_QUESTION);
                     break;
                 case PAM_ERROR_MSG:
-                    emit showError(msg);
+                    emit showMessage(msg, MESSAGE_TYPE_ERROR);
                     break;
                 case PAM_TEXT_INFO:
-                    emit showMessage(msg);
+                    emit showMessage(msg, MESSAGE_TYPE_INFO);
                     break;
                 }
             }
@@ -385,7 +387,7 @@ void Greeter::onRead(int fd)
             if(!d->isAuthenticated) {
                 d->authenticationUser = "";
             }
-            emit authenticationComplete(d->isAuthenticated);
+            emit authenticationComplete();
             d->inAuthentication = false;
         }
         else