#include <QItemSelectionModel>
#include "network.h"
+#include "networkmodel.h"
#include "types.h"
#include "selectionmodelsynchronizer.h"
-class NetworkModel;
class QAbstractItemView;
class BufferModel : public QSortFilterProxyModel {
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);
QtUi::registerNotificationBackend(new KNotificationBackend(this));
#endif /* HAVE_KDE */
+ connect(bufferWidget(), SIGNAL(currentChanged(BufferId)), SLOT(currentBufferChanged(BufferId)));
+
setDisconnectedState(); // Disable menus and stuff
#ifdef HAVE_KDE
/********************************************************************************************************/
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);
}
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)
}
}
+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 addBufferView(ClientBufferViewConfig *config);
BufferView *allBuffersView() const;
+ BufferWidget *bufferWidget() const { return _bufferWidget; }
+
inline SystemTray *systemTray() const;
bool event(QEvent *event);
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());