// Merges shapes with a common unichar over the [start, end) interval. // Assumes single unichar per shape. void ShapeTable::ForceFontMerges(int start, int end) { for (int s1 = start; s1 < end; ++s1) { if (MasterDestinationIndex(s1) == s1 && GetShape(s1).size() == 1) { int unichar_id = GetShape(s1)[0].unichar_id; for (int s2 = s1 + 1; s2 < end; ++s2) { if (MasterDestinationIndex(s2) == s2 && GetShape(s2).size() == 1 && unichar_id == GetShape(s2)[0].unichar_id) { MergeShapes(s1, s2); } } } } ShapeTable compacted(*unicharset_); compacted.AppendMasterShapes(*this); *this = compacted; }
KMFolder::KMFolder( KMFolderDir* aParent, const QString& aFolderName, KMFolderType aFolderType, bool withIndex, bool exportedSernums ) : KMFolderNode( aParent, aFolderName ), mStorage(0), mChild( 0 ), mIsSystemFolder( false ), mHasIndex( withIndex ), mExportsSernums( exportedSernums ), mMoveInProgress( false ), mExpireMessages( false ), mUnreadExpireAge( 28 ), mReadExpireAge( 14 ), mUnreadExpireUnits( expireNever ), mReadExpireUnits( expireNever ), mExpireAction( ExpireDelete ), mUseCustomIcons( false ), mMailingListEnabled( false ), mAcctList( 0 ), mPutRepliesInSameFolder( false ), mHideInSelectionDialog( false ), mIgnoreNewMail( false ), mIndicator( 0 ) { mIdentity = kmkernel->identityManager()->defaultIdentity().uoid(); if( aFolderType == KMFolderTypeCachedImap ) mStorage = new KMFolderCachedImap( this, aFolderName.toLatin1() ); else if( aFolderType == KMFolderTypeImap ) mStorage = new KMFolderImap( this, aFolderName.toLatin1() ); else if( aFolderType == KMFolderTypeMaildir ) mStorage = new KMFolderMaildir( this, aFolderName.toLatin1() ); else if( aFolderType == KMFolderTypeSearch ) mStorage = new KMFolderSearch( this, aFolderName.toLatin1() ); else mStorage = new KMFolderMbox( this, aFolderName.toLatin1() ); assert( mStorage ); QFileInfo dirinfo; dirinfo.setFile( mStorage->location() ); if ( !dirinfo.exists() ) { int rc = mStorage->create(); QString msg = i18n("<qt>Error while creating file <b>%1</b>:<br />%2</qt>", aFolderName, strerror(rc)); if ( rc ) { KMessageBox::information(0, msg); } } if ( aParent ) { connect( mStorage, SIGNAL( msgAdded( KMFolder*, quint32 ) ), aParent->manager(), SIGNAL( msgAdded( KMFolder*, quint32 ) ) ); connect( mStorage, SIGNAL( msgRemoved( KMFolder*, quint32 ) ), parent()->manager(), SIGNAL( msgRemoved( KMFolder*, quint32 ) ) ); connect( this, SIGNAL( msgChanged( KMFolder*, quint32, int ) ), parent()->manager(), SIGNAL( msgChanged( KMFolder*, quint32, int ) ) ); connect( this, SIGNAL( msgHeaderChanged( KMFolder*, int ) ), parent()->manager(), SIGNAL( msgHeaderChanged( KMFolder*, int ) ) ); connect( mStorage, SIGNAL( invalidated( KMFolder* ) ), parent()->manager(), SIGNAL( folderInvalidated( KMFolder* ) ) ); } // Resend all mStorage signals connect( mStorage, SIGNAL( changed() ), SIGNAL( changed() ) ); connect( mStorage, SIGNAL( compacted() ), SIGNAL( compacted() ) ); connect( mStorage, SIGNAL( cleared() ), SIGNAL( cleared() ) ); connect( mStorage, SIGNAL( expunged( KMFolder* ) ), SIGNAL( expunged( KMFolder* ) ) ); connect( mStorage, SIGNAL( nameChanged() ), SIGNAL( nameChanged() ) ); connect( mStorage, SIGNAL( msgRemoved( KMFolder*, quint32 ) ), SIGNAL( msgRemoved( KMFolder*, quint32 ) ) ); connect( mStorage, SIGNAL( msgRemoved( int, const QString& ) ), SIGNAL( msgRemoved( int, const QString& ) ) ); connect( mStorage, SIGNAL( msgRemoved( KMFolder* ) ), SIGNAL( msgRemoved( KMFolder* ) ) ); connect( mStorage, SIGNAL( msgAdded( int ) ), SIGNAL( msgAdded( int ) ) ); connect( mStorage, SIGNAL( msgAdded( KMFolder*, quint32 ) ), SIGNAL( msgAdded( KMFolder*, quint32 ) ) ); connect( mStorage, SIGNAL( msgChanged( KMFolder*, quint32, int ) ), SIGNAL( msgChanged( KMFolder*, quint32, int ) ) ); connect( mStorage, SIGNAL( msgHeaderChanged( KMFolder*, int ) ), SIGNAL( msgHeaderChanged( KMFolder*, int ) ) ); connect( mStorage, SIGNAL( statusMsg( const QString& ) ), SIGNAL( statusMsg( const QString& ) ) ); connect( mStorage, SIGNAL( numUnreadMsgsChanged( KMFolder* ) ), SIGNAL( numUnreadMsgsChanged( KMFolder* ) ) ); connect( mStorage, SIGNAL( removed( KMFolder*, bool ) ), SIGNAL( removed( KMFolder*, bool ) ) ); connect( mStorage, SIGNAL(noContentChanged()), SIGNAL(noContentChanged()) ); connect( mStorage, SIGNAL( contentsTypeChanged( KMail::FolderContentsType ) ), this, SLOT( slotContentsTypeChanged( KMail::FolderContentsType ) ) ); connect( mStorage, SIGNAL( folderSizeChanged() ), this, SLOT( slotFolderSizeChanged() ) ); connect( kmkernel->identityManager(), SIGNAL( changed() ), this, SLOT( slotIdentitiesChanged() ) ); //FIXME: Centralize all the readConfig calls somehow - Zack // Meanwhile, readConfig must be done before registerWithMessageDict, since // that one can call writeConfig in some circumstances - David mStorage->readConfig(); // trigger from here, since it needs a fully constructed FolderStorage if ( mExportsSernums ) mStorage->registerWithMessageDict(); if ( !mHasIndex ) mStorage->setAutoCreateIndex( false ); if ( mId == 0 && aParent ) mId = aParent->manager()->createId(); }