本文整理汇总了C++中KMFolder类的典型用法代码示例。如果您正苦于以下问题:C++ KMFolder类的具体用法?C++ KMFolder怎么用?C++ KMFolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KMFolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
//-----------------------------------------------------------------------------
KMFolder* KMFolderDir::createFolder(const QString& aFolderName, bool aSysFldr, KMFolderType aFolderType)
{
KMFolder* fld;
assert(!aFolderName.isEmpty());
// FIXME urgs, is this still needed
if (mDirType == KMImapDir)
fld = new KMFolder( this, aFolderName, KMFolderTypeImap );
else
fld = new KMFolder( this, aFolderName, aFolderType );
assert(fld != 0);
fld->setSystemFolder(aSysFldr);
KMFolderNode* fNode;
int index = 0;
for (fNode=first(); fNode; fNode=next()) {
if (fNode->name().lower() > fld->name().lower()) {
insert( index, fld );
break;
}
++index;
}
if (!fNode)
append(fld);
fld->correctUnreadMsgsCount();
return fld;
}
示例2: i18n
void ExpiryPropertiesDialog::slotOk()
{
bool enableGlobally = expireReadMailCB->isChecked() || expireUnreadMailCB->isChecked();
if ( enableGlobally && moveToRB->isChecked() && !folderSelector->folder() ) {
KMessageBox::error( this, i18n("Please select a folder to expire messages into."),
i18n( "No Folder Selected" ) );
return;
}
mFolder->setAutoExpire( enableGlobally );
// we always write out days now
mFolder->setReadExpireAge( expireReadMailSB->value() );
mFolder->setUnreadExpireAge( expireUnreadMailSB->value() );
mFolder->setReadExpireUnits( expireReadMailCB->isChecked()? expireDays : expireNever );
mFolder->setUnreadExpireUnits( expireUnreadMailCB->isChecked()? expireDays : expireNever );
if ( deletePermanentlyRB->isChecked() )
mFolder->setExpireAction( KMFolder::ExpireDelete );
else
mFolder->setExpireAction( KMFolder::ExpireMove );
KMFolder* expireToFolder = folderSelector->folder();
if ( expireToFolder )
mFolder->setExpireToFolderId( expireToFolder->idString() );
// trigger immediate expiry if there is something to do
if ( enableGlobally )
mFolder->expireOldMessages( true /*immediate*/);
KDialogBase::slotOk();
}
示例3: finished
void KMSearch::start()
{
//close all referenced folders
QList<QPointer<KMFolder> >::Iterator fit;
for ( fit = mOpenedFolders.begin(); fit != mOpenedFolders.end(); ++fit ) {
if ( !(*fit) ) {
continue;
}
(*fit)->close( "kmsearch" );
}
mOpenedFolders.clear();
mFolders.clear();
if ( running() ) {
return;
}
if ( !mSearchPattern ) {
emit finished( true );
return;
}
mFoundCount = 0;
mSearchCount = 0;
mRunning = true;
mFolders.append( mRoot );
if ( recursive() ) {
//Append all descendants to folders
KMFolder *folder;
for ( int i = 0; i < mFolders.size(); i++ ) {
folder = mFolders[i];
KMFolderDir *dir = 0;
if ( folder ) {
dir = folder->child();
} else {
dir = &kmkernel->folderMgr()->dir();
}
if ( !dir ) {
continue;
}
QListIterator<KMFolderNode*> it( *dir );
while ( it.hasNext() ) {
KMFolderNode *node = it.next();
if ( !node->isDir() ) {
KMFolder* kmf = dynamic_cast<KMFolder*>( node );
if ( kmf ) {
mFolders.append( kmf );
}
}
}
}
}
mRemainingFolders = mFolders.count();
mLastFolder.clear();
mProcessNextBatchTimer->start( 0 );
}
示例4: folderSizeChanged
void KMFolder::slotFolderSizeChanged()
{
emit folderSizeChanged( this );
KMFolder* papa = parent()->manager()->parentFolder( this );
if ( papa && papa != this ) {
papa->slotFolderSizeChanged();
}
}
示例5: dlg
void FavoriteFolderView::addFolder()
{
KMFolderSelDlg dlg(mainWidget(), i18n("Add Favorite Folder"), false);
if(dlg.exec() != QDialog::Accepted)
return;
KMFolder *folder = dlg.folder();
if(!folder)
return;
KMFolderTreeItem *fti = findFolderTreeItem(folder);
addFolder(folder, fti ? prettyName(fti) : folder->label());
}
示例6: inReadOnlyFolder
bool MessageCopyHelper::inReadOnlyFolder(const QList< quint32 > & sernums)
{
KMFolder *f = 0;
int index;
for ( QList<quint32>::ConstIterator it = sernums.begin(); it != sernums.end(); ++it ) {
KMMsgDict::instance()->getLocation( *it, &f, &index );
if ( !f ) // not found
continue;
if ( f->isReadOnly() )
return true;
}
return false;
}
示例7: openFolder
int KMFilterMgr::process(Q_UINT32 serNum, const KMFilter *filter)
{
bool stopIt = false;
int result = 1;
if(!filter)
return 1;
if(isMatching(serNum, filter))
{
KMFolder *folder = 0;
int idx = -1;
// get the message with the serNum
KMMsgDict::instance()->getLocation(serNum, &folder, &idx);
if(!folder || (idx == -1) || (idx >= folder->count()))
{
return 1;
}
KMFolderOpener openFolder(folder, "filtermgr");
KMMsgBase *msgBase = folder->getMsgBase(idx);
bool unGet = !msgBase->isMessage();
KMMessage *msg = folder->getMsg(idx);
// do the actual filtering stuff
if(!msg || !beginFiltering(msg))
{
if(unGet)
folder->unGetMsg(idx);
return 1;
}
if(filter->execActions(msg, stopIt) == KMFilter::CriticalError)
{
if(unGet)
folder->unGetMsg(idx);
return 2;
}
KMFolder *targetFolder = MessageProperty::filterFolder(msg);
endFiltering(msg);
if(targetFolder)
{
tempOpenFolder(targetFolder);
msg->setTransferInProgress(false);
result = targetFolder->moveMsg(msg);
msg->setTransferInProgress(true);
}
if(unGet)
folder->unGetMsg(idx);
}
else
{
result = 1;
}
return result;
}
示例8: countUnread
int KMFolder::countUnreadRecursive()
{
KMFolder *folder;
int count = countUnread();
KMFolderDir *dir = child();
if (!dir)
return count;
QList<KMFolderNode*>::const_iterator it;
for ( it = dir->constBegin(); it != dir->constEnd(); ++it )
if ( !( (*it)->isDir() ) ) {
folder = static_cast<KMFolder*>( (*it) );
count += folder->countUnreadRecursive();
}
return count;
}
示例9: hide
/**
* Refreshes the list of folders we are monitoring. This is called on
* startup and is also connected to the 'changed' signal on the KMFolderMgr.
*/
void KMSystemTray::foldersChanged()
{
/**
* Hide and remove all unread mappings to cover the case where the only
* unread message was in a folder that was just removed.
*/
mFoldersWithUnread.clear();
mCount = 0;
if ( mMode == GlobalSettings::EnumSystemTrayPolicy::ShowOnUnread ) {
hide();
}
/** Disconnect all previous connections */
disconnect(this, SLOT(updateNewMessageNotification(KMFolder *)));
QStringList folderNames;
QValueList<QGuardedPtr<KMFolder> > folderList;
kmkernel->folderMgr()->createFolderList(&folderNames, &folderList);
kmkernel->imapFolderMgr()->createFolderList(&folderNames, &folderList);
kmkernel->dimapFolderMgr()->createFolderList(&folderNames, &folderList);
kmkernel->searchFolderMgr()->createFolderList(&folderNames, &folderList);
QStringList::iterator strIt = folderNames.begin();
for(QValueList<QGuardedPtr<KMFolder> >::iterator it = folderList.begin();
it != folderList.end() && strIt != folderNames.end(); ++it, ++strIt)
{
KMFolder * currentFolder = *it;
QString currentName = *strIt;
if ( ((!currentFolder->isSystemFolder() || (currentFolder->name().lower() == "inbox")) ||
(currentFolder->folderType() == KMFolderTypeImap)) &&
!currentFolder->ignoreNewMail() )
{
/** If this is a new folder, start listening for messages */
connect(currentFolder, SIGNAL(numUnreadMsgsChanged(KMFolder *)),
this, SLOT(updateNewMessageNotification(KMFolder *)));
/** Check all new folders to see if we started with any new messages */
updateNewMessageNotification(currentFolder);
}
}
示例10: logText
int KMFilterMgr::process(KMMessage *msg, const KMFilter *filter)
{
if(!msg || !filter || !beginFiltering(msg))
return 1;
bool stopIt = false;
int result = 1;
if(FilterLog::instance()->isLogging())
{
QString logText(i18n("<b>Evaluating filter rules:</b> "));
logText.append(filter->pattern()->asString());
FilterLog::instance()->add(logText, FilterLog::patternDesc);
}
if(filter->pattern()->matches(msg))
{
if(FilterLog::instance()->isLogging())
{
FilterLog::instance()->add(i18n("<b>Filter rules have matched.</b>"),
FilterLog::patternResult);
}
if(filter->execActions(msg, stopIt) == KMFilter::CriticalError)
return 2;
KMFolder *folder = MessageProperty::filterFolder(msg);
endFiltering(msg);
if(folder)
{
tempOpenFolder(folder);
result = folder->moveMsg(msg);
}
}
else
{
endFiltering(msg);
result = 1;
}
return result;
}
示例11: stop
void KMSearch::stop()
{
if ( !running() ) {
return;
}
mIncompleteFolders.clear();
QList<QPointer<KMFolder> >::ConstIterator jt;
for ( jt = mOpenedFolders.constBegin(); jt != mOpenedFolders.constEnd(); ++jt ) {
KMFolder *folder = *jt;
if ( !folder ) {
continue;
}
// explicitly stop jobs for this folder as it will not be closed below
// when the folder is currently selected
if ( folder->folderType() == KMFolderTypeImap ) {
KMAcctImap *account =
static_cast<KMFolderImap*>( folder->storage() )->account();
account->ignoreJobsForFolder( folder );
}
folder->storage()->search( 0 );
mSearchCount += folder->count();
folder->close( "kmsearch" );
}
mRemainingFolders = -1;
mOpenedFolders.clear();
mFolders.clear();
mLastFolder.clear();
mRunning = false;
emit finished(false);
}
示例12: QObject
MessageCopyHelper::MessageCopyHelper( const QList<quint32> & msgs,
KMFolder * dest, bool move, QObject * parent ) :
QObject( parent )
{
if ( msgs.isEmpty() || !dest )
return;
KMFolder *f = 0;
int index;
QList<KMMsgBase*> list;
for ( QList<quint32>::ConstIterator it = msgs.constBegin(); it != msgs.constEnd(); ++it ) {
KMMsgDict::instance()->getLocation( *it, &f, &index );
if ( !f ) // not found
continue;
if ( f == dest )
continue; // already there
if ( !mOpenFolders.contains( f ) ) {// not yet opened
f->open( "messagecopy" );
mOpenFolders.insert( f, 0 );
}
KMMsgBase *msgBase = f->getMsgBase( index );
if ( msgBase )
list.append( msgBase );
}
if ( list.isEmpty() )
return; // nothing to do
KMCommand *command;
if ( move ) {
command = new KMMoveCommand( dest, list );
} else {
command = new KMCopyCommand( dest, list );
}
connect( command, SIGNAL(completed(KMCommand*)), SLOT(copyCompleted(KMCommand*)) );
command->start();
}
示例13: assert
//-----------------------------------------------------------------------------
int KMFolder::moveMsg(KMMessage* aMsg, int* aIndex_ret)
{
KMFolder* msgParent;
int rc;
assert(aMsg != NULL);
msgParent = aMsg->parent();
if (msgParent)
{
msgParent->open();
aMsg = msgParent->take(msgParent->find(aMsg));
msgParent->close();
}
open();
rc = addMsg(aMsg, aIndex_ret);
close();
// debug("KMFolder::moveMsg() rc=%i",rc);
return rc;
}
示例14: connect
void KMSearch::slotProcessNextBatch()
{
if ( !running() ) {
return;
}
if ( mFolders.count() != 0 ) {
KMFolder *folder = *( mFolders.begin() );
mFolders.erase( mFolders.begin() );
if ( folder ) {
mLastFolder = folder->label();
folder->open( "kmsearch" );
mOpenedFolders.append( folder );
connect( folder->storage(),
SIGNAL( searchResult( KMFolder*, QList<quint32>,
const KMSearchPattern*, bool ) ),
this,
SLOT( slotSearchFolderResult( KMFolder*, QList<quint32>,
const KMSearchPattern*, bool ) ) );
folder->storage()->search( mSearchPattern );
} else {
--mRemainingFolders;
示例15: endFiltering
void KMFilterMgr::endFiltering(KMMsgBase *msgBase) const
{
KMFolder *parent = msgBase->parent();
if(parent)
{
if(parent == MessageProperty::filterFolder(msgBase))
{
parent->take(parent->find(msgBase));
}
else if(! MessageProperty::filterFolder(msgBase))
{
int index = parent->find(msgBase);
KMMessage *msg = parent->getMsg(index);
parent->take(index);
parent->addMsgKeepUID(msg);
}
}
MessageProperty::setFiltering(msgBase, false);
}