smshelper.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /********************************************************************************************
  2. ** Copyright © 2011 Nokia Corporation. All rights reserved.
  3. ** Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
  4. ** Java and all Java-based marks are trademarks or registered trademarks of
  5. ** Sun Microsystems, Inc. Other product and company names mentioned herein may be
  6. ** trademarks or trade names of their respective owners.
  7. **
  8. ** Subject to the conditions below, you may, without charge:
  9. **
  10. ** · Use, copy, modify and/or merge copies of this software and
  11. ** associated content and documentation files (the “Software”)
  12. **
  13. ** · Publish, distribute, sub-licence and/or sell new software
  14. ** derived from or incorporating the Software.
  15. **
  16. ** Some of the documentation, content and/or software maybe licensed under open source
  17. ** software or other licenses. To the extent such documentation, content and/or
  18. ** software are included, licenses and/or other terms and conditions shall apply
  19. ** in addition and/or instead of this notice. The exact terms of the licenses, disclaimers,
  20. ** acknowledgements and notices are reproduced in the materials provided.
  21. **
  22. ** This file, unmodified, shall be included with all copies or substantial portions
  23. ** of the Software that are distributed in source code form.
  24. **
  25. ** The Software cannot constitute the primary value of any new software derived
  26. ** from or incorporating the Software.
  27. **
  28. ** Any person dealing with the Software shall not misrepresent the source of the Software.
  29. **
  30. ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  31. ** INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  32. ** PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  33. ** HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  34. ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  35. ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  36. ********************************************************************************************/
  37. #ifndef SMSHELPER_H
  38. #define SMSHELPER_H
  39. #include <QObject>
  40. #include <qmessage.h>
  41. #include <qmessageservice.h>
  42. QTM_USE_NAMESPACE
  43. #ifdef Q_OS_SYMBIAN
  44. # define SENDSMS_ENABLED
  45. #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
  46. # define SENDSMS_ENABLED
  47. #endif
  48. class SMSHelper : public QObject
  49. {
  50. Q_OBJECT
  51. public:
  52. explicit SMSHelper(QObject *parent = 0);
  53. ~SMSHelper();
  54. Q_INVOKABLE bool sendsms(QString phonenumber, QString message);
  55. signals:
  56. void stateMsg(const QString &statemsg);
  57. void errorMsg(const QString &errormsg);
  58. void debugMsg(const QString &dbgmsg);
  59. private slots:
  60. void messageStateChanged(QMessageService::State s);
  61. #ifndef SENDSMS_ENABLED
  62. void signalFinishedState() { emit stateMsg("FinishedState");};
  63. #endif
  64. private:
  65. QMessageService iMessageService;
  66. QMessageManager iManager;
  67. QMessageService::State state;
  68. };
  69. #endif // SMSHELPER_H