Source Code (Use browser search to find items of interest.)
Class Index
empath'Empath (./kdepim/empath/lib/Empath.h:63)
class Empath : public QObject
{
Q_OBJECT
public:
enum SetupType {
SetupDisplay,
SetupIdentity,
SetupComposing,
SetupSending,
SetupAccounts,
SetupFilters,
SetupWizard
};
/**
* Creates an Empath object.
*/
static void start();
/**
* Use this to kill off Empath. You should delete the UI first. This
* allows you to bring down the UI quickly, before Empath dies.
* Once this method returns, everything should have been cleaned
* up, synced, and destructed. You may delete your KApplication.
*/
void shutdown();
/**
* This must be called after the constructor. You can construct
* a ui first, but don't try to access any mailboxes or filters
* as they're not initialised until you call this. @see start
*/
void init();
/**
* In the style of KApplication and QApplication, this
* saves you having to pass a pointer to the (single) object of
* this controller class to every object in the system.
*
* There is a macro 'empath' defined that makes this even easier.
*
* @short Pointer to controller class.
* @return Pointer to controller class.
*/
static Empath * getEmpath() { return EMPATH; }
/**
* @return The folder being used as the inbox.
*/
EmpathURL inbox() const { return inbox_; }
/**
* @return The folder being used for queued messages.
*/
EmpathURL outbox() const { return outbox_; }
/**
* @return The folder being used for sent messages.
*/
EmpathURL sent() const { return sent_; }
/**
* @return The folder being used for draft messages.
*/
EmpathURL drafts() const { return drafts_; }
/**
* @return The folder being used for 'deleted' messages.
*/
EmpathURL trash() const { return trash_; }
/**
* @internal
* This is used by generateUnique.
*/
Q_UINT32 startTime() const { return startupSeconds_; }
/**
* @internal
* This is used by generateUnique.
*/
unsigned int processID() const { return processID_; }
/**
* @internal
* This is used by generateUnique.
*/
QString hostName() const { return hostName_; }
/**
* Pass the message referred to in the URL through the filtering
* mechanism.
*/
void filter(const EmpathURL &);
/**
* Call this when you change the type of server for outgoing
* messages. The old server will be deleted and the new one
* will be used from then on.
*/
void updateOutgoingServer();
/**
* Get a previously requested message.
* @return A pointer to an RMM::RMessage, unless the message can't
* be found, when it returns 0.
*/
RMM::RMessage message(const EmpathURL &);
/**
* Gets a pointer to the folder specified in the url, or 0.
*/
EmpathFolder * folder(const EmpathURL &);
/**
* Gets a pointer to the mailbox specified in the url, or 0.
*/
EmpathMailbox * mailbox(const EmpathURL &);
/**
* Queue a new message for sending later.
*/
void queue(RMM::RMessage &);
/**
* Send a message. If the user set queueing as the default,
* it'll be queued, surprisingly.
*/
void send(RMM::RMessage &);
/**
* Attempt to send all queued messages.
*/
void sendQueued();
/**
* @internal
*/
static Empath * EMPATH;
/**
* Generate an unique filename
*/
QString generateUnique();
void cacheMessage(const EmpathURL &, RMM::RMessage);
EmpathMailboxList * mailboxList();
EmpathFilterList * filterList();
protected:
Empath();
~Empath();
public:
EmpathJobID createFolder(
const EmpathURL &,
QObject * = 0L,
const char * = 0L
);
EmpathJobID removeFolder(
const EmpathURL &,
QObject * = 0L,
const char * = 0L
);
/**
* Ask for a message to be copied from one folder to another.
*/
EmpathJobID copy(
const EmpathURL & src,
const EmpathURL & dest,
QObject * = 0L,
const char * = 0L
);
/**
* Ask for a message to be moved from one folder to another.
*/
EmpathJobID move(
const EmpathURL & src,
const EmpathURL & dest,
QObject * = 0L,
const char * = 0L
);
/**
* Ask for a message to be retrieved.
*/
EmpathJobID retrieve(
const EmpathURL & messageURL,
QObject * = 0L,
const char * = 0L
);
/**
* Write a new message to the specified folder.
*/
EmpathJobID write(
RMM::RMessage & msg,
const EmpathURL & folder,
QObject * = 0L,
const char * = 0L
);
/**
* Remove given message.
*/
EmpathJobID remove(
const EmpathURL & messageURL,
QObject * = 0L,
const char * = 0L
);
/**
* Remove messages. The mailbox and folder are given in the URL.
* The QStringList is used to pass the message ids.
*/
EmpathJobID remove(
const EmpathURL & folder,
const QStringList & ids,
QObject * = 0L,
const char * = 0L
);
/**
* Mark a message with a particular status (Read, Marked, ...)
*/
EmpathJobID mark(
const EmpathURL & messageURL,
EmpathIndexRecord::Status,
QObject * = 0L,
const char * = 0L
);
/**
* Mark many messages with a particular status.
* The mailbox and folder to use are given in the URL. The QStringList
* is used to pass the message ids.
*/
EmpathJobID mark(
const EmpathURL & folder,
const QStringList & ids,
EmpathIndexRecord::Status,
QObject * = 0L,
const char * = 0L
);
public slots:
/**
* Check mail in all boxes.
*/
void s_checkMail();
/**
* Use when folders have changed and any displayed lists need updating.
*/
void s_updateFolderLists();
void s_syncFolderLists();
/**
* Please ask the user to enter settings for the mailbox
* specified in the URL.
*/
void s_configureMailbox(const EmpathURL &, QWidget *);
///////////////////////////////////////////////////////////////////
// Message composition.
/**
* Compose a new message.
*/
void s_compose();
void s_composeTo(const QString & recipient);
/**
* Reply to the given message.
*/
void s_reply(const EmpathURL & url);
/**
* Reply to the given message.
*/
void s_replyAll(const EmpathURL & url);
/**
* Forward given message.
*/
void s_forward(const EmpathURL & url);
/**
* Bounce a message.
*/
void s_bounce(const EmpathURL &);
///////////////////////////////////////////////////////////////////
// Async methods.
void saveMessage(const EmpathURL &, QWidget *);
//////////////////////////////////////////////////////////////////
// Request user interaction to alter configuration.
/**
* Request that the UI bring up the settings for the given type.
*/
void s_setup(SetupType, QWidget *);
/**
* Connect to this from anywhere to provide the about box.
*/
void s_about(QWidget *);
//////////////////////////////////////////////////////////////////
// Internal.
/**
* @internal
*/
void s_newTask(EmpathTask *);
/**
* @internal
*/
void s_newMailArrived();
/**
* @internal
*/
void s_saveConfig();
/**
* @internal
*/
// void s_saveNameReady(const EmpathURL & url, QString path);
/**
* @internal
*/
// void s_messageReadyForSave(bool, const EmpathURL &, QString);
signals:
/**
* EmpathMessageListWidget connects to this to be notified when
* it should show the contents of a folder. It uses the id to
* decide whether to ignore the signal.
*/
void showFolder(const EmpathURL &, unsigned int id);
/**
* EmpathMailbox connects to this to be notified of
* checkMail requests.
*/
void checkMail();
/**
* Please ask the user to configure this mailbox.
*/
void configureMailbox(const EmpathURL &, QWidget *);
/**
* Please ask the user to enter a path to save this message
* under.
*/
void getSaveName(const EmpathURL &, QWidget *);
/**
* Signals that the on-screen folder lists should be updated.
* Usually connected to a slot in the UI module.
* Call this when a folder has been added/removed.
* Once you are done adding/removing folders, call syncFolderLists().
*/
void updateFolderLists();
/**
* Signals that the on-screen folder lists should be synced.
* Usually connected to a slot in the UI module.
* Call updateFolderLists() when a folder has been added/removed.
* Once you are done adding/removing folders, call this.
*/
void syncFolderLists();
/**
* Signals that new mail has arrived somewhere.
*/
void newMailArrived();
/**
* Signals that we want to compose a message.
* All the info about the message is kept in the composeform.
* Usually connected to a slot in the UI module.
*/
void newComposer(EmpathComposeForm);
/**
* Signals that the settings should be provided for
* review. In other words, bring up the settings dialog.
* Usually connected to a slot in the UI module.
*/
void setup(Empath::SetupType, QWidget *);
/**
* Signals that we want to see who's responsible for this stuff.
* Usually connected to a slot in the UI module.
*/
void about(QWidget *);
/**
* Signals that a new task has started.
* Usually connected to a slot in the UI module.
*/
void newTask(EmpathTask *);
private:
EmpathJobScheduler * _jobScheduler();
EmpathMailSender * _sender();
void _saveHostName();
void _setStartTime();
EmpathURL inbox_, outbox_, sent_, drafts_, trash_;
QString hostName_;
unsigned int processID_;
Q_UINT32 startupSeconds_;
QString startupSecondsStr_;
QString pidStr_;
QCache<EmpathCachedMessage> cache_;
// Order dependency
EmpathMailboxList * mailboxList_;
EmpathFilterList * filterList_;
EmpathMailSender * sender_;
EmpathJobScheduler * jobScheduler_;
unsigned long int seq_;
// End order dependency
};
#endif
// vim:ts=4:sw=4:tw=78
empath'Empath::start() (./kdepim/empath/lib/Empath.cpp:60)
Empath::start()
{
if (0 == EMPATH)
EMPATH = new Empath;
}
void
empath'Empath::shutdown() (./kdepim/empath/lib/Empath.cpp:67)
Empath::shutdown()
{
s_saveConfig();
delete this;
}
empath'Empath::Empath() (./kdepim/empath/lib/Empath.cpp:73)
Empath::Empath()
: QObject((QObject *)0L, "Empath"),
mailboxList_ (0L),
filterList_ (0L),
sender_ (0L),
jobScheduler_ (0L),
seq_ (0)
{
#ifdef USE_QPTHREAD
(void)new QpInit;
#endif
// Don't do dollar expansion by default.
// Possible security hole.
KGlobal::config()->setDollarExpansion(false);
KGlobal::dirs()->addResourceType(
"indices",
QString::fromUtf8("share/apps/empath/indices")
);
KGlobal::dirs()->addResourceType(
"cache",
QString::fromUtf8("share/apps/empath/cache")
);
}
void
empath'Empath::init() (./kdepim/empath/lib/Empath.cpp:101)
Empath::init()
{
processID_ = int(getpid());
pidStr_.setNum(processID_);
_saveHostName();
_setStartTime();
cache_.setMaxCost(5);
QString s(i18n("Local"));
inbox_ .setMailboxName(s);
outbox_ .setMailboxName(s);
sent_ .setMailboxName(s);
drafts_ .setMailboxName(s);
trash_ .setMailboxName(s);
KConfig * c = KGlobal::config();
c->setGroup(QString::fromUtf8("Folders"));
inbox_ .setFolderPath
(c->readEntry(QString::fromUtf8("Inbox"), i18n("Inbox")));
outbox_ .setFolderPath
(c->readEntry(QString::fromUtf8("Outbox"), i18n("Outbox")));
sent_ .setFolderPath
(c->readEntry(QString::fromUtf8("Sent"), i18n("Sent")));
drafts_ .setFolderPath
(c->readEntry(QString::fromUtf8("Drafts"), i18n("Drafts")));
trash_ .setFolderPath
(c->readEntry(QString::fromUtf8("Trash"), i18n("Trash")));
mailboxList()->loadConfig();
}
empath'Empath::~Empath() (./kdepim/empath/lib/Empath.cpp:141)
Empath::~Empath()
{
delete mailboxList_;
mailboxList_ = 0L;
delete sender_;
sender_ = 0L;
delete filterList_;
filterList_ = 0L;
delete jobScheduler_;
jobScheduler_ = 0L;
}
void
empath'Empath::s_saveConfig() (./kdepim/empath/lib/Empath.cpp:157)
Empath::s_saveConfig()
{
filterList()->saveConfig();
mailboxList()->saveConfig();
KGlobal::config()->sync();
}
RMM::RMessage
Empath::message(const EmpathURL & source)
{
QCacheIterator<EmpathCachedMessage> it(cache_);
for (; it.current(); ++it)
if (it.current()->refCount() == 0) {
cache_.remove(it.currentKey());
break; // One at a time.
}
EmpathCachedMessage * cached = cache_[source.asString()];
if (cached == 0)
return RMM::RMessage();
return cached->message();
}
void
empath'Empath::cacheMessage() (./kdepim/empath/lib/Empath.cpp:185)
Empath::cacheMessage(const EmpathURL & url, RMM::RMessage m)
{
EmpathCachedMessage * cached = cache_[url.asString()];
if (cached == 0) {
cached = new EmpathCachedMessage(m);
cache_.insert(url.asString(), cached);
}
cached->ref();
}
EmpathMailboxList *
empath'Empath::mailboxList() (./kdepim/empath/lib/Empath.cpp:199)
Empath::mailboxList()
{
if (0 == mailboxList_)
mailboxList_ = new EmpathMailboxList;
return mailboxList_;
}
EmpathMailSender *
empath'Empath::_sender() (./kdepim/empath/lib/Empath.cpp:208)
Empath::_sender()
{
if (0 == sender_)
sender_ = new EmpathMailSender;
return sender_;
}
void
empath'Empath::updateOutgoingServer() (./kdepim/empath/lib/Empath.cpp:217)
Empath::updateOutgoingServer()
{
_sender()->update();
}
EmpathJobScheduler *
empath'Empath::_jobScheduler() (./kdepim/empath/lib/Empath.cpp:223)
Empath::_jobScheduler()
{
if (0 == jobScheduler_)
jobScheduler_ = new EmpathJobScheduler;
return jobScheduler_;
}
EmpathFilterList *
empath'Empath::filterList() (./kdepim/empath/lib/Empath.cpp:232)
Empath::filterList()
{
if (0 == filterList_) {
filterList_ = new EmpathFilterList;
filterList_->loadConfig();
}
return filterList_;
}
EmpathMailbox *
empath'Empath::mailbox() (./kdepim/empath/lib/Empath.cpp:243)
Empath::mailbox(const EmpathURL & url)
{ return (*mailboxList())[url.mailboxName()]; }
EmpathFolder *
empath'Empath::folder() (./kdepim/empath/lib/Empath.cpp:247)
Empath::folder(const EmpathURL & url)
{ EmpathMailbox * m = mailbox(url); return (m == 0 ? 0 : m->folder(url)); }
EmpathJobID
empath'Empath::copy() (./kdepim/empath/lib/Empath.cpp:251)
Empath::copy(const EmpathURL & from, const EmpathURL & to, QObject * o, const char * slot)
{ return _jobScheduler()->newCopyJob(from, to, o, slot); }
EmpathJobID
empath'Empath::move() (./kdepim/empath/lib/Empath.cpp:255)
Empath::move(const EmpathURL & from, const EmpathURL & to, QObject * o, const char * slot)
{ return _jobScheduler()->newMoveJob(from, to, o, slot); }
EmpathJobID
empath'Empath::retrieve() (./kdepim/empath/lib/Empath.cpp:259)
Empath::retrieve(const EmpathURL & url, QObject * o, const char * slot)
{ return _jobScheduler()->newRetrieveJob(url, o, slot); }
EmpathJobID
empath'Empath::write() (./kdepim/empath/lib/Empath.cpp:263)
Empath::write(RMM::RMessage & msg, const EmpathURL & folder, QObject * o, const char * slot)
{ return _jobScheduler()->newWriteJob(msg, folder, o, slot); }
EmpathJobID
empath'Empath::remove() (./kdepim/empath/lib/Empath.cpp:267)
Empath::remove(const EmpathURL & url, QObject * o, const char * slot)
{ return _jobScheduler()->newRemoveJob(url, o, slot); }
EmpathJobID
empath'Empath::remove() (./kdepim/empath/lib/Empath.cpp:271)
Empath::remove(const EmpathURL & f, const QStringList & IDList, QObject * o, const char * slot)
{ return _jobScheduler()->newRemoveJob(f, IDList, o, slot); }
EmpathJobID
empath'Empath::mark() (./kdepim/empath/lib/Empath.cpp:275)
Empath::mark(const EmpathURL & url, EmpathIndexRecord::Status s, QObject * o, const char * slot)
{ return _jobScheduler()->newMarkJob(url, s, o, slot); }
EmpathJobID
empath'Empath::mark() (./kdepim/empath/lib/Empath.cpp:279)
Empath::mark(
const EmpathURL & f,
const QStringList & l,
EmpathIndexRecord::Status s,
QObject * o,
const char * slot
)
{ return _jobScheduler()->newMarkJob(f, l, s, o, slot); }
EmpathJobID
empath'Empath::createFolder() (./kdepim/empath/lib/Empath.cpp:289)
Empath::createFolder(const EmpathURL & url, QObject * o, const char * slot)
{ return _jobScheduler()->newCreateFolderJob(url, o, slot); }
EmpathJobID
empath'Empath::removeFolder() (./kdepim/empath/lib/Empath.cpp:293)
Empath::removeFolder(const EmpathURL & url, QObject * o, const char * slot)
{ return _jobScheduler()->newRemoveFolderJob(url, o, slot); }
void
empath'Empath::send() (./kdepim/empath/lib/Empath.cpp:297)
Empath::send(RMM::RMessage & m)
{ _sender()->send(m); }
void
empath'Empath::queue() (./kdepim/empath/lib/Empath.cpp:301)
Empath::queue(RMM::RMessage & m)
{ _sender()->queue(m); }
void
empath'Empath::sendQueued() (./kdepim/empath/lib/Empath.cpp:305)
Empath::sendQueued()
{ _sender()->sendQueued(); }
void
empath'Empath::s_newMailArrived() (./kdepim/empath/lib/Empath.cpp:309)
Empath::s_newMailArrived()
{ emit(newMailArrived()); }
void
empath'Empath::filter() (./kdepim/empath/lib/Empath.cpp:313)
Empath::filter(const EmpathURL & m)
{ filterList()->filter(m); }
void
empath'Empath::s_setup() (./kdepim/empath/lib/Empath.cpp:317)
Empath::s_setup(SetupType t, QWidget * parent)
{ emit(setup(t, parent)); }
void
empath'Empath::s_about() (./kdepim/empath/lib/Empath.cpp:321)
Empath::s_about(QWidget * parent)
{ emit(about(parent)); }
void
empath'Empath::s_newTask() (./kdepim/empath/lib/Empath.cpp:325)
Empath::s_newTask(EmpathTask * t)
{ emit(newTask(t)); }
void
empath'Empath::s_compose() (./kdepim/empath/lib/Empath.cpp:329)
Empath::s_compose()
{ EmpathComposer::instance()->newComposeForm(QString::null); }
void
empath'Empath::s_composeTo() (./kdepim/empath/lib/Empath.cpp:333)
Empath::s_composeTo(const QString & recipient)
{ EmpathComposer::instance()->newComposeForm(recipient); }
void
empath'Empath::s_reply() (./kdepim/empath/lib/Empath.cpp:337)
Empath::s_reply(const EmpathURL & url)
{ EmpathComposer::instance()->newComposeForm(EmpathComposeForm::Reply, url); }
void
empath'Empath::s_replyAll() (./kdepim/empath/lib/Empath.cpp:341)
Empath::s_replyAll(const EmpathURL & url)
{ EmpathComposer::instance()->newComposeForm(EmpathComposeForm::ReplyAll, url);}
void
empath'Empath::s_forward() (./kdepim/empath/lib/Empath.cpp:345)
Empath::s_forward(const EmpathURL & url)
{ EmpathComposer::instance()->newComposeForm(EmpathComposeForm::Forward, url); }
void
empath'Empath::s_bounce() (./kdepim/empath/lib/Empath.cpp:349)
Empath::s_bounce(const EmpathURL & url)
{ EmpathComposer::instance()->newComposeForm(EmpathComposeForm::Bounce, url); }
void
empath'Empath::saveMessage() (./kdepim/empath/lib/Empath.cpp:353)
Empath::saveMessage(const EmpathURL & url, QWidget * parent)
{ emit(getSaveName(url, parent)); }
void
empath'Empath::s_configureMailbox() (./kdepim/empath/lib/Empath.cpp:357)
Empath::s_configureMailbox(const EmpathURL & u, QWidget * w)
{ emit(configureMailbox(u, w)); }
void
empath'Empath::s_checkMail() (./kdepim/empath/lib/Empath.cpp:361)
Empath::s_checkMail()
{ emit(checkMail()); }
void
empath'Empath::s_updateFolderLists() (./kdepim/empath/lib/Empath.cpp:365)
Empath::s_updateFolderLists()
{ emit(updateFolderLists()); }
void
empath'Empath::s_syncFolderLists() (./kdepim/empath/lib/Empath.cpp:369)
Empath::s_syncFolderLists()
{ emit(syncFolderLists()); }
QString
empath'Empath::generateUnique() (./kdepim/empath/lib/Empath.cpp:373)
Empath::generateUnique()
{
return (
startupSecondsStr_ + '.' + pidStr_ + '_' +
QString::number(seq_++) + '.' + hostName_);
}
void
empath'Empath::_setStartTime() (./kdepim/empath/lib/Empath.cpp:381)
Empath::_setStartTime()
{
struct timeval timeVal;
struct timezone timeZone;
gettimeofday(&timeVal, &timeZone);
startupSeconds_ = timeVal.tv_sec;
startupSecondsStr_.setNum(startupSeconds_);
}
void
empath'Empath::_saveHostName() (./kdepim/empath/lib/Empath.cpp:392)
Empath::_saveHostName()
{
struct utsname utsName;
if (uname(&utsName) == 0)
hostName_ = utsName.nodename;
}
// vim:ts=4:sw=4:tw=78