X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Fbufferviewconfig.cpp;h=0ec0348ba4c8d8f63471239446a22aa8a33a998d;hb=7b4bac1b744a407d51f0ece67e0d531206ddad0b;hp=88c9dc0e3431008e43c6bd732c86185184431e57;hpb=a1bcca1c86e88406a0c5495b08731e6b11dd987e;p=quassel.git diff --git a/src/common/bufferviewconfig.cpp b/src/common/bufferviewconfig.cpp index 88c9dc0e..0ec0348b 100644 --- a/src/common/bufferviewconfig.cpp +++ b/src/common/bufferviewconfig.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * 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 * @@ -28,6 +28,7 @@ BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent) _addNewBuffersAutomatically(true), _sortAlphabetically(true), _hideInactiveBuffers(false), + _disableDecoration(false), _allowedBufferTypes(BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer), _minimumActivity(0) { @@ -74,6 +75,14 @@ void BufferViewConfig::setSortAlphabetically(bool sortAlphabetically) { 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; @@ -130,7 +139,7 @@ void BufferViewConfig::initSetBufferList(const QList &buffers) { emit bufferListSet(); } -QVariantList BufferViewConfig::initRemovedBuffersList() const { +QVariantList BufferViewConfig::initRemovedBuffers() const { QVariantList removedBuffers; foreach(BufferId bufferId, _removedBuffers) { @@ -140,7 +149,7 @@ QVariantList BufferViewConfig::initRemovedBuffersList() const { return removedBuffers; } -void BufferViewConfig::initSetRemovedBuffersList(const QVariantList &buffers) { +void BufferViewConfig::initSetRemovedBuffers(const QVariantList &buffers) { _removedBuffers.clear(); foreach(QVariant buffer, buffers) { @@ -148,6 +157,24 @@ void BufferViewConfig::initSetRemovedBuffersList(const QVariantList &buffers) { } } +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(); + } +} + void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) { if(_buffers.contains(bufferId)) return; @@ -159,7 +186,10 @@ void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) { if(_removedBuffers.contains(bufferId)) _removedBuffers.remove(bufferId); - + + if(_temporarilyRemovedBuffers.contains(bufferId)) + _temporarilyRemovedBuffers.remove(bufferId); + _buffers.insert(pos, bufferId); emit bufferAdded(bufferId, pos); } @@ -178,17 +208,24 @@ void BufferViewConfig::moveBuffer(const BufferId &bufferId, int 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);