/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
_addNewBuffersAutomatically(true),
_sortAlphabetically(true),
_hideInactiveBuffers(false),
+ _disableDecoration(false),
_allowedBufferTypes(BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer),
_minimumActivity(0)
{
emit sortAlphabeticallySet(sortAlphabetically);
}
+void BufferViewConfig::setDisableDecoration(bool disableDecoration) {
+ if(_disableDecoration == disableDecoration)
+ return;
+
+ _disableDecoration = disableDecoration;
+ emit disableDecorationSet(disableDecoration);
+}
+
void BufferViewConfig::setAllowedBufferTypes(int bufferTypes) {
if(_allowedBufferTypes == bufferTypes)
return;
_buffers << buffer.value<BufferId>();
}
+ // normaly initSeters don't need an emit. this one is to track changes in the settingspage
emit bufferListSet();
}
_buffers << bufferId;
}
+ // normaly initSeters don't need an emit. this one is to track changes in the settingspage
emit bufferListSet();
}
+QVariantList BufferViewConfig::initRemovedBuffers() const {
+ QVariantList removedBuffers;
+
+ foreach(BufferId bufferId, _removedBuffers) {
+ removedBuffers << qVariantFromValue(bufferId);
+ }
+
+ return removedBuffers;
+}
+
+void BufferViewConfig::initSetRemovedBuffers(const QVariantList &buffers) {
+ _removedBuffers.clear();
+
+ foreach(QVariant buffer, buffers) {
+ _removedBuffers << buffer.value<BufferId>();
+ }
+}
+
+QVariantList BufferViewConfig::initTemporarilyRemovedBuffers() const {
+ QVariantList temporarilyRemovedBuffers;
+
+ foreach(BufferId bufferId, _temporarilyRemovedBuffers) {
+ temporarilyRemovedBuffers << qVariantFromValue(bufferId);
+ }
+
+ return temporarilyRemovedBuffers;
+}
+
+void BufferViewConfig::initSetTemporarilyRemovedBuffers(const QVariantList &buffers) {
+ _temporarilyRemovedBuffers.clear();
+
+ foreach(QVariant buffer, buffers) {
+ _temporarilyRemovedBuffers << buffer.value<BufferId>();
+ }
+}
+
void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) {
if(_buffers.contains(bufferId))
return;
pos = 0;
if(pos > _buffers.count())
pos = _buffers.count();
-
+
+ if(_removedBuffers.contains(bufferId))
+ _removedBuffers.remove(bufferId);
+
+ if(_temporarilyRemovedBuffers.contains(bufferId))
+ _temporarilyRemovedBuffers.remove(bufferId);
+
_buffers.insert(pos, bufferId);
emit bufferAdded(bufferId, pos);
}
}
void BufferViewConfig::removeBuffer(const BufferId &bufferId) {
- if(!_buffers.contains(bufferId))
- return;
-
- _buffers.removeAt(_buffers.indexOf(bufferId));
+ if(_buffers.contains(bufferId))
+ _buffers.removeAt(_buffers.indexOf(bufferId));
+
+ if(_removedBuffers.contains(bufferId))
+ _removedBuffers.remove(bufferId);
+
+ _temporarilyRemovedBuffers << bufferId;
+
emit bufferRemoved(bufferId);
}
+
+void BufferViewConfig::removeBufferPermanently(const BufferId &bufferId) {
+ if(_buffers.contains(bufferId))
+ _buffers.removeAt(_buffers.indexOf(bufferId));
+
+ if(_temporarilyRemovedBuffers.contains(bufferId))
+ _temporarilyRemovedBuffers.remove(bufferId);
+
+ _removedBuffers << bufferId;
+
+ emit bufferPermanentlyRemoved(bufferId);
+}