summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore 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.ui149
3 files changed, 156 insertions, 60 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
@@ -5,11 +5,13 @@
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qtabwidget.h> 6#include <qtabwidget.h>
7#include <qlistview.h> 7#include <qlistview.h>
8 8#include <qtextbrowser.h>
9#include <termios.h> 9#include <termios.h>
10 10
11#include <gsmlib/gsm_me_ta.h> 11#include <gsmlib/gsm_me_ta.h>
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
14using namespace gsmlib; 16using namespace gsmlib;
15 17
@@ -23,11 +25,15 @@ GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl )
23{ 25{
24 devicelocked = 0; 26 devicelocked = 0;
25 me = NULL; 27 me = NULL;
28 sms_store = NULL;
26 setConnected(FALSE); 29 setConnected(FALSE);
27 /* FIXME: Persistent settings for device/baudrate */ 30 /* FIXME: Persistent settings for device/baudrate */
28 connect(ConnectButton, SIGNAL(clicked()), this, SLOT(doConnectButton())); 31 connect(ConnectButton, SIGNAL(clicked()), this, SLOT(doConnectButton()));
29 connect(ScanButton, SIGNAL(clicked()), this, SLOT(doScanButton())); 32 connect(ScanButton, SIGNAL(clicked()), this, SLOT(doScanButton()));
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?
32} 38}
33 39
@@ -129,6 +135,49 @@ void GSMTool::timerEvent( QTimerEvent * )
129 } 135 }
130} 136}
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()
133{ 182{
134 qDebug("ScanButton"); 183 qDebug("ScanButton");
@@ -248,4 +297,16 @@ void GSMTool::doConnectButton()
248 RevisionText->setText(ifo._revision.c_str()); 297 RevisionText->setText(ifo._revision.c_str());
249 SerialText->setText(ifo._serialNumber.c_str()); 298 SerialText->setText(ifo._serialNumber.c_str());
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
@@ -21,12 +21,16 @@ private slots:
21 void doConnectButton(); 21 void doConnectButton();
22 void doScanButton(); 22 void doScanButton();
23 void doTabChanged(); 23 void doTabChanged();
24 void doSMSStoreChanged();
25 void doSMSTypeChanged();
26
24private: 27private:
25 static const speed_t baudrates[]; 28 static const speed_t baudrates[];
26 int devicelocked; 29 int devicelocked;
27 int timerid; 30 int timerid;
28 31
29 gsmlib::MeTa *me; 32 gsmlib::MeTa *me;
33 gsmlib::SMSStoreRef sms_store;
30 34
31 char *devicename; 35 char *devicename;
32 speed_t baudrate; 36 speed_t baudrate;
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
@@ -11,8 +11,8 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
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>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
@@ -739,56 +739,91 @@
739 <name>title</name> 739 <name>title</name>
740 <string>SMS</string> 740 <string>SMS</string>
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>
747 <property stdset="1"> 747 <property stdset="1">
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>
754 <property>
755 <name>text</name>
756 <string>None</string>
757 </property>
758 </item>
759 <item>
760 <property>
761 <name>text</name>
762 <string>Incoming</string>
763 </property>
764 </item>
765 <item>
766 <property>
767 <name>text</name>
768 <string>Outgoing</string>
769 </property>
770 </item>
771 <property stdset="1">
772 <name>name</name>
773 <cstring>ComboBox11</cstring>
774 </property>
775 <property stdset="1">
776 <name>enabled</name>
777 <bool>true</bool>
778 </property>
779 </widget>
780 <widget row="0" column="0" >
781 <class>QLabel</class>
782 <property stdset="1"> 753 <property stdset="1">
783 <name>name</name> 754 <name>name</name>
784 <cstring>TextLabel4</cstring> 755 <cstring>Layout6</cstring>
785 </property>
786 <property stdset="1">
787 <name>text</name>
788 <string>Message Collection:</string>
789 </property> 756 </property>
757 <hbox>
758 <property stdset="1">
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">
773 <name>text</name>
774 <string>Store:</string>
775 </property>
776 </widget>
777 <widget>
778 <class>QComboBox</class>
779 <item>
780 <property>
781 <name>text</name>
782 <string>None</string>
783 </property>
784 </item>
785 <property stdset="1">
786 <name>name</name>
787 <cstring>SMSStoreList</cstring>
788 </property>
789 <property stdset="1">
790 <name>enabled</name>
791 <bool>true</bool>
792 </property>
793 </widget>
794 <widget>
795 <class>QLabel</class>
796 <property stdset="1">
797 <name>name</name>
798 <cstring>SMSTypeLabel</cstring>
799 </property>
800 <property stdset="1">
801 <name>text</name>
802 <string>Type:</string>
803 </property>
804 </widget>
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>
790 </widget> 825 </widget>
791 <widget row="1" column="0" rowspan="1" colspan="2" > 826 <widget>
792 <class>QListView</class> 827 <class>QListView</class>
793 <column> 828 <column>
794 <property> 829 <property>
@@ -820,21 +855,10 @@
820 </column> 855 </column>
821 <property stdset="1"> 856 <property stdset="1">
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>
839 <property stdset="1"> 863 <property stdset="1">
840 <name>name</name> 864 <name>name</name>
@@ -856,7 +880,7 @@
856 <class>QPushButton</class> 880 <class>QPushButton</class>
857 <property stdset="1"> 881 <property stdset="1">
858 <name>name</name> 882 <name>name</name>
859 <cstring>PushButton11</cstring> 883 <cstring>SMSDeleteButton</cstring>
860 </property> 884 </property>
861 <property stdset="1"> 885 <property stdset="1">
862 <name>text</name> 886 <name>text</name>
@@ -867,7 +891,7 @@
867 <class>QPushButton</class> 891 <class>QPushButton</class>
868 <property stdset="1"> 892 <property stdset="1">
869 <name>name</name> 893 <name>name</name>
870 <cstring>PushButton12</cstring> 894 <cstring>SMSSendButton</cstring>
871 </property> 895 </property>
872 <property stdset="1"> 896 <property stdset="1">
873 <name>text</name> 897 <name>text</name>
@@ -878,7 +902,7 @@
878 <class>QPushButton</class> 902 <class>QPushButton</class>
879 <property stdset="1"> 903 <property stdset="1">
880 <name>name</name> 904 <name>name</name>
881 <cstring>PushButton13</cstring> 905 <cstring>SMSNewButton</cstring>
882 </property> 906 </property>
883 <property stdset="1"> 907 <property stdset="1">
884 <name>text</name> 908 <name>text</name>
@@ -887,7 +911,14 @@
887 </widget> 911 </widget>
888 </hbox> 912 </hbox>
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>
892 </widget> 923 </widget>
893 </vbox> 924 </vbox>