Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Calendar Support
Commits
e7e7e388
Commit
e7e7e388
authored
Jul 21, 2021
by
Glen Ditchfield
🐛
Browse files
Insert a parent class for CalPrintDay and CalPrintWeek config options
parent
3bf4c90b
Pipeline
#71292
failed with stage
in 4 minutes and 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/printing/calprintdefaultplugins.cpp
View file @
e7e7e388
...
...
@@ -632,12 +632,64 @@ void CalPrintIncidence::print(QPainter &p, int width, int height)
p
.
setFont
(
oldFont
);
}
/**************************************************************
* Print Timetables
**************************************************************/
CalPrintTimetable
::
CalPrintTimetable
()
:
CalPrintPluginBase
()
{
}
CalPrintTimetable
::~
CalPrintTimetable
()
{
}
void
CalPrintTimetable
::
doLoadConfig
()
{
CalPrintPluginBase
::
doLoadConfig
();
if
(
mConfig
)
{
KConfigGroup
grp
(
mConfig
,
groupName
());
QDate
dt
=
QDate
::
currentDate
();
// any valid QDate will do
QTime
tm1
(
dayStart
());
QDateTime
startTm
(
dt
,
tm1
);
QDateTime
endTm
(
dt
,
tm1
.
addSecs
(
12
*
60
*
60
));
mStartTime
=
grp
.
readEntry
(
"Start time"
,
startTm
).
time
();
mEndTime
=
grp
.
readEntry
(
"End time"
,
endTm
).
time
();
mIncludeDescription
=
grp
.
readEntry
(
"Include description"
,
false
);
mIncludeCategories
=
grp
.
readEntry
(
"Include categories"
,
false
);
mIncludeTodos
=
grp
.
readEntry
(
"Include todos"
,
false
);
mIncludeAllEvents
=
grp
.
readEntry
(
"Include all events"
,
false
);
mSingleLineLimit
=
grp
.
readEntry
(
"Single line limit"
,
false
);
mExcludeTime
=
grp
.
readEntry
(
"Exclude time"
,
false
);
}
}
void
CalPrintTimetable
::
doSaveConfig
()
{
if
(
mConfig
)
{
KConfigGroup
grp
(
mConfig
,
groupName
());
QDateTime
dt
=
QDateTime
::
currentDateTime
();
// any valid QDateTime will do
dt
.
setTime
(
mStartTime
);
grp
.
writeEntry
(
"Start time"
,
dt
);
dt
.
setTime
(
mEndTime
);
grp
.
writeEntry
(
"End time"
,
dt
);
grp
.
writeEntry
(
"Include description"
,
mIncludeDescription
);
grp
.
writeEntry
(
"Include categories"
,
mIncludeCategories
);
grp
.
writeEntry
(
"Include todos"
,
mIncludeTodos
);
grp
.
writeEntry
(
"Include all events"
,
mIncludeAllEvents
);
grp
.
writeEntry
(
"Single line limit"
,
mSingleLineLimit
);
grp
.
writeEntry
(
"Exclude time"
,
mExcludeTime
);
}
CalPrintPluginBase
::
doSaveConfig
();
}
/**************************************************************
* Print Day
**************************************************************/
CalPrintDay
::
CalPrintDay
()
:
CalPrint
PluginBas
e
()
:
CalPrint
Timetabl
e
()
{
}
...
...
@@ -712,22 +764,10 @@ void CalPrintDay::setSettingsWidget()
void
CalPrintDay
::
doLoadConfig
()
{
CalPrint
PluginBas
e
::
doLoadConfig
();
CalPrint
Timetabl
e
::
doLoadConfig
();
if
(
mConfig
)
{
KConfigGroup
grp
(
mConfig
,
groupName
());
QDate
dt
=
QDate
::
currentDate
();
// any valid QDate will do
QTime
tm1
(
dayStart
());
QDateTime
startTm
(
dt
,
tm1
);
QDateTime
endTm
(
dt
,
tm1
.
addSecs
(
12
*
60
*
60
));
mStartTime
=
grp
.
readEntry
(
"Start time"
,
startTm
).
time
();
mEndTime
=
grp
.
readEntry
(
"End time"
,
endTm
).
time
();
mIncludeDescription
=
grp
.
readEntry
(
"Include description"
,
false
);
mIncludeCategories
=
grp
.
readEntry
(
"Include categories"
,
false
);
mIncludeTodos
=
grp
.
readEntry
(
"Include todos"
,
false
);
mIncludeAllEvents
=
grp
.
readEntry
(
"Include all events"
,
false
);
mDayPrintType
=
static_cast
<
eDayPrintType
>
(
grp
.
readEntry
(
"Print type"
,
static_cast
<
int
>
(
Timetable
)));
mSingleLineLimit
=
grp
.
readEntry
(
"Single line limit"
,
false
);
mExcludeTime
=
grp
.
readEntry
(
"Exclude time"
,
false
);
}
setSettingsWidget
();
}
...
...
@@ -737,20 +777,9 @@ void CalPrintDay::doSaveConfig()
readSettingsWidget
();
if
(
mConfig
)
{
KConfigGroup
grp
(
mConfig
,
groupName
());
QDateTime
dt
=
QDateTime
::
currentDateTime
();
// any valid QDateTime will do
dt
.
setTime
(
mStartTime
);
grp
.
writeEntry
(
"Start time"
,
dt
);
dt
.
setTime
(
mEndTime
);
grp
.
writeEntry
(
"End time"
,
dt
);
grp
.
writeEntry
(
"Include description"
,
mIncludeDescription
);
grp
.
writeEntry
(
"Include categories"
,
mIncludeCategories
);
grp
.
writeEntry
(
"Include todos"
,
mIncludeTodos
);
grp
.
writeEntry
(
"Include all events"
,
mIncludeAllEvents
);
grp
.
writeEntry
(
"Print type"
,
int
(
mDayPrintType
));
grp
.
writeEntry
(
"Single line limit"
,
mSingleLineLimit
);
grp
.
writeEntry
(
"Exclude time"
,
mExcludeTime
);
}
CalPrint
PluginBas
e
::
doSaveConfig
();
CalPrint
Timetabl
e
::
doSaveConfig
();
}
void
CalPrintDay
::
setDateRange
(
const
QDate
&
from
,
const
QDate
&
to
)
...
...
@@ -857,7 +886,7 @@ void CalPrintDay::print(QPainter &p, int width, int height)
**************************************************************/
CalPrintWeek
::
CalPrintWeek
()
:
CalPrint
PluginBas
e
()
:
CalPrint
Timetabl
e
()
{
}
...
...
@@ -930,26 +959,15 @@ void CalPrintWeek::setSettingsWidget()
cfg
->
mExcludeConfidential
->
setChecked
(
mExcludeConfidential
);
cfg
->
mExcludePrivate
->
setChecked
(
mExcludePrivate
);
}
CalPrintTimetable
::
setSettingsWidget
();
}
void
CalPrintWeek
::
doLoadConfig
()
{
CalPrint
PluginBas
e
::
doLoadConfig
();
CalPrint
Timetabl
e
::
doLoadConfig
();
if
(
mConfig
)
{
KConfigGroup
grp
(
mConfig
,
groupName
());
QDate
dt
=
QDate
::
currentDate
();
// any valid QDate will do
QTime
tm1
(
dayStart
());
QDateTime
startTm
(
dt
,
tm1
);
QDateTime
endTm
(
dt
,
tm1
.
addSecs
(
43200
));
mStartTime
=
grp
.
readEntry
(
"Start time"
,
startTm
).
time
();
mEndTime
=
grp
.
readEntry
(
"End time"
,
endTm
).
time
();
mSingleLineLimit
=
grp
.
readEntry
(
"Single line limit"
,
false
);
mIncludeTodos
=
grp
.
readEntry
(
"Include todos"
,
false
);
mIncludeAllEvents
=
grp
.
readEntry
(
"Include all events"
,
false
);
mWeekPrintType
=
(
eWeekPrintType
)(
grp
.
readEntry
(
"Print type"
,
(
int
)
Filofax
));
mIncludeDescription
=
grp
.
readEntry
(
"Include Description"
,
false
);
mIncludeCategories
=
grp
.
readEntry
(
"Include categories"
,
false
);
mExcludeTime
=
grp
.
readEntry
(
"Exclude Time"
,
false
);
}
setSettingsWidget
();
}
...
...
@@ -959,20 +977,9 @@ void CalPrintWeek::doSaveConfig()
readSettingsWidget
();
if
(
mConfig
)
{
KConfigGroup
grp
(
mConfig
,
groupName
());
QDateTime
dt
=
QDateTime
::
currentDateTime
();
// any valid QDateTime will do
dt
.
setTime
(
mStartTime
);
grp
.
writeEntry
(
"Start time"
,
dt
);
dt
.
setTime
(
mEndTime
);
grp
.
writeEntry
(
"End time"
,
dt
);
grp
.
writeEntry
(
"Single line limit"
,
mSingleLineLimit
);
grp
.
writeEntry
(
"Include todos"
,
mIncludeTodos
);
grp
.
writeEntry
(
"Include all events"
,
mIncludeAllEvents
);
grp
.
writeEntry
(
"Print type"
,
int
(
mWeekPrintType
));
grp
.
writeEntry
(
"Include Description"
,
mIncludeDescription
);
grp
.
writeEntry
(
"Include categories"
,
mIncludeCategories
);
grp
.
writeEntry
(
"Exclude Time"
,
mExcludeTime
);
}
CalPrint
PluginBas
e
::
doSaveConfig
();
CalPrint
Timetabl
e
::
doSaveConfig
();
}
QPageLayout
::
Orientation
CalPrintWeek
::
defaultOrientation
()
const
...
...
src/printing/calprintdefaultplugins.h
View file @
e7e7e388
...
...
@@ -74,7 +74,25 @@ protected:
bool
mShowAttachments
;
};
class
CalPrintDay
:
public
CalPrintPluginBase
class
CalPrintTimetable
:
public
CalPrintPluginBase
{
public:
CalPrintTimetable
();
~
CalPrintTimetable
()
override
;
void
doLoadConfig
()
override
;
void
doSaveConfig
()
override
;
protected:
QTime
mStartTime
,
mEndTime
;
bool
mSingleLineLimit
;
bool
mIncludeTodos
;
bool
mIncludeDescription
;
bool
mIncludeCategories
;
bool
mIncludeAllEvents
;
bool
mExcludeTime
;
};
class
CalPrintDay
:
public
CalPrintTimetable
{
public:
CalPrintDay
();
...
...
@@ -116,16 +134,9 @@ public:
protected:
enum
eDayPrintType
{
Filofax
=
0
,
Timetable
,
SingleTimetable
}
mDayPrintType
;
QTime
mStartTime
,
mEndTime
;
bool
mIncludeDescription
;
bool
mIncludeCategories
;
bool
mSingleLineLimit
;
bool
mIncludeTodos
;
bool
mIncludeAllEvents
;
bool
mExcludeTime
;
};
class
CalPrintWeek
:
public
CalPrint
PluginBas
e
class
CalPrintWeek
:
public
CalPrint
Timetabl
e
{
public:
CalPrintWeek
();
...
...
@@ -173,13 +184,6 @@ public:
protected:
enum
eWeekPrintType
{
Filofax
=
0
,
Timetable
,
SplitWeek
}
mWeekPrintType
;
QTime
mStartTime
,
mEndTime
;
bool
mSingleLineLimit
;
bool
mIncludeTodos
;
bool
mIncludeDescription
;
bool
mIncludeCategories
;
bool
mIncludeAllEvents
;
bool
mExcludeTime
;
};
class
CalPrintMonth
:
public
CalPrintPluginBase
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment