Fix iterator

svn path=/trunk/KDE/kdebase/workspace/; revision=883047
This commit is contained in:
Laurent Montel 2008-11-11 23:09:11 +00:00
parent b274203a6a
commit 5535a9de5e
22 changed files with 200 additions and 200 deletions

View file

@ -875,8 +875,8 @@ void Client::setActive( bool act )
StackingUpdatesBlocker blocker( workspace());
workspace()->updateClientLayer( this ); // active windows may get different layer
ClientList mainclients = mainClients();
for( ClientList::ConstIterator it = mainclients.begin();
it != mainclients.end();
for( ClientList::ConstIterator it = mainclients.constBegin();
it != mainclients.constEnd();
++it )
if( (*it)->isFullScreen()) // fullscreens go high even if their transient is active
workspace()->updateClientLayer( *it );

View file

@ -645,8 +645,8 @@ bool Client::isMinimizable() const
{ // #66868 - let other xmms windows be minimized when the mainwindow is minimized
bool shown_mainwindow = false;
ClientList mainclients = mainClients();
for( ClientList::ConstIterator it = mainclients.begin();
it != mainclients.end();
for( ClientList::ConstIterator it = mainclients.constBegin();
it != mainclients.constEnd();
++it )
{
if( (*it)->isShown( true ))
@ -857,8 +857,8 @@ void Client::updateVisibility()
return;
}
bool belongs_to_desktop = false;
for( ClientList::ConstIterator it = group()->members().begin();
it != group()->members().end();
for( ClientList::ConstIterator it = group()->members().constBegin();
it != group()->members().constEnd();
++it )
if( (*it)->isDesktop())
{
@ -1508,8 +1508,8 @@ void Client::getIcons()
if( icon_pix.isNull() && isTransient())
{ // then mainclients
ClientList mainclients = mainClients();
for( ClientList::ConstIterator it = mainclients.begin();
it != mainclients.end() && icon_pix.isNull();
for( ClientList::ConstIterator it = mainclients.constBegin();
it != mainclients.constEnd() && icon_pix.isNull();
++it )
{
icon_pix = (*it)->icon();

View file

@ -90,7 +90,7 @@ void PlastikConfig::save(KConfigGroup&)
KConfigGroup cg(m_config, "General");
QList<QRadioButton *> buttons = m_dialog->titleAlign->findChildren<QRadioButton *>();
for(QList<QRadioButton *>::ConstIterator it = buttons.begin(); it != buttons.end(); ++it)
for(QList<QRadioButton *>::ConstIterator it = buttons.constBegin(); it != buttons.constEnd(); ++it)
{
if((*it)->isChecked())
cg.writeEntry("TitleAlignment", QString((*it)->objectName()));

View file

@ -248,8 +248,8 @@ void Workspace::finishCompositing()
scene = NULL;
compositeTimer.stop();
repaints_region = QRegion();
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it )
{ // forward all opacity values to the frame in case there'll be other CM running
if( (*it)->opacity() != 1.0 )

View file

@ -58,8 +58,8 @@ int main( int argc, char* argv[] )
++pos;
dest_cfg.deleteGroup( QString::number( pos ));
KConfigGroup dcg2 (&dest_cfg, QString::number( pos ));
for( QMap< QString, QString >::ConstIterator it = entries.begin();
it != entries.end();
for( QMap< QString, QString >::ConstIterator it = entries.constBegin();
it != entries.constEnd();
++it )
dcg2.writeEntry( it.key(), *it );
}

View file

@ -108,7 +108,7 @@ void Workspace::updateClientArea( bool force )
iS ++ )
new_sareas[ i ][ iS ] = screens[ iS ];
}
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
for ( ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
{
if( !(*it)->hasStrut())
continue;
@ -200,12 +200,12 @@ void Workspace::updateClientArea( bool force )
}
updateTopMenuGeometry();
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it)
(*it)->checkWorkspacePosition();
for( ClientList::ConstIterator it = desktops.begin();
it != desktops.end();
for( ClientList::ConstIterator it = desktops.constBegin();
it != desktops.constEnd();
++it)
(*it)->checkWorkspacePosition();
}
@ -353,7 +353,7 @@ QPoint Workspace::adjustClientPosition( Client* c, QPoint pos, bool unrestricted
if (snap)
{
QList<Client *>::ConstIterator l;
for (l = clients.begin();l != clients.end();++l )
for (l = clients.constBegin();l != clients.constEnd();++l )
{
if ((*l)->isOnDesktop(currentDesktop()) &&
!(*l)->isMinimized()
@ -568,7 +568,7 @@ QRect Workspace::adjustClientSize( Client* c, QRect moveResizeGeom, int mode )
deltaX = int(snap);
deltaY = int(snap);
QList<Client *>::ConstIterator l;
for (l = clients.begin();l != clients.end();++l )
for (l = clients.constBegin();l != clients.constEnd();++l )
{
if ((*l)->isOnDesktop(currentDesktop()) &&
!(*l)->isMinimized()
@ -790,8 +790,8 @@ void Workspace::updateTopMenuGeometry( Client* c )
area = clientArea( MaximizeFullArea, QPoint( 0, 0 ), 1 ); // HACK desktop ?
area.setHeight( topMenuHeight());
topmenu_space->setGeometry( area );
for( ClientList::ConstIterator it = topmenus.begin();
it != topmenus.end();
for( ClientList::ConstIterator it = topmenus.constBegin();
it != topmenus.constEnd();
++it )
updateTopMenuGeometry( *it );
}

View file

@ -65,8 +65,8 @@ bool performTransiencyCheck()
{
bool ret = true;
ClientList clients = Workspace::self()->clients;
for( ClientList::ConstIterator it1 = clients.begin();
it1 != clients.end();
for( ClientList::ConstIterator it1 = clients.constBegin();
it1 != clients.constEnd();
++it1 )
{
if( (*it1)->deleting )
@ -92,8 +92,8 @@ bool performTransiencyCheck()
else
{
ClientList mains = (*it1)->mainClients();
for( ClientList::ConstIterator it2 = mains.begin();
it2 != mains.end();
for( ClientList::ConstIterator it2 = mains.constBegin();
it2 != mains.constEnd();
++it2 )
{
if( transiencyCheckNonExistent
@ -113,8 +113,8 @@ bool performTransiencyCheck()
}
}
ClientList trans = (*it1)->transients_list;
for( ClientList::ConstIterator it2 = trans.begin();
it2 != trans.end();
for( ClientList::ConstIterator it2 = trans.constBegin();
it2 != trans.constEnd();
++it2 )
{
if( transiencyCheckNonExistent
@ -134,13 +134,13 @@ bool performTransiencyCheck()
}
}
GroupList groups = Workspace::self()->groups;
for( GroupList::ConstIterator it1 = groups.begin();
it1 != groups.end();
for( GroupList::ConstIterator it1 = groups.constBegin();
it1 != groups.constEnd();
++it1 )
{
ClientList members = (*it1)->members();
for( ClientList::ConstIterator it2 = members.begin();
it2 != members.end();
for( ClientList::ConstIterator it2 = members.constBegin();
it2 != members.constEnd();
++it2 )
{
if( (*it2)->in_group != *it1 )
@ -329,8 +329,8 @@ void Group::getIcons()
Group* Workspace::findGroup( Window leader ) const
{
assert( leader != None );
for( GroupList::ConstIterator it = groups.begin();
it != groups.end();
for( GroupList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it )
if( (*it)->leader() == leader )
return *it;
@ -343,8 +343,8 @@ Group* Workspace::findClientLeaderGroup( const Client* c ) const
{
TRANSIENCY_CHECK( c );
Group* ret = NULL;
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it )
{
if( *it == c )
@ -380,8 +380,8 @@ void Workspace::updateMinimizedOfTransients( Client* c )
// if mainwindow is minimized or shaded, minimize transients too
if ( c->isMinimized() || c->isShade() )
{
for( ClientList::ConstIterator it = c->transients().begin();
it != c->transients().end();
for( ClientList::ConstIterator it = c->transients().constBegin();
it != c->transients().constEnd();
++it )
{
if( !(*it)->isMinimized()
@ -394,8 +394,8 @@ void Workspace::updateMinimizedOfTransients( Client* c )
}
else
{ // else unmiminize the transients
for( ClientList::ConstIterator it = c->transients().begin();
it != c->transients().end();
for( ClientList::ConstIterator it = c->transients().constBegin();
it != c->transients().constEnd();
++it )
{
if( (*it)->isMinimized()
@ -414,8 +414,8 @@ void Workspace::updateMinimizedOfTransients( Client* c )
*/
void Workspace::updateOnAllDesktopsOfTransients( Client* c )
{
for( ClientList::ConstIterator it = c->transients().begin();
it != c->transients().end();
for( ClientList::ConstIterator it = c->transients().constBegin();
it != c->transients().constEnd();
++it)
{
if( (*it)->isOnAllDesktops() != c->isOnAllDesktops())
@ -427,8 +427,8 @@ void Workspace::updateOnAllDesktopsOfTransients( Client* c )
void Workspace::checkTransients( Window w )
{
TRANSIENCY_CHECK( NULL );
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it )
(*it)->checkTransient( w );
}
@ -639,8 +639,8 @@ void Client::removeFromMainClients()
transientFor()->removeTransient( this );
if( groupTransient())
{
for( ClientList::ConstIterator it = group()->members().begin();
it != group()->members().end();
for( ClientList::ConstIterator it = group()->members().constBegin();
it != group()->members().constEnd();
++it )
(*it)->removeTransient( this );
}
@ -675,14 +675,14 @@ void Client::cleanGrouping()
// it != mains.end();
// ++it )
// kDebug() << "MN2:" << *it;
for( ClientList::ConstIterator it = transients_list.begin();
it != transients_list.end();
for( ClientList::ConstIterator it = transients_list.constBegin();
it != transients_list.constEnd();
)
{
if( (*it)->transientFor() == this )
{
removeTransient( *it );
it = transients_list.begin(); // restart, just in case something more has changed with the list
it = transients_list.constBegin(); // restart, just in case something more has changed with the list
}
else
++it;
@ -705,8 +705,8 @@ void Client::cleanGrouping()
ClientList group_members = group()->members();
group()->removeMember( this );
in_group = NULL;
for( ClientList::ConstIterator it = group_members.begin();
it != group_members.end();
for( ClientList::ConstIterator it = group_members.constBegin();
it != group_members.constEnd();
++it )
(*it)->removeTransient( this );
// kDebug() << "CLEANGROUPING4:" << this;
@ -723,14 +723,14 @@ void Client::cleanGrouping()
void Client::checkGroupTransients()
{
TRANSIENCY_CHECK( this );
for( ClientList::ConstIterator it1 = group()->members().begin();
it1 != group()->members().end();
for( ClientList::ConstIterator it1 = group()->members().constBegin();
it1 != group()->members().constEnd();
++it1 )
{
if( !(*it1)->groupTransient()) // check all group transients in the group
continue; // TODO optimize to check only the changed ones?
for( ClientList::ConstIterator it2 = group()->members().begin();
it2 != group()->members().end();
for( ClientList::ConstIterator it2 = group()->members().constBegin();
it2 != group()->members().constEnd();
++it2 ) // group transients can be transient only for others in the group,
{ // so don't make them transient for the ones that are transient for it
if( *it1 == *it2 )
@ -756,8 +756,8 @@ void Client::checkGroupTransients()
// transient for it - the indirect transiency actually shouldn't break anything,
// but it can lead to exponentially expensive operations (#95231)
// TODO this is pretty slow as well
for( ClientList::ConstIterator it3 = group()->members().begin();
it3 != group()->members().end();
for( ClientList::ConstIterator it3 = group()->members().constBegin();
it3 != group()->members().constEnd();
++it3 )
{
if( *it1 == *it2 || *it2 == *it3 || *it1 == *it3 )
@ -928,8 +928,8 @@ bool Client::hasTransientInternal( const Client* cl, bool indirect, ConstClientL
if( set.contains( this ))
return false;
set.append( this );
for( ClientList::ConstIterator it = transients().begin();
it != transients().end();
for( ClientList::ConstIterator it = transients().constBegin();
it != transients().constEnd();
++it )
if( (*it)->hasTransientInternal( cl, indirect, set ))
return true;
@ -943,8 +943,8 @@ ClientList Client::mainClients() const
if( transientFor() != NULL )
return ClientList() << const_cast< Client* >( transientFor());
ClientList result;
for( ClientList::ConstIterator it = group()->members().begin();
it != group()->members().end();
for( ClientList::ConstIterator it = group()->members().constBegin();
it != group()->members().constEnd();
++it )
if((*it)->hasTransient( this, false ))
result.append( *it );
@ -961,8 +961,8 @@ ClientList Client::allMainClients() const
Client* Client::findModal( bool allow_itself )
{
for( ClientList::ConstIterator it = transients().begin();
it != transients().end();
for( ClientList::ConstIterator it = transients().constBegin();
it != transients().constEnd();
++it )
if( Client* ret = (*it)->findModal( true ))
return ret;
@ -1071,14 +1071,14 @@ void Client::checkGroup( Group* set_group, bool force )
// no longer transient for ones in the old group
if( old_group != NULL )
{
for( ClientList::ConstIterator it = old_group->members().begin();
it != old_group->members().end();
for( ClientList::ConstIterator it = old_group->members().constBegin();
it != old_group->members().constEnd();
++it )
(*it)->removeTransient( this );
}
// and make transient for all in the new group
for( ClientList::ConstIterator it = group()->members().begin();
it != group()->members().end();
for( ClientList::ConstIterator it = group()->members().constBegin();
it != group()->members().constEnd();
++it )
{
if( *it == this )
@ -1088,8 +1088,8 @@ void Client::checkGroup( Group* set_group, bool force )
}
// group transient splashscreens should be transient even for windows
// in group mapped later
for( ClientList::ConstIterator it = group()->members().begin();
it != group()->members().end();
for( ClientList::ConstIterator it = group()->members().constBegin();
it != group()->members().constEnd();
++it )
{
if( !(*it)->isSplash())

View file

@ -516,7 +516,7 @@ void ButtonDropSite::recalcItemGeometry()
// update the geometry of the items in the left button list
int offset = r.left();
for (ButtonList::const_iterator it = buttonsLeft.begin(); it != buttonsLeft.end(); ++it) {
for (ButtonList::const_iterator it = buttonsLeft.constBegin(); it != buttonsLeft.constEnd(); ++it) {
int w = (*it)->width();
(*it)->rect = QRect(offset, r.top(), w, (*it)->height() );
offset += w;
@ -524,7 +524,7 @@ void ButtonDropSite::recalcItemGeometry()
// the right button list...
offset = r.right() - calcButtonListWidth(buttonsRight);
for (ButtonList::const_iterator it = buttonsRight.begin(); it != buttonsRight.end(); ++it) {
for (ButtonList::const_iterator it = buttonsRight.constBegin(); it != buttonsRight.constEnd(); ++it) {
int w = (*it)->width();
(*it)->rect = QRect(offset, r.top(), w, (*it)->height() );
offset += w;
@ -533,14 +533,14 @@ void ButtonDropSite::recalcItemGeometry()
ButtonDropSiteItem *ButtonDropSite::buttonAt(QPoint p) {
// try to find the item in the left button list
for (ButtonList::const_iterator it = buttonsLeft.begin(); it != buttonsLeft.end(); ++it) {
for (ButtonList::const_iterator it = buttonsLeft.constBegin(); it != buttonsLeft.constEnd(); ++it) {
if ( (*it)->rect.contains(p) ) {
return *it;
}
}
// try to find the item in the right button list
for (ButtonList::const_iterator it = buttonsRight.begin(); it != buttonsRight.end(); ++it) {
for (ButtonList::const_iterator it = buttonsRight.constBegin(); it != buttonsRight.constEnd(); ++it) {
if ( (*it)->rect.contains(p) ) {
return *it;
}
@ -569,7 +569,7 @@ bool ButtonDropSite::removeButton(ButtonDropSiteItem *item) {
int ButtonDropSite::calcButtonListWidth(const ButtonList& btns)
{
int w = 0;
for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) {
for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) {
w += (*it)->width();
}
@ -593,7 +593,7 @@ bool ButtonDropSite::removeSelectedButton()
void ButtonDropSite::drawButtonList(QPainter *p, const ButtonList& btns, int offset)
{
for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) {
for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) {
QRect itemRect = (*it)->rect;
if (itemRect.isValid() ) {
(*it)->draw(p, palette(), itemRect);
@ -847,7 +847,7 @@ QString ButtonPositionWidget::buttonsLeft() const
{
ButtonList btns = m_dropSite->buttonsLeft;
QString btnString = "";
for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) {
for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) {
btnString.append( (*it)->button().type );
}
return btnString;
@ -857,7 +857,7 @@ QString ButtonPositionWidget::buttonsRight() const
{
ButtonList btns = m_dropSite->buttonsRight;
QString btnString = "";
for (ButtonList::const_iterator it = btns.begin(); it != btns.end(); ++it) {
for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) {
btnString.append( (*it)->button().type );
}
return btnString;

View file

@ -217,10 +217,10 @@ KWinDecorationModule::~KWinDecorationModule()
// And insert these into a DecorationInfo structure
void KWinDecorationModule::findDecorations()
{
QStringList dirList = KGlobal::dirs()->findDirs("data", "kwin");
const QStringList dirList = KGlobal::dirs()->findDirs("data", "kwin");
QStringList::ConstIterator it;
for (it = dirList.begin(); it != dirList.end(); ++it)
for (it = dirList.constBegin(); it != dirList.constEnd(); ++it)
{
QDir d(*it);
if (d.exists())
@ -253,7 +253,7 @@ void KWinDecorationModule::createDecorationList()
// Sync with kwin hardcoded KDE2 style which has no desktop item
QStringList decorationNames;
// decorationNames.append( i18n("KDE 2") );
for (it = decorations.begin(); it != decorations.end(); ++it)
for (it = decorations.constBegin(); it != decorations.constEnd(); ++it)
{
decorationNames.append((*it).name);
}
@ -293,8 +293,8 @@ static const char* const border_names[ KDecorationDefines::BordersCount ] =
int KWinDecorationModule::borderSizeToIndex( BorderSize size, QList< BorderSize > sizes )
{
int pos = 0;
for( QList< BorderSize >::ConstIterator it = sizes.begin();
it != sizes.end();
for( QList< BorderSize >::ConstIterator it = sizes.constBegin();
it != sizes.constEnd();
++it, ++pos )
if( size <= *it )
break;
@ -304,9 +304,9 @@ int KWinDecorationModule::borderSizeToIndex( BorderSize size, QList< BorderSize
KDecorationDefines::BorderSize KWinDecorationModule::indexToBorderSize( int index,
QList< BorderSize > sizes )
{
QList< BorderSize >::ConstIterator it = sizes.begin();
QList< BorderSize >::ConstIterator it = sizes.constBegin();
for(;
it != sizes.end();
it != sizes.constEnd();
++it, --index )
if( index == 0 )
break;
@ -576,7 +576,7 @@ void KWinDecorationModule::checkSupportedBorderSizes()
cBorder->hide();
} else {
cBorder->clear();
for (QList<BorderSize>::const_iterator it = sizes.begin(); it != sizes.end(); ++it) {
for (QList<BorderSize>::const_iterator it = sizes.constBegin(); it != sizes.constEnd(); ++it) {
BorderSize size = *it;
cBorder->addItem(i18n(border_names[size]), borderSizeToIndex(size,sizes) );
}

View file

@ -51,14 +51,14 @@ static void saveRules( const QList< Rules* >& rules )
{
KConfig cfg( "kwinrulesrc" );
QStringList groups = cfg.groupList();
for( QStringList::ConstIterator it = groups.begin();
it != groups.end();
for( QStringList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it )
cfg.deleteGroup( *it );
cfg.group("General").writeEntry( "count", rules.count());
int i = 1;
for( QList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
for( QList< Rules* >::ConstIterator it = rules.constBegin();
it != rules.constEnd();
++it )
{
KConfigGroup cg( &cfg, QString::number( i ));
@ -85,8 +85,8 @@ static Rules* findRule( const QList< Rules* >& rules, Window wid, bool whole_app
QByteArray machine = info.clientMachine().toLower();
Rules* best_match = NULL;
int match_quality = 0;
for( QList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
for( QList< Rules* >::ConstIterator it = rules.constBegin();
it != rules.constEnd();
++it )
{
// try to find an exact match, i.e. not a generic rule

View file

@ -178,14 +178,14 @@ void KCMRulesList::save()
{
KConfig cfg( QLatin1String("kwinrulesrc") );
QStringList groups = cfg.groupList();
for( QStringList::ConstIterator it = groups.begin();
it != groups.end();
for( QStringList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it )
cfg.deleteGroup( *it );
cfg.group("General").writeEntry( "count", rules.count());
int i = 1;
for( QVector< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
for( QVector< Rules* >::ConstIterator it = rules.constBegin();
it != rules.constEnd();
++it )
{
KConfigGroup cg( &cfg, QString::number( i ));

View file

@ -101,8 +101,8 @@ void Workspace::updateClientLayer( Client* c )
return;
StackingUpdatesBlocker blocker( this );
c->invalidateLayer(); // invalidate, will be updated when doing restacking
for( ClientList::ConstIterator it = c->transients().begin();
it != c->transients().end();
for( ClientList::ConstIterator it = c->transients().constBegin();
it != c->transients().constEnd();
++it )
updateClientLayer( *it );
}
@ -202,9 +202,9 @@ void Workspace::propagateClients( bool propagate_new_clients )
cl = new Window[ desktops.count() + clients.count()];
pos = 0;
// TODO this is still not completely in the map order
for ( ClientList::ConstIterator it = desktops.begin(); it != desktops.end(); ++it )
for ( ClientList::ConstIterator it = desktops.constBegin(); it != desktops.constEnd(); ++it )
cl[pos++] = (*it)->window();
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it )
for ( ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it )
cl[pos++] = (*it)->window();
rootInfo->setClientList( cl, pos );
delete [] cl;
@ -212,7 +212,7 @@ void Workspace::propagateClients( bool propagate_new_clients )
cl = new Window[ stacking_order.count()];
pos = 0;
for ( ClientList::ConstIterator it = stacking_order.begin(); it != stacking_order.end(); ++it)
for ( ClientList::ConstIterator it = stacking_order.constBegin(); it != stacking_order.constEnd(); ++it)
cl[pos++] = (*it)->window();
rootInfo->setClientListStacking( cl, pos );
delete [] cl;
@ -571,8 +571,8 @@ ClientList Workspace::constrainedStackingOrder()
#endif
// build the order from layers
QHash< Group*, Layer > minimum_layer;
for( ClientList::ConstIterator it = unconstrained_stacking_order.begin();
it != unconstrained_stacking_order.end();
for( ClientList::ConstIterator it = unconstrained_stacking_order.constBegin();
it != unconstrained_stacking_order.constEnd();
++it )
{
Layer l = (*it)->layer();
@ -693,8 +693,8 @@ ClientList Workspace::ensureStackingOrder( const ClientList& list ) const
return list;
// TODO is this worth optimizing?
ClientList result = list;
for( ClientList::ConstIterator it = stacking_order.begin();
it != stacking_order.end();
for( ClientList::ConstIterator it = stacking_order.constBegin();
it != stacking_order.constEnd();
++it )
if( result.removeAll( *it ) != 0 )
result.append( *it );

View file

@ -223,8 +223,8 @@ unsigned long KDecorationOptionsPrivate::updateSettings( KConfig* config )
KDecorationDefines::BorderSize KDecorationOptionsPrivate::findPreferredBorderSize( BorderSize size,
QList< BorderSize > sizes ) const
{
for( QList< BorderSize >::ConstIterator it = sizes.begin();
it != sizes.end();
for( QList< BorderSize >::ConstIterator it = sizes.constBegin();
it != sizes.constEnd();
++it )
if( size <= *it ) // size is either a supported size, or *it is the closest larger supported
return *it;

View file

@ -68,8 +68,8 @@ void KDecorationFactory::removeDecoration( KDecoration* deco )
void KDecorationFactory::resetDecorations( unsigned long changed )
{
for( QList< KDecoration* >::ConstIterator it = _decorations.begin();
it != _decorations.end();
for( QList< KDecoration* >::ConstIterator it = _decorations.constBegin();
it != _decorations.constEnd();
++it )
(*it)->reset( changed );
}

View file

@ -169,8 +169,8 @@ bool Client::manage( Window w, bool isMapped )
bool on_current = false;
Client* maincl = NULL;
// this is slightly duplicated from Placement::placeOnMainWindow()
for( ClientList::ConstIterator it = mainclients.begin();
it != mainclients.end();
for( ClientList::ConstIterator it = mainclients.constBegin();
it != mainclients.constEnd();
++it )
{
if( mainclients.count() > 1 && (*it)->isSpecialWindow())
@ -338,8 +338,8 @@ bool Client::manage( Window w, bool isMapped )
if( init_minimize && isTransient())
{
ClientList mainclients = mainClients();
for( ClientList::ConstIterator it = mainclients.begin();
it != mainclients.end();
for( ClientList::ConstIterator it = mainclients.constBegin();
it != mainclients.constEnd();
++it )
if( (*it)->isShown( true ))
init_minimize = false; // SELI even e.g. for NET::Utility?
@ -351,8 +351,8 @@ bool Client::manage( Window w, bool isMapped )
// use allMainClients(), to include also main clients of group transients
// that have been optimized out in Client::checkGroupTransients()
ClientList mainclients = allMainClients();
for( ClientList::ConstIterator it = mainclients.begin();
it != mainclients.end();
for( ClientList::ConstIterator it = mainclients.constBegin();
it != mainclients.constEnd();
++it )
if( (*it)->isShown( true ))
visible_parent = true;
@ -492,8 +492,8 @@ bool Client::manage( Window w, bool isMapped )
workspace()->setCurrentDesktop( desktop());
bool belongs_to_desktop = false;
for( ClientList::ConstIterator it = group()->members().begin();
it != group()->members().end();
for( ClientList::ConstIterator it = group()->members().constBegin();
it != group()->members().constEnd();
++it )
if( (*it)->isDesktop())
{

View file

@ -187,7 +187,7 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/ )
cxl = x; cxr = x + cw;
cyt = y; cyb = y + ch;
ClientList::ConstIterator l;
for(l = m_WorkspacePtr->stackingOrder().begin(); l != m_WorkspacePtr->stackingOrder().end() ; ++l)
for(l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l)
{
if((*l)->isOnDesktop(desktop) &&
(*l)->isShown( false ) && (*l) != c)
@ -243,7 +243,7 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/ )
// compare to the position of each client on the same desk
ClientList::ConstIterator l;
for(l = m_WorkspacePtr->stackingOrder().begin(); l != m_WorkspacePtr->stackingOrder().end() ; ++l)
for(l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l)
{
if ((*l)->isOnDesktop(desktop) &&
@ -278,7 +278,7 @@ void Placement::placeSmart(Client* c, const QRect& area, Policy /*next*/ )
//test the position of each window on the desk
ClientList::ConstIterator l;
for(l = m_WorkspacePtr->stackingOrder().begin(); l != m_WorkspacePtr->stackingOrder().end() ; ++l)
for(l = m_WorkspacePtr->stackingOrder().constBegin(); l != m_WorkspacePtr->stackingOrder().constEnd() ; ++l)
{
if((*l)->isOnDesktop(desktop) &&
(*l) != c && c->isShown( false ))
@ -481,8 +481,8 @@ void Placement::placeOnMainWindow(Client* c, QRect& area, Policy nextPlacement )
Client* place_on = NULL;
Client* place_on2 = NULL;
int mains_count = 0;
for( ClientList::ConstIterator it = mainwindows.begin();
it != mainwindows.end();
for( ClientList::ConstIterator it = mainwindows.constBegin();
it != mainwindows.constEnd();
++it )
{
if( mainwindows.count() > 1 && (*it)->isSpecialWindow())
@ -727,8 +727,8 @@ int Workspace::packPositionLeft( const Client* cl, int oldx, bool left_edge ) co
QPoint( cl->geometry().left() - 1, cl->geometry().center().y()), cl->desktop()).left();
if( oldx <= newx )
return oldx;
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it)
{
if( !(*it)->isShown( false ) || !(*it)->isOnDesktop( active_client->desktop()))
@ -750,8 +750,8 @@ int Workspace::packPositionRight( const Client* cl, int oldx, bool right_edge )
QPoint( cl->geometry().right() + 1, cl->geometry().center().y()), cl->desktop()).right();
if( oldx >= newx )
return oldx;
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it)
{
if( !(*it)->isShown( false ) || !(*it)->isOnDesktop( cl->desktop()))
@ -773,8 +773,8 @@ int Workspace::packPositionUp( const Client* cl, int oldy, bool top_edge ) const
QPoint( cl->geometry().center().x(), cl->geometry().top() - 1 ), cl->desktop()).top();
if( oldy <= newy )
return oldy;
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it)
{
if( !(*it)->isShown( false ) || !(*it)->isOnDesktop( cl->desktop()))
@ -796,8 +796,8 @@ int Workspace::packPositionDown( const Client* cl, int oldy, bool bottom_edge )
QPoint( cl->geometry().center().x(), cl->geometry().bottom() + 1 ), cl->desktop()).bottom();
if( oldy >= newy )
return oldy;
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it)
{
if( !(*it)->isShown( false ) || !(*it)->isOnDesktop( cl->desktop()))

View file

@ -709,8 +709,8 @@ void WindowRules::discardTemporary()
void WindowRules::update( Client* c )
{
bool updated = false;
for( QVector< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
for( QVector< Rules* >::ConstIterator it = rules.constBegin();
it != rules.constEnd();
++it )
if( (*it)->update( c )) // no short-circuiting here
updated = true;
@ -724,8 +724,8 @@ type WindowRules::check##rule( type arg, bool init ) const \
if( rules.count() == 0 ) \
return arg; \
type ret = arg; \
for( QVector< Rules* >::ConstIterator it = rules.begin(); \
it != rules.end(); \
for( QVector< Rules* >::ConstIterator it = rules.constBegin(); \
it != rules.constEnd(); \
++it ) \
{ \
if( (*it)->apply##rule( ret, init )) \
@ -935,14 +935,14 @@ void Workspace::writeWindowRules()
rulesUpdatedTimer.stop();
KConfig cfg( "kwinrulesrc", KConfig::NoGlobals );
QStringList groups = cfg.groupList();
for( QStringList::ConstIterator it = groups.begin();
it != groups.end();
for( QStringList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it )
cfg.deleteGroup( *it );
cfg.group("General").writeEntry( "count", rules.count());
int i = 1;
for( QList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
for( QList< Rules* >::ConstIterator it = rules.constBegin();
it != rules.constEnd();
++it )
{
if( (*it)->isTemporary())
@ -956,8 +956,8 @@ void Workspace::writeWindowRules()
void Workspace::gotTemporaryRulesMessage( const QString& message )
{
bool was_temporary = false;
for( QList< Rules* >::ConstIterator it = rules.begin();
it != rules.end();
for( QList< Rules* >::ConstIterator it = rules.constBegin();
it != rules.constEnd();
++it )
if( (*it)->isTemporary())
was_temporary = true;

View file

@ -50,8 +50,8 @@ void SceneBasic::paint( QRegion, ToplevelList windows )
val.subwindow_mode = IncludeInferiors;
GC gc = XCreateGC( display(), composite_pixmap, GCForeground | GCSubwindowMode, &val );
XFillRectangle( display(), composite_pixmap, gc, 0, 0, displayWidth(), displayHeight());
for( ToplevelList::ConstIterator it = windows.begin();
it != windows.end();
for( ToplevelList::ConstIterator it = windows.constBegin();
it != windows.constEnd();
++it )
{
QRect r = (*it)->geometry().intersected( QRect( 0, 0, displayWidth(), displayHeight()));

View file

@ -208,7 +208,7 @@ void TabBox::reset( bool partial_reset )
// calculate maximum caption width
cw = fontMetrics().width(no_tasks)+20;
for (ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
{
cw = fontMetrics().width( (*it)->caption() );
if ( cw > wmax ) wmax = cw;
@ -460,7 +460,7 @@ void TabBox::paintEvent( QPaintEvent* e )
}
else
{
for (ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
{
if ( workspace()->hasClient( *it ) ) // safety
{
@ -719,8 +719,8 @@ void TabBox::handleMouseEvent( XEvent* e )
if( mode() == TabBoxWindowsMode )
{
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it)
{
if( workspace()->hasClient( *it ) && (num == 0) ) // safety

View file

@ -1227,8 +1227,8 @@ void Client::setShortcut( const QString& _cut )
}
QList< KShortcut > keys;
QStringList groups = cut.split( ' ');
for( QStringList::ConstIterator it = groups.begin();
it != groups.end();
for( QStringList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it )
{
QRegExp reg( "(.*\\+)\\((.*)\\)" );
@ -1246,15 +1246,15 @@ void Client::setShortcut( const QString& _cut )
}
}
}
for( QList< KShortcut >::ConstIterator it = keys.begin();
it != keys.end();
for( QList< KShortcut >::ConstIterator it = keys.constBegin();
it != keys.constEnd();
++it )
{
if( _shortcut == *it ) // current one is in the list
return;
}
for( QList< KShortcut >::ConstIterator it = keys.begin();
it != keys.end();
for( QList< KShortcut >::ConstIterator it = keys.constBegin();
it != keys.constEnd();
++it )
{
if( workspace()->shortcutAvailable( *it, this ))
@ -1290,8 +1290,8 @@ void Client::delayedSetShortcut()
bool Workspace::shortcutAvailable( const KShortcut& cut, Client* ignore ) const
{
// TODO check global shortcuts etc.
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it )
{
if( (*it) != ignore && (*it)->shortcut() == cut )

View file

@ -443,8 +443,8 @@ Workspace::~Workspace()
blockStackingUpdates( true );
// TODO grabXServer();
// use stacking_order, so that kwin --replace keeps stacking order
for( ClientList::ConstIterator it = stacking_order.begin();
it != stacking_order.end();
for( ClientList::ConstIterator it = stacking_order.constBegin();
it != stacking_order.constEnd();
++it )
{
// only release the window
@ -455,8 +455,8 @@ Workspace::~Workspace()
clients.removeAll( *it );
desktops.removeAll( *it );
}
for( UnmanagedList::ConstIterator it = unmanaged.begin();
it != unmanaged.end();
for( UnmanagedList::ConstIterator it = unmanaged.constBegin();
it != unmanaged.constEnd();
++it )
(*it)->release();
delete tab_box;
@ -760,8 +760,8 @@ void Workspace::updateCurrentTopMenu()
{
if( menu_client->isFullScreen())
block_desktop_menubar = true;
for( ClientList::ConstIterator it = menu_client->transients().begin();
it != menu_client->transients().end();
for( ClientList::ConstIterator it = menu_client->transients().constBegin();
it != menu_client->transients().constEnd();
++it )
if( (*it)->isTopMenu())
{
@ -776,8 +776,8 @@ void Workspace::updateCurrentTopMenu()
}
if( !menubar )
{ // try to find any topmenu from the application (#72113)
for( ClientList::ConstIterator it = active_client->group()->members().begin();
it != active_client->group()->members().end();
for( ClientList::ConstIterator it = active_client->group()->members().constBegin();
it != active_client->group()->members().constEnd();
++it )
if( (*it)->isTopMenu())
{
@ -792,8 +792,8 @@ void Workspace::updateCurrentTopMenu()
Client* desktop = findDesktop( true, currentDesktop());
if( desktop != NULL )
{
for( ClientList::ConstIterator it = desktop->transients().begin();
it != desktop->transients().end();
for( ClientList::ConstIterator it = desktop->transients().constBegin();
it != desktop->transients().constEnd();
++it )
if( (*it)->isTopMenu())
{
@ -806,8 +806,8 @@ void Workspace::updateCurrentTopMenu()
// thus the topmenu is not transient for it :-/.
if( menubar == NULL )
{
for( ClientList::ConstIterator it = topmenus.begin();
it != topmenus.end();
for( ClientList::ConstIterator it = topmenus.constBegin();
it != topmenus.constEnd();
++it )
if( (*it)->wasOriginallyGroupTransient()) // kdesktop's topmenu has WM_TRANSIENT_FOR
{ // set pointing to the root window
@ -836,7 +836,7 @@ void Workspace::updateCurrentTopMenu()
}
// ... then hide the other ones. Avoids flickers.
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
for ( ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
{
if( (*it)->isTopMenu() && (*it) != menubar )
(*it)->hideClient( true );
@ -849,8 +849,8 @@ void Workspace::updateToolWindows( bool also_hide )
// TODO what if Client's transiency/group changes? should this be called too? (I'm paranoid, am I not?)
if( !options->hideUtilityWindowsForInactive )
{
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it )
(*it)->hideClient( false );
return;
@ -875,8 +875,8 @@ void Workspace::updateToolWindows( bool also_hide )
// SELI but maybe it should - what if a new client has been added that's not in stacking order yet?
ClientList to_show, to_hide;
for( ClientList::ConstIterator it = stacking_order.begin();
it != stacking_order.end();
for( ClientList::ConstIterator it = stacking_order.constBegin();
it != stacking_order.constEnd();
++it )
{
if( (*it)->isUtility() || (*it)->isMenu() || (*it)->isToolbar())
@ -907,8 +907,8 @@ void Workspace::updateToolWindows( bool also_hide )
// have e.g. kicker as mainwindow
if( mainclients.isEmpty())
show = true;
for( ClientList::ConstIterator it2 = mainclients.begin();
it2 != mainclients.end();
for( ClientList::ConstIterator it2 = mainclients.constBegin();
it2 != mainclients.constEnd();
++it2 )
{
if( (*it2)->isSpecialWindow())
@ -928,8 +928,8 @@ void Workspace::updateToolWindows( bool also_hide )
to_show.at( i )->hideClient( false );
if( also_hide )
{
for( ClientList::ConstIterator it = to_hide.begin();
it != to_hide.end();
for( ClientList::ConstIterator it = to_hide.constBegin();
it != to_hide.constEnd();
++it ) // from bottommost
(*it)->hideClient( true );
updateToolWindowsTimer.stop();
@ -1020,8 +1020,8 @@ void Workspace::slotReconfigure()
curtain.setGeometry( QApplication::desktop()->geometry() );
curtain.show();
#endif
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it )
{
(*it)->updateDecoration( true, true );
@ -1269,8 +1269,8 @@ void ObscuringWindows::create( Client* c )
ObscuringWindows::~ObscuringWindows()
{
max_cache_size = qMax( ( int )max_cache_size, obscuring_windows.count() + 4 ) - 1;
for( QList<Window>::ConstIterator it = obscuring_windows.begin();
it != obscuring_windows.end();
for( QList<Window>::ConstIterator it = obscuring_windows.constBegin();
it != obscuring_windows.constEnd();
++it )
{
XUnmapWindow( display(), *it );
@ -1312,7 +1312,7 @@ bool Workspace::setCurrentDesktop( int new_desktop )
current_desktop = new_desktop; // change the desktop (so that Client::updateVisibility() works)
for ( ClientList::ConstIterator it = stacking_order.begin(); it != stacking_order.end(); ++it)
for ( ClientList::ConstIterator it = stacking_order.constBegin(); it != stacking_order.constEnd(); ++it)
if ( !(*it)->isOnDesktop( new_desktop ) && (*it) != movingClient )
{
if( (*it)->isShown( true ) && (*it)->isOnDesktop( old_desktop ))
@ -1581,8 +1581,8 @@ void Workspace::setNumberOfDesktops( int n )
// windows that would be hidden to the last visible desktop
if( old_number_of_desktops > number_of_desktops )
{
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it)
{
if( !(*it)->isOnAllDesktops() && (*it)->desktop() > numberOfDesktops())
@ -1635,8 +1635,8 @@ void Workspace::sendClientToDesktop( Client* c, int desk, bool dont_activate )
}
ClientList transients_stacking_order = ensureStackingOrder( c->transients());
for( ClientList::ConstIterator it = transients_stacking_order.begin();
it != transients_stacking_order.end();
for( ClientList::ConstIterator it = transients_stacking_order.constBegin();
it != transients_stacking_order.constEnd();
++it )
sendClientToDesktop( *it, desk, dont_activate );
updateClientArea();
@ -1708,8 +1708,8 @@ void Workspace::sendClientToScreen( Client* c, int screen )
c->size().width(), c->size().height());
c->checkWorkspacePosition();
ClientList transients_stacking_order = ensureStackingOrder( c->transients());
for( ClientList::ConstIterator it = transients_stacking_order.begin();
it != transients_stacking_order.end();
for( ClientList::ConstIterator it = transients_stacking_order.constBegin();
it != transients_stacking_order.constEnd();
++it )
sendClientToScreen( *it, screen );
if( c->isActive())
@ -2374,8 +2374,8 @@ void Workspace::lostTopMenuSelection()
delete topmenu_space;
topmenu_space = NULL;
updateClientArea();
for( ClientList::ConstIterator it = topmenus.begin();
it != topmenus.end();
for( ClientList::ConstIterator it = topmenus.constBegin();
it != topmenus.constEnd();
++it )
(*it)->checkWorkspacePosition();
}
@ -2523,15 +2523,15 @@ void Workspace::setShowingDesktop( bool showing )
ClientList cls = stackingOrder();
// find them first, then minimize, otherwise transients may get minimized with the window
// they're transient for
for( ClientList::ConstIterator it = cls.begin();
it != cls.end();
for( ClientList::ConstIterator it = cls.constBegin();
it != cls.constEnd();
++it )
{
if( (*it)->isOnCurrentDesktop() && (*it)->isShown( true ) && !(*it)->isSpecialWindow())
showing_desktop_clients.prepend( *it ); // topmost first to reduce flicker
}
for( ClientList::ConstIterator it = showing_desktop_clients.begin();
it != showing_desktop_clients.end();
for( ClientList::ConstIterator it = showing_desktop_clients.constBegin();
it != showing_desktop_clients.constEnd();
++it )
(*it)->minimize();
--block_focus;
@ -2540,8 +2540,8 @@ void Workspace::setShowingDesktop( bool showing )
}
else
{
for( ClientList::ConstIterator it = showing_desktop_clients.begin();
it != showing_desktop_clients.end();
for( ClientList::ConstIterator it = showing_desktop_clients.constBegin();
it != showing_desktop_clients.constEnd();
++it )
(*it)->unminimize();
if( showing_desktop_clients.count() > 0 )
@ -2569,8 +2569,8 @@ void Workspace::resetShowingDesktop( bool keep_hidden )
++block_showing_desktop;
if( !keep_hidden )
{
for( ClientList::ConstIterator it = showing_desktop_clients.begin();
it != showing_desktop_clients.end();
for( ClientList::ConstIterator it = showing_desktop_clients.constBegin();
it != showing_desktop_clients.constEnd();
++it )
(*it)->unminimize();
}
@ -2627,8 +2627,8 @@ void Workspace::slotBlockShortcuts( int data )
global_shortcuts_disabled_for_client = false;
}
// update also Alt+LMB actions etc.
for( ClientList::ConstIterator it = clients.begin();
it != clients.end();
for( ClientList::ConstIterator it = clients.constBegin();
it != clients.constEnd();
++it )
(*it)->updateMouseGrab();
}

View file

@ -944,10 +944,10 @@ inline Client* Workspace::findClient( T predicate ) const
template< typename T1, typename T2 >
inline void Workspace::forEachClient( T1 procedure, T2 predicate )
{
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
for ( ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it)
if ( predicate( const_cast< const Client* >( *it)))
procedure( *it );
for ( ClientList::ConstIterator it = desktops.begin(); it != desktops.end(); ++it)
for ( ClientList::ConstIterator it = desktops.constBegin(); it != desktops.constEnd(); ++it)
if ( predicate( const_cast< const Client* >( *it)))
procedure( *it );
}
@ -967,7 +967,7 @@ inline Unmanaged* Workspace::findUnmanaged( T predicate ) const
template< typename T1, typename T2 >
inline void Workspace::forEachUnmanaged( T1 procedure, T2 predicate )
{
for ( UnmanagedList::ConstIterator it = unmanaged.begin(); it != unmanaged.end(); ++it)
for ( UnmanagedList::ConstIterator it = unmanaged.constBegin(); it != unmanaged.constEnd(); ++it)
if ( predicate( const_cast< const Unmanaged* >( *it)))
procedure( *it );
}