Added send sms button to detail window and better error handling. Converted gui's...
authoreshe <jessehakanen@gmail.com>
Sun, 18 Apr 2010 19:09:49 +0000 (20:09 +0100)
committereshe <jessehakanen@gmail.com>
Sun, 18 Apr 2010 19:09:49 +0000 (20:09 +0100)
src/common/eniro.cpp
src/common/translations/fi_FI.qm
src/common/translations/fi_FI.ts
src/gui/detailwindow.cpp
src/gui/detailwindow.h
src/gui/main.cpp
www/index.html

index 896a788..63dc421 100644 (file)
@@ -436,7 +436,7 @@ void Eniro::loadResults(int id, QString const& httpData)
         }
     }
 
-    // If number there were no results or no phone numbers needed to
+    // If there were no results or no phone numbers needed to
     // be fetched, the whole request is ready
     if(it.value()->numbersTotal == 0 || !requestsPending)
     {
index 9cb8b20..5df0c8e 100644 (file)
Binary files a/src/common/translations/fi_FI.qm and b/src/common/translations/fi_FI.qm differ
index 398cb17..b610970 100644 (file)
 <context>
     <name>DetailWindow</name>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="39"/>
-        <location filename="../../gui/detailwindow.cpp" line="106"/>
+        <location filename="../../gui/detailwindow.cpp" line="42"/>
+        <location filename="../../gui/detailwindow.cpp" line="120"/>
         <source>Add to contacts</source>
         <translation>Lisää yhteistietoihin</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="40"/>
+        <location filename="../../gui/detailwindow.cpp" line="43"/>
         <source>Copy number to clipboard</source>
         <translation>Kopioi numero leikepöydälle</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="46"/>
-        <location filename="../../gui/detailwindow.cpp" line="109"/>
+        <location filename="../../gui/detailwindow.cpp" line="44"/>
+        <source>Call</source>
+        <translation>Soita</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="45"/>
+        <source>Send SMS</source>
+        <translation>Lähetä SMS</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="53"/>
+        <location filename="../../gui/detailwindow.cpp" line="123"/>
         <source>Name</source>
         <translation>Nimi</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="47"/>
+        <location filename="../../gui/detailwindow.cpp" line="54"/>
         <source>Street</source>
         <translation>Katu</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="48"/>
+        <location filename="../../gui/detailwindow.cpp" line="55"/>
         <source>City</source>
         <translation>Kaupunki</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="50"/>
+        <location filename="../../gui/detailwindow.cpp" line="57"/>
         <source>Phone number</source>
         <translation>Puhelinnumero</translation>
     </message>
     <message>
         <location filename="../../gui/detailwindow.cpp" line="110"/>
+        <source>Unable make call</source>
+        <translation>Puhelun aloittaminen epäonnistui</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="124"/>
         <source>Add</source>
         <translation>Lisää</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="133"/>
+        <location filename="../../gui/detailwindow.cpp" line="155"/>
         <source>Contact was successfully added to contacts.</source>
         <translation>Yhteystieto lisättiin onnistuneesti.</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="137"/>
+        <location filename="../../gui/detailwindow.cpp" line="191"/>
+        <source>Unable to open SMS application</source>
+        <translation>SMS-sovelluksen käynnistäminen epäonnistui</translation>
+    </message>
+    <message>
+        <location filename="../../gui/detailwindow.cpp" line="110"/>
+        <location filename="../../gui/detailwindow.cpp" line="159"/>
+        <location filename="../../gui/detailwindow.cpp" line="191"/>
         <source>Error</source>
         <translation>Virhe</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="137"/>
+        <location filename="../../gui/detailwindow.cpp" line="159"/>
         <source>Unable to add contact.</source>
         <translation>Yhteystiedon lisääminen epäonnistui,</translation>
     </message>
     <message>
-        <location filename="../../gui/detailwindow.cpp" line="145"/>
+        <location filename="../../gui/detailwindow.cpp" line="167"/>
         <source>Number was successfully copied to clipboard.</source>
         <translation>Numero kopioitiin onnistuneesti leikepöydälle.</translation>
     </message>
         <translation>Hakutulokset</translation>
     </message>
     <message>
-        <location filename="../../gui/resultwindow.cpp" line="150"/>
+        <location filename="../../gui/resultwindow.cpp" line="151"/>
         <source>Unknown error</source>
         <translation>Tuntematon virhe</translation>
     </message>
     <message>
-        <location filename="../../gui/resultwindow.cpp" line="153"/>
+        <location filename="../../gui/resultwindow.cpp" line="154"/>
         <source>Error</source>
         <translation>Virhe</translation>
     </message>
     <message>
-        <location filename="../../gui/resultwindow.cpp" line="158"/>
+        <location filename="../../gui/resultwindow.cpp" line="159"/>
         <source>No results found</source>
         <translation>Ei hakutuloksia</translation>
     </message>
index e916fcb..8dc4349 100644 (file)
@@ -36,12 +36,18 @@ DetailWindow::DetailWindow(QWidget* parent): QMainWindow(parent), addDialog_(0)
     layout_ = new QVBoxLayout;
     QHBoxLayout* top = new QHBoxLayout;
     QHBoxLayout* bottom = new QHBoxLayout;
+    QHBoxLayout* actions1 = new QHBoxLayout;
+    QHBoxLayout* actions2 = new QHBoxLayout;
 
     QPushButton* addButton = new QPushButton(QIcon::fromTheme("general_contacts"), tr("Add to contacts"));
     QPushButton* copyButton = new QPushButton(tr("Copy number to clipboard"));
+    QPushButton* callButton = new QPushButton(QIcon::fromTheme("general_call"), tr("Call"));
+    QPushButton* smsButton = new QPushButton(QIcon::fromTheme("general_sms"), tr("Send SMS"));
 
     connect(addButton, SIGNAL(pressed()), this, SLOT(showAddToContactsDialog()));
     connect(copyButton, SIGNAL(pressed()), this, SLOT(copyToClipboard()));
+    connect(callButton, SIGNAL(pressed()), this, SLOT(makeCall()));
+    connect(smsButton, SIGNAL(pressed()), this, SLOT(sendSMS()));
 
     nameButton_ = new QMaemo5ValueButton(QIcon::fromTheme("general_default_avatar"),
                                          tr("Name"), this);
@@ -56,10 +62,14 @@ DetailWindow::DetailWindow(QWidget* parent): QMainWindow(parent), addDialog_(0)
     bottom->addWidget(streetButton_);
     top->addWidget(numberButton_);
     bottom->addWidget(cityButton_);
+    actions1->addWidget(callButton);
+    actions1->addWidget(smsButton);
+    actions2->addWidget(addButton);
+    actions2->addWidget(copyButton);
     layout_->addLayout(top);
     layout_->addLayout(bottom);
-    layout_->addWidget(addButton);
-    layout_->addWidget(copyButton);
+    layout_->addLayout(actions1);
+    layout_->addLayout(actions2);
     area_->setLayout(layout_);
     setCentralWidget(area_);
 }
@@ -95,7 +105,10 @@ void DetailWindow::makeCall()
 
     msg.setArguments(arguments);
 
-    QDBusConnection::systemBus().send(msg);
+    if(!QDBusConnection::systemBus().send(msg))
+    {
+        QMessageBox::critical(this, tr("Error"), tr("Unable make call"));
+    }
 
 }
 
@@ -153,3 +166,29 @@ void DetailWindow::copyToClipboard()
     QApplication::clipboard()->setText(numberButton_->valueText());
     QMaemo5InformationBox::information(this, tr("Number was successfully copied to clipboard."));
 }
+
+void DetailWindow::sendSMS()
+{
+    QString number = numberButton_->valueText();
+
+    if(number.isEmpty())
+    {
+        return;
+    }
+
+    QDBusMessage msg = QDBusMessage::createMethodCall("com.nokia.MessagingUI",
+                                                      "/com/nokia/MessagingUI",
+                                                      "com.nokia.MessagingUI",
+                                                      "messaging_ui_interface_start_sms");
+    QList<QVariant> arguments;
+
+    arguments.append(QVariant("sms:" + number));
+
+    msg.setArguments(arguments);
+
+    if(!QDBusConnection::systemBus().send(msg))
+    {
+        QMessageBox::critical(this, tr("Error"), tr("Unable to open SMS application"));
+    }
+
+}
index eefad76..ff6b87a 100644 (file)
@@ -43,6 +43,7 @@ private slots:
     void showAddToContactsDialog();
     void addToContacts();
     void copyToClipboard();
+    void sendSMS();
 
 private:
     QScrollArea* area_;
index 649f4a7..fdb1245 100644 (file)
@@ -1,50 +1,50 @@
-/*\r
- * This file is part of Jenirok.\r
- *\r
- * Jenirok is free software: you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation, either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Jenirok is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Jenirok.  If not, see <http://www.gnu.org/licenses/>.\r
- *\r
- */\r
-\r
-#include <QtCore/QTranslator>\r
-#include <QtCore/QLocale>\r
-#include <QtGui/QApplication>\r
-#include <QtCore/QObject>\r
-#include "mainwindow.h"\r
-#include "searchdialog.h"\r
-#include "resultwindow.h"\r
-#include "detailwindow.h"\r
-#include "eniro.h"\r
-\r
-int main(int argc, char *argv[])\r
-{\r
-    QApplication app(argc, argv);\r
-\r
-    QTranslator translator;\r
-    translator.load(":/translations/" + QLocale::system().name());\r
-    app.installTranslator(&translator);\r
-\r
-    MainWindow window;\r
-    ResultWindow results(&window);\r
-    DetailWindow details(&results);\r
-\r
-    window.show();\r
-\r
-    QObject::connect(&window, SIGNAL(search(SearchDialog::SearchDetails&)),\r
-                     &results, SLOT(search(SearchDialog::SearchDetails&)));\r
-\r
-    QObject::connect(&results, SIGNAL(itemSelected(Eniro::Result const&)),\r
-                     &details, SLOT(loadData(Eniro::Result const&)));\r
-\r
-    return app.exec();\r
-}\r
+/*
+ * This file is part of Jenirok.
+ *
+ * Jenirok is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Jenirok is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jenirok.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <QtCore/QTranslator>
+#include <QtCore/QLocale>
+#include <QtGui/QApplication>
+#include <QtCore/QObject>
+#include "mainwindow.h"
+#include "searchdialog.h"
+#include "resultwindow.h"
+#include "detailwindow.h"
+#include "eniro.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication app(argc, argv);
+
+    QTranslator translator;
+    translator.load(":/translations/" + QLocale::system().name());
+    app.installTranslator(&translator);
+
+    MainWindow window;
+    ResultWindow results(&window);
+    DetailWindow details(&results);
+
+    window.show();
+
+    QObject::connect(&window, SIGNAL(search(SearchDialog::SearchDetails&)),
+                     &results, SLOT(search(SearchDialog::SearchDetails&)));
+
+    QObject::connect(&results, SIGNAL(itemSelected(Eniro::Result const&)),
+                     &details, SLOT(loadData(Eniro::Result const&)));
+
+    return app.exec();
+}
index 7ce620c..c986f18 100644 (file)
@@ -27,7 +27,7 @@
        <li><a href="https://garage.maemo.org/projects/jenirok/">Project page</a></li>\r
 </ul>\r
 \r
-<p>Jenirok is an open source Maemo 5 application that shows unknown callers' details automatically on screen. Caller details are fetched using <a href="http://henkilot.eniro.fi/">Eniro person search</a> which means that Jenirok is mainly usable for Finnish, Swedish and Danish users. Currently Jenirok is available in English and Finnish, but I'm looking for Swedish and Danish translators. <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#106;&#101;&#115;&#115;&#101;&#104;&#97;&#107;&#97;&#110;&#101;&#110;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;">Contact me</a> if you are interested.</a></p>\r
+<p>Jenirok is an open source Maemo 5 application that shows unknown callers' details automatically on screen. Caller details are fetched using <a href="http://henkilot.eniro.fi/">Eniro person search</a> which means that Jenirok is mainly usable for Finnish, Swedish and Danish users. Currently Jenirok is available in English and Finnish, but I'm looking for Swedish and Danish translators. <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#106;&#101;&#115;&#115;&#101;&#104;&#97;&#107;&#97;&#110;&#101;&#110;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;">Contact me</a> if you are interested.</p>\r
 \r
 <p>Jenirok consists of a background daemon which listens to incoming calls and a gui application which can be used for manual searching and configuring the daemon. Eniro account is needed for manual search. Searches are automatically cached so network is used as little as possible. Searching is only done when the caller's number is not found from the address book.</p>\r
 \r
 \r
 <p>Jenirok is compiled with PR 1.2 SDK and Qt 4.6.2 which is not completely compatible with PR 1.1, so there is no deb package available yet. Package will be available on <a href="https://garage.maemo.org/projects/jenirok/">project page</a> and extras-devel as soon as PR 1.2 becomes available to end users.</p>\r
 \r
-<p>Meanwhile the source code can be obtained from <a href="https://garage.maemo.org/plugins/ggit/browse.php/?p=jenirok;a=tree">git repository</a>: <pre>git clone https://vcs.maemo.org/git/jenirok</pre></p>\r
+<p>Meanwhile the source code can be obtained from <a href="https://garage.maemo.org/plugins/ggit/browse.php/?p=jenirok;a=tree">git repository</a>:</p>\r
+<pre>git clone https://vcs.maemo.org/git/jenirok</pre>\r
 \r
-<p>Compilation on scratchbox is pretty straightforward when you have the required dependencies:\r
+<p>Compilation on scratchbox is pretty straightforward when you have the required dependencies:</p>\r
 <pre>fakeroot apt-get install libqt4-dev libebook-dev</pre>\r
-<p>And the compilation:\r
+<p>And the compilation:</p>\r
 <pre>make\r
-fakeroot make install</pre></p>\r
+fakeroot make install</pre>\r
 \r
 <hr/>\r
 \r