[Pkg-owncloud-commits] [owncloud-client] 192/470: Wizard: Implement alternative forms of inquiring about the userID

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:02 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit fb75adcd57db8927f7adbe11a3ef039cc23d6c16
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Thu Mar 17 16:47:27 2016 +0100

    Wizard: Implement alternative forms of inquiring about the userID
    
    Settable in the theme.
---
 src/gui/wizard/owncloudhttpcredspage.cpp | 16 ++++++++++++++++
 src/gui/wizard/owncloudhttpcredspage.ui  |  4 +---
 src/libsync/theme.cpp                    | 15 +++++++++++++++
 src/libsync/theme.h                      | 33 ++++++++++++++++++++++++++++++++
 4 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/src/gui/wizard/owncloudhttpcredspage.cpp b/src/gui/wizard/owncloudhttpcredspage.cpp
index 30d8391..046c1fe 100644
--- a/src/gui/wizard/owncloudhttpcredspage.cpp
+++ b/src/gui/wizard/owncloudhttpcredspage.cpp
@@ -42,6 +42,22 @@ OwncloudHttpCredsPage::OwncloudHttpCredsPage(QWidget* parent)
     registerField( QLatin1String("OCUser*"),   _ui.leUsername);
     registerField( QLatin1String("OCPasswd*"), _ui.lePassword);
 
+    Theme *theme = Theme::instance();
+    switch(theme->userIDType()) {
+    case Theme::UserIDUserName:
+        // default, handled in ui file
+        break;
+    case Theme::UserIDEmail:
+        _ui.usernameLabel->setText(tr("&E-mail address"));
+        break;
+    case Theme::UserIDCustom:
+        _ui.usernameLabel->setText(theme->customUserID());
+        break;
+    default:
+        break;
+    }
+    _ui.leUsername->setPlaceholderText(theme->userIDHint());
+
     setTitle(WizardCommon::titleTemplate().arg(tr("Connect to %1").arg(Theme::instance()->appNameGUI())));
     setSubTitle(WizardCommon::subTitleTemplate().arg(tr("Enter user credentials")));
 
diff --git a/src/gui/wizard/owncloudhttpcredspage.ui b/src/gui/wizard/owncloudhttpcredspage.ui
index 58bdddd..2f3bbe5 100644
--- a/src/gui/wizard/owncloudhttpcredspage.ui
+++ b/src/gui/wizard/owncloudhttpcredspage.ui
@@ -33,7 +33,7 @@
    <item row="1" column="1">
     <layout class="QFormLayout" name="formLayout">
      <item row="0" column="0">
-      <widget class="QLabel" name="label">
+      <widget class="QLabel" name="usernameLabel">
        <property name="text">
         <string>&Username</string>
        </property>
@@ -127,8 +127,6 @@
     </widget>
    </item>
   </layout>
-  <zorder>topLabel</zorder>
-  <zorder>bottomLabel</zorder>
  </widget>
  <resources/>
  <connections/>
diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp
index ff2cce9..c73f539 100644
--- a/src/libsync/theme.cpp
+++ b/src/libsync/theme.cpp
@@ -432,6 +432,21 @@ bool Theme::forceSystemNetworkProxy() const
     return false;
 }
 
+Theme::UserIDType Theme::userIDType() const
+{
+    return UserIDType::UserIDUserName;
+}
+
+QString Theme::customUserID() const
+{
+    return QString();
+}
+
+QString Theme::userIDHint() const
+{
+    return QString();
+}
+
 
 
 } // end namespace client
diff --git a/src/libsync/theme.h b/src/libsync/theme.h
index d93fcb1..db36bb1 100644
--- a/src/libsync/theme.h
+++ b/src/libsync/theme.h
@@ -239,6 +239,39 @@ public:
 
     virtual bool forceSystemNetworkProxy() const;
 
+    /**
+     * @brief How to handle the userID
+     *
+     * @value UserIDUserName Wizard asks for user name as ID
+     * @value UserIDEmail Wizard asks for an email as ID
+     * @value UserIDCustom Specify string in \ref customUserID
+     */
+    enum UserIDType { UserIDUserName = 0, UserIDEmail, UserIDCustom };
+
+    /** @brief What to display as the userID (e.g. in the wizards)
+     *
+     *  @return UserIDType::UserIDUserName, unless reimplemented
+     */
+    virtual UserIDType userIDType() const;
+
+    /**
+     * @brief Allows to customize the type of user ID (e.g. user name, email)
+     *
+     * @note This string cannot be translated, but is still useful for
+     *       referencing brand name IDs (e.g. "ACME ID", when using ACME.)
+     *
+     * @return An empty string, unless reimplemented
+     */
+    virtual QString customUserID() const;
+
+    /**
+     * @brief Demo string to be displayed when no text has been
+     *        entered for the user id (e.g. mylogin at company.com)
+     *
+     * @return An empty string, unless reimplemented
+     */
+    virtual QString userIDHint() const;
+
 protected:
 #ifndef TOKEN_AUTH_ONLY
     QIcon themeIcon(const QString& name, bool sysTray = false) const;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list