-void BufferViewOverlay::viewInitialized(BufferViewConfig *config) {
- if(!config) {
- qWarning() << "BufferViewOverlay::viewInitialized() received invalid view!";
- return;
- }
- disconnect(config, SIGNAL(initDone()), this, SLOT(viewInitialized()));
-
- connect(config, SIGNAL(networkIdSet(const NetworkId &)), this, SLOT(update()));
- connect(config, SIGNAL(addNewBuffersAutomaticallySet(bool)), this, SLOT(update()));
- connect(config, SIGNAL(sortAlphabeticallySet(bool)), this, SLOT(update()));
- connect(config, SIGNAL(hideInactiveBuffersSet(bool)), this, SLOT(update()));
- connect(config, SIGNAL(allowedBufferTypesSet(int)), this, SLOT(update()));
- connect(config, SIGNAL(minimumActivitySet(int)), this, SLOT(update()));
- connect(config, SIGNAL(bufferListSet()), this, SLOT(update()));
- connect(config, SIGNAL(bufferAdded(const BufferId &, int)), this, SLOT(update()));
- connect(config, SIGNAL(bufferRemoved(const BufferId &)), this, SLOT(update()));
- connect(config, SIGNAL(bufferPermanentlyRemoved(const BufferId &)), this, SLOT(update()));
-
- // check if the view was removed in the meantime...
- if(_bufferViewIds.contains(config->bufferViewId()))
+
+void BufferViewOverlay::removeView(int viewId)
+{
+ if (!_bufferViewIds.contains(viewId))
+ return;
+
+ _bufferViewIds.remove(viewId);
+ BufferViewConfig *config = Client::bufferViewManager()->bufferViewConfig(viewId);
+ if (config)
+ disconnect(config, 0, this, 0);
+
+ // update initialized State:
+ bool wasInitialized = isInitialized();
+ _uninitializedViewCount = 0;
+ QSet<int>::iterator viewIter = _bufferViewIds.begin();
+ while (viewIter != _bufferViewIds.end()) {
+ config = Client::bufferViewManager()->bufferViewConfig(*viewIter);
+ if (!config) {
+ viewIter = _bufferViewIds.erase(viewIter);
+ }
+ else {
+ if (!config->isInitialized())
+ _uninitializedViewCount++;
+ ++viewIter;
+ }
+ }
+