diff options
Diffstat (limited to 'src/common/remotepermissions.cpp')
-rw-r--r-- | src/common/remotepermissions.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/common/remotepermissions.cpp b/src/common/remotepermissions.cpp index 30ac59cff..90febc000 100644 --- a/src/common/remotepermissions.cpp +++ b/src/common/remotepermissions.cpp @@ -27,7 +27,7 @@ static const char letters[] = " WDNVCKRSMmz"; template <typename Char> void RemotePermissions::fromArray(const Char *p) { - _value = p ? notNullMask : 0; + _value = notNullMask; if (!p) return; while (*p) { @@ -37,17 +37,7 @@ void RemotePermissions::fromArray(const Char *p) } } -RemotePermissions::RemotePermissions(const char *p) -{ - fromArray(p); -} - -RemotePermissions::RemotePermissions(const QString &s) -{ - fromArray(s.isEmpty() ? nullptr : s.utf16()); -} - -QByteArray RemotePermissions::toString() const +QByteArray RemotePermissions::toDbValue() const { QByteArray result; if (isNull()) @@ -64,4 +54,25 @@ QByteArray RemotePermissions::toString() const return result; } +QByteArray RemotePermissions::toString() const +{ + return toDbValue(); +} + +RemotePermissions RemotePermissions::fromDbValue(const QByteArray &value) +{ + if (value.isEmpty()) + return RemotePermissions(); + RemotePermissions perm; + perm.fromArray(value.constData()); + return perm; +} + +RemotePermissions RemotePermissions::fromServerString(const QString &value) +{ + RemotePermissions perm; + perm.fromArray(value.utf16()); + return perm; +} + } // namespace OCC |