API Documentation
Documentation for developing SailfishOS applicationsSimSmsFilter Class
(Sailfish::Mdm::SimSmsFilter)The SimSmsFilter class controls access to SMS features. More...
Header: | #include <mdm-simsmsfilter.h> |
Properties
- defaultTextAction : SimFilter::Action
- ready : const bool
- textRules : SimFilter::RuleList
Public Functions
SimSmsFilter(QObject *parent = 0) | |
~SimSmsFilter() | |
bool | clearTextRules() |
SimFilter::Action | defaultTextAction() const |
bool | hasTextRuleForImsi(const QString &imsi) const |
bool | ready() const |
bool | removeTextRule(const QString &imsi) |
bool | setDefaultTextAction(SimFilter::Action action) |
bool | setTextRule(const SimFilter::Rule &rule) |
bool | setTextRules(const SimFilter::RuleList &rules) |
SimFilter::RuleList | textRules() const |
Signals
void | defaultTextActionChanged() |
void | readyChanged() |
void | textRuleAdded(const Sailfish::Mdm::SimFilter::Rule &rule) |
void | textRuleRemoved(const QString &imsi) |
void | textRulesChanged(const Sailfish::Mdm::SimFilter::RuleList &oldRules, const Sailfish::Mdm::SimFilter::RuleList &newRules) |
Detailed Description
The SimSmsFilter class controls access to SMS features.
Filter rules can be set for incoming SMS text data. Note that this only applies to incoming texts, and not outgoing texts.
To use this class, clients must add the following to their qmake project:
CONFIG += link_pkgconfig PKGCONFIG += sailfishmdm
and then #include <mdm-simsmsfilter.h>
.
Example of usage:
#include <mdm-simsmsfilter.h> int main(int argc, char **argv) { QCoreApplication app(arg, argv); SimSmsFilter *smsFilter = new SimSmsFilter; QObject::connect(smsFilter, &SimSmsFilter::readyChanged, [smsFilter] { qInfo() << smsFilter->textRules().count() << "text rules are currently set"; SimFilter::Rule rule("123456789", SimFilter::Block); smsFilter->addTextRule(rule); QObject::connect(smsFilter, &SimSmsFilter::textRuleAdded, [rule] { qInfo() << "Rule added for IMSI" << rule.imsi; app.quit(); }); }); return app.exec(); }
Property Documentation
defaultTextAction : SimFilter::Action
The default action for SMS text data.
Access functions:
SimFilter::Action | defaultTextAction() const |
bool | setDefaultTextAction(SimFilter::Action action) |
Notifier signal:
void | defaultTextActionChanged() |
ready : const bool
True when the SMS filter is ready to be used and the property values are valid.
Access functions:
bool | ready() const |
Notifier signal:
void | readyChanged() |
textRules : SimFilter::RuleList
The filter rules for SMS text data.
Access functions:
SimFilter::RuleList | textRules() const |
bool | setTextRules(const SimFilter::RuleList &rules) |
Notifier signal:
void | textRulesChanged(const Sailfish::Mdm::SimFilter::RuleList &oldRules, const Sailfish::Mdm::SimFilter::RuleList &newRules) |
Member Function Documentation
SimSmsFilter::SimSmsFilter(QObject *parent = 0)
Default constructs an instance of SimSmsFilter.
SimSmsFilter::~SimSmsFilter()
Destroys the instance of SimSmsFilter.
bool SimSmsFilter::clearTextRules()
Clears the list of rules.
This is an asynchronous call. When the call completes, textRulesChanged() is emitted.
Returns true if the asynchronous call was sent. Returns false and does nothing if there are no existing text rules.
bool SimSmsFilter::hasTextRuleForImsi(const QString &imsi) const
Returns whether there is an existing SMS text rule for the specified imsi.
bool SimSmsFilter::removeTextRule(const QString &imsi)
Removes the rule with the specified imsi from the list of text SMS rules.
This is an asynchronous call. When the call completes, textRulesChanged() and textRuleRemoved() are emitted.
Returns true if the asynchronous call was sent. Returns false and does nothing if the IMSI is invalid, or if there is no existing rule for this IMSI.
bool SimSmsFilter::setTextRule(const SimFilter::Rule &rule)
Adds or modifies rule in the list of text SMS rules.
This is an asynchronous call. When the call completes, textRulesChanged() is emitted. If this is a new rule, textRuleAdded() is also emitted.
Returns true if the asynchronous call was sent. Returns false and does nothing if the IMSI is invalid, or if there is an existing rule with the same IMSI and action.
bool SimSmsFilter::setTextRules(const SimFilter::RuleList &rules)
Sets the list of rules to rules.
This is an asynchronous call. When the call completes, textRulesChanged() is emitted.
Returns true if the asynchronous call was sent. Returns false and does nothing if any IMSI is invalid, or if the given rules match the existing rules.
Note: Setter function for property textRules.
See also textRules().
[signal]
void SimSmsFilter::textRuleAdded(const Sailfish::Mdm::SimFilter::Rule &rule)
This signal is emitted when a new SMS text rule is added.
[signal]
void SimSmsFilter::textRuleRemoved(const QString &imsi)
This signal is emitted when a SMS text rule with the specified imsi is removed.
[signal]
void SimSmsFilter::textRulesChanged(const Sailfish::Mdm::SimFilter::RuleList &oldRules, const Sailfish::Mdm::SimFilter::RuleList &newRules)
This signal is emitted when the list of SMS text rules changes from oldRules to newRules, due to modifications of the entire list, or individual rules within the list.
Note: Notifier signal for property textRules.