summaryrefslogtreecommitdiffstats
path: root/kmail/index.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /kmail/index.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/index.cpp')
-rw-r--r--kmail/index.cpp88
1 files changed, 44 insertions, 44 deletions
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 <kdebug.h>
#include <kapplication.h>
-#include <qfile.h>
-#include <qtimer.h>
-#include <qvaluestack.h>
-#include <qptrlist.h>
-#include <qfileinfo.h>
+#include <tqfile.h>
+#include <tqtimer.h>
+#include <tqvaluestack.h>
+#include <tqptrlist.h>
+#include <tqfileinfo.h>
#ifdef HAVE_INDEXLIB
#include <indexlib/create.h>
#endif
@@ -60,44 +60,44 @@ const char* const folderIndexDisabledKey = "fulltextIndexDisabled";
#ifdef HAVE_INDEXLIB
static
-QValueList<int> vectorToQValueList( const std::vector<Q_UINT32>& input ) {
- QValueList<int> res;
+TQValueList<int> vectorToQValueList( const std::vector<Q_UINT32>& input ) {
+ TQValueList<int> res;
std::copy( input.begin(), input.end(), std::back_inserter( res ) );
return res;
}
static
-std::vector<Q_UINT32> QValueListToVector( const QValueList<int>& input ) {
+std::vector<Q_UINT32> QValueListToVector( const TQValueList<int>& input ) {
std::vector<Q_UINT32> res;
// res.assign( input.begin(), input.end() ) doesn't work for some reason
- for ( QValueList<int>::const_iterator first = input.begin(), past = input.end(); first != past; ++first ) {
+ for ( TQValueList<int>::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<const char*>( QFile::encodeName( defaultPath() ) + "/lock" ) ) ),
+ mLockFile( std::string( static_cast<const char*>( 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<int> pendingMsg;
+ TQValueList<int> 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<const char*>( 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<KMFolderDir*> folders;
+ TQValueStack<KMFolderDir*> 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<Q_UINT32> KMMsgIndex::simpleSearch( QString s, bool* ok ) const {
+std::vector<Q_UINT32> 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<Q_UINT32> KMMsgIndex::simpleSearch( QString s, bool* ok ) const {
bool KMMsgIndex::canHandleQuery( const KMSearchPattern* pat ) const {
kdDebug( 5006 ) << "KMMsgIndex::canHandleQuery( . )" << endl;
if ( !pat ) return false;
- QPtrListIterator<KMSearchRule> it( *pat );
+ TQPtrListIterator<KMSearchRule> 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 );