summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/gsmtool/gsmtool.cpp51
-rw-r--r--noncore/unsupported/gsmtool/gsmtool.h1
-rw-r--r--noncore/unsupported/gsmtool/gsmtoolbase.ui44
3 files changed, 79 insertions, 17 deletions
diff --git a/noncore/unsupported/gsmtool/gsmtool.cpp b/noncore/unsupported/gsmtool/gsmtool.cpp
index c3f9482..8273461 100644
--- a/noncore/unsupported/gsmtool/gsmtool.cpp
+++ b/noncore/unsupported/gsmtool/gsmtool.cpp
@@ -6,6 +6,8 @@
6#include <qtabwidget.h> 6#include <qtabwidget.h>
7#include <qlistview.h> 7#include <qlistview.h>
8#include <qtextbrowser.h> 8#include <qtextbrowser.h>
9#include <qmultilineedit.h>
10
9#include <termios.h> 11#include <termios.h>
10 12
11#include <gsmlib/gsm_me_ta.h> 13#include <gsmlib/gsm_me_ta.h>
@@ -33,7 +35,7 @@ GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl )
33 connect(TabWidget2, SIGNAL(currentChanged(QWidget *)), this, SLOT(doTabChanged())); 35 connect(TabWidget2, SIGNAL(currentChanged(QWidget *)), this, SLOT(doTabChanged()));
34 connect(SMSStoreList, SIGNAL(activated(int)), this, SLOT(doSMSStoreChanged())); 36 connect(SMSStoreList, SIGNAL(activated(int)), this, SLOT(doSMSStoreChanged()));
35 connect(SMSViewType, SIGNAL(activated(int)), this, SLOT(doSMSTypeChanged())); 37 connect(SMSViewType, SIGNAL(activated(int)), this, SLOT(doSMSTypeChanged()));
36 38 connect(SMSList, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(doSelectedSMSChanged(QListViewItem *)));
37 timerid = -1; // Is this not possible normally? 39 timerid = -1; // Is this not possible normally?
38} 40}
39 41
@@ -139,7 +141,9 @@ void GSMTool::doSMSStoreChanged()
139{ 141{
140 const char *storename = SMSStoreList->currentText().ascii(); 142 const char *storename = SMSStoreList->currentText().ascii();
141 qDebug("Store Changed to '%s'", storename); 143 qDebug("Store Changed to '%s'", storename);
142 try { 144 if (!strcmp(storename, "None")) {
145 sms_store = NULL;
146 } else try {
143 sms_store = me->getSMSStore(storename); 147 sms_store = me->getSMSStore(storename);
144 148
145 qDebug("got store of size %d", sms_store->size()); 149 qDebug("got store of size %d", sms_store->size());
@@ -147,6 +151,8 @@ void GSMTool::doSMSStoreChanged()
147 sms_store = NULL; 151 sms_store = NULL;
148 qDebug("get store failed"); 152 qDebug("get store failed");
149 } 153 }
154
155 SMSList->setEnabled(!(sms_store == NULL));
150 doSMSTypeChanged(); 156 doSMSTypeChanged();
151} 157}
152 158
@@ -156,6 +162,8 @@ void GSMTool::doSMSTypeChanged()
156 qDebug("direction %s\n", direction?"outgoing":"incoming"); 162 qDebug("direction %s\n", direction?"outgoing":"incoming");
157 163
158 SMSList->clear(); 164 SMSList->clear();
165 doSelectedSMSChanged(NULL);
166
159 if (sms_store == NULL) 167 if (sms_store == NULL)
160 return; 168 return;
161 for (int i = 0; i < sms_store->size(); i++) { 169 for (int i = 0; i < sms_store->size(); i++) {
@@ -168,16 +176,45 @@ void GSMTool::doSMSTypeChanged()
168 SMSMessageRef message = sms_store()[i].message(); 176 SMSMessageRef message = sms_store()[i].message();
169 qDebug("Got message."); 177 qDebug("Got message.");
170 178
171#if 0 // WTF does this die? Did I mention that gsmlib needs rewriting in a sane language? 179 // qDebug(message->toString().c_str());
172 qDebug(message->toString().c_str());
173 if (direction == message->messageType()) { 180 if (direction == message->messageType()) {
174 qDebug("yes\n"); 181 qDebug("yes\n");
175 new QListViewItem(SMSList, "xx", message->address()._number.c_str()); 182 char buf[3];
176 } else qDebug("no. dir %d, type %d\n", direction, message->messageType()); 183 snprintf(buf, 3, "%d", i);
177#endif 184 new QListViewItem(SMSList, message->address()._number.c_str(), message->serviceCentreTimestamp().toString().c_str(), buf);
185 }
178 } 186 }
179} 187}
180 188
189void GSMTool::doSelectedSMSChanged(QListViewItem *item)
190{
191 qDebug("message changed\n");
192
193 if (!item || sms_store == NULL) {
194 SMSText->setText("");
195 SMSText->setEnabled(FALSE);
196 SMSDeleteButton->setEnabled(FALSE);
197 SMSSendButton->setEnabled(FALSE);
198 return;
199 }
200 /* ARGH. This sucks. Surely there's an app-private pointer in the
201 QListViewItem that I've failed to notice?
202
203 SMSMessageRef message = *(SMSMessageRef*)item->private;
204 */
205 qDebug("item %p\n", item);
206
207 qDebug("text(2) is %s\n", item->text(2).ascii());
208 int index = atoi(item->text(2).ascii());
209 qDebug("index %d\n", index);
210 SMSMessageRef message = sms_store()[index].message();
211
212 SMSText->setText(message->userData().c_str());
213 SMSText->setEnabled(TRUE);
214 SMSDeleteButton->setEnabled(TRUE);
215 SMSSendButton->setEnabled(TRUE);
216
217}
181void GSMTool::doScanButton() 218void GSMTool::doScanButton()
182{ 219{
183 qDebug("ScanButton"); 220 qDebug("ScanButton");
diff --git a/noncore/unsupported/gsmtool/gsmtool.h b/noncore/unsupported/gsmtool/gsmtool.h
index 49387d9..b8d9a86 100644
--- a/noncore/unsupported/gsmtool/gsmtool.h
+++ b/noncore/unsupported/gsmtool/gsmtool.h
@@ -23,6 +23,7 @@ private slots:
23 void doTabChanged(); 23 void doTabChanged();
24 void doSMSStoreChanged(); 24 void doSMSStoreChanged();
25 void doSMSTypeChanged(); 25 void doSMSTypeChanged();
26 void doSelectedSMSChanged(QListViewItem *);
26 27
27private: 28private:
28 static const speed_t baudrates[]; 29 static const speed_t baudrates[];
diff --git a/noncore/unsupported/gsmtool/gsmtoolbase.ui b/noncore/unsupported/gsmtool/gsmtoolbase.ui
index 340f26c..69480cd 100644
--- a/noncore/unsupported/gsmtool/gsmtoolbase.ui
+++ b/noncore/unsupported/gsmtool/gsmtoolbase.ui
@@ -11,7 +11,7 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>309</width> 14 <width>371</width>
15 <height>390</height> 15 <height>390</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -666,6 +666,10 @@
666 <vsizetype>7</vsizetype> 666 <vsizetype>7</vsizetype>
667 </sizepolicy> 667 </sizepolicy>
668 </property> 668 </property>
669 <property stdset="1">
670 <name>allColumnsShowFocus</name>
671 <bool>true</bool>
672 </property>
669 </widget> 673 </widget>
670 <widget> 674 <widget>
671 <class>QLayoutWidget</class> 675 <class>QLayoutWidget</class>
@@ -739,7 +743,7 @@
739 <name>title</name> 743 <name>title</name>
740 <string>SMS</string> 744 <string>SMS</string>
741 </attribute> 745 </attribute>
742 <vbox> 746 <grid>
743 <property stdset="1"> 747 <property stdset="1">
744 <name>margin</name> 748 <name>margin</name>
745 <number>11</number> 749 <number>11</number>
@@ -748,7 +752,7 @@
748 <name>spacing</name> 752 <name>spacing</name>
749 <number>6</number> 753 <number>6</number>
750 </property> 754 </property>
751 <widget> 755 <widget row="0" column="0" >
752 <class>QLayoutWidget</class> 756 <class>QLayoutWidget</class>
753 <property stdset="1"> 757 <property stdset="1">
754 <name>name</name> 758 <name>name</name>
@@ -823,12 +827,12 @@
823 </widget> 827 </widget>
824 </hbox> 828 </hbox>
825 </widget> 829 </widget>
826 <widget> 830 <widget row="1" column="0" >
827 <class>QListView</class> 831 <class>QListView</class>
828 <column> 832 <column>
829 <property> 833 <property>
830 <name>text</name> 834 <name>text</name>
831 <string>Date</string> 835 <string>Number</string>
832 </property> 836 </property>
833 <property> 837 <property>
834 <name>clickable</name> 838 <name>clickable</name>
@@ -842,7 +846,7 @@
842 <column> 846 <column>
843 <property> 847 <property>
844 <name>text</name> 848 <name>text</name>
845 <string>Number</string> 849 <string>Date</string>
846 </property> 850 </property>
847 <property> 851 <property>
848 <name>clickable</name> 852 <name>clickable</name>
@@ -857,8 +861,16 @@
857 <name>name</name> 861 <name>name</name>
858 <cstring>SMSList</cstring> 862 <cstring>SMSList</cstring>
859 </property> 863 </property>
864 <property stdset="1">
865 <name>enabled</name>
866 <bool>false</bool>
867 </property>
868 <property stdset="1">
869 <name>allColumnsShowFocus</name>
870 <bool>true</bool>
871 </property>
860 </widget> 872 </widget>
861 <widget> 873 <widget row="2" column="0" >
862 <class>QLayoutWidget</class> 874 <class>QLayoutWidget</class>
863 <property stdset="1"> 875 <property stdset="1">
864 <name>name</name> 876 <name>name</name>
@@ -911,14 +923,26 @@
911 </widget> 923 </widget>
912 </hbox> 924 </hbox>
913 </widget> 925 </widget>
914 <widget> 926 <widget row="3" column="0" >
915 <class>QTextBrowser</class> 927 <class>QMultiLineEdit</class>
916 <property stdset="1"> 928 <property stdset="1">
917 <name>name</name> 929 <name>name</name>
918 <cstring>SMSText</cstring> 930 <cstring>SMSText</cstring>
919 </property> 931 </property>
932 <property stdset="1">
933 <name>enabled</name>
934 <bool>false</bool>
935 </property>
936 <property stdset="1">
937 <name>wordWrap</name>
938 <enum>WidgetWidth</enum>
939 </property>
940 <property stdset="1">
941 <name>readOnly</name>
942 <bool>true</bool>
943 </property>
920 </widget> 944 </widget>
921 </vbox> 945 </grid>
922 </widget> 946 </widget>
923 </widget> 947 </widget>
924 </vbox> 948 </vbox>