Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[fingerterm] Use libnemonotifications rather than MNotification
MNotification is no longer maintained.
  • Loading branch information
matthewvogt committed Mar 19, 2015
1 parent d146390 commit ec43d36
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
3 changes: 3 additions & 0 deletions fingerterm.pro
@@ -1,5 +1,8 @@
QT = core gui qml quick dbus feedback

CONFIG += link_pkgconfig
PKGCONFIG += nemonotifications-qt5

contains(MEEGO_EDITION,harmattan): {
CONFIG += meegotouch
}
Expand Down
2 changes: 2 additions & 0 deletions main.cpp
Expand Up @@ -51,6 +51,8 @@ int main(int argc, char *argv[])
QSettings *settings = new QSettings(QDir::homePath()+"/.config/FingerTerm/settings.ini", QSettings::IniFormat);
defaultSettings(settings);

QCoreApplication::setApplicationName("Fingerterm");

// fork the child process before creating QGuiApplication
int socketM;
int pid = forkpty(&socketM,NULL,NULL,NULL);
Expand Down
1 change: 1 addition & 0 deletions rpm/fingerterm.spec
Expand Up @@ -12,6 +12,7 @@ BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(Qt0Feedback)
BuildRequires: pkgconfig(nemonotifications-qt5) >= 1.0.4
Requires: qt5-qtdeclarative-import-xmllistmodel
Requires: qt5-qtdeclarative-import-window2
Requires: qt-components-qt5
Expand Down
36 changes: 20 additions & 16 deletions util.cpp
Expand Up @@ -34,6 +34,10 @@

#include <QFeedbackEffect>

#ifdef MEEGO_EDITION_HARMATTAN
#include <notification.h>
#endif

Util::Util(QSettings *settings, QObject *parent) :
QObject(parent),
iAllowGestures(false),
Expand Down Expand Up @@ -228,30 +232,30 @@ void Util::bellAlert()
if(settingsValue("general/backgroundBellNotify").toBool() &&
!iWindow->hasFocus())
{
MRemoteAction act(MComponentData::instance()->serviceName(),
"/org/maemo/m",
"com.nokia.MApplicationIf",
"launch");
MNotification notif(MNotification::ImReceivedEvent, "FingerTerm", "Terminal alert was received");
notif.setImage("/usr/share/icons/hicolor/80x80/apps/fingerterm.png");
notif.setAction(act);
Notification notif;
notif.setAppIcon("icon-l-terminal");
notif.setUrgency(Notification::Normal);
notif.setExpireTimeout(0);
notif.setPreviewSummary(QCoreApplication::applicationName());
// TODO: should be translated
notif.setPreviewBody("Terminal alert was received");
notif.setRemoteAction(Notification::remoteAction("default", "", MComponentData::instance()->serviceName(), "/org/maemo/m", "com.nokia.MApplicationIf", "launch"));
notif.publish();
} else if( settingsValue("general/visualBell").toBool() ) {
} else
#endif //MEEGO_EDITION_HARMATTAN
if( settingsValue("general/visualBell").toBool() ) {
emit visualBell();
}
#else
if( settingsValue("general/visualBell").toBool() )
emit visualBell();
#endif
}

void Util::clearNotifications()
{
#ifdef MEEGO_EDITION_HARMATTAN
QList<MNotification*> notifs = MNotification::notifications();
foreach(MNotification* n, notifs) {
if( n->remove() )
delete n;
foreach( QObject *obj, Notification::notifications() ) {
if( Notification *notif = qobject_cast<Notification *>(obj) ) {
notif->close();
}
delete obj;
}
#endif //MEEGO_EDITION_HARMATTAN
}
Expand Down

0 comments on commit ec43d36

Please sign in to comment.