Attached is a patch that allows AccessPoints to be compared by their signal strength. This allows an AccessPointList to be sorted and itemmodels that contain them to sort them. Does anyone have any objections? Chris
Index: wirelessaccesspoint.h =================================================================== --- wirelessaccesspoint.h (revision 807590) +++ wirelessaccesspoint.h (working copy) @@ -122,6 +122,27 @@ */ int signalStrength() const; + /** + * Compares signal strength + * + * @return true if this access point has a weaker signal than other, otherwise false + */ + bool operator<(const AccessPoint &other) const; + + /** + * Compares signal strength + * + * @return true if this access point has a stronger signal than other, otherwise false + */ + bool operator>(const AccessPoint &other) const; + + /** + * Compares signal strength + * + * @return true if this access point has an equal signal strength as other, otherwise false + */ + bool operator==(const AccessPoint &other) const; + protected: /** * This signal is emitted when the signal strength of this network has changed. Index: wirelessaccesspoint.cpp =================================================================== --- wirelessaccesspoint.cpp (revision 807590) +++ wirelessaccesspoint.cpp (working copy) @@ -135,6 +135,21 @@ return_SOLID_CALL(Ifaces::AccessPoint *, d->backendObject(), 0, signalStrength()); } +bool Solid::Control::AccessPoint::operator<(const AccessPoint &other) const +{ + return this->signalStrength() < other.signalStrength(); +} + +bool Solid::Control::AccessPoint::operator>(const AccessPoint &other) const +{ + return this->signalStrength() > other.signalStrength(); +} + +bool Solid::Control::AccessPoint::operator==(const AccessPoint &other) const +{ + return this->signalStrength() == other.signalStrength(); +} + void Solid::Control::AccessPointPrivate::setBackendObject(QObject *object) { FrontendObjectPrivate::setBackendObject(object);
_______________________________________________ Kde-hardware-devel mailing list Kde-hardware-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-hardware-devel