We now properly close only the notifications that refer to the current buffer if you switch to
it or activate the window. Before, we closed all active notifications when the window got
activated (and only then).
#include <QItemSelectionModel>
#include "network.h"
#include <QItemSelectionModel>
#include "network.h"
+#include "networkmodel.h"
#include "types.h"
#include "selectionmodelsynchronizer.h"
#include "types.h"
#include "selectionmodelsynchronizer.h"
class QAbstractItemView;
class BufferModel : public QSortFilterProxyModel {
class QAbstractItemView;
class BufferModel : public QSortFilterProxyModel {
void synchronizeView(QAbstractItemView *view);
inline QModelIndex currentIndex() { return standardSelectionModel()->currentIndex(); }
void synchronizeView(QAbstractItemView *view);
inline QModelIndex currentIndex() { return standardSelectionModel()->currentIndex(); }
+ inline BufferId currentBuffer() { return currentIndex().data(NetworkModel::BufferIdRole).value<BufferId>(); }
public slots:
void setCurrentIndex(const QModelIndex &newCurrent);
public slots:
void setCurrentIndex(const QModelIndex &newCurrent);
QtUi::registerNotificationBackend(new KNotificationBackend(this));
#endif /* HAVE_KDE */
QtUi::registerNotificationBackend(new KNotificationBackend(this));
#endif /* HAVE_KDE */
+ connect(bufferWidget(), SIGNAL(currentChanged(BufferId)), SLOT(currentBufferChanged(BufferId)));
+
setDisconnectedState(); // Disable menus and stuff
#ifdef HAVE_KDE
setDisconnectedState(); // Disable menus and stuff
#ifdef HAVE_KDE
/********************************************************************************************************/
bool MainWin::event(QEvent *event) {
/********************************************************************************************************/
bool MainWin::event(QEvent *event) {
- if(event->type() == QEvent::WindowActivate)
- QtUi::closeNotifications();
+ if(event->type() == QEvent::WindowActivate) {
+ BufferId buffer = Client::bufferModel()->currentBuffer();
+ if(buffer.isValid())
+ QtUi::closeNotifications(buffer);
+ }
return QMainWindow::event(event);
}
return QMainWindow::event(event);
}
BufferId bufId = idx.data(ChatLineModel::BufferIdRole).value<BufferId>();
BufferInfo::Type bufType = Client::networkModel()->bufferType(bufId);
BufferId bufId = idx.data(ChatLineModel::BufferIdRole).value<BufferId>();
BufferInfo::Type bufType = Client::networkModel()->bufferType(bufId);
- if(hasFocus && bufId == _bufferWidget->currentBuffer())
+ if(hasFocus && bufId == Client::bufferModel()->currentBuffer())
continue;
if((flags & Message::Highlight || bufType == BufferInfo::QueryBuffer)
continue;
if((flags & Message::Highlight || bufType == BufferInfo::QueryBuffer)
+void MainWin::currentBufferChanged(BufferId buffer) {
+ if(buffer.isValid())
+ QtUi::closeNotifications(buffer);
+}
+
void MainWin::clientNetworkCreated(NetworkId id) {
const Network *net = Client::network(id);
QAction *act = new QAction(net->networkName(), this);
void MainWin::clientNetworkCreated(NetworkId id) {
const Network *net = Client::network(id);
QAction *act = new QAction(net->networkName(), this);
void addBufferView(ClientBufferViewConfig *config);
BufferView *allBuffersView() const;
void addBufferView(ClientBufferViewConfig *config);
BufferView *allBuffersView() const;
+ BufferWidget *bufferWidget() const { return _bufferWidget; }
+
inline SystemTray *systemTray() const;
bool event(QEvent *event);
inline SystemTray *systemTray() const;
bool event(QEvent *event);
void addBufferView(int bufferViewConfigId);
void awayLogDestroyed();
void removeBufferView(int bufferViewConfigId);
void addBufferView(int bufferViewConfigId);
void awayLogDestroyed();
void removeBufferView(int bufferViewConfigId);
+ void currentBufferChanged(BufferId);
void messagesInserted(const QModelIndex &parent, int start, int end);
void showAboutDlg();
void showChannelList(NetworkId netId = NetworkId());
void messagesInserted(const QModelIndex &parent, int start, int end);
void showAboutDlg();
void showChannelList(NetworkId netId = NetworkId());