Skip to content

Commit

Permalink
Fixup codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
neochapay committed Oct 16, 2023
1 parent e191c79 commit b1773fa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion daemon/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <QCoreApplication>
#include "messageshandler.h"
#include <QCoreApplication>

int main(int argc, char** argv)
{
Expand Down
18 changes: 11 additions & 7 deletions daemon/messageshandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
#include "messageshandler.h"
#include <notification.h>

MessagesHandler::MessagesHandler(QObject *parent)
MessagesHandler::MessagesHandler(QObject* parent)
: QObject(parent)
, m_ofonoManager(new QOfonoManager(this))
, m_commhistoryEventModel(new CommHistory::EventModel(this))
{
connect(m_ofonoManager, &QOfonoManager::modemsChanged, this, &MessagesHandler::onModemsChanged);
connect(m_ofonoManager, &QOfonoManager::modemsChanged, this,
&MessagesHandler::onModemsChanged);
}

void MessagesHandler::onModemsChanged(const QStringList &modems)
void MessagesHandler::onModemsChanged(const QStringList& modems)
{
foreach (QOfonoMessageManager* manager, m_messageManagers) {
manager->disconnect();
Expand All @@ -21,11 +22,13 @@ void MessagesHandler::onModemsChanged(const QStringList &modems)
foreach (QString modem, modems) {
QOfonoMessageManager* manager = new QOfonoMessageManager(this);
manager->setModemPath(modem);
connect(manager, &QOfonoMessageManager::incomingMessage, this, &MessagesHandler::onIncomingMessage);
connect(manager, &QOfonoMessageManager::incomingMessage, this,
&MessagesHandler::onIncomingMessage);
}
}

void MessagesHandler::onIncomingMessage(const QString &message, const QVariantMap &info)
void MessagesHandler::onIncomingMessage(const QString& message,
const QVariantMap& info)
{
CommHistory::Event event;
event.setType(CommHistory::Event::SMSEvent);
Expand All @@ -38,10 +41,11 @@ void MessagesHandler::onIncomingMessage(const QString &message, const QVariantMa
newMessageNotification.setAppName(tr("Messages"));
newMessageNotification.setSummary(info.key("Sender"));
newMessageNotification.setBody(message);
newMessageNotification.setIcon("/usr/share/glacier-messages/glacier-messages.png");
newMessageNotification.setIcon(
"/usr/share/glacier-messages/glacier-messages.png");
newMessageNotification.setUrgency(Notification::Urgency::Normal);

if(m_commhistoryEventModel->addEvent(event)) {
if (m_commhistoryEventModel->addEvent(event)) {
newMessageNotification.publish();
} else {
qWarning() << "Can`t save event";
Expand Down
9 changes: 4 additions & 5 deletions daemon/messageshandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
#include <CommHistory/event.h>
#include <CommHistory/eventmodel.h>

class MessagesHandler : public QObject
{
class MessagesHandler : public QObject {
Q_OBJECT
public:
explicit MessagesHandler(QObject *parent = nullptr);
explicit MessagesHandler(QObject* parent = nullptr);

private slots:
void onModemsChanged(const QStringList &modems);
void onIncomingMessage(const QString &message, const QVariantMap &info);
void onModemsChanged(const QStringList& modems);
void onIncomingMessage(const QString& message, const QVariantMap& info);

private:
QOfonoManager* m_ofonoManager;
Expand Down

0 comments on commit b1773fa

Please sign in to comment.