diff --git a/src/account.cpp b/src/account.cpp index d3738226ec330291f6d7c3aa07cfce4a9858d57d..aa0d7b45e9d9fbe46252be48e57bbce071b7b816 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -1472,6 +1472,11 @@ Account* Account::operator<<(Account::EditAction& action) return this; } +Account* operator<<(Account* a, Account::EditAction action) +{ + return (!a)?nullptr : (*a) << action; +} + ///Change the current edition state bool Account::performAction(const Account::EditAction action) { diff --git a/src/account.h b/src/account.h index 29444092774c3fc5d5fa67f8cfcdc3fc9c9c86e7..051810984f8663f4f47106ac6d08b9d8a20db5c3 100644 --- a/src/account.h +++ b/src/account.h @@ -52,7 +52,17 @@ enum DtmfType { }; Q_ENUMS(DtmfType) -///Account: a daemon account (SIP or AIX) +/** + * A communication account. + * + * This class represent an account based around a protocol and a bunch of properties. + * + * Using the setters on this object wont cause the changes to take effect immediately. + * + * To save the changes, use the "<<" operator on the account with Account::EditAction::SAVE. + * Similarly, the Account::EditAction::RELOAD action will reset the changes to match the + * current properties used by daemon. + */ class LIB_EXPORT Account : public QObject { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" @@ -394,6 +404,8 @@ Q_DECLARE_METATYPE(Account*) Q_DECLARE_METATYPE(Account::RegistrationState) Q_DECLARE_METATYPE(Account::EditAction) +Account* operator<<(Account* a, Account::EditAction action); + /** * Some accounts can be loaded at later time. This object will be upgraded * to an account when it arrive diff --git a/src/call.cpp b/src/call.cpp index b1eeaa24f5e1d57232453ca31f446d75e56f5d46..c4c974394899f64e92b4c02f38cc3762022f20df 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -478,6 +478,12 @@ Call* Call::operator<<( Call::Action& c) return this; } + +Call* operator<<(Call* c, Call::Action action) +{ + return (!c) ? nullptr : (*c) << action; +} + ///Get the history state from the type (see Call.cpp header) Call::LegacyHistoryState CallPrivate::historyStateFromType(const QString& type) { diff --git a/src/call.h b/src/call.h index 9cfdbdd91510f16a8004e7f4fe227c27c2cc9493..2410a3d2eecd83b7fa5bd7e2884441727fd1a18a 100644 --- a/src/call.h +++ b/src/call.h @@ -361,6 +361,7 @@ Q_DECLARE_METATYPE(Call::State) Q_DECLARE_METATYPE(Call::Direction) Q_DECLARE_METATYPE(Call::LegacyHistoryState) +Call* operator<<(Call* c, Call::Action a); QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::State& c ); QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::DaemonState& c ); QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::Action& c ); diff --git a/src/useractionmodel.cpp b/src/useractionmodel.cpp index bdf4672b6196dd9fc57dc483ac5b2c3d5fa9785f..2864e9321a77697742e41f9d67f2701d7a32ed1c 100644 --- a/src/useractionmodel.cpp +++ b/src/useractionmodel.cpp @@ -492,6 +492,18 @@ bool UserActionModel::execute(const UserActionModel::Action action) const return true; //TODO handle errors } +UserActionModel* UserActionModel::operator<<(UserActionModel::Action& action) +{ + execute(action); + return this; +} + + +UserActionModel* operator<<(UserActionModel* m,UserActionModel::Action action) +{ + return (!m)? nullptr : (*m) << action; +} + /** * Execute an action * @param idx A model index. It can be from proxies. diff --git a/src/useractionmodel.h b/src/useractionmodel.h index 925508fcfc67af9e527664658bd10b3d14c23845..1e953fa4985721cbe9a9de0e9e1eac94885206e1 100644 --- a/src/useractionmodel.h +++ b/src/useractionmodel.h @@ -97,6 +97,9 @@ public: bool execute( const Action action ) const; bool execute( const QModelIndex& idx ) const; + //Operators + UserActionModel* operator<<(UserActionModel::Action& action); + private: const QScopedPointer<UserActionModelPrivate> d_ptr; Q_DECLARE_PRIVATE(UserActionModel) @@ -109,6 +112,8 @@ Q_DECLARE_METATYPE(UserActionModel*) Q_DECLARE_METATYPE(UserActionModel::Action) +UserActionModel* operator<<(UserActionModel* m,UserActionModel::Action action); + /** * "Java bean" used to avoid having a 5+ parameter pixmap delegate */