From 8d5a300af1292568264137af8a7a32027ffb705a Mon Sep 17 00:00:00 2001
From: eshe
Date: Sun, 18 Apr 2010 20:09:49 +0100
Subject: [PATCH] Added send sms button to detail window and better error
handling. Converted gui's main.cc to unix format.
---
src/common/eniro.cpp | 2 +-
src/common/translations/fi_FI.qm | Bin 4693 -> 5093 bytes
src/common/translations/fi_FI.ts | 52 ++++++++++++++------
src/gui/detailwindow.cpp | 45 +++++++++++++++--
src/gui/detailwindow.h | 1 +
src/gui/main.cpp | 100 +++++++++++++++++++-------------------
www/index.html | 11 +++--
7 files changed, 137 insertions(+), 74 deletions(-)
diff --git a/src/common/eniro.cpp b/src/common/eniro.cpp
index 896a788..63dc421 100644
--- a/src/common/eniro.cpp
+++ b/src/common/eniro.cpp
@@ -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)
{
diff --git a/src/common/translations/fi_FI.qm b/src/common/translations/fi_FI.qm
index 9cb8b2071a6f8ef6f0bded1a785eaca138de633f..5df0c8e94881ad09751ea43916f3cf8a2fb6fd3e 100644
GIT binary patch
delta 715
zcmX|-ZAcSw9LK-A-Q6DUHrFP1McCto=F&5dy!-~a#keZSw&{T6CJ*Ijd`
zrU8ByusR{^MI)n+`#}~bb?FI0PE;JtpMV49IihH*b8X8
z6$Y43B{ema)cP71GQHH{#n4R_sET67B2Zo*zWmjIlw-*di53SQFt-QT!8_Ufik5$Leke{_rhzKc_a#33Tg6%Q16U3?j$6+6NW#RF9ZPk}bECjvOx>@!2k;ITqN3=t#=zc|X%%kGm^RhPNy>~3Qp
zQ|Cq-aySWvhH~(cp&e3X*eoepw@+%9iU$1!*SKjfI?%H=uaauykfD}Ks7814n>SSK
zj*upYRmFE&jw-&ca<8r#-MWE~)&xss*p37RoFN32o*qQ$uIS6=ExMm~ZLNfP%VEiw
aFBVs{B9%{$$JI!eoQ%Y@wO>;CZ^D1;MXn0~
delta 459
zcmX9)OGq1G7@Xbx|38Vl8w2%$podhUSV2$HgW^F1TPsCSdn!Uj3o6uu-oz}3k6^)y
z5lyRLdR}589stBT
z=H~?WZjkht{FRTt|KF0QU+d}P+>uZ8#XpsRyHvk^GX=OF8us%#F0L8%wXJ|BCHxg>
z3i6BUSDS#bEtcksNLVUXTf)R$k-qlwE+)fq66f^Fg&_OtSr*L_8GrYKLZEy*^_)l5
z{)$07QFjFaI8bNmZja9O2G`Z+Nha{xJsY^B!*kDr?q$Fm&pF&+I=&85kMM!0G7Aqs
zQP76jd(;M4Nz*B3jZLfW;DW@(R^!Y+-aWP^Uqs0>Z0%?R6f~GcpWpi4&P2Tzwru%T
z&M0c^XsV2j4m
DetailWindow
-
-
+
+
Add to contacts
Lisää yhteistietoihin
-
+
Copy number to clipboard
Kopioi numero leikepöydälle
-
-
+
+ Call
+ Soita
+
+
+
+ Send SMS
+ Lähetä SMS
+
+
+
+
Name
Nimi
-
+
Street
Katu
-
+
City
Kaupunki
-
+
Phone number
Puhelinnumero
+ Unable make call
+ Puhelun aloittaminen epäonnistui
+
+
+
Add
Lisää
-
+
Contact was successfully added to contacts.
Yhteystieto lisättiin onnistuneesti.
-
+
+ Unable to open SMS application
+ SMS-sovelluksen käynnistäminen epäonnistui
+
+
+
+
+
Error
Virhe
-
+
Unable to add contact.
Yhteystiedon lisääminen epäonnistui,
-
+
Number was successfully copied to clipboard.
Numero kopioitiin onnistuneesti leikepöydälle.
@@ -149,17 +171,17 @@
Hakutulokset
-
+
Unknown error
Tuntematon virhe
-
+
Error
Virhe
-
+
No results found
Ei hakutuloksia
diff --git a/src/gui/detailwindow.cpp b/src/gui/detailwindow.cpp
index e916fcb..8dc4349 100644
--- a/src/gui/detailwindow.cpp
+++ b/src/gui/detailwindow.cpp
@@ -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 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"));
+ }
+
+}
diff --git a/src/gui/detailwindow.h b/src/gui/detailwindow.h
index eefad76..ff6b87a 100644
--- a/src/gui/detailwindow.h
+++ b/src/gui/detailwindow.h
@@ -43,6 +43,7 @@ private slots:
void showAddToContactsDialog();
void addToContacts();
void copyToClipboard();
+ void sendSMS();
private:
QScrollArea* area_;
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index 649f4a7..fdb1245 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -1,50 +1,50 @@
-/*
- * 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 .
- *
- */
-
-#include
-#include
-#include
-#include
-#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();
-}
+/*
+ * 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 .
+ *
+ */
+
+#include
+#include
+#include
+#include
+#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();
+}
diff --git a/www/index.html b/www/index.html
index 7ce620c..c986f18 100644
--- a/www/index.html
+++ b/www/index.html
@@ -27,7 +27,7 @@
Project page
-Jenirok is an open source Maemo 5 application that shows unknown callers' details automatically on screen. Caller details are fetched using Eniro person search 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. Contact me if you are interested.
+Jenirok is an open source Maemo 5 application that shows unknown callers' details automatically on screen. Caller details are fetched using Eniro person search 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. Contact me if you are interested.
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.
@@ -49,13 +49,14 @@
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 project page and extras-devel as soon as PR 1.2 becomes available to end users.
-Meanwhile the source code can be obtained from git repository :
git clone https://vcs.maemo.org/git/jenirok
+Meanwhile the source code can be obtained from git repository :
+git clone https://vcs.maemo.org/git/jenirok
-Compilation on scratchbox is pretty straightforward when you have the required dependencies:
+
Compilation on scratchbox is pretty straightforward when you have the required dependencies:
fakeroot apt-get install libqt4-dev libebook-dev
-And the compilation:
+
And the compilation:
make
-fakeroot make install
+fakeroot make install
--
1.7.9.5