Skip to content

Commit

Permalink
More useful infobanner
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidorov Aleksey committed Jun 2, 2012
1 parent 9ffcd1e commit d08cbe9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/dialogsmodel.cpp
Expand Up @@ -9,6 +9,8 @@ DialogsModel::DialogsModel(QObject *parent) :
m_unreadCount(0)
{
setSortOrder(Qt::DescendingOrder);
connect(this, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
SLOT(onDataChanged(QModelIndex,QModelIndex)));
}

void DialogsModel::setClient(QObject *client)
Expand Down Expand Up @@ -100,6 +102,7 @@ void DialogsModel::onAddMessage(const vk::Message &message)

void DialogsModel::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
qDebug("&s", Q_FUNC_INFO);
for (int i = topLeft.row(); i != bottomRight.row() + 1; i++) {
auto message = at(i);
if (message.isIncoming()) {
Expand Down
2 changes: 1 addition & 1 deletion src/qml/harmattan/components/StackedInfoBanner.qml
Expand Up @@ -32,7 +32,7 @@ InfoBanner {
function __setInfo(item)
{
banner.text = item.text
banner.iconSource = item.iconSource
banner.iconSource = item.iconSource ? item.iconSource : ""
}

timerEnabled: false
Expand Down
2 changes: 1 addition & 1 deletion src/qml/harmattan/ios
Submodule ios updated from 6720b4 to d0f70a
16 changes: 10 additions & 6 deletions src/qml/harmattan/main.qml
Expand Up @@ -197,7 +197,7 @@ PageStackWindow {
text: qsTr("Messages")
iconSource: checked ? "images/tile-messages-down.png" :
"images/tile-messages-up.png"
badge: dialogsPage.unreadCount > 0 ? dialogsPage.unreadCount : ""
badge: internal.hasUnread ? "*" : ""
}
Ios.TileIcon {
id: audioIcon
Expand All @@ -220,11 +220,15 @@ PageStackWindow {
}
}

Connections {
target: client.longPoll ? client.longPoll : parent
onMessageAdded: {
messagesIcon.alert()
sendNotify(qsTr("New message recieved"), "")
QtObject {
id: internal
property bool hasUnread: dialogsPage.unreadCount > 0

onHasUnreadChanged: {
if (hasUnread) {
messagesIcon.alert()
sendNotify(qsTr("New message recieved"), "")
}
}
}
}
2 changes: 1 addition & 1 deletion vk
Submodule vk updated from fefd72 to 534f07

0 comments on commit d08cbe9

Please sign in to comment.