Commit 8a5544a6 authored by Bertjan Broeksema's avatar Bertjan Broeksema
Browse files

Merged revisions...

Merged revisions 1181272,1181572,1181600,1181606,1181635,1182377,1182387,1182389,1182437-1182438,1182622,1182635,1182638,1182640-1182642,1182733,1182978 via svnmerge from 
svn+ssh://bbroeksema@svn.kde.org/home/kde/branches/work/akonadi-agentserver-kdepim-runtime

CCMAIL: kde@nyblom.org

........
  r1181272 | bbroeksema | 2010-09-30 16:59:16 +0200 (Thu, 30 Sep 2010) | 1 line
  
  Merge the changes from branches/work/~vkrause/akonadi-in-process-resource/
........
  r1181572 | bbroeksema | 2010-10-01 13:58:27 +0200 (Fri, 01 Oct 2010) | 2 lines
  
  Replace X-Akonadi-RunInAgentServer with X-Akonadi-LaunchMethod
........
  r1181600 | bbroeksema | 2010-10-01 15:20:50 +0200 (Fri, 01 Oct 2010) | 3 lines
  
  That was easy! Make the mail dispatcher a plugin which is ran in the
  AgentServer.
........
  r1181606 | bbroeksema | 2010-10-01 15:26:58 +0200 (Fri, 01 Oct 2010) | 6 lines
  
  For testing purposes we run the knut resource using the launcher.
  We now have agents that:
  - run as before (in a separate process)
  - are launched into a separate process (knut)
  - run in AgentServer (mail dispatcher)
........
  r1181635 | bbroeksema | 2010-10-01 17:23:01 +0200 (Fri, 01 Oct 2010) | 4 lines
  
  To make the Mail Dispatcher Agent suitable for running in the AgentServer
  it shouldn't use QDBusConnection::sessionBus(). Replace these calls with
  the thread safe DBusConnectionPool::threadConnection() equivalent.
........
  r1182377 | bbroeksema | 2010-10-04 13:32:59 +0200 (Mon, 04 Oct 2010) | 3 lines
  
  Add a dummy implementation of configure( WId ) to SFR base so that
  moc actually recognizes it as a slot for SFR derived resources.
........
  r1182387 | bbroeksema | 2010-10-04 13:57:05 +0200 (Mon, 04 Oct 2010) | 3 lines
  
  AgentBase is a better place to make configure(WId) a slot. Therefore,
  revert r1182377.
........
  r1182389 | bbroeksema | 2010-10-04 13:58:57 +0200 (Mon, 04 Oct 2010) | 2 lines
  
  Make the ical resource a plugin that runs in the agent server.
........
  r1182437 | bbroeksema | 2010-10-04 17:13:29 +0200 (Mon, 04 Oct 2010) | 9 lines
  
  For now disable the following SFR based resources:
  - kdeaccounts
  - vcard
  - mbox
  
  Currently I'm working on making SFR based resources suitable for running
  in the AgentServer and this requires changes to how the resources deal with
  settings. ICal will be the first, the obove will follow soon.
........
  r1182438 | bbroeksema | 2010-10-04 17:14:50 +0200 (Mon, 04 Oct 2010) | 4 lines
  
  Singletons don't work when running multiple resource instances in the same
  thread. Adapt the SingleFileResource class to this by requiring the settings
  to be a member of the class in stead of being a singleton.
........
  r1182622 | bbroeksema | 2010-10-05 10:23:07 +0200 (Tue, 05 Oct 2010) | 3 lines
  
  Adapt the kdeaccounts resource to the fact that Settings should not
  be a Singleton anymore.
........
  r1182635 | bbroeksema | 2010-10-05 11:02:13 +0200 (Tue, 05 Oct 2010) | 1 line
  
  Make sure that the notes resource is launched in the AgentServer as well
........
  r1182638 | bbroeksema | 2010-10-05 11:03:43 +0200 (Tue, 05 Oct 2010) | 2 lines
  
  Adapt and reenable the mbox resource for running in the AgentServer.
........
  r1182640 | bbroeksema | 2010-10-05 11:04:56 +0200 (Tue, 05 Oct 2010) | 1 line
  
  Forgot to save, adapt the desktop file as well
........
  r1182641 | bbroeksema | 2010-10-05 11:15:01 +0200 (Tue, 05 Oct 2010) | 3 lines
  
  And last but not least, also adapt the vcard SFR for running in
  the AgentServer.
........
  r1182642 | bbroeksema | 2010-10-05 11:20:31 +0200 (Tue, 05 Oct 2010) | 2 lines
  
  Use the DBusConnectionPool in resources that run in the AgentServer.
........
  r1182733 | bbroeksema | 2010-10-05 15:51:58 +0200 (Tue, 05 Oct 2010) | 7 lines
  
  The MailDispatcherAgent randomly creates widgets while running (e.g. to
  ask for a password). This makes it unsuitable for running in a thread. That is,
  only when we know when and where widgets are created we might be able to
  redirect the call to the main thread (as we did for AgentBase::configure()).
  
  Therefore, run the MDA using the AgentLauncher method.
........
  r1182978 | bbroeksema | 2010-10-06 09:26:51 +0200 (Wed, 06 Oct 2010) | 1 line
  
  Install the plugin in the right directory
........

svn path=/trunk/KDE/kdepim/runtime/; revision=1184805
parent 28d0de45
......@@ -18,7 +18,7 @@ qt4_add_dbus_adaptor( maildispatcheragent_SRCS
org.freedesktop.Akonadi.MailDispatcherAgent.xml maildispatcheragent.h MailDispatcherAgent
)
kde4_add_executable(akonadi_maildispatcher_agent ${maildispatcheragent_SRCS})
kde4_add_plugin(akonadi_maildispatcher_agent ${maildispatcheragent_SRCS})
if (Q_WS_MAC)
set_target_properties(akonadi_maildispatcher_agent PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist.template)
......@@ -28,6 +28,6 @@ endif (Q_WS_MAC)
target_link_libraries(akonadi_maildispatcher_agent ${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_AKONADI_KMIME_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} ${KDEPIMLIBS_KMIME_LIBS} ${KDEPIMLIBS_MAILTRANSPORT_LIBS} )
install(TARGETS akonadi_maildispatcher_agent ${INSTALL_TARGETS_DEFAULT_ARGS})
install( TARGETS akonadi_maildispatcher_agent DESTINATION ${PLUGIN_INSTALL_DIR}/ )
install( FILES maildispatcheragent.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/akonadi/agents" )
install( FILES akonadi_maildispatcher_agent.notifyrc DESTINATION "${DATA_INSTALL_DIR}/akonadi_maildispatcher_agent" )
......@@ -37,6 +37,8 @@
#include <KNotification>
#include <KIconLoader>
#include <akonadi/agentfactory.h>
#include <akonadi/dbusconnectionpool.h>
#include <Akonadi/ItemFetchScope>
#include <KMime/Message>
......@@ -164,12 +166,13 @@ MailDispatcherAgent::MailDispatcherAgent( const QString &id )
new SettingsAdaptor( Settings::self() );
new MailDispatcherAgentAdaptor( this );
QDBusConnection::sessionBus().registerObject( QLatin1String( "/Settings" ),
Settings::self(), QDBusConnection::ExportAdaptors );
QDBusConnection::sessionBus().registerObject( QLatin1String( "/MailDispatcherAgent" ),
this, QDBusConnection::ExportAdaptors );
QDBusConnection::sessionBus().registerService( QLatin1String( "org.freedesktop.Akonadi.MailDispatcherAgent" ) );
DBusConnectionPool::threadConnection().registerObject( QLatin1String( "/Settings" ),
Settings::self(), QDBusConnection::ExportAdaptors );
DBusConnectionPool::threadConnection().registerObject( QLatin1String( "/MailDispatcherAgent" ),
this, QDBusConnection::ExportAdaptors );
DBusConnectionPool::threadConnection().registerService( QLatin1String( "org.freedesktop.Akonadi.MailDispatcherAgent" ) );
d->queue = new OutboxQueue( this );
connect( d->queue, SIGNAL( newItems() ), this, SLOT( dispatch() ) );
......@@ -303,7 +306,7 @@ void MailDispatcherAgent::Private::emitStatusReady()
}
AKONADI_AGENT_MAIN( MailDispatcherAgent )
AKONADI_AGENT_FACTORY( MailDispatcherAgent, akonadi_maildispatcher_agent )
#include "maildispatcheragent.moc"
......@@ -36,3 +36,4 @@ Icon=mail-folder-outbox
X-Akonadi-MimeTypes=message/rfc822
X-Akonadi-Capabilities=Unique,Autostart,NoConfig
X-Akonadi-Identifier=akonadi_maildispatcher_agent
X-Akonadi-LaunchMethod=AgentLauncher
......@@ -45,6 +45,7 @@
#include <akonadi/agentinstance.h>
#include <akonadi/agentmanager.h>
#include <akonadi/dbusconnectionpool.h>
#include <Akonadi/TransportResourceBase>
#include <akonadi/kmime/addressattribute.h>
#include <akonadi/kmime/messageparts.h>
......@@ -133,7 +134,7 @@ void SendJob::Private::doAkonadiTransport()
iface = new QDBusInterface(
QLatin1String( "org.freedesktop.Akonadi.Resource." ) + resourceId,
QLatin1String( "/Transport" ), QLatin1String( "org.freedesktop.Akonadi.Resource.Transport" ),
QDBusConnection::sessionBus(), q );
DBusConnectionPool::threadConnection(), q );
if( !iface->isValid() ) {
storeResult( false, i18n( "Failed to get D-Bus interface of resource %1.", resourceId ) );
delete iface;
......
......@@ -15,7 +15,6 @@ set( icalresource_SRCS
${AKONADI_SINGLEFILERESOURCE_SHARED_SOURCES}
icalresourcebase.cpp
icalresource.cpp
icalresourcemain.cpp
)
install( FILES icalresource.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/akonadi/agents" )
......@@ -27,7 +26,7 @@ qt4_add_dbus_adaptor(icalresource_SRCS
${CMAKE_CURRENT_BINARY_DIR}/org.kde.Akonadi.ICal.Settings.xml settings.h Settings
)
kde4_add_executable(akonadi_ical_resource ${icalresource_SRCS})
kde4_add_plugin(akonadi_ical_resource ${icalresource_SRCS})
if (Q_WS_MAC)
set_target_properties(akonadi_ical_resource PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist.template)
......@@ -37,4 +36,4 @@ endif (Q_WS_MAC)
target_link_libraries(akonadi_ical_resource ${KDEPIMLIBS_AKONADI_LIBS} ${QT_QTDBUS_LIBRARY} ${KDE4_KIO_LIBS} ${KDEPIMLIBS_KCALCORE_LIBS})
install(TARGETS akonadi_ical_resource ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS akonadi_ical_resource DESTINATION ${PLUGIN_INSTALL_DIR})
......@@ -20,12 +20,15 @@
#include "icalresource.h"
#include <akonadi/agentfactory.h>
#include <kcalcore/memorycalendar.h>
#include <kcalcore/freebusy.h>
#include <kdebug.h>
#include <klocale.h>
#include <QtCore/QtPlugin>
using namespace Akonadi;
using namespace KCalCore;
......@@ -148,4 +151,6 @@ QString ICalResource::mimeType( const IncidenceBase::Ptr &incidence ) const
return incidence->mimeType();
}
AKONADI_AGENT_FACTORY( ICalResource, akonadi_ical_resource );
#include "icalresource.moc"
......@@ -86,3 +86,4 @@ Icon=text-calendar
X-Akonadi-MimeTypes=text/calendar,application/x-vnd.akonadi.calendar.event,application/x-vnd.akonadi.calendar.todo,application/x-vnd.akonadi.calendar.journal,application/x-vnd.akonadi.calendar.freebusy
X-Akonadi-Capabilities=Resource
X-Akonadi-Identifier=akonadi_ical_resource
X-Akonadi-LaunchMethod=AgentServer
......@@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile/>
<kcfgfile arg="true" />
<group name="General">
<entry name="Path" type="Path">
<label>Path to iCal file.</label>
......
......@@ -22,6 +22,8 @@
#include "settingsadaptor.h"
#include "singlefileresourceconfigdialog.h"
#include <akonadi/dbusconnectionpool.h>
#include <kcalcore/filestorage.h>
#include <kcalcore/memorycalendar.h>
#include <kcalcore/incidence.h>
......@@ -35,7 +37,7 @@ using namespace Akonadi;
using namespace KCalCore;
ICalResourceBase::ICalResourceBase( const QString &id )
: SingleFileResource<Settings>( id )
: SingleFileResource<Settings>( id )
{
KGlobal::locale()->insertCatalog( "akonadi_ical_resource" );
}
......@@ -43,9 +45,9 @@ ICalResourceBase::ICalResourceBase( const QString &id )
void ICalResourceBase::initialise( const QStringList &mimeTypes, const QString &icon )
{
setSupportedMimetypes( mimeTypes, icon );
new SettingsAdaptor( Settings::self() );
QDBusConnection::sessionBus().registerObject( QLatin1String( "/Settings" ),
Settings::self(), QDBusConnection::ExportAdaptors );
new SettingsAdaptor( mSettings );
DBusConnectionPool::threadConnection().registerObject( QLatin1String( "/Settings" ),
mSettings, QDBusConnection::ExportAdaptors );
}
ICalResourceBase::~ICalResourceBase()
......@@ -67,10 +69,10 @@ bool ICalResourceBase::retrieveItem( const Akonadi::Item &item,
void ICalResourceBase::aboutToQuit()
{
if ( !Settings::self()->readOnly() ) {
if ( !mSettings->readOnly() ) {
writeFile();
}
Settings::self()->writeConfig();
mSettings->writeConfig();
}
void ICalResourceBase::customizeConfigDialog( SingleFileResourceConfigDialog<Settings> *dlg )
......
/*
Copyright (c) 2009 David Jarvie <djarvie@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "icalresource.h"
AKONADI_RESOURCE_MAIN( ICalResource )
......@@ -35,7 +35,7 @@ static QLatin1String sNotesType( "application/x-vnd.kde.notes" );
NotesResource::NotesResource( const QString &id )
: ICalResource( id, allMimeTypes(), "knotes" )
{
KConfigSkeleton::ItemPath *item = static_cast<KConfigSkeleton::ItemPath*>( Settings::self()->findItem( "Path" ) );
KConfigSkeleton::ItemPath *item = static_cast<KConfigSkeleton::ItemPath*>( mSettings->findItem( "Path" ) );
if ( item ) {
item->setDefaultValue( KGlobal::dirs()->saveLocation( "data", "knotes/" ) + "notes.ics" );
}
......
......@@ -109,3 +109,4 @@ Icon=view-pim-notes
X-Akonadi-MimeTypes=application/x-vnd.kde.notes
X-Akonadi-Capabilities=Resource
X-Akonadi-Identifier=akonadi_notes_resource
X-Akonadi-LaunchMethod=AgentServer
......@@ -4,6 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile arg="true" />
<group name="General">
<entry name="Path" type="Path">
<label>Path to iCal file.</label>
......
......@@ -3,6 +3,6 @@ ClassName=Settings
Mutators=true
ItemAccessors=true
SetUserTexts=true
Singleton=true
Singleton=false
#IncludeFiles=
GlobalEnums=true
......@@ -3,6 +3,6 @@ ClassName=Settings
Mutators=true
ItemAccessors=true
SetUserTexts=true
Singleton=true
Singleton=false
#IncludeFiles=
GlobalEnums=true
......@@ -22,11 +22,12 @@
#include "settingsadaptor.h"
#include "singlefileresourceconfigdialog.h"
#include <akonadi/dbusconnectionpool.h>
#include <kfiledialog.h>
#include <klocale.h>
#include <KWindowSystem>
#include <QtDBus/QDBusConnection>
using namespace Akonadi;
......@@ -37,9 +38,9 @@ KDEAccountsResource::KDEAccountsResource( const QString &id )
setName( i18n( "KDE Accounts" ) );
new SettingsAdaptor( Settings::self() );
QDBusConnection::sessionBus().registerObject( QLatin1String( "/Settings" ),
Settings::self(), QDBusConnection::ExportAdaptors );
new SettingsAdaptor( mSettings );
DBusConnectionPool::threadConnection().registerObject( QLatin1String( "/Settings" ),
mSettings, QDBusConnection::ExportAdaptors );
}
KDEAccountsResource::~KDEAccountsResource()
......@@ -71,8 +72,8 @@ void KDEAccountsResource::configDialogAcceptedActions( SingleFileResourceConfigD
{
// We can't hide the GUI element but we can enforce that the
// resource is read-only
Settings::self()->setReadOnly( true );
Settings::self()->writeConfig();
mSettings->setReadOnly( true );
mSettings->writeConfig();
}
void KDEAccountsResource::itemAdded( const Akonadi::Item&, const Akonadi::Collection& )
......
......@@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile/>
<kcfgfile arg="true" />
<group name="General">
<entry name="Path" type="Path">
<label>Path to KDE accounts file.</label>
......
......@@ -3,5 +3,5 @@ ClassName=Settings
Mutators=true
ItemAccessors=true
SetUserTexts=true
Singleton=true
Singleton=false
GlobalEnums=true
......@@ -10,10 +10,10 @@ kde4_add_kcfg_files(knutresource_SRCS settings.kcfgc)
kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/knutresource.kcfg org.kde.Akonadi.Knut.Settings)
qt4_add_dbus_adaptor(knutresource_SRCS
${CMAKE_CURRENT_BINARY_DIR}/org.kde.Akonadi.Knut.Settings.xml settings.h Settings
${CMAKE_CURRENT_BINARY_DIR}/org.kde.Akonadi.Knut.Settings.xml settings.h KnutSettings
)
kde4_add_executable(akonadi_knut_resource ${knutresource_SRCS})
kde4_add_plugin(akonadi_knut_resource ${knutresource_SRCS})
if (Q_WS_MAC)
set_target_properties(akonadi_knut_resource PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/../Info.plist.template)
......@@ -28,7 +28,7 @@ target_link_libraries(akonadi_knut_resource
${QT_QTXML_LIBRARY}
)
install( TARGETS akonadi_knut_resource ${INSTALL_TARGETS_DEFAULT_ARGS} )
install( TARGETS akonadi_knut_resource DESTINATION ${PLUGIN_INSTALL_DIR}/ )
install( FILES knutresource.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/akonadi/agents" )
install( FILES knut-template.xml DESTINATION ${DATA_INSTALL_DIR}/akonadi_knut_resource/ )
#! /usr/bin/env bash
$EXTRACTRC `find . -name \*.ui` `find . -name \*.kcfg` >> rc.cpp || exit 11
$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
$XGETTEXT *.cpp -o $podir/akonadi_knut_resource.pot
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