*
*/
+#include <QDateTime>
#include "common.h"
#include "callproxy.h"
#include "managerproxy.h"
-//#include "resourceproxy.h"
+
+// Returns a valid QDateTime if parsable as such, otherwise the result
+// will be !isValid()
+static QDateTime qDateTimeFromOfono(const QString &val)
+{
+ TRACE
+ QDateTime result;
+
+ if (val.isEmpty())
+ return result;
+
+ // NOTE: Ofono formats time to string with the following format spec:
+ // %Y-%m-%dT%H:%M:%S%z (for example: "2001-10-19T10:32:30-05:00")
+
+ // Start by trying to parse this as an ISODate "YYYY-MM-DDTHH:MM:SSTZD"
+ result = QDateTime::fromString(val,Qt::ISODate);
+#ifdef VERBOSE
+ qDebug() << QString("Converted %1 with Qt::ISODate: %2")
+ .arg(val)
+ .arg(result.toString());
+#endif
+
+ if (!result.isValid()) {
+ // ISODate conversion has failed, fallback to manual method
+ // NOTE: QDateTime::fromString(val, Qt::ISODate) Fails since the date
+ // format from Ofono is in RFC 822 form, but QDateTime can't parse it
+ struct tm time_tm;
+ QByteArray bytes = val.toAscii();
+ const char *str = bytes.constData();
+ if (strptime(str, "%Y-%m-%dT%H:%M:%S%z", &time_tm) != NULL) {
+ time_t t = mktime(&time_tm);
+ if (t >= (time_t)(0)) {
+ result.setTime_t(t);
+#ifdef VERBOSE
+ qDebug() << QString("Converted %1 with strptime: %2")
+ .arg(val)
+ .arg(result.toString());
+#endif
+ }
+ }
+
+ if (!result.isValid())
+ qCritical() << QString("Format error, unknown date/time: %1")
+ .arg(str);
+ }
+
+ return result;
+}
CallProxy::CallProxy(const QString &callPath)
: org::ofono::VoiceCall(OFONO_SERVICE,
#define TRACE
#endif
-/*
- * Commonly used QRegExp expressions
- */
-#include <QRegExp>
-#define MATCH_ANY(p) QRegExp(p,Qt::CaseInsensitive,QRegExp::FixedString)
-#define MATCH_ALL QRegExp()
-
-/*
- * Commonly used values for MNotifications
- */
-#define DEFAULT_AVATAR_ICON "icon-m-content-avatar-placeholder"
-#define NOTIFICATION_CALL_EVENT "x-nokia.call"
-
-/*
- * Convienence macro for showing TBD message
- */
-#define SHOW_TBD \
- MainWindow *w = dynamic_cast<MainWindow *>(DialerApplication::instance()->activeApplicationWindow()); \
- if (w) \
- w->showTBD();
-
-/*
- * Convience macro for checking available dialer modes
- */
-#define CONFIG_KEY_TARGET_MODE "/apps/dialer/mode"
-#define MODE_HFP_STR "hfp"
-#define MODE_HANDSET_STR "handset"
-#define MODE_HFP_ENABLED DC->modes().contains(MODE_HFP_STR)
-#define MODE_HANDSET_ENABLED DC->modes().contains(MODE_HANDSET_STR)
QString stripLineID(QString lineid);
-bool currentPageIs(int pagenum);
-
-#include <QDateTime>
-QDateTime qDateTimeFromOfono(const QString &val);
-
#endif // COMMON_H
SLOT(onCallsChanged()));
connect(m_manager->voicemail(), SIGNAL(messagesWaitingChanged()), this,
SLOT(messagesWaitingChanged()));
- if (!MODE_HANDSET_ENABLED)
- {
- PAControl* paControl = PAControl::instance();
- connect(m_manager->callManager(), SIGNAL(callsChanged()), paControl,
- SLOT(onCallsChanged()));
-
- }
+ PAControl* paControl = PAControl::instance();
+ connect(m_manager->callManager(), SIGNAL(callsChanged()), paControl,
+ SLOT(onCallsChanged()));
}
}
qCritical() << "Error registering dbus object:" <<
QDBusConnection::sessionBus().lastError().message();
}
- /*
- m_seasideModel = new SeasideSyncModel();
- m_seasideProxy = new SeasideProxyModel();
- m_seasideProxy->setSourceModel(m_seasideModel);
- m_seasideProxy->setDynamicSortFilter(true);
- m_seasideProxy->setFilterKeyColumn(-1);
- m_seasideProxy->setFilterRegExp(MATCH_ALL);
- m_seasideProxy->sort(Seaside::ColumnLastName, Qt::AscendingOrder);
- */
- //m_historyModel = new HistoryTableModel();
- // m_historyProxy = new QSortFilterProxyModel();
- // m_historyProxy->setSourceModel(m_historyModel);
- // m_historyProxy->setDynamicSortFilter(true);
- // m_historyProxy->setFilterKeyColumn(HistoryTableModel::COLUMN_LINEID);
- // m_historyProxy->sort(HistoryTableModel::COLUMN_CALLSTART,
- // Qt::DescendingOrder);
-
- /*
- connect(m_manager->modem(), SIGNAL(connected()),
- SLOT(modemConnected()));
- connect(m_manager->modem(), SIGNAL(disconnected()),
- SLOT(modemDisconnected()));
- */
connect(m_manager, SIGNAL(modemChanged()),
SLOT(modemChanged()));
return lineid.replace(rx, "");
}
-bool currentPageIs(int pagenum)
-{
- DialerApplication *app = DialerApplication::instance();
- return true;
-}
-
-// Returns a valid QDateTime if parsable as such, otherwise the result
-// will be !isValid()
-QDateTime qDateTimeFromOfono(const QString &val)
-{
- TRACE
- QDateTime result;
-
- if (val.isEmpty())
- return result;
-
- // NOTE: Ofono formats time to string with the following format spec:
- // %Y-%m-%dT%H:%M:%S%z (for example: "2001-10-19T10:32:30-05:00")
-
- // Start by trying to parse this as an ISODate "YYYY-MM-DDTHH:MM:SSTZD"
- result = QDateTime::fromString(val,Qt::ISODate);
-#ifdef VERBOSE
- qDebug() << QString("Converted %1 with Qt::ISODate: %2")
- .arg(val)
- .arg(result.toString());
-#endif
-
- if (!result.isValid()) {
- // ISODate conversion has failed, fallback to manual method
- // NOTE: QDateTime::fromString(val, Qt::ISODate) Fails since the date
- // format from Ofono is in RFC 822 form, but QDateTime can't parse it
- struct tm time_tm;
- QByteArray bytes = val.toAscii();
- const char *str = bytes.constData();
- if (strptime(str, "%Y-%m-%dT%H:%M:%S%z", &time_tm) != NULL) {
- time_t t = mktime(&time_tm);
- if (t >= (time_t)(0)) {
- result.setTime_t(t);
-#ifdef VERBOSE
- qDebug() << QString("Converted %1 with strptime: %2")
- .arg(val)
- .arg(result.toString());
-#endif
- }
- }
-
- if (!result.isValid())
- qCritical() << QString("Format error, unknown date/time: %1")
- .arg(str);
- }
-
- return result;
-}