SVN commit 1036833 by toma: Adapt to sudden removal of the ttoltipproxy model which is merged with the statisticsmodel. M +40 -9 mainwindow.cpp --- trunk/extragear/pim/mailody/src/mainwindow.cpp #1036832:1036833 @@ -215,6 +215,9 @@ setAcceptDrops( false ); slotSyncAllFolderLists(); + + connect( manager, SIGNAL( instanceAdded (const Akonadi::AgentInstance&) ), + SLOT( slotInstanceAdded (const Akonadi::AgentInstance &) ) ); } MainWindow::~MainWindow() @@ -291,11 +294,9 @@ collectionFilter->addMimeTypeInclusionFilter( Collection::mimeType() ); collectionFilter->setHeaderGroup( EntityTreeModel::CollectionTreeHeaders ); - StatisticsToolTipProxyModel* statisticsToolTipProxyModel = new StatisticsToolTipProxyModel( this ); - statisticsToolTipProxyModel->setSourceModel( collectionFilter ); - StatisticsProxyModel *statisticsProxyModel = new StatisticsProxyModel( this ); - statisticsProxyModel->setSourceModel( statisticsToolTipProxyModel ); + statisticsProxyModel->setToolTipEnabled( true ); + statisticsProxyModel->setSourceModel( collectionFilter ); QSortFilterProxyModel *sortModel = new QSortFilterProxyModel( this ); sortModel->setDynamicSortFilter( true ); @@ -703,8 +704,12 @@ // set to manual expunge QString dbusstr = "org.freedesktop.Akonadi.Resource."; dbusstr.append( agent.identifier() ); - QDBusInterface dbus( dbusstr, "/", "org.kde.Akonadi.Imap.Resource" ); - dbus.call( QLatin1String( "setCustomPurge" ), true ); + QDBusInterface dbus( dbusstr, "/Settings" ); + dbus.call( QLatin1String( "setAutomaticExpungeEnabled" ), + false ); + + agent.reconfigure(); + kDebug() << "Set no automexpunge on: " << agent.name() << agent.identifier(); } agent.synchronizeCollectionTree(); @@ -713,6 +718,29 @@ } } +void MainWindow::slotInstanceAdded (const Akonadi::AgentInstance &agent) +{ + kDebug() << "new resource."; + + if ( agent.type().identifier() == "akonadi_imap_resource") { + + // set to manual expunge + QString dbusstr = "org.freedesktop.Akonadi.Resource."; + dbusstr.append( agent.identifier() ); + QDBusInterface dbus( dbusstr, "/Settings" ); + dbus.call( QLatin1String( "setAutomaticExpungeEnabled" ), + false ); + + agent.reconfigure(); + + kDebug() << "Set no automexpunge on: " << agent.name(); + } + + //syncCollectionTree() is not const.... + AgentInstance agent2 = agent; + agent2.synchronizeCollectionTree(); +} + void MainWindow::slotSyncFolderList() { const QString identifier = m_currentCollection.resource(); @@ -1316,12 +1344,15 @@ void MainWindow::slotPurge() { // use dbus to call the resource asking to slotPurge() the collection. - // kDebug() << "CollectionResource " << m_currentCollection.resource(); + kDebug() << "CollectionResource " << m_currentCollection.resource() + << m_currentCollection.remoteId(); QString dbusstr = "org.freedesktop.Akonadi.Resource."; dbusstr.append( m_currentCollection.resource() ); - QDBusInterface dbus( dbusstr, "/", "org.kde.Akonadi.Imap.Resource" ); - dbus.call( QLatin1String( "purge" ), m_currentCollection.remoteId() ); + QDBusInterface dbus( dbusstr, "/Settings" ); + dbus.call( QLatin1String( "org.freedesktop.DBus.Properties.Set" ), + QLatin1String( "expungeRequested" ), + m_currentCollection.remoteId() ); }