-rw-r--r-- | noncore/unsupported/gsmtool/gsmtool.cpp | 51 | ||||
-rw-r--r-- | noncore/unsupported/gsmtool/gsmtool.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/gsmtool/gsmtoolbase.ui | 44 |
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 | |||
@@ -8,2 +8,4 @@ | |||
8 | #include <qtextbrowser.h> | 8 | #include <qtextbrowser.h> |
9 | #include <qmultilineedit.h> | ||
10 | |||
9 | #include <termios.h> | 11 | #include <termios.h> |
@@ -35,3 +37,3 @@ GSMTool::GSMTool( QWidget* parent, const char* name, WFlags fl ) | |||
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? |
@@ -141,3 +143,5 @@ void GSMTool::doSMSStoreChanged() | |||
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); |
@@ -149,2 +153,4 @@ void GSMTool::doSMSStoreChanged() | |||
149 | } | 153 | } |
154 | |||
155 | SMSList->setEnabled(!(sms_store == NULL)); | ||
150 | doSMSTypeChanged(); | 156 | doSMSTypeChanged(); |
@@ -158,2 +164,4 @@ void GSMTool::doSMSTypeChanged() | |||
158 | SMSList->clear(); | 164 | SMSList->clear(); |
165 | doSelectedSMSChanged(NULL); | ||
166 | |||
159 | if (sms_store == NULL) | 167 | if (sms_store == NULL) |
@@ -170,9 +178,9 @@ void GSMTool::doSMSTypeChanged() | |||
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 | } |
@@ -180,2 +188,31 @@ void GSMTool::doSMSTypeChanged() | |||
180 | 188 | ||
189 | void 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 | } | ||
181 | void GSMTool::doScanButton() | 218 | void GSMTool::doScanButton() |
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 | |||
@@ -25,2 +25,3 @@ private slots: | |||
25 | void doSMSTypeChanged(); | 25 | void doSMSTypeChanged(); |
26 | void doSelectedSMSChanged(QListViewItem *); | ||
26 | 27 | ||
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 | |||
@@ -13,3 +13,3 @@ | |||
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>309</width> | 14 | <width>371</width> |
15 | <height>390</height> | 15 | <height>390</height> |
@@ -668,2 +668,6 @@ | |||
668 | </property> | 668 | </property> |
669 | <property stdset="1"> | ||
670 | <name>allColumnsShowFocus</name> | ||
671 | <bool>true</bool> | ||
672 | </property> | ||
669 | </widget> | 673 | </widget> |
@@ -741,3 +745,3 @@ | |||
741 | </attribute> | 745 | </attribute> |
742 | <vbox> | 746 | <grid> |
743 | <property stdset="1"> | 747 | <property stdset="1"> |
@@ -750,3 +754,3 @@ | |||
750 | </property> | 754 | </property> |
751 | <widget> | 755 | <widget row="0" column="0" > |
752 | <class>QLayoutWidget</class> | 756 | <class>QLayoutWidget</class> |
@@ -825,3 +829,3 @@ | |||
825 | </widget> | 829 | </widget> |
826 | <widget> | 830 | <widget row="1" column="0" > |
827 | <class>QListView</class> | 831 | <class>QListView</class> |
@@ -830,3 +834,3 @@ | |||
830 | <name>text</name> | 834 | <name>text</name> |
831 | <string>Date</string> | 835 | <string>Number</string> |
832 | </property> | 836 | </property> |
@@ -844,3 +848,3 @@ | |||
844 | <name>text</name> | 848 | <name>text</name> |
845 | <string>Number</string> | 849 | <string>Date</string> |
846 | </property> | 850 | </property> |
@@ -859,4 +863,12 @@ | |||
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> |
@@ -913,4 +925,4 @@ | |||
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"> |
@@ -919,4 +931,16 @@ | |||
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> |