Commit e597eb4d authored by Tobias Koenig's avatar Tobias Koenig
Browse files

Disable the idle detection for contact and calendar feeder.

The idle detection doesn't make sense for these two data types
because the user wants them to show up in Nepomuk immediately after
he had entered them to the system. A 10 seconds wait-for-system-being-idle
delay is inacceptable in this case.

svn path=/trunk/KDE/kdepim/runtime/; revision=1192639
parent 4b0aa813
......@@ -70,6 +70,8 @@ NepomukCalendarFeeder::NepomukCalendarFeeder( const QString &id )
addSupportedMimeType( KCalCore::FreeBusy::freeBusyMimeType() );
changeRecorder()->itemFetchScope().fetchFullPayload();
disableIdleDetection( true );
}
NepomukCalendarFeeder::~NepomukCalendarFeeder()
......
......@@ -61,6 +61,8 @@ NepomukContactFeeder::NepomukContactFeeder( const QString &id )
addSupportedMimeType( KABC::ContactGroup::mimeType() );
changeRecorder()->itemFetchScope().fetchFullPayload();
disableIdleDetection( true );
}
NepomukContactFeeder::~NepomukContactFeeder()
......
......@@ -85,7 +85,8 @@ NepomukFeederAgentBase::NepomukFeederAgentBase(const QString& id) :
mInitialUpdateDone( false ),
mNeedsStrigi( false ),
mSelfTestPassed( false ),
mSystemIsIdle( false )
mSystemIsIdle( false ),
mIdleDetectionDisabled( false )
{
// initialize Nepomuk
Nepomuk::ResourceManager::instance()->init();
......@@ -487,6 +488,11 @@ void NepomukFeederAgentBase::setIndexCompatibilityLevel(int level)
mIndexCompatLevel = level;
}
void NepomukFeederAgentBase::disableIdleDetection( bool value )
{
mIdleDetectionDisabled = value;
}
bool NepomukFeederAgentBase::needsReIndexing() const
{
const KConfigGroup grp( componentData().config(), "InitialIndexing" );
......@@ -508,11 +514,17 @@ void NepomukFeederAgentBase::doSetOnline(bool online)
void NepomukFeederAgentBase::checkOnline()
{
setOnline( mSelfTestPassed && mSystemIsIdle );
if ( mIdleDetectionDisabled )
setOnline( mSelfTestPassed );
else
setOnline( mSelfTestPassed && mSystemIsIdle );
}
void NepomukFeederAgentBase::systemIdle()
{
if ( mIdleDetectionDisabled )
return;
emit status( Idle, i18n( "System idle, ready to index data." ) );
mSystemIsIdle = true;
KIdleTime::instance()->catchNextResumeEvent();
......@@ -521,6 +533,9 @@ void NepomukFeederAgentBase::systemIdle()
void NepomukFeederAgentBase::systemResumed()
{
if ( mIdleDetectionDisabled )
return;
emit status( Idle, i18n( "System busy, indexing suspended." ) );
mSystemIsIdle = false;
checkOnline();
......
......@@ -150,6 +150,11 @@ class NepomukFeederAgentBase : public Akonadi::AgentBase, public Akonadi::AgentB
*/
void setIndexCompatibilityLevel( int level );
/**
* Sets whether the 'Only feed when system is idle' functionality shall be used.
*/
void disableIdleDetection( bool value );
public slots:
/** Trigger a complete update of all items. */
void updateAll();
......@@ -207,6 +212,7 @@ class NepomukFeederAgentBase : public Akonadi::AgentBase, public Akonadi::AgentB
bool mNeedsStrigi;
bool mSelfTestPassed;
bool mSystemIsIdle;
bool mIdleDetectionDisabled;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment