+ setObjectName(config()->bufferViewName());
+
+ invalidate();
+ emit configChanged();
+}
+
+QList<QAction *> BufferViewFilter::actions(const QModelIndex &index) {
+ Q_UNUSED(index)
+ QList<QAction *> actionList;
+ actionList << &_enableEditMode;
+ return actionList;
+}
+
+void BufferViewFilter::enableEditMode(bool enable) {
+ if(_editMode == enable) {
+ return;
+ }
+ _editMode = enable;
+
+ if(!config())
+ return;
+
+ if(enable == false) {
+ int numBuffers = config()->bufferList().count();
+ QSet<BufferId>::const_iterator iter;
+ for(iter = _toAdd.constBegin(); iter != _toAdd.constEnd(); iter++) {
+ if(config()->bufferList().contains(*iter))
+ continue;
+ config()->requestAddBuffer(*iter, numBuffers);
+ }
+ for(iter = _toTempRemove.constBegin(); iter != _toTempRemove.constEnd(); iter++) {
+ if(config()->temporarilyRemovedBuffers().contains(*iter))
+ continue;
+ config()->requestRemoveBuffer(*iter);
+ }
+ for(iter = _toRemove.constBegin(); iter != _toRemove.constEnd(); iter++) {
+ if(config()->removedBuffers().contains(*iter))
+ continue;
+ config()->requestRemoveBufferPermanently(*iter);
+ }
+ }
+ _toAdd.clear();
+ _toTempRemove.clear();
+ _toRemove.clear();
+