void ArchiveMailWidget::load() { KSharedConfig::Ptr config = KGlobal::config(); const QStringList collectionList = config->groupList().filter( QRegExp( archiveMailCollectionPattern ) ); const int numberOfCollection = collectionList.count(); for(int i = 0 ; i < numberOfCollection; ++i) { KConfigGroup group = config->group(collectionList.at(i)); ArchiveMailInfo *info = new ArchiveMailInfo(group); createOrUpdateItem(info); } }
void ArchiveMailWidget::save() { if (!mChanged) return; KSharedConfig::Ptr config = KGlobal::config(); // first, delete all filter groups: const QStringList filterGroups =config->groupList().filter( QRegExp( archiveMailCollectionPattern ) ); foreach ( const QString &group, filterGroups ) { config->deleteGroup( group ); }
bool FollowUpReminderInfoWidget::save() { if (!mChanged) { return false; } KSharedConfig::Ptr config = KSharedConfig::openConfig(); // first, delete all filter groups: const QStringList filterGroups = config->groupList().filter(QRegularExpression(followUpItemPattern())); foreach (const QString &group, filterGroups) { config->deleteGroup(group); }
void FollowUpReminderInfoWidget::load() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); const QStringList filterGroups = config->groupList().filter(QRegularExpression(followUpItemPattern())); const int numberOfItem = filterGroups.count(); for (int i = 0; i < numberOfItem; ++i) { KConfigGroup group = config->group(filterGroups.at(i)); FollowUpReminder::FollowUpReminderInfo *info = new FollowUpReminder::FollowUpReminderInfo(group); if (info->isValid()) { createOrUpdateItem(info); } else { delete info; } } }