Commit 61c430b8 authored by Glen Ditchfield's avatar Glen Ditchfield 🐛
Browse files

Add common config options to printed journal and year

Add a "Print footer" option to the configuration dialogd for the printed
journal and printed year, just like the other printouts with footers.

Add security exclusions (exclude confidential, exclude private) to the
printed year configuration, just like the other printed calendars.
parent bdd983c7
Pipeline #67632 passed with stage
in 5 minutes and 55 seconds
......@@ -155,6 +155,28 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mGeneralGroup">
<property name="title">
<string comment="@title general print settings">General</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="mPrintFooter">
<property name="toolTip">
<string>Print a datetime footer on each page</string>
</property>
<property name="whatsThis">
<string>Check this box if you want to print a small footer on each page that contains the date of the print.</string>
</property>
<property name="text">
<string>Print &amp;Footer</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
......
......@@ -91,83 +91,130 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="mDisplayOptionsGroup">
<widget class="QGroupBox" name="mSecurity">
<property name="title">
<string>General</string>
<string>Security Exclusions</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="mExcludeConfidential">
<property name="whatsThis">
<string>Check this option to exclude confidential events.</string>
</property>
<property name="text">
<string>Exclude &amp;confidential</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="mPagesLabel">
<widget class="QCheckBox" name="mExcludePrivate">
<property name="whatsThis">
<string>Check this option to exclude private events</string>
</property>
<property name="text">
<string>Exclude pri&amp;vate</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="mGeneralGroup">
<property name="title">
<string>General</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="mPagesLabel">
<property name="text">
<string>Num&amp;ber of pages:</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mPages</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mPages"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mSubDaysLabel">
<property name="text">
<string>Show &amp;sub-day events as:</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mSubDays</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mSubDays">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Num&amp;ber of pages:</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mPages</cstring>
<string>Text</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mPages"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mSubDaysLabel">
</item>
<item>
<property name="text">
<string>Show sub-day events as:</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mSubDays">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Text</string>
</property>
</item>
<item>
<property name="text">
<string>Time Boxes</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mHolidaysLabel">
<string>Time Boxes</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mHolidaysLabel">
<property name="text">
<string>Show &amp;holidays as:</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mHolidays</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="mHolidays">
<item>
<property name="text">
<string>Show holidays as:</string>
<string>Text</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="mHolidays">
<item>
<property name="text">
<string>Text</string>
</property>
</item>
<item>
<property name="text">
<string>Time Boxes</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<property name="text">
<string>Time Boxes</string>
</property>
</item>
</widget>
</item>
<item row="3" colspan="2">
<widget class="QCheckBox" name="mPrintFooter">
<property name="toolTip">
<string>Print a datetime footer on each page</string>
</property>
<property name="whatsThis">
<string>Check this box if you want to print a small footer on each page that contains the date of the print.</string>
</property>
<property name="text">
<string>Print &amp;Footer</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
......
......@@ -24,6 +24,7 @@ void CalPrintJournal::readSettingsWidget()
{
auto cfg = dynamic_cast<CalPrintJournalConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mPrintFooter = cfg->mPrintFooter->isChecked();
mFromDate = cfg->mFromDate->date();
mToDate = cfg->mToDate->date();
mUseDateRange = cfg->mRangeJournals->isChecked();
......@@ -34,6 +35,7 @@ void CalPrintJournal::setSettingsWidget()
{
auto cfg = dynamic_cast<CalPrintJournalConfig *>((QWidget *)mConfigWidget);
if (cfg) {
cfg->mPrintFooter->setChecked(mPrintFooter);
cfg->mFromDate->setDate(mFromDate);
cfg->mToDate->setDate(mToDate);
......@@ -109,5 +111,7 @@ void CalPrintJournal::print(QPainter &p, int width, int height)
drawJournal(j, p, x, y, width, height);
}
drawFooter(p, footerBox);
if (mPrintFooter) {
drawFooter(p, footerBox);
}
}
......@@ -24,10 +24,13 @@ void CalPrintYear::readSettingsWidget()
{
auto cfg = dynamic_cast<CalPrintYearConfig *>((QWidget *)mConfigWidget);
if (cfg) {
mPrintFooter = cfg->mPrintFooter->isChecked();
mYear = cfg->mYear->value();
mPages = cfg->mPages->currentText().toInt();
mSubDaysEvents = (cfg->mSubDays->currentIndex() == 0) ? Text : TimeBoxes;
mHolidaysEvents = (cfg->mHolidays->currentIndex() == 0) ? Text : TimeBoxes;
mExcludeConfidential = cfg->mExcludeConfidential->isChecked();
mExcludePrivate = cfg->mExcludePrivate->isChecked();
}
}
......@@ -46,11 +49,14 @@ void CalPrintYear::setSettingsWidget()
}
}
cfg->mPrintFooter->setChecked(mPrintFooter);
cfg->mYear->setValue(mYear);
cfg->mPages->setCurrentIndex(cfg->mPages->findData(mPages));
cfg->mSubDays->setCurrentIndex((mSubDaysEvents == Text) ? 0 : 1);
cfg->mHolidays->setCurrentIndex((mHolidaysEvents == Text) ? 0 : 1);
cfg->mExcludeConfidential->setChecked(mExcludeConfidential);
cfg->mExcludePrivate->setChecked(mExcludePrivate);
}
}
......@@ -62,6 +68,8 @@ void CalPrintYear::loadConfig()
mPages = config.readEntry("Pages", 1);
mSubDaysEvents = config.readEntry("ShowSubDayEventsAs", static_cast<int>(TimeBoxes));
mHolidaysEvents = config.readEntry("ShowHolidaysAs", static_cast<int>(Text));
mExcludeConfidential = config.readEntry("Exclude confidential", true);
mExcludePrivate = config.readEntry("Exclude private", true);
}
setSettingsWidget();
}
......@@ -78,6 +86,8 @@ void CalPrintYear::saveConfig()
config.writeEntry("Pages", mPages);
config.writeEntry("ShowSubDayEventsAs", mSubDaysEvents);
config.writeEntry("ShowHolidaysAs", mHolidaysEvents);
config.writeEntry("Exclude confidential", mExcludeConfidential);
config.writeEntry("Exclude private", mExcludePrivate);
}
}
......@@ -151,7 +161,8 @@ void CalPrintYear::print(QPainter &p, int width, int height)
int xstart = static_cast<int>(j * monthwidth + 0.5);
int xend = static_cast<int>((j + 1) * monthwidth + 0.5);
QRect monthBox(xstart, monthesBox.top(), xend - xstart, monthesBox.height());
drawMonth(p, temp, monthBox, maxdays, mSubDaysEvents, mHolidaysEvents);
drawMonth(p, temp, monthBox, maxdays, mSubDaysEvents, mHolidaysEvents,
mExcludeConfidential, mExcludePrivate);
temp = temp.addMonths(1);
}
......
......@@ -62,7 +62,10 @@ public:
protected:
int mYear;
int mPages;
int mSubDaysEvents, mHolidaysEvents;
int mSubDaysEvents;
int mHolidaysEvents;
bool mExcludeConfidential;
bool mExcludePrivate;
};
class CalPrintYearConfig : public QWidget, public Ui::CalPrintYearConfig_Base
......
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