projects
/
quassel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
41b719f
)
Simplify code, fix potential crash
author
Manuel Nickschas
<sputnick@quassel-irc.org>
Thu, 10 Sep 2009 19:21:46 +0000
(21:21 +0200)
committer
Manuel Nickschas
<sputnick@quassel-irc.org>
Thu, 10 Sep 2009 19:31:24 +0000
(21:31 +0200)
src/qtui/qtui.cpp
patch
|
blob
|
history
diff --git
a/src/qtui/qtui.cpp
b/src/qtui/qtui.cpp
index
7be5bd4
..
3774acb
100644
(file)
--- a/
src/qtui/qtui.cpp
+++ b/
src/qtui/qtui.cpp
@@
-109,7
+109,7
@@
const QList<AbstractNotificationBackend *> &QtUi::notificationBackends() {
uint QtUi::invokeNotification(BufferId bufId, AbstractNotificationBackend::NotificationType type, const QString &sender, const QString &text) {
static int notificationId = 0;
uint QtUi::invokeNotification(BufferId bufId, AbstractNotificationBackend::NotificationType type, const QString &sender, const QString &text) {
static int notificationId = 0;
- //notificationId++;
+
AbstractNotificationBackend::Notification notification(++notificationId, bufId, type, sender, text);
_notifications.append(notification);
foreach(AbstractNotificationBackend *backend, _notificationBackends)
AbstractNotificationBackend::Notification notification(++notificationId, bufId, type, sender, text);
_notifications.append(notification);
foreach(AbstractNotificationBackend *backend, _notificationBackends)
@@
-120,11
+120,10
@@
uint QtUi::invokeNotification(BufferId bufId, AbstractNotificationBackend::Notif
void QtUi::closeNotification(uint notificationId) {
QList<AbstractNotificationBackend::Notification>::iterator i = _notifications.begin();
while(i != _notifications.end()) {
void QtUi::closeNotification(uint notificationId) {
QList<AbstractNotificationBackend::Notification>::iterator i = _notifications.begin();
while(i != _notifications.end()) {
- if(
(*i).
notificationId == notificationId) {
+ if(
i->
notificationId == notificationId) {
foreach(AbstractNotificationBackend *backend, _notificationBackends)
backend->close(notificationId);
i = _notifications.erase(i);
foreach(AbstractNotificationBackend *backend, _notificationBackends)
backend->close(notificationId);
i = _notifications.erase(i);
- break;
} else ++i;
}
}
} else ++i;
}
}
@@
-132,9
+131,9
@@
void QtUi::closeNotification(uint notificationId) {
void QtUi::closeNotifications(BufferId bufferId) {
QList<AbstractNotificationBackend::Notification>::iterator i = _notifications.begin();
while(i != _notifications.end()) {
void QtUi::closeNotifications(BufferId bufferId) {
QList<AbstractNotificationBackend::Notification>::iterator i = _notifications.begin();
while(i != _notifications.end()) {
- if(!bufferId.isValid() ||
(*i).
bufferId == bufferId) {
+ if(!bufferId.isValid() ||
i->
bufferId == bufferId) {
foreach(AbstractNotificationBackend *backend, _notificationBackends)
foreach(AbstractNotificationBackend *backend, _notificationBackends)
- backend->close(
(*i).
notificationId);
+ backend->close(
i->
notificationId);
i = _notifications.erase(i);
} else ++i;
}
i = _notifications.erase(i);
} else ++i;
}
@@
-148,17
+147,16
@@
void QtUi::notificationActivated(uint notificationId) {
if(notificationId != 0) {
QList<AbstractNotificationBackend::Notification>::iterator i = _notifications.begin();
while(i != _notifications.end()) {
if(notificationId != 0) {
QList<AbstractNotificationBackend::Notification>::iterator i = _notifications.begin();
while(i != _notifications.end()) {
- if(
(*i).
notificationId == notificationId) {
- BufferId bufId =
(*i).
bufferId;
+ if(
i->
notificationId == notificationId) {
+ BufferId bufId =
i->
bufferId;
if(bufId.isValid())
Client::bufferModel()->switchToBuffer(bufId);
if(bufId.isValid())
Client::bufferModel()->switchToBuffer(bufId);
- foreach(AbstractNotificationBackend *backend, _notificationBackends)
- backend->close(notificationId);
- _notifications.erase(i);
break;
break;
- } else ++i;
+ }
+ ++i;
}
}
}
}
+ closeNotification(notificationId);
mainWindow()->forceActivated();
}
mainWindow()->forceActivated();
}