Commit b39f6ae7 authored by Thomas McGuire's avatar Thomas McGuire

Make this a value-based class instead of a singleton, as per API review.

svn path=/trunk/KDE/kdepimlibs/; revision=1068247
parent 03568353
......@@ -36,16 +36,6 @@ using namespace MailTransport;
K_GLOBAL_STATIC( DispatcherInterfacePrivate, sInstance )
DispatcherInterfacePrivate::DispatcherInterfacePrivate()
: instance( new DispatcherInterface() )
{
}
DispatcherInterfacePrivate::~DispatcherInterfacePrivate()
{
delete instance;
}
void DispatcherInterfacePrivate::massModifyResult( KJob *job )
{
// Nothing to do here, really. If the job fails, the user can retry it.
......@@ -60,11 +50,6 @@ DispatcherInterface::DispatcherInterface()
{
}
DispatcherInterface *DispatcherInterface::self()
{
return sInstance->instance;
}
AgentInstance DispatcherInterface::dispatcherInstance() const
{
AgentInstance a =
......
......@@ -33,8 +33,7 @@ namespace MailTransport {
dispatchManually) and retry sending (@see retryDispatching).
This class also takes care of registering the attributes that the mail
dispatcher agent and MailTransport use. The attributes are registered
the first time you call self(), so do that early in your application.
dispatcher agent and MailTransport use.
@author Constantin Berzan <exit3219@gmail.com>
@since 4.4
......@@ -43,10 +42,7 @@ class MAILTRANSPORT_EXPORT DispatcherInterface
{
public:
/**
Returns the DispatcherInterface instance.
*/
static DispatcherInterface *self();
DispatcherInterface();
/**
Returns the current instance of the mail dispatcher agent. May return an invalid
......@@ -65,12 +61,6 @@ class MAILTRANSPORT_EXPORT DispatcherInterface
queues them again for sending.
*/
void retryDispatching();
private:
DispatcherInterface();
friend class DispatcherInterfacePrivate;
Q_DISABLE_COPY( DispatcherInterface )
};
} // namespace MailTransport
......
......@@ -34,11 +34,6 @@ class DispatcherInterfacePrivate : public QObject
public:
DispatcherInterfacePrivate();
~DispatcherInterfacePrivate();
DispatcherInterface *instance;
public Q_SLOTS:
void massModifyResult( KJob *job );
......
......@@ -42,7 +42,7 @@ Runner::Runner()
void Runner::sendAbort()
{
const AgentInstance mda = DispatcherInterface::self()->dispatcherInstance();
const AgentInstance mda = DispatcherInterface().dispatcherInstance();
if( !mda.isValid() ) {
kDebug() << "Invalid instance; waiting.";
QTimer::singleShot( 1000, this, SLOT(sendAbort()) );
......
......@@ -47,7 +47,7 @@ Runner::Runner()
void Runner::checkFolders()
{
DispatcherInterface::self()->retryDispatching();
DispatcherInterface().retryDispatching();
}
int main( int argc, char **argv )
......
......@@ -47,7 +47,7 @@ Runner::Runner()
void Runner::checkFolders()
{
DispatcherInterface::self()->dispatchManually();
DispatcherInterface().dispatchManually();
}
int main( int argc, char **argv )
......
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