summaryrefslogtreecommitdiff
path: root/noncore/unsupported/gsmtool/gsmtool.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/gsmtool/gsmtool.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/gsmtool/gsmtool.cpp63
1 files changed, 62 insertions, 1 deletions
diff --git a/noncore/unsupported/gsmtool/gsmtool.cpp b/noncore/unsupported/gsmtool/gsmtool.cpp
index 38baf45..c3f9482 100644
--- a/noncore/unsupported/gsmtool/gsmtool.cpp
+++ b/noncore/unsupported/gsmtool/gsmtool.cpp
@@ -7,3 +7,3 @@
7#include <qlistview.h> 7#include <qlistview.h>
8 8#include <qtextbrowser.h>
9#include <termios.h> 9#include <termios.h>
@@ -12,2 +12,4 @@
12#include <gsmlib/gsm_unix_serial.h> 12#include <gsmlib/gsm_unix_serial.h>
13#include <gsmlib/gsm_sms.h>
14#include <gsmlib/gsm_sorted_sms_store.h>
13 15
@@ -25,2 +27,3 @@ GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl )
25 me = NULL; 27 me = NULL;
28 sms_store = NULL;
26 setConnected(FALSE); 29 setConnected(FALSE);
@@ -30,2 +33,5 @@ GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl )
30 connect(TabWidget2, SIGNAL(currentChanged(QWidget *)), this, SLOT(doTabChanged())); 33 connect(TabWidget2, SIGNAL(currentChanged(QWidget *)), this, SLOT(doTabChanged()));
34 connect(SMSStoreList, SIGNAL(activated(int)), this, SLOT(doSMSStoreChanged()));
35 connect(SMSViewType, SIGNAL(activated(int)), this, SLOT(doSMSTypeChanged()));
36
31 timerid = -1; // Is this not possible normally? 37 timerid = -1; // Is this not possible normally?
@@ -131,2 +137,45 @@ void GSMTool::timerEvent( QTimerEvent * )
131 137
138void GSMTool::doSMSStoreChanged()
139{
140 const char *storename = SMSStoreList->currentText().ascii();
141 qDebug("Store Changed to '%s'", storename);
142 try {
143 sms_store = me->getSMSStore(storename);
144
145 qDebug("got store of size %d", sms_store->size());
146 } catch (GsmException) {
147 sms_store = NULL;
148 qDebug("get store failed");
149 }
150 doSMSTypeChanged();
151}
152
153void GSMTool::doSMSTypeChanged()
154{
155 int direction = SMSViewType->currentItem();
156 qDebug("direction %s\n", direction?"outgoing":"incoming");
157
158 SMSList->clear();
159 if (sms_store == NULL)
160 return;
161 for (int i = 0; i < sms_store->size(); i++) {
162 qDebug("Message %d", i);
163 qDebug("Is%sempty", sms_store()[i].empty()?" ":" not ");
164 if (sms_store()[i].empty())
165 continue;
166
167 qDebug("Status %d", sms_store()[i].status());
168 SMSMessageRef message = sms_store()[i].message();
169 qDebug("Got message.");
170
171#if 0 // WTF does this die? Did I mention that gsmlib needs rewriting in a sane language?
172 qDebug(message->toString().c_str());
173 if (direction == message->messageType()) {
174 qDebug("yes\n");
175 new QListViewItem(SMSList, "xx", message->address()._number.c_str());
176 } else qDebug("no. dir %d, type %d\n", direction, message->messageType());
177#endif
178 }
179}
180
132void GSMTool::doScanButton() 181void GSMTool::doScanButton()
@@ -250,2 +299,14 @@ void GSMTool::doConnectButton()
250 setConnected(TRUE); 299 setConnected(TRUE);
300
301 SMSStoreList->clear();
302 SMSStoreList->insertItem("None");
303
304 vector<string> storenames = me->getSMSStoreNames();
305
306 for (vector<string>::iterator i = storenames.begin(); i != storenames.end(); ++i) {
307 SMSStoreList->insertItem(i->c_str());
308 }
309 SMSList->clear();
310 SMSText->setText("");
311 sms_store = NULL;
251} 312}