Fix dbus interface for folder

svn path=/trunk/KDE/kdepim/; revision=678049
wilder-work
Laurent Montel 19 years ago
parent fda2dd36da
commit 7e5b7e220c
  1. 7
      folderadaptor.cpp
  2. 1
      folderadaptor.h
  3. 26
      kmkernel.cpp
  4. 2
      kmkernel.h

@ -47,7 +47,7 @@ namespace KMail {
FolderAdaptor::FolderAdaptor( const QString& vpath )
: mPath( vpath )
{
QDBusConnection::sessionBus().registerObject("/Folder", this);
QDBusConnection::sessionBus().registerObject("/Folder", this,QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportScriptableSignals );
//kDebug(5006)<<"FolderIface folder = "<< mPath <<endl;
mFolder = kmkernel->folderMgr()->getFolderByURL( mPath );
if ( !mFolder )
@ -112,6 +112,11 @@ FolderAdaptor::unreadRecursiveMessages()
return mFolder->countUnreadRecursive();
}
void FolderAdaptor::unregisterobject()
{
QDBusConnection::sessionBus().unregisterObject("/Folder");
}
//The reason why this function is disabled is that we loose
//the message as soon as we get it (after we switch folders,
//it's being unget. We need a reference count on message to make it work

@ -44,6 +44,7 @@ namespace KMail {
public:
FolderAdaptor( const QString& vpath );
void unregisterobject();
public Q_SLOTS:
Q_SCRIPTABLE QString path() const;

@ -126,7 +126,7 @@ KMKernel::KMKernel (QObject *parent, const char *name) :
the_msgSender = 0;
mWin = 0;
mMailCheckAborted = false;
folderAdaptor=0;
// make sure that we check for config updates before doing anything else
KMKernel::config();
// this shares the kmailrc parsing too (via KSharedConfig), and reads values from it
@ -983,7 +983,6 @@ QStringList KMKernel::folderList() const
QDBusObjectPath KMKernel::getFolder( const QString& vpath )
{
#if 0
QString adaptorName;
const QString localPrefix = "/Local";
if ( the_folderMgr->getFolderByURL( vpath ) )
@ -996,25 +995,14 @@ QDBusObjectPath KMKernel::getFolder( const QString& vpath )
adaptorName=vpath;
if( !adaptorName.isEmpty())
{
KMail::FolderAdaptor *adaptor = new KMail::FolderAdaptor(adaptorName);
QDBusConnection::sessionBus().registerObject( vpath, this );
if ( folderAdaptor )
{
folderAdaptor->unregisterobject();
delete folderAdaptor;
}
folderAdaptor = new KMail::FolderAdaptor(adaptorName);
return QDBusObjectPath(vpath);
}
#endif
#ifdef __GNUC__
#warning Port DCOPRef usage!
#endif
/* const QString localPrefix = "/Local";
if ( the_folderMgr->getFolderByURL( vpath ) )
return DCOPRef( new FolderIface( vpath ) );
else if ( vpath.startsWith( localPrefix ) &&
the_folderMgr->getFolderByURL( vpath.mid( localPrefix.length() ) ) )
return DCOPRef( new FolderIface( vpath.mid( localPrefix.length() ) ) );
else if ( the_imapFolderMgr->getFolderByURL( vpath ) )
return DCOPRef( new FolderIface( vpath ) );
else if ( the_dimapFolderMgr->getFolderByURL( vpath ) )
return DCOPRef( new FolderIface( vpath ) );
return DCOPRef();*/
return QDBusObjectPath();
}

@ -45,6 +45,7 @@ namespace KMail {
class JobScheduler;
class MessageSender;
class AccountManager;
class FolderAdaptor;
}
namespace KPIM { class ProgressDialog; }
using KMail::MailServiceImpl;
@ -461,6 +462,7 @@ private:
QStringList mAddMessageMsgIds;
QString mAddMessageLastFolder;
KMFolder *mAddMsgCurrentFolder;
KMail::FolderAdaptor *folderAdaptor;
};
#endif

Loading…
Cancel
Save