summaryrefslogtreecommitdiff
path: root/noncore
authordwmw2 <dwmw2>2002-04-03 18:22:16 (UTC)
committer dwmw2 <dwmw2>2002-04-03 18:22:16 (UTC)
commit2c2fbf9ae12eb117d5ec6ab9b6a14e27d93261fa (patch) (unidiff)
treeaa725b743c70f7f7dbf05f4eb74c597a40146edc /noncore
parent7993b149e594bf8abd05add99653abd529f5c10a (diff)
downloadopie-2c2fbf9ae12eb117d5ec6ab9b6a14e27d93261fa.zip
opie-2c2fbf9ae12eb117d5ec6ab9b6a14e27d93261fa.tar.gz
opie-2c2fbf9ae12eb117d5ec6ab9b6a14e27d93261fa.tar.bz2
Read SMS messages from phone
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/gsmtool/gsmtool.cpp63
-rw-r--r--noncore/unsupported/gsmtool/gsmtool.h4
-rw-r--r--noncore/unsupported/gsmtool/gsmtoolbase.ui109
3 files changed, 136 insertions, 40 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}
diff --git a/noncore/unsupported/gsmtool/gsmtool.h b/noncore/unsupported/gsmtool/gsmtool.h
index 1625cb1..49387d9 100644
--- a/noncore/unsupported/gsmtool/gsmtool.h
+++ b/noncore/unsupported/gsmtool/gsmtool.h
@@ -23,2 +23,5 @@ private slots:
23 void doTabChanged(); 23 void doTabChanged();
24 void doSMSStoreChanged();
25 void doSMSTypeChanged();
26
24private: 27private:
@@ -29,2 +32,3 @@ private:
29 gsmlib::MeTa *me; 32 gsmlib::MeTa *me;
33 gsmlib::SMSStoreRef sms_store;
30 34
diff --git a/noncore/unsupported/gsmtool/gsmtoolbase.ui b/noncore/unsupported/gsmtool/gsmtoolbase.ui
index 72c943a..340f26c 100644
--- a/noncore/unsupported/gsmtool/gsmtoolbase.ui
+++ b/noncore/unsupported/gsmtool/gsmtoolbase.ui
@@ -13,4 +13,4 @@
13 <y>0</y> 13 <y>0</y>
14 <width>388</width> 14 <width>309</width>
15 <height>502</height> 15 <height>390</height>
16 </rect> 16 </rect>
@@ -741,6 +741,6 @@
741 </attribute> 741 </attribute>
742 <grid> 742 <vbox>
743 <property stdset="1"> 743 <property stdset="1">
744 <name>margin</name> 744 <name>margin</name>
745 <number>2</number> 745 <number>11</number>
746 </property> 746 </property>
@@ -748,18 +748,32 @@
748 <name>spacing</name> 748 <name>spacing</name>
749 <number>1</number> 749 <number>6</number>
750 </property> 750 </property>
751 <widget row="0" column="1" > 751 <widget>
752 <class>QComboBox</class> 752 <class>QLayoutWidget</class>
753 <item> 753 <property stdset="1">
754 <property> 754 <name>name</name>
755 <name>text</name> 755 <cstring>Layout6</cstring>
756 <string>None</string>
757 </property> 756 </property>
758 </item> 757 <hbox>
759 <item> 758 <property stdset="1">
760 <property> 759 <name>margin</name>
760 <number>0</number>
761 </property>
762 <property stdset="1">
763 <name>spacing</name>
764 <number>6</number>
765 </property>
766 <widget>
767 <class>QLabel</class>
768 <property stdset="1">
769 <name>name</name>
770 <cstring>SMSStoreLabel</cstring>
771 </property>
772 <property stdset="1">
761 <name>text</name> 773 <name>text</name>
762 <string>Incoming</string> 774 <string>Store:</string>
763 </property> 775 </property>
764 </item> 776 </widget>
777 <widget>
778 <class>QComboBox</class>
765 <item> 779 <item>
@@ -767,3 +781,3 @@
767 <name>text</name> 781 <name>text</name>
768 <string>Outgoing</string> 782 <string>None</string>
769 </property> 783 </property>
@@ -772,3 +786,3 @@
772 <name>name</name> 786 <name>name</name>
773 <cstring>ComboBox11</cstring> 787 <cstring>SMSStoreList</cstring>
774 </property> 788 </property>
@@ -779,3 +793,3 @@
779 </widget> 793 </widget>
780 <widget row="0" column="0" > 794 <widget>
781 <class>QLabel</class> 795 <class>QLabel</class>
@@ -783,3 +797,3 @@
783 <name>name</name> 797 <name>name</name>
784 <cstring>TextLabel4</cstring> 798 <cstring>SMSTypeLabel</cstring>
785 </property> 799 </property>
@@ -787,6 +801,27 @@
787 <name>text</name> 801 <name>text</name>
788 <string>Message Collection:</string> 802 <string>Type:</string>
789 </property> 803 </property>
790 </widget> 804 </widget>
791 <widget row="1" column="0" rowspan="1" colspan="2" > 805 <widget>
806 <class>QComboBox</class>
807 <item>
808 <property>
809 <name>text</name>
810 <string>Incoming</string>
811 </property>
812 </item>
813 <item>
814 <property>
815 <name>text</name>
816 <string>Outgoing</string>
817 </property>
818 </item>
819 <property stdset="1">
820 <name>name</name>
821 <cstring>SMSViewType</cstring>
822 </property>
823 </widget>
824 </hbox>
825 </widget>
826 <widget>
792 <class>QListView</class> 827 <class>QListView</class>
@@ -822,17 +857,6 @@
822 <name>name</name> 857 <name>name</name>
823 <cstring>ListView3</cstring> 858 <cstring>SMSList</cstring>
824 </property>
825 </widget>
826 <widget row="3" column="0" rowspan="1" colspan="2" >
827 <class>QMultiLineEdit</class>
828 <property stdset="1">
829 <name>name</name>
830 <cstring>MultiLineEdit3</cstring>
831 </property>
832 <property stdset="1">
833 <name>readOnly</name>
834 <bool>true</bool>
835 </property> 859 </property>
836 </widget> 860 </widget>
837 <widget row="2" column="0" rowspan="1" colspan="2" > 861 <widget>
838 <class>QLayoutWidget</class> 862 <class>QLayoutWidget</class>
@@ -858,3 +882,3 @@
858 <name>name</name> 882 <name>name</name>
859 <cstring>PushButton11</cstring> 883 <cstring>SMSDeleteButton</cstring>
860 </property> 884 </property>
@@ -869,3 +893,3 @@
869 <name>name</name> 893 <name>name</name>
870 <cstring>PushButton12</cstring> 894 <cstring>SMSSendButton</cstring>
871 </property> 895 </property>
@@ -880,3 +904,3 @@
880 <name>name</name> 904 <name>name</name>
881 <cstring>PushButton13</cstring> 905 <cstring>SMSNewButton</cstring>
882 </property> 906 </property>
@@ -889,3 +913,10 @@
889 </widget> 913 </widget>
890 </grid> 914 <widget>
915 <class>QTextBrowser</class>
916 <property stdset="1">
917 <name>name</name>
918 <cstring>SMSText</cstring>
919 </property>
920 </widget>
921 </vbox>
891 </widget> 922 </widget>