Commit 7698fd59 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Don't show "offline" checkbox for local resources

CCBUG: 223482
parent d3d886cb
......@@ -526,11 +526,15 @@ void AccountsPageReceivingTab::slotShowMailCheckMenu( const QString &ident, cons
connect( manualMailCheck, SIGNAL(toggled(bool)), this, SLOT(slotIncludeInCheckChanged(bool)) );
}
QAction *switchOffline = new QAction( i18nc( "Label to a checkbox, so is either checked/unchecked", "Switch offline on KMail Shutdown" ), menu );
switchOffline->setCheckable( true );
switchOffline->setChecked( OfflineOnShutdown );
switchOffline->setData( ident );
menu->addAction( switchOffline );
if( !MailCommon::Util::isLocalCollection( ident ) ) {
QAction *switchOffline = new QAction( i18nc( "Label to a checkbox, so is either checked/unchecked", "Switch offline on KMail Shutdown" ), menu );
switchOffline->setCheckable( true );
switchOffline->setChecked( OfflineOnShutdown );
switchOffline->setData( ident );
menu->addAction( switchOffline );
connect( switchOffline, SIGNAL(toggled(bool)), this, SLOT(slotOfflineOnShutdownChanged(bool)) );
}
QAction *checkOnStartup = new QAction( i18n( "Check mail on startup" ), menu );
checkOnStartup->setCheckable( true );
......@@ -538,7 +542,6 @@ void AccountsPageReceivingTab::slotShowMailCheckMenu( const QString &ident, cons
checkOnStartup->setData( ident );
menu->addAction( checkOnStartup );
connect( switchOffline, SIGNAL(toggled(bool)), this, SLOT(slotOfflineOnShutdownChanged(bool)) );
connect( checkOnStartup, SIGNAL(toggled(bool)), this, SLOT(slotCheckOnStatupChanged(bool)) );
menu->exec( mAccountsReceiving.mAccountList->view()->mapToGlobal( pos ) );
......
......@@ -112,6 +112,14 @@ bool MailCommon::Util::isVirtualCollection( const QString &resource )
resource == QLatin1String( "akonadi_search_resource" ) );
}
bool MailCommon::Util::isLocalCollection( const QString &resource )
{
return resource.contains(QLatin1String("akonadi_mbox_resource")) ||
resource.contains(QLatin1String("akonadi_maildir_resource")) ||
resource.contains(QLatin1String("akonadi_mixedmaildir_resource"));
}
QString MailCommon::Util::fullCollectionPath( const Akonadi::Collection &collection )
{
QString fullPath;
......
......@@ -130,6 +130,8 @@ namespace Util {
MAILCOMMON_EXPORT Akonadi::Collection::Id convertFolderPathToCollectionId( const QString& folder);
MAILCOMMON_EXPORT QString convertFolderPathToCollectionStr( const QString& folder);
MAILCOMMON_EXPORT bool isLocalCollection( const QString &resource );
}
}
......
Supports Markdown
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