[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/runtime/nepomuk/services/strigi
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2010-01-27 11:52:55
Message-ID: 1264593175.601653.23956.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1080999 by trueg:

* Set the plasma status to active while checking the file system for new files.
* Claim that we are indexing while removing old entries. But do not use the current
  folder in the status message since there is none (this is a string change and, thus
  cannot be backported)


 M  +3 -3      indexscheduler.cpp  
 M  +1 -1      indexscheduler.h  
 M  +1 -1      statuswidget.cpp  
 M  +41 -14    strigiservice.cpp  
 M  +3 -0      strigiservice.h  
 M  +1 -6      systray.cpp  


--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/indexscheduler.cpp #1080998:1080999
@@ -1,5 +1,5 @@
 /* This file is part of the KDE Project
-   Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
+   Copyright (c) 2008-2010 Sebastian Trueg <trueg@kde.org>
 
    Parts of this file are based on code from Strigi
    Copyright (C) 2006-2007 Jos van den Oever <jos@vandenoever.info>
@@ -214,14 +214,14 @@
     // set lowest priority for this thread
     setPriority( QThread::IdlePriority );
 
+    setIndexingStarted( true );
+
     // initialization
     readConfig();
 
     Strigi::StreamAnalyzer analyzer( *m_analyzerConfig );
     analyzer.setIndexWriter( *m_indexManager->indexWriter() );
 
-    setIndexingStarted( true );
-
     while ( 1 ) {
         // wait for more dirs to analyze in case the initial
         // indexing is done
--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/indexscheduler.h #1080998:1080999
@@ -1,5 +1,5 @@
 /* This file is part of the KDE Project
-   Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
+   Copyright (c) 2008-2010 Sebastian Trueg <trueg@kde.org>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/statuswidget.cpp #1080998:1080999
@@ -1,5 +1,5 @@
 /* This file is part of the KDE Project
-   Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
+   Copyright (c) 2008-2010 Sebastian Trueg <trueg@kde.org>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/strigiservice.cpp #1080998:1080999
@@ -104,17 +104,10 @@
         // setup the indexer to index at snail speed for the first two minutes
         // this is done for KDE startup - to not slow that down too much
         m_indexScheduler->setIndexingSpeed( IndexScheduler::SnailPace );
-        QTimer::singleShot( 2*60*1000, m_indexScheduler, SLOT( setReducedIndexingSpeed() ) );
 
-        // slow down on user activity (start also only after 2 minutes)
-        UserActivityMonitor* userActivityMonitor = new UserActivityMonitor( this );
-        connect( userActivityMonitor, SIGNAL( userActive( bool ) ),
-                 m_indexScheduler, SLOT( setReducedIndexingSpeed( bool ) ) );
-        QTimer::singleShot( 2*60*1000, userActivityMonitor, SLOT( start() ) );
+        // delayed init for the rest which uses IO and CPU
+        QTimer::singleShot( 2*60*1000, this, SLOT( finishInitialization() ) );
 
-        // start watching the index folders
-        QTimer::singleShot( 2*60*1000, this, SLOT( updateWatches() ) );
-
         // start the actual indexing
         m_indexScheduler->start();
     }
@@ -139,6 +132,22 @@
 }
 
 
+void Nepomuk::StrigiService::finishInitialization()
+{
+    // slow down on user activity (start also only after 2 minutes)
+    UserActivityMonitor* userActivityMonitor = new UserActivityMonitor( this );
+    connect( userActivityMonitor, SIGNAL( userActive( bool ) ),
+             m_indexScheduler, SLOT( setReducedIndexingSpeed( bool ) ) );
+    userActivityMonitor->start();
+
+    // full speed until the user is active
+    m_indexScheduler->setIndexingSpeed( IndexScheduler::FullSpeed );
+
+    // start watching the fs the ugly way
+    updateWatches();
+}
+
+
 void Nepomuk::StrigiService::updateWatches()
 {
     // the hard way since the KDirWatch API is too simple
@@ -165,17 +174,30 @@
     bool suspended = m_indexScheduler->isSuspended();
     QString folder = m_indexScheduler->currentFolder();
 
-    if ( suspended )
+    if ( suspended ) {
         return i18nc( "@info:status", "File indexer is suspended" );
-    else if ( indexing )
-        return i18nc( "@info:status", "Strigi is currently indexing files in folder %1", folder );
-    else if ( m_fsWatcher->status() == FileSystemWatcher::Checking )
+    }
+    else if ( indexing ) {
+        if ( folder.isEmpty() )
+            return i18nc( "@info:status", "Strigi is currently indexing files" );
+        else
+            return i18nc( "@info:status", "Strigi is currently indexing files in folder %1", folder );
+    }
+    else if ( m_fsWatcher->status() == FileSystemWatcher::Checking ) {
         return i18nc( "@info:status", "Checking file system for new files" );
-    else
+    }
+    else {
         return i18nc( "@info:status", "File indexer is idle" );
+    }
 }
 
 
+bool Nepomuk::StrigiService::isIdle() const
+{
+    return ( !m_indexScheduler->isIndexing() && m_fsWatcher->status() == FileSystemWatcher::Idle );
+}
+
+
 void Nepomuk::StrigiService::setSuspended( bool suspend )
 {
     if ( suspend ) {
@@ -189,6 +211,11 @@
 }
 
 
+bool Nepomuk::StrigiService::isSuspended() const
+{
+    return m_indexScheduler->isSuspended();
+}
+
 #include <kpluginfactory.h>
 #include <kpluginloader.h>
 
--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/strigiservice.h #1080998:1080999
@@ -53,9 +53,12 @@
          * \return A user readable status string
          */
         QString userStatusString() const;
+        bool isIdle() const;
         void setSuspended( bool );
+        bool isSuspended() const;
 
     private Q_SLOTS:
+        void finishInitialization();
         void updateWatches();
         void slotDirDirty( const QString& );
 
--- trunk/KDE/kdebase/runtime/nepomuk/services/strigi/systray.cpp #1080998:1080999
@@ -77,12 +77,7 @@
     setToolTip("nepomuk", i18n("Search Service"),  m_service->userStatusString() );
     m_suspendResumeAction->setChecked( m_service->indexScheduler()->isSuspended() );
     // a manually suspended service should not be passive
-    if (m_service->indexScheduler()->isIndexing() ||
-        m_suspendedManually) {
-        setStatus(Active);
-    } else {
-        setStatus(Passive);
-    }
+    setStatus( m_service->isIdle() && !m_service->isSuspended() ? Passive : Active );
 }
 
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic