[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/akonadi/server/control
From: Kevin Krammer <kevin.krammer () gmx ! at>
Date: 2007-08-23 11:56:40
Message-ID: 1187870200.398038.3783.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 703821 by krake:
Do lookup of SearchProvider and Agent .desktop files also based on XDG base dir spec.
M +20 -9 agentmanager.cpp
M +11 -2 agentmanager.h
M +13 -4 searchprovidermanager.cpp
M +11 -2 searchprovidermanager.h
--- trunk/KDE/kdepim/akonadi/server/control/agentmanager.cpp #703820:703821
@@ -24,8 +24,6 @@
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusError>
-#include <akonadi-prefix.h> // for AKONADIDIR
-
#include "agentmanager.h"
#include "agentmanageradaptor.h"
#include "processcontrol.h"
@@ -48,12 +46,16 @@
readPluginInfos();
- QFileSystemWatcher *watcher = new QFileSystemWatcher( this );
- watcher->addPath( pluginInfoPath() );
+ QStringList pathList = pluginInfoPathList();
- connect( watcher, SIGNAL( directoryChanged( const QString& ) ),
- this, SLOT( updatePluginInfos() ) );
+ foreach ( QString path, pathList ) {
+ QFileSystemWatcher *watcher = new QFileSystemWatcher( this );
+ watcher->addPath( path );
+ connect( watcher, SIGNAL( directoryChanged( const QString& ) ),
+ this, SLOT( updatePluginInfos() ) );
+ }
+
load();
}
@@ -329,8 +331,16 @@
{
mPluginInfos.clear();
- QDir directory( pluginInfoPath(), "*.desktop" );
+ QStringList pathList = pluginInfoPathList();
+ foreach ( QString path, pathList ) {
+ QDir directory( path, "*.desktop" );
+ readPluginInfos( directory );
+ }
+}
+
+void AgentManager::readPluginInfos( const QDir& directory )
+{
QStringList files = directory.entryList();
for ( int i = 0; i < files.count(); ++i ) {
const QString fileName = directory.absoluteFilePath( files[ i ] );
@@ -372,9 +382,10 @@
}
}
-QString AgentManager::pluginInfoPath()
+QStringList AgentManager::pluginInfoPathList()
{
- return QString( "%1/share/apps/akonadi/agents" ).arg( AKONADIDIR );
+ Akonadi::XdgBaseDirs baseDirs;
+ return baseDirs.findAllResourceDirs( "data", QLatin1String( "akonadi/agents" ) );
}
QString AgentManager::configPath( bool writeable )
--- trunk/KDE/kdepim/akonadi/server/control/agentmanager.h #703820:703821
@@ -26,6 +26,8 @@
#include "resourceinterface.h"
#include "tracerinterface.h"
+class QDir;
+
namespace Akonadi {
class ProcessControl;
}
@@ -244,10 +246,10 @@
private:
/**
- * Returns the directory path where the .desktop files
+ * Returns the list of directory paths where the .desktop files
* for the plugins are located.
*/
- static QString pluginInfoPath();
+ static QStringList pluginInfoPathList();
/**
* Returns the path of the config file.
@@ -270,6 +272,13 @@
void readPluginInfos();
/**
+ * Reads the plugin infos from directory.
+ *
+ * @param directory the directory to get plugin information from
+ */
+ void readPluginInfos( const QDir &directory );
+
+ /**
* Internal method.
*/
bool checkInterface( const QString &identifier, const QString &method ) const;
--- trunk/KDE/kdepim/akonadi/server/control/searchprovidermanager.cpp #703820:703821
@@ -19,8 +19,8 @@
#include "processcontrol.h"
#include "searchprovidermanager.h"
-#include "akonadi-prefix.h"
#include "searchprovidermanageradaptor.h"
+#include "xdgbasedirs.h"
#include <QDebug>
#include <QDir>
@@ -60,17 +60,26 @@
return result;
}
-QString Akonadi::SearchProviderManager::providerInfoPath()
+QStringList Akonadi::SearchProviderManager::providerInfoPathList()
{
- return QString( "%1/share/apps/akonadi/searchproviders" ).arg( AKONADIDIR );
+ XdgBaseDirs baseDirs;
+ return baseDirs.findAllResourceDirs( "data", QLatin1String( "akonadi/searchproviders" ) );
}
void Akonadi::SearchProviderManager::readProviderInfos()
{
mProviderInfos.clear();
- QDir directory( providerInfoPath(), "*.desktop" );
+ QStringList pathList = providerInfoPathList();
+ foreach ( QString path, pathList ) {
+ QDir directory( path, "*.desktop" );
+ readProviderInfos( directory );
+ }
+}
+
+void Akonadi::SearchProviderManager::readProviderInfos( const QDir& directory )
+{
QStringList files = directory.entryList();
for ( int i = 0; i < files.count(); ++i ) {
const QString fileName = directory.absoluteFilePath( files[ i ] );
--- trunk/KDE/kdepim/akonadi/server/control/searchprovidermanager.h #703820:703821
@@ -28,6 +28,8 @@
#include <QObject>
#include <QStringList>
+class QDir;
+
namespace Akonadi {
class ProcessControl;
@@ -56,9 +58,9 @@
private:
/**
- Returns the path where the .desktop files for searchproviders are located.
+ Returns the path list where the .desktop files for searchproviders are located.
*/
- static QString providerInfoPath();
+ static QStringList providerInfoPathList();
/**
Reads information about available search providers.
@@ -66,6 +68,13 @@
void readProviderInfos();
/**
+ Reads information about available search providers from a given directory.
+
+ @param directory the directory to get provider information from
+ */
+ void readProviderInfos( const QDir &directory );
+
+ /**
Start search provider processes.
*/
void startProviders();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic