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
KOrganizer
Commits
7003dd4a
Commit
7003dd4a
authored
Jul 16, 2020
by
Laurent Montel
😁
Browse files
Byebye KPrefsModule
parent
2c60123a
Pipeline
#27380
passed with stage
in 25 minutes and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/prefs/koprefsdialog.cpp
View file @
7003dd4a
...
...
@@ -81,6 +81,7 @@
#include <KAboutData>
#include <QButtonGroup>
#include <QFontDialog>
#include <QCheckBox>
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/FeedbackConfigWidget>
...
...
@@ -939,7 +940,7 @@ void FontPreviewButton::selectFont()
}
KOPrefsDialogColorsAndFonts
::
KOPrefsDialogColorsAndFonts
(
QWidget
*
parent
)
:
K
PIM
::
KPrefsModule
(
KOPrefs
::
instance
(),
parent
)
:
K
CModule
(
parent
)
{
QBoxLayout
*
topTopLayout
=
new
QVBoxLayout
(
this
);
QTabWidget
*
tabWidget
=
new
QTabWidget
(
this
);
...
...
@@ -1070,41 +1071,29 @@ KOPrefsDialogColorsAndFonts::KOPrefsDialogColorsAndFonts(QWidget *parent)
mTimeBarFontButton
=
new
FontPreviewButton
(
KOPrefs
::
instance
()
->
agendaTimeLabelsFontItem
()
->
label
(),
this
);
mTimeBarFontButton
->
setPreviewText
(
QLocale
().
toString
(
QTime
(
12
,
34
),
QLocale
::
ShortFormat
));
fontLayout
->
addWidget
(
mTimeBarFontButton
);
// KPIM::KPrefsWidFont *timeBarFont
// = addWidFont(KOPrefs::instance()->agendaTimeLabelsFontItem(), fontFrame,
// QLocale().toString(QTime(12, 34), QLocale::ShortFormat));
connect
(
mTimeBarFontButton
,
&
FontPreviewButton
::
changed
,
this
,
&
KOPrefsDialogColorsAndFonts
::
slotConfigChanged
);
mMonthViewFont
=
new
FontPreviewButton
(
KOPrefs
::
instance
()
->
monthViewFontItem
()
->
label
(),
this
);
mMonthViewFont
->
setPreviewText
(
QLocale
().
toString
(
QTime
(
12
,
34
),
QLocale
::
ShortFormat
)
+
QLatin1Char
(
' '
)
+
i18nc
(
"@label"
,
"Event text"
));
fontLayout
->
addWidget
(
mMonthViewFont
);
// KPIM::KPrefsWidFont *monthViewFont
// = addWidFont(KOPrefs::instance()->monthViewFontItem(), fontFrame,
// QLocale().toString(QTime(12, 34), QLocale::ShortFormat) + QLatin1Char(' ')
// +i18nc("@label", "Event text"));
connect
(
mMonthViewFont
,
&
FontPreviewButton
::
changed
,
this
,
&
KOPrefsDialogColorsAndFonts
::
slotConfigChanged
);
mAgendaViewFont
=
new
FontPreviewButton
(
KOPrefs
::
instance
()
->
agendaViewFontItem
()
->
label
(),
this
);
mAgendaViewFont
->
setPreviewText
(
i18nc
(
"@label"
,
"Event text"
));
fontLayout
->
addWidget
(
mAgendaViewFont
);
connect
(
mAgendaViewFont
,
&
FontPreviewButton
::
changed
,
this
,
&
KOPrefsDialogColorsAndFonts
::
slotConfigChanged
);
// KPIM::KPrefsWidFont *agendaViewFont
// = addWidFont(KOPrefs::instance()->agendaViewFontItem(), fontFrame,
// i18nc("@label", "Event text"));
mMarcusBainsFont
=
new
FontPreviewButton
(
KOPrefs
::
instance
()
->
agendaMarcusBainsLineFontItem
()
->
label
(),
this
);
mMarcusBainsFont
->
setPreviewText
(
QLocale
().
toString
(
QTime
(
12
,
34
,
23
),
QLocale
::
ShortFormat
));
fontLayout
->
addWidget
(
mMarcusBainsFont
);
// KPIM::KPrefsWidFont *marcusBainsFont
// = addWidFont(KOPrefs::instance()->agendaMarcusBainsLineFontItem(), fontFrame,
// QLocale().toString(QTime(12, 34, 23), QLocale::ShortFormat));
connect
(
mMarcusBainsFont
,
&
FontPreviewButton
::
changed
,
this
,
&
KOPrefsDialogColorsAndFonts
::
slotConfigChanged
);
fontLayout
->
addStretch
(
1
);
load
();
}
void
KOPrefsDialogColorsAndFonts
::
usrWriteConfig
()
void
KOPrefsDialogColorsAndFonts
::
save
()
{
QHash
<
QString
,
QColor
>::
const_iterator
i
=
mCategoryDict
.
constBegin
();
while
(
i
!=
mCategoryDict
.
constEnd
())
{
...
...
@@ -1134,7 +1123,7 @@ void KOPrefsDialogColorsAndFonts::usrWriteConfig()
KOPrefs
::
instance
()
->
setAgendaMarcusBainsLineFont
(
mMarcusBainsFont
->
font
());
}
void
KOPrefsDialogColorsAndFonts
::
usrReadConfig
()
void
KOPrefsDialogColorsAndFonts
::
load
()
{
updateCategories
();
updateResources
();
...
...
@@ -1172,7 +1161,7 @@ void KOPrefsDialogColorsAndFonts::updateCategories()
void
KOPrefsDialogColorsAndFonts
::
setCategoryColor
()
{
mCategoryDict
.
insert
(
mCategoryCombo
->
currentText
(),
mCategoryButton
->
color
());
slot
Wid
Changed
();
slot
Config
Changed
();
}
void
KOPrefsDialogColorsAndFonts
::
updateCategoryColor
()
...
...
@@ -1204,7 +1193,7 @@ void KOPrefsDialogColorsAndFonts::setResourceColor()
return
;
}
mResourceDict
.
insert
(
id
,
mResourceButton
->
color
());
slot
Wid
Changed
();
slot
Config
Changed
();
}
void
KOPrefsDialogColorsAndFonts
::
updateResourceColor
()
...
...
@@ -1226,6 +1215,11 @@ void KOPrefsDialogColorsAndFonts::updateResourceColor()
mResourceButton
->
setColor
(
color
);
}
void
KOPrefsDialogColorsAndFonts
::
slotConfigChanged
()
{
Q_EMIT
markAsChanged
();
}
extern
"C"
{
Q_DECL_EXPORT
KCModule
*
create_korganizerconfigcolorsandfonts
(
QWidget
*
parent
,
const
char
*
)
...
...
src/prefs/koprefsdialog.h
View file @
7003dd4a
...
...
@@ -28,11 +28,13 @@
#include "kcm_korganizer_export.h"
#include "kcmdesignerfields.h"
#include <QSet>
#include <Libkdepim/KPrefsDialog>
#include <KColorButton>
class
QPushButton
;
class
QComboBox
;
class
QCheckBox
;
class
QGroupBox
;
class
QLineEdit
;
namespace
Ui
{
class
KOGroupwarePrefsPage
;
...
...
@@ -81,15 +83,14 @@ private:
QLabel
*
mPreview
=
nullptr
;
};
class
KCM_KORGANIZER_EXPORT
KOPrefsDialogColorsAndFonts
:
public
K
PIM
::
KPrefs
Module
class
KCM_KORGANIZER_EXPORT
KOPrefsDialogColorsAndFonts
:
public
K
C
Module
{
Q_OBJECT
public:
explicit
KOPrefsDialogColorsAndFonts
(
QWidget
*
parent
);
protected:
void
usrWriteConfig
()
override
;
void
usrReadConfig
()
override
;
void
save
()
override
;
void
load
()
override
;
private
Q_SLOTS
:
void
useSystemColorToggle
(
bool
useSystemColor
);
...
...
@@ -104,6 +105,7 @@ protected Q_SLOTS:
void
updateResourceColor
();
private:
void
slotConfigChanged
();
QComboBox
*
mCategoryCombo
=
nullptr
;
KColorButton
*
mCategoryButton
=
nullptr
;
QHash
<
QString
,
QColor
>
mCategoryDict
;
...
...
Write
Preview
Supports
Markdown
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