~ubuntu-branches/ubuntu/hardy/quassel/hardy-backports

« back to all changes in this revision

Viewing changes to src/common/bufferviewconfig.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter
  • Date: 2008-09-09 14:57:02 UTC
  • mfrom: (3.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080909145702-31pj1yy1s8ptwc84
Tags: 0.3.0-0ubuntu4~hardy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
    _buffers << buffer.value<BufferId>();
116
116
  }
117
117
 
 
118
  // normaly initSeters don't need an emit. this one is to track changes in the settingspage
118
119
  emit bufferListSet();
119
120
}
120
121
 
125
126
    _buffers << bufferId;
126
127
  }
127
128
 
 
129
  // normaly initSeters don't need an emit. this one is to track changes in the settingspage
128
130
  emit bufferListSet();
129
131
}
130
132
 
 
133
QVariantList BufferViewConfig::initRemovedBuffers() const {
 
134
  QVariantList removedBuffers;
 
135
 
 
136
  foreach(BufferId bufferId, _removedBuffers) {
 
137
    removedBuffers << qVariantFromValue(bufferId);
 
138
  }
 
139
 
 
140
  return removedBuffers;
 
141
}
 
142
 
 
143
void BufferViewConfig::initSetRemovedBuffers(const QVariantList &buffers) {
 
144
  _removedBuffers.clear();
 
145
 
 
146
  foreach(QVariant buffer, buffers) {
 
147
    _removedBuffers << buffer.value<BufferId>();
 
148
  }
 
149
}
 
150
 
 
151
QVariantList BufferViewConfig::initTemporarilyRemovedBuffers() const {
 
152
  QVariantList temporarilyRemovedBuffers;
 
153
 
 
154
  foreach(BufferId bufferId, _temporarilyRemovedBuffers) {
 
155
    temporarilyRemovedBuffers << qVariantFromValue(bufferId);
 
156
  }
 
157
 
 
158
  return temporarilyRemovedBuffers;
 
159
}
 
160
 
 
161
void BufferViewConfig::initSetTemporarilyRemovedBuffers(const QVariantList &buffers) {
 
162
  _temporarilyRemovedBuffers.clear();
 
163
 
 
164
  foreach(QVariant buffer, buffers) {
 
165
    _temporarilyRemovedBuffers << buffer.value<BufferId>();
 
166
  }
 
167
}
 
168
 
131
169
void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) {
132
170
  if(_buffers.contains(bufferId))
133
171
    return;
136
174
    pos = 0;
137
175
  if(pos > _buffers.count())
138
176
    pos = _buffers.count();
 
177
 
 
178
  if(_removedBuffers.contains(bufferId))
 
179
    _removedBuffers.remove(bufferId);
 
180
  
 
181
  if(_temporarilyRemovedBuffers.contains(bufferId))
 
182
    _temporarilyRemovedBuffers.remove(bufferId);
139
183
  
140
184
  _buffers.insert(pos, bufferId);
141
185
  emit bufferAdded(bufferId, pos);
155
199
}
156
200
 
157
201
void BufferViewConfig::removeBuffer(const BufferId &bufferId) {
158
 
  if(!_buffers.contains(bufferId))
159
 
    return;
 
202
  if(_buffers.contains(bufferId))
 
203
    _buffers.removeAt(_buffers.indexOf(bufferId));
160
204
  
161
 
  _buffers.removeAt(_buffers.indexOf(bufferId));
 
205
  if(_removedBuffers.contains(bufferId))
 
206
    _removedBuffers.remove(bufferId);
 
207
 
 
208
  _temporarilyRemovedBuffers << bufferId;
 
209
 
162
210
  emit bufferRemoved(bufferId);
163
211
}
 
212
 
 
213
void BufferViewConfig::removeBufferPermanently(const BufferId &bufferId) {
 
214
  if(_buffers.contains(bufferId))
 
215
    _buffers.removeAt(_buffers.indexOf(bufferId));
 
216
 
 
217
  if(_temporarilyRemovedBuffers.contains(bufferId))
 
218
    _temporarilyRemovedBuffers.remove(bufferId);
 
219
  
 
220
  _removedBuffers << bufferId;
 
221
 
 
222
  emit bufferPermanentlyRemoved(bufferId);
 
223
}