Commit 4c8cccb1 authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Port Cache Policy tab from the collection properties dialog to QFormLayout

See mailcommon!5
parent 0f8e9f5e
Pipeline #71742 passed with stage
in 10 minutes and 39 seconds
......@@ -34,6 +34,7 @@ public:
void slotRetrievalOptionsGroupBoxDisabled(bool disable);
Ui::CachePolicyPage *const mUi;
GuiMode mode;
};
void CachePolicyPage::Private::slotIntervalValueChanged(int interval)
......@@ -48,7 +49,10 @@ void CachePolicyPage::Private::slotCacheValueChanged(int interval)
void CachePolicyPage::Private::slotRetrievalOptionsGroupBoxDisabled(bool disable)
{
mUi->retrievalOptionsGroupBox->setDisabled(disable);
mUi->retrieveFullMessages->setDisabled(disable);
mUi->retrieveFullMessages->setDisabled(disable);
mUi->retrieveOnlyHeaders->setDisabled(disable);
mUi->localCacheTimeout->setDisabled(disable);
if (!disable) {
mUi->label->setEnabled(mUi->retrieveOnlyHeaders->isChecked());
mUi->localCacheTimeout->setEnabled(mUi->retrieveOnlyHeaders->isChecked());
......@@ -61,6 +65,7 @@ CachePolicyPage::CachePolicyPage(QWidget *parent, GuiMode mode)
{
setObjectName(QStringLiteral("Akonadi::CachePolicyPage"));
setPageTitle(i18n("Retrieval"));
d->mode = mode;
d->mUi->setupUi(this);
connect(d->mUi->checkInterval, QOverload<int>::of(&QSpinBox::valueChanged), this, [this](int value) {
......@@ -73,7 +78,13 @@ CachePolicyPage::CachePolicyPage(QWidget *parent, GuiMode mode)
d->slotRetrievalOptionsGroupBoxDisabled(checked);
});
if (mode == AdvancedMode) {
d->mUi->stackedWidget->setCurrentWidget(d->mUi->rawPage);
d->mUi->retrievalOptionsLabel->hide();
d->mUi->retrieveFullMessages->hide();
d->mUi->retrieveOnlyHeaders->hide();
d->mUi->localCacheTimeout->hide();
} else {
d->mUi->localParts->hide();
d->mUi->localPartsLabel->hide();
}
}
......@@ -140,7 +151,7 @@ void CachePolicyPage::save(Collection &collection)
// parts to keep around locally, if the user selected that, or remove
// it otherwise. In "raw" mode we simple use the values from the list
// view.
if (d->mUi->stackedWidget->currentWidget() != d->mUi->rawPage) {
if (d->mode != AdvancedMode) {
if (d->mUi->retrieveFullMessages->isChecked() && !localParts.contains(QLatin1String("RFC822"))) {
localParts.append(QStringLiteral("RFC822"));
} else if (!d->mUi->retrieveFullMessages->isChecked() && localParts.contains(QLatin1String("RFC822"))) {
......
......@@ -13,8 +13,8 @@
<height>461</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QFormLayout" name="verticalLayout_3">
<item row="0" column="1">
<widget class="QCheckBox" name="inherit">
<property name="text">
<string>Use options from parent folder or account</string>
......@@ -27,170 +27,132 @@
</property>
</widget>
</item>
<item>
<item row="1" column="1">
<widget class="QCheckBox" name="syncOnDemand">
<property name="text">
<string>Synchronize when selecting this folder</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Automatically synchronize after:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="checkInterval">
<property name="specialValueText">
<string comment="never check the cache">Never</string>
</property>
<property name="suffix">
<string>minutes</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Synchronize after:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="checkInterval">
<property name="specialValueText">
<string comment="never check the cache">Never</string>
</property>
<property name="suffix">
<string>minutes</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="localPartsLabel">
<property name="text">
<string>Locally cached parts:</string>
</property>
<property name="buddy">
<cstring>localParts</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KEditListWidget" name="localParts">
<property name="minimumSize">
<size>
<width>150</width>
</size>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="buttons">
<set>KEditListWidget::Add|KEditListWidget::Remove</set>
</property>
<property name="title" stdset="0">
<string>Locally Cached Parts</string>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
<item row="4" column="0">
<widget class="QLabel" name="retrievalOptionsLabel">
<property name="text">
<string>Retrieval Options:</string>
</property>
<widget class="QWidget" name="rawPage">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Locally Cached Parts</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="KEditListWidget" name="localParts">
<property name="enabled">
<bool>false</bool>
</property>
<property name="buttons">
<set>KEditListWidget::Add|KEditListWidget::Remove</set>
</property>
<property name="title" stdset="0">
<string>Locally Cached Parts</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="endUserPage">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="retrievalOptionsGroupBox">
<property name="title">
<string>Retrieval Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="retrieveFullMessages">
<property name="text">
<string>Always retrieve full &amp;messages</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="retrieveOnlyHeaders">
<property name="text">
<string>&amp;Retrieve message bodies on demand</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Keep message bodies locally for:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="localCacheTimeout">
<property name="specialValueText">
<string comment="no cache timeout">Forever</string>
</property>
<property name="suffix">
<string>minutes</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="4" column="1">
<widget class="QRadioButton" name="retrieveFullMessages">
<property name="text">
<string>Always retrieve full &amp;messages</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QRadioButton" name="retrieveOnlyHeaders">
<property name="text">
<string>&amp;Retrieve message bodies on demand</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Store emails locally:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="localCacheTimeout">
<property name="minimumSize">
<size>
<width>150</width>
</size>
</property>
<property name="specialValueText">
<string comment="no cache timeout">Forever</string>
</property>
<property name="suffix">
<string>minutes</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="7">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
......
......@@ -93,7 +93,7 @@ void CollectionMaintenancePage::init(const Collection &col)
d->ui.folderTypeLbl->setText(instance.type().name());
} else {
d->ui.folderTypeLbl->hide();
d->ui.filesLayout->labelForField(d->ui.folderTypeLbl)->hide();
d->ui.verticalLayout->labelForField(d->ui.folderTypeLbl)->hide();
}
connect(d->ui.reindexButton, &QPushButton::clicked, this, [this]() {
......@@ -105,7 +105,10 @@ void CollectionMaintenancePage::init(const Collection &col)
const auto resource = Akonadi::AgentManager::self()->instance(col.resource()).type();
if (!col.cachePolicy().localParts().contains(QLatin1String("RFC822"))
&& resource.customProperties().value(QStringLiteral("HasLocalStorage"), QString()) != QLatin1String("true")) {
d->ui.indexingGroup->hide();
d->ui.indexingLabel->hide();
d->ui.enableIndexingChkBox->hide();
d->ui.indexedCountLbl->hide();
d->ui.reindexButton->hide();
}
}
......
......@@ -10,130 +10,92 @@
<height>371</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="filesGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QFormLayout" name="verticalLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Folder type:</string>
</property>
<property name="title">
<string>Files</string>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="folderTypeLbl">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="folderSizeLbl">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>File size:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Total items:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="itemsCountLbl">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Unread items:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="unreadItemsCountLbl">
<property name="text">
<string>unknown</string>
</property>
<layout class="QFormLayout" name="filesLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Folder type:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="folderTypeLbl">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="folderSizeLbl">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Size:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="itemsGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="4" column="0">
<widget class="QLabel" name="indexingLabel">
<property name="text">
<string>Indexing:</string>
</property>
<property name="title">
<string>Items</string>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="enableIndexingChkBox">
<property name="text">
<string>Enable fulltext indexing</string>
</property>
<layout class="QFormLayout" name="itemsLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Total items:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="itemsCountLbl">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Unread items:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="unreadItemsCountLbl">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="indexingGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="5" column="1">
<widget class="QLabel" name="indexedCountLbl">
<property name="text">
<string>Retrieving indexed items count...</string>
</property>
<property name="title">
<string>Indexing</string>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="reindexButton">
<property name="text">
<string>Reindex folder</string>
</property>
<layout class="QVBoxLayout" name="indexingLayout">
<item>
<widget class="QCheckBox" name="enableIndexingChkBox">
<property name="text">
<string>Enable fulltext indexing</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="indexedCountLbl">
<property name="text">
<string>Retrieving indexed items count ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reindexButton">
<property name="text">
<string>Reindex folder</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<item row="7">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......
Markdown is supported
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