X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fidentity.cpp;h=6cb37808c5235a2ee3cf81373b328bb0a7332eec;hp=0569178ade8b86b0fbc150c2cbe322d3d64ecb1b;hb=a72e2b4a90ce18c58b54e111161691ba008dc47d;hpb=137e21913092a372c6a35042150e918000631b0c diff --git a/src/common/identity.cpp b/src/common/identity.cpp index 0569178a..6cb37808 100644 --- a/src/common/identity.cpp +++ b/src/common/identity.cpp @@ -42,6 +42,7 @@ # include #endif +INIT_SYNCABLE_OBJECT(Identity) Identity::Identity(IdentityId id, QObject *parent) : SyncableObject(parent), _identityId(id) @@ -75,6 +76,18 @@ Identity::Identity(const Identity &other, QObject *parent) init(); } +#ifdef Q_WS_WIN +#ifdef UNICODE +QString tcharToQString(TCHAR *tchar){ + return QString::fromUtf16( reinterpret_cast(tchar)); +} +#else +QString tcharToQString(TCHAR *tchar){ + return QString::fromLocal8Bit(tchar); +} +#endif + +#endif void Identity::init() { setObjectName(QString::number(id().toInt())); setAllowClientUpdates(true); @@ -101,7 +114,7 @@ QString Identity::defaultNick() { DWORD bufCharCount = 128; //if(GetUserNameEx(/* NameSamCompatible */ 1, infoBuf, &bufCharCount)) if(GetUserNameEx(NameSamCompatible, infoBuf, &bufCharCount)) { - QString nickName(infoBuf); + QString nickName(tcharToQString(infoBuf)); int lastBs = nickName.lastIndexOf('\\'); if(lastBs != -1) { nickName = nickName.mid(lastBs + 1); @@ -137,7 +150,7 @@ QString Identity::defaultRealName() { TCHAR infoBuf[128]; DWORD bufCharCount = 128; if(GetUserName(infoBuf, &bufCharCount)) - return QString(infoBuf); + return tcharToQString(infoBuf); else return generalDefault; #else @@ -171,98 +184,100 @@ void Identity::setToDefaults() { void Identity::setId(IdentityId _id) { _identityId = _id; + SYNC(ARG(_id)) emit idSet(_id); renameObject(QString::number(id().toInt())); } void Identity::setIdentityName(const QString &identityName) { _identityName = identityName; - emit identityNameSet(identityName); + SYNC(ARG(identityName)) } void Identity::setRealName(const QString &realName) { _realName = realName; - emit realNameSet(realName); + SYNC(ARG(realName)) } void Identity::setNicks(const QStringList &nicks) { _nicks = nicks; + SYNC(ARG(nicks)) emit nicksSet(nicks); } void Identity::setAwayNick(const QString &nick) { _awayNick = nick; - emit awayNickSet(nick); + SYNC(ARG(nick)) } void Identity::setAwayReason(const QString &reason) { _awayReason = reason; - emit awayReasonSet(reason); + SYNC(ARG(reason)) } void Identity::setAwayNickEnabled(bool enabled) { _awayNickEnabled = enabled; - emit awayNickEnabledSet(enabled); + SYNC(ARG(enabled)) } void Identity::setAwayReasonEnabled(bool enabled) { _awayReasonEnabled = enabled; - emit awayReasonEnabledSet(enabled); + SYNC(ARG(enabled)) } void Identity::setAutoAwayEnabled(bool enabled) { _autoAwayEnabled = enabled; - emit autoAwayEnabledSet(enabled); + SYNC(ARG(enabled)) } void Identity::setAutoAwayTime(int time) { _autoAwayTime = time; - emit autoAwayTimeSet(time); + SYNC(ARG(time)) } void Identity::setAutoAwayReason(const QString &reason) { _autoAwayReason = reason; - emit autoAwayReasonSet(reason); + SYNC(ARG(reason)) } void Identity::setAutoAwayReasonEnabled(bool enabled) { _autoAwayReasonEnabled = enabled; - emit autoAwayReasonEnabledSet(enabled); + SYNC(ARG(enabled)) } void Identity::setDetachAwayEnabled(bool enabled) { _detachAwayEnabled = enabled; - emit detachAwayEnabledSet(enabled); + SYNC(ARG(enabled)) } void Identity::setDetachAwayReason(const QString &reason) { _detachAwayReason = reason; - emit detachAwayReasonSet(reason); + SYNC(ARG(reason)) } void Identity::setDetachAwayReasonEnabled(bool enabled) { _detachAwayReasonEnabled = enabled; - emit detachAwayReasonEnabledSet(enabled); + SYNC(ARG(enabled)) } void Identity::setIdent(const QString &ident) { _ident = ident; - emit identSet(ident); + SYNC(ARG(ident)) } void Identity::setKickReason(const QString &reason) { _kickReason = reason; - emit kickReasonSet(reason); + SYNC(ARG(reason)) } void Identity::setPartReason(const QString &reason) { _partReason = reason; - emit partReasonSet(reason); + SYNC(ARG(reason)) } void Identity::setQuitReason(const QString &reason) { _quitReason = reason; - emit quitReasonSet(reason); + SYNC(ARG(reason)) } /*** ***/ @@ -312,3 +327,6 @@ QDataStream &operator>>(QDataStream &in, Identity &id) { return in; } +#ifdef HAVE_SSL +INIT_SYNCABLE_OBJECT(CertManager) +#endif // HAVE_SSL