From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmail/index.cpp | 88 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) (limited to 'kmail/index.cpp') diff --git a/kmail/index.cpp b/kmail/index.cpp index 5b156a99..ef1ba7de 100644 --- a/kmail/index.cpp +++ b/kmail/index.cpp @@ -37,11 +37,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #ifdef HAVE_INDEXLIB #include #endif @@ -60,44 +60,44 @@ const char* const folderIndexDisabledKey = "fulltextIndexDisabled"; #ifdef HAVE_INDEXLIB static -QValueList vectorToQValueList( const std::vector& input ) { - QValueList res; +TQValueList vectorToQValueList( const std::vector& input ) { + TQValueList res; std::copy( input.begin(), input.end(), std::back_inserter( res ) ); return res; } static -std::vector QValueListToVector( const QValueList& input ) { +std::vector QValueListToVector( const TQValueList& input ) { std::vector res; // res.assign( input.begin(), input.end() ) doesn't work for some reason - for ( QValueList::const_iterator first = input.begin(), past = input.end(); first != past; ++first ) { + for ( TQValueList::const_iterator first = input.begin(), past = input.end(); first != past; ++first ) { res.push_back( *first ); } return res; } #endif -KMMsgIndex::KMMsgIndex( QObject* parent ): - QObject( parent, "index" ), +KMMsgIndex::KMMsgIndex( TQObject* parent ): + TQObject( parent, "index" ), mState( s_idle ), #ifdef HAVE_INDEXLIB - mLockFile( std::string( static_cast( QFile::encodeName( defaultPath() ) + "/lock" ) ) ), + mLockFile( std::string( static_cast( TQFile::encodeName( defaultPath() ) + "/lock" ) ) ), mIndex( 0 ), #endif - mIndexPath( QFile::encodeName( defaultPath() ) ), - mTimer( new QTimer( this, "mTimer" ) ), + mIndexPath( TQFile::encodeName( defaultPath() ) ), + mTimer( new TQTimer( this, "mTimer" ) ), //mSyncState( ss_none ), - //mSyncTimer( new QTimer( this ) ), + //mSyncTimer( new TQTimer( this ) ), mSlowDown( false ) { kdDebug( 5006 ) << "KMMsgIndex::KMMsgIndex()" << endl; - connect( kmkernel->folderMgr(), SIGNAL( msgRemoved( KMFolder*, Q_UINT32 ) ), SLOT( slotRemoveMessage( Q_UINT32 ) ) ); - connect( kmkernel->folderMgr(), SIGNAL( msgAdded( KMFolder*, Q_UINT32 ) ), SLOT( slotAddMessage( Q_UINT32 ) ) ); - connect( kmkernel->dimapFolderMgr(), SIGNAL( msgRemoved( KMFolder*, Q_UINT32 ) ), SLOT( slotRemoveMessage( Q_UINT32 ) ) ); - connect( kmkernel->dimapFolderMgr(), SIGNAL( msgAdded( KMFolder*, Q_UINT32 ) ), SLOT( slotAddMessage( Q_UINT32 ) ) ); + connect( kmkernel->folderMgr(), TQT_SIGNAL( msgRemoved( KMFolder*, Q_UINT32 ) ), TQT_SLOT( slotRemoveMessage( Q_UINT32 ) ) ); + connect( kmkernel->folderMgr(), TQT_SIGNAL( msgAdded( KMFolder*, Q_UINT32 ) ), TQT_SLOT( slotAddMessage( Q_UINT32 ) ) ); + connect( kmkernel->dimapFolderMgr(), TQT_SIGNAL( msgRemoved( KMFolder*, Q_UINT32 ) ), TQT_SLOT( slotRemoveMessage( Q_UINT32 ) ) ); + connect( kmkernel->dimapFolderMgr(), TQT_SIGNAL( msgAdded( KMFolder*, Q_UINT32 ) ), TQT_SLOT( slotAddMessage( Q_UINT32 ) ) ); - connect( mTimer, SIGNAL( timeout() ), SLOT( act() ) ); - //connect( mSyncTimer, SIGNAL( timeout() ), SLOT( syncIndex() ) ); + connect( mTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( act() ) ); + //connect( mSyncTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( syncIndex() ) ); #ifdef HAVE_INDEXLIB KConfigGroup cfg( KMKernel::config(), "text-index" ); @@ -116,11 +116,11 @@ KMMsgIndex::KMMsgIndex( QObject* parent ): mIndex = indexlib::open( mIndexPath, indexlib::open_flags::fail_if_nonexistant ).release(); } if ( !mIndex ) { - QTimer::singleShot( 8000, this, SLOT( create() ) ); + TQTimer::singleShot( 8000, this, TQT_SLOT( create() ) ); mState = s_willcreate; } else { if ( cfg.readBoolEntry( "creating" ) ) { - QTimer::singleShot( 8000, this, SLOT( continueCreation() ) ); + TQTimer::singleShot( 8000, this, TQT_SLOT( continueCreation() ) ); mState = s_creating; } else { mPendingMsgs = QValueListToVector( cfg.readIntListEntry( "pending" ) ); @@ -140,7 +140,7 @@ KMMsgIndex::~KMMsgIndex() { #ifdef HAVE_INDEXLIB KConfigGroup cfg( KMKernel::config(), "text-index" ); cfg.writeEntry( "creating", mState == s_creating ); - QValueList pendingMsg; + TQValueList pendingMsg; if ( mState == s_processing ) { Q_ASSERT( mAddedMsgs.empty() ); pendingMsg = vectorToQValueList( mPendingMsgs ); @@ -182,7 +182,7 @@ void KMMsgIndex::setEnabled( bool e ) { // nothing can be done, probably return; case s_disabled: - QTimer::singleShot( 8000, this, SLOT( create() ) ); + TQTimer::singleShot( 8000, this, TQT_SLOT( create() ) ); mState = s_willcreate; } } else { @@ -265,7 +265,7 @@ void KMMsgIndex::clear() { void KMMsgIndex::maintenance() { #ifdef HAVE_INDEXLIB if ( mState != s_idle || kapp->hasPendingEvents() ) { - QTimer::singleShot( 8000, this, SLOT( maintenance() ) ); + TQTimer::singleShot( 8000, this, TQT_SLOT( maintenance() ) ); return; } mIndex->maintenance(); @@ -292,9 +292,9 @@ int KMMsgIndex::addMessage( Q_UINT32 serNum ) { * Setting to false which makes more sense. * We keep signature to get the person's name */ - QString body = msg->asPlainText( false, false ); + TQString body = msg->asPlainText( false, false ); if ( !body.isEmpty() && static_cast( body.latin1() ) ) { - mIndex->add( body.latin1(), QString::number( serNum ).latin1() ); + mIndex->add( body.latin1(), TQString::number( serNum ).latin1() ); } else { kdDebug( 5006 ) << "Funny, no body" << endl; } @@ -370,7 +370,7 @@ void KMMsgIndex::create() { kdDebug( 5006 ) << "KMMsgIndex::create()" << endl; #ifdef HAVE_INDEXLIB - if ( !QFileInfo( mIndexPath ).exists() ) { + if ( !TQFileInfo( mIndexPath ).exists() ) { ::mkdir( mIndexPath, S_IRWXU ); } mState = s_creating; @@ -380,7 +380,7 @@ void KMMsgIndex::create() { mState = s_error; return; } - QValueStack folders; + TQValueStack folders; folders.push(&(kmkernel->folderMgr()->dir())); folders.push(&(kmkernel->dimapFolderMgr()->dir())); while ( !folders.empty() ) { @@ -404,10 +404,10 @@ bool KMMsgIndex::startQuery( KMSearch* s ) { kdDebug( 5006 ) << "KMMsgIndex::startQuery( . ) starting query" << endl; Search* search = new Search( s ); - connect( search, SIGNAL( finished( bool ) ), s, SIGNAL( finished( bool ) ) ); - connect( search, SIGNAL( finished( bool ) ), s, SLOT( indexFinished() ) ); - connect( search, SIGNAL( destroyed( QObject* ) ), SLOT( removeSearch( QObject* ) ) ); - connect( search, SIGNAL( found( Q_UINT32 ) ), s, SIGNAL( found( Q_UINT32 ) ) ); + connect( search, TQT_SIGNAL( finished( bool ) ), s, TQT_SIGNAL( finished( bool ) ) ); + connect( search, TQT_SIGNAL( finished( bool ) ), s, TQT_SLOT( indexFinished() ) ); + connect( search, TQT_SIGNAL( destroyed( TQObject* ) ), TQT_SLOT( removeSearch( TQObject* ) ) ); + connect( search, TQT_SIGNAL( found( Q_UINT32 ) ), s, TQT_SIGNAL( found( Q_UINT32 ) ) ); mSearches.push_back( search ); return true; } @@ -432,7 +432,7 @@ bool KMMsgIndex::startQuery( KMSearch* s ) { // //} -void KMMsgIndex::removeSearch( QObject* destroyed ) { +void KMMsgIndex::removeSearch( TQObject* destroyed ) { mSearches.erase( std::find( mSearches.begin(), mSearches.end(), destroyed ) ); } @@ -449,7 +449,7 @@ bool KMMsgIndex::stopQuery( KMSearch* s ) { return false; } -std::vector KMMsgIndex::simpleSearch( QString s, bool* ok ) const { +std::vector KMMsgIndex::simpleSearch( TQString s, bool* ok ) const { kdDebug( 5006 ) << "KMMsgIndex::simpleSearch( -" << s.latin1() << "- )" << endl; if ( mState == s_error || mState == s_disabled ) { if ( ok ) *ok = false; @@ -471,7 +471,7 @@ std::vector KMMsgIndex::simpleSearch( QString s, bool* ok ) const { bool KMMsgIndex::canHandleQuery( const KMSearchPattern* pat ) const { kdDebug( 5006 ) << "KMMsgIndex::canHandleQuery( . )" << endl; if ( !pat ) return false; - QPtrListIterator it( *pat ); + TQPtrListIterator it( *pat ); KMSearchRule* rule; while ( (rule = it.current()) != 0 ) { ++it; @@ -514,15 +514,15 @@ void KMMsgIndex::removeMessage( Q_UINT32 serNum ) { if ( mState == s_error || mState == s_disabled ) return; #ifdef HAVE_INDEXLIB - mIndex->remove_doc( QString::number( serNum ).latin1() ); + mIndex->remove_doc( TQString::number( serNum ).latin1() ); ++mMaintenanceCount; if ( mMaintenanceCount > MaintenanceLimit && mRemovedMsgs.empty() ) { - QTimer::singleShot( 100, this, SLOT( maintenance() ) ); + TQTimer::singleShot( 100, this, TQT_SLOT( maintenance() ) ); } #endif } -QString KMMsgIndex::defaultPath() { +TQString KMMsgIndex::defaultPath() { return KMKernel::localDataPath() + "text-index"; } @@ -532,10 +532,10 @@ bool KMMsgIndex::creating() const { KMMsgIndex::Search::Search( KMSearch* s ): mSearch( s ), - mTimer( new QTimer( this, "mTimer" ) ), + mTimer( new TQTimer( this, "mTimer" ) ), mResidual( new KMSearchPattern ), mState( s_starting ) { - connect( mTimer, SIGNAL( timeout() ), SLOT( act() ) ); + connect( mTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( act() ) ); mTimer->start( 0 ); } @@ -547,10 +547,10 @@ void KMMsgIndex::Search::act() { switch ( mState ) { case s_starting: { KMSearchPattern* pat = mSearch->searchPattern(); - QString terms; + TQString terms; for ( KMSearchRule* rule = pat->first(); rule; rule = pat->next() ) { Q_ASSERT( rule->function() == KMSearchRule::FuncContains ); - terms += QString::fromLatin1( " %1 " ).arg( rule->contents() ); + terms += TQString::fromLatin1( " %1 " ).arg( rule->contents() ); } mValues = kmkernel->msgIndex()->simpleSearch( terms, 0 ); -- cgit v1.2.3