Folder properties: do not create a job on the stack,

and eliminate a nested event loop.

REVIEW:107521
wilder-work
Jonathan Marten 13 years ago
parent 4da73b4c61
commit 31e86758db
  1. 27
      kmmainwidget.cpp
  2. 1
      kmmainwidget.h

@ -4676,11 +4676,28 @@ void KMMainWidget::slotCollectionPropertiesContinued( KJob* job )
void KMMainWidget::showCollectionPropertiesContinued( const QString &pageToShow )
{
Akonadi::CollectionFetchJob fetch( mCurrentFolder->collection(), Akonadi::CollectionFetchJob::Base );
fetch.fetchScope().setIncludeStatistics( true );
fetch.exec();
Akonadi::CollectionFetchJob *fetch = new Akonadi::CollectionFetchJob( mCurrentFolder->collection(),
Akonadi::CollectionFetchJob::Base );
fetch->fetchScope().setIncludeStatistics( true );
fetch->setProperty( "pageToShow", pageToShow );
connect( fetch, SIGNAL(result(KJob*)),
this, SLOT(slotCollectionPropertiesFinished(KJob*)) );
}
const Akonadi::Collection collection = fetch.collections().first();
void KMMainWidget::slotCollectionPropertiesFinished( KJob *job )
{
if ( !job )
return;
Akonadi::CollectionFetchJob *fetch = dynamic_cast<Akonadi::CollectionFetchJob *>( job );
Q_ASSERT( fetch );
if ( fetch->collections().isEmpty() )
{
kWarning() << "no collection";
return;
}
const Akonadi::Collection collection = fetch->collections().first();
const QStringList pages = QStringList() << QLatin1String( "MailCommon::CollectionGeneralPage" )
<< QLatin1String( "KMail::CollectionViewPage" )
@ -4694,6 +4711,8 @@ void KMMainWidget::showCollectionPropertiesContinued( const QString &pageToShow
Akonadi::CollectionPropertiesDialog *dlg = new Akonadi::CollectionPropertiesDialog( collection, pages, this );
dlg->setCaption( i18nc( "@title:window", "Properties of Folder %1", collection.name() ) );
dlg->resize( 500, 400 );
const QString pageToShow = fetch->property( "pageToShow" ).toString();
if ( !pageToShow.isEmpty() ) { // show a specific page
dlg->setCurrentPage( pageToShow );
}

@ -527,6 +527,7 @@ class KMAIL_EXPORT KMMainWidget : public QWidget
void itemsFetchDone( KJob *job );
void slotCollectionPropertiesContinued( KJob* job );
void slotCollectionPropertiesFinished( KJob *job );
void slotDeletionCollectionResult(KJob* job);
void slotServerSideSubscription();
void slotFetchItemsForFolderDone(KJob*job);

Loading…
Cancel
Save