[Pkg-owncloud-commits] [owncloud-client] 11/47: Move code from HTTPCredentials to more generic locations

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Feb 17 18:06:33 UTC 2014


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 ccb45bfea65a55d0b329414440e65ba13928c634
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Thu Feb 6 12:56:34 2014 +0100

    Move code from HTTPCredentials to more generic locations
    
    This is a preparation to make them usable from the Shibboleth
    credentials class.
---
 src/CMakeLists.txt                |  1 +
 src/creds/abstractcredentials.cpp | 42 +++++++++++++++++++++++++++++++++++++++
 src/creds/abstractcredentials.h   |  2 ++
 src/creds/httpcredentials.cpp     | 22 --------------------
 src/creds/httpcredentials.h       |  1 -
 src/mirall/account.h              |  2 ++
 6 files changed, 47 insertions(+), 23 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f2f4ffa..81b3ccf 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -84,6 +84,7 @@ set(libsync_SRCS
     mirall/quotainfo.cpp
     mirall/clientproxy.cpp
     creds/dummycredentials.cpp
+    creds/abstractcredentials.cpp
     creds/httpcredentials.cpp
     creds/credentialsfactory.cpp
     creds/http/httpconfigfile.cpp
diff --git a/src/creds/abstractcredentials.cpp b/src/creds/abstractcredentials.cpp
new file mode 100644
index 0000000..b248b39
--- /dev/null
+++ b/src/creds/abstractcredentials.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) by Daniel Molkentin <danimo at owncloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+
+#include <QString>
+#include <QDebug>
+
+#include "creds/abstractcredentials.h"
+
+namespace Mirall
+{
+
+QString AbstractCredentials::keychainKey(const QString &url, const QString &user)
+{
+    QString u(url);
+    if( u.isEmpty() ) {
+        qDebug() << "Empty url in keyChain, error!";
+        return QString::null;
+    }
+    if( user.isEmpty() ) {
+        qDebug() << "Error: User is emty!";
+        return QString::null;
+    }
+
+    if( !u.endsWith(QChar('/')) ) {
+        u.append(QChar('/'));
+    }
+
+    QString key = user+QLatin1Char(':')+u;
+    return key;
+}
+} // ns Mirall
diff --git a/src/creds/abstractcredentials.h b/src/creds/abstractcredentials.h
index cde85f8..81ef261 100644
--- a/src/creds/abstractcredentials.h
+++ b/src/creds/abstractcredentials.h
@@ -44,6 +44,8 @@ public:
     virtual void invalidateToken(Account *account) = 0;
 
 
+    static QString keychainKey(const QString &url, const QString &user);
+
 Q_SIGNALS:
     void fetched();
 };
diff --git a/src/creds/httpcredentials.cpp b/src/creds/httpcredentials.cpp
index 171596f..a5b26f4 100644
--- a/src/creds/httpcredentials.cpp
+++ b/src/creds/httpcredentials.cpp
@@ -30,8 +30,6 @@
 
 using namespace QKeychain;
 
-Q_DECLARE_METATYPE(Mirall::Account*)
-
 namespace Mirall
 {
 
@@ -299,24 +297,4 @@ void HttpCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* a
     reply->close();
 }
 
-QString HttpCredentials::keychainKey(const QString &url, const QString &user)
-{
-    QString u(url);
-    if( u.isEmpty() ) {
-        qDebug() << "Empty url in keyChain, error!";
-        return QString::null;
-    }
-    if( user.isEmpty() ) {
-        qDebug() << "Error: User is emty!";
-        return QString::null;
-    }
-
-    if( !u.endsWith(QChar('/')) ) {
-        u.append(QChar('/'));
-    }
-
-    QString key = user+QLatin1Char(':')+u;
-    return key;
-}
-
 } // ns Mirall
diff --git a/src/creds/httpcredentials.h b/src/creds/httpcredentials.h
index 00bd8ee..1de04d0 100644
--- a/src/creds/httpcredentials.h
+++ b/src/creds/httpcredentials.h
@@ -59,7 +59,6 @@ private Q_SLOTS:
     void slotWriteJobDone(QKeychain::Job*);
 
 private:
-    static QString keychainKey(const QString &url, const QString &user);
     QString _user;
     QString _password;
     bool _ready;
diff --git a/src/mirall/account.h b/src/mirall/account.h
index 2d27fe9..6c48a31 100644
--- a/src/mirall/account.h
+++ b/src/mirall/account.h
@@ -163,4 +163,6 @@ private:
 
 }
 
+Q_DECLARE_METATYPE(Mirall::Account*)
+
 #endif //SERVERCONNECTION_H

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