Clean received & sent messages
[nnokia.git] / smshandler.cpp
index 527ea38d93df966a8c08e2b6598746acf86de8ff..40f6452f47fb4c61065bea6ccf84cc542ac58aec 100644 (file)
@@ -1,7 +1,7 @@
 #include <QtDebug>
 #include <QtDebug>
-#include <QMessageService>
 #include "smshandler.h"
 #include "camshooter.h"
 #include "smshandler.h"
 #include "camshooter.h"
+#include "shootquery.h"
 
 SmsHandler::SmsHandler(QObject *parent) :
     QObject(parent)
 
 SmsHandler::SmsHandler(QObject *parent) :
     QObject(parent)
@@ -15,24 +15,15 @@ SmsHandler::SmsHandler(QObject *parent) :
   msgManager->registerNotificationFilter(
       QMessageFilter::byType(QMessage::Sms) &
       QMessageFilter::byStandardFolder(QMessage::InboxFolder));
   msgManager->registerNotificationFilter(
       QMessageFilter::byType(QMessage::Sms) &
       QMessageFilter::byStandardFolder(QMessage::InboxFolder));
-
-  /*
-  timer = new QTimer(this);
-  timer->setInterval(20000);
-  timer->setSingleShot(false);
-  QObject::connect(timer, SIGNAL(timeout()), this, SLOT(slot_timer_activation()));
-  */
-  QObject::connect(camShooter, SIGNAL(fileReady(const QString &)),
-                   this, SLOT(slot_imageReady(const QString &)));
 }
 
 }
 
+
 void SmsHandler::slot_message_received(const QMessageId & id, const QMessageManager::NotificationFilterIdSet & /*matchingFilterIds*/) {
     qDebug() << "message received";
 
     QMessage msg = msgManager->message(id);
 
 void SmsHandler::slot_message_received(const QMessageId & id, const QMessageManager::NotificationFilterIdSet & /*matchingFilterIds*/) {
     qDebug() << "message received";
 
     QMessage msg = msgManager->message(id);
 
-    remoteAddr = msg.from();
-    qDebug() << "from" << remoteAddr.addressee();
+    qDebug() << "from" << msg.from().addressee();
 
     QString content = msg.textContent();
     qDebug() << "content" << content;
 
     QString content = msg.textContent();
     qDebug() << "content" << content;
@@ -43,27 +34,7 @@ void SmsHandler::slot_message_received(const QMessageId & id, const QMessageMana
         qDebug() << "deleting original message";
         msgManager->removeMessage(id);
 
         qDebug() << "deleting original message";
         msgManager->removeMessage(id);
 
-        qDebug() << "starting shooter";
-        camShooter->go();
+        new ShootQuery(this, this->camShooter, msg.from());
     }
 }
 
     }
 }
 
-void SmsHandler::slot_imageReady(const QString &filename) {
-    qDebug() << "In slot imageReady";
-
-    qDebug() << "building mms";
-    QMessage response;
-    response.setType(QMessage::Mms);
-    response.setTo(remoteAddr);
-    qDebug() << "attaching image";
-    QStringList paths;
-    paths << filename;
-    response.appendAttachments(paths);
-
-    qDebug() << "sending message";
-    QMessageService *m_service = new QMessageService(this);
-    if (!m_service->send(response)) {
-        qDebug() << "send() failed.";
-    }
-    qDebug() << "message" << response.id().toString() << "queued";
-}