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
Kontact
Commits
74e093f3
Commit
74e093f3
authored
Jan 26, 2021
by
Laurent Montel
😁
Browse files
run git clang-format
parent
4479206e
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
src/aboutdialog.cpp
View file @
74e093f3
...
...
@@ -13,17 +13,17 @@ using namespace Kontact;
#include <KontactInterface/Plugin>
#include <KAboutData>
#include <KLocalizedString>
#include <QTextBrowser>
#include <KConfigGroup>
#include <QIcon>
#include <KIconLoader>
#include <KLocalizedString>
#include <QIcon>
#include <QTextBrowser>
#include <KSharedConfig>
#include <KWindowConfig>
#include <QBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <KSharedConfig>
#include <KWindowConfig>
AboutDialog
::
AboutDialog
(
KontactInterface
::
Core
*
core
)
:
KPageDialog
(
core
)
...
...
@@ -34,8 +34,7 @@ AboutDialog::AboutDialog(KontactInterface::Core *core)
button
(
QDialogButtonBox
::
Close
)
->
setDefault
(
true
);
setModal
(
false
);
setFaceType
(
KPageDialog
::
List
);
addAboutData
(
i18n
(
"Kontact Container"
),
QStringLiteral
(
"kontact"
),
KAboutData
::
applicationData
());
addAboutData
(
i18n
(
"Kontact Container"
),
QStringLiteral
(
"kontact"
),
KAboutData
::
applicationData
());
QList
<
KontactInterface
::
Plugin
*>
plugins
=
mCore
->
pluginList
();
const
QList
<
KontactInterface
::
Plugin
*>::
ConstIterator
end
=
plugins
.
constEnd
();
QList
<
KontactInterface
::
Plugin
*>::
ConstIterator
it
=
plugins
.
constBegin
();
...
...
@@ -85,8 +84,7 @@ void AboutDialog::addAboutData(const QString &title, const QString &icon, const
text
+=
QLatin1String
(
"</p>"
);
if
(
!
about
.
shortDescription
().
isEmpty
())
{
text
+=
QLatin1String
(
"<p>"
)
+
about
.
shortDescription
()
+
QLatin1String
(
"<br>"
)
+
about
.
copyrightStatement
()
+
QLatin1String
(
"</p>"
);
text
+=
QLatin1String
(
"<p>"
)
+
about
.
shortDescription
()
+
QLatin1String
(
"<br>"
)
+
about
.
copyrightStatement
()
+
QLatin1String
(
"</p>"
);
}
QString
home
=
about
.
homepage
();
...
...
@@ -99,8 +97,7 @@ void AboutDialog::addAboutData(const QString &title, const QString &icon, const
QLabel
*
label
=
new
QLabel
(
text
,
topFrame
);
label
->
setAlignment
(
Qt
::
AlignTop
);
label
->
setOpenExternalLinks
(
true
);
label
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
|
Qt
::
LinksAccessibleByMouse
);
label
->
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
|
Qt
::
TextSelectableByKeyboard
|
Qt
::
LinksAccessibleByMouse
);
topLayout
->
addWidget
(
label
);
auto
*
personView
=
new
QTextBrowser
(
topFrame
);
...
...
@@ -141,7 +138,7 @@ void AboutDialog::addAboutData(const QString &title, const QString &icon, const
text
+=
formatPerson
((
*
it
).
name
(),
(
*
it
).
emailAddress
());
}
}
//krazy:excludeall=style (really need krazy conditional code sections)
//
krazy:excludeall=style (really need krazy conditional code sections)
text
+=
i18n
(
"<br /><br />\
<i>This Free Software product was improved as part of a commercial project:</i>\
...
...
@@ -259,8 +256,7 @@ void AboutDialog::addLicenseText(const KAboutData &about)
if
(
about
.
licenses
().
isEmpty
())
{
return
;
}
QPixmap
pixmap
=
KIconLoader
::
global
()
->
loadIcon
(
QStringLiteral
(
"help-about"
),
KIconLoader
::
Desktop
,
48
);
QPixmap
pixmap
=
KIconLoader
::
global
()
->
loadIcon
(
QStringLiteral
(
"help-about"
),
KIconLoader
::
Desktop
,
48
);
const
QString
title
=
i18n
(
"%1 License"
,
about
.
displayName
());
...
...
src/aboutdialog.h
View file @
74e093f3
...
...
@@ -11,14 +11,16 @@
#include <KPageDialog>
namespace
KontactInterface
{
namespace
KontactInterface
{
class
Core
;
class
Plugin
;
}
class
KAboutData
;
namespace
Kontact
{
namespace
Kontact
{
class
AboutDialog
:
public
KPageDialog
{
Q_OBJECT
...
...
src/iconsidepane.cpp
View file @
74e093f3
...
...
@@ -15,24 +15,25 @@ using namespace Kontact;
#include <KontactInterface/Core>
#include <KontactInterface/Plugin>
#include <QApplication>
#include <KIconLoader>
#include <KLocalizedString>
#include <QAction>
#include <QApplication>
#include <QIcon>
#include <KLocalizedString>
#include <KIconLoader>
#include <QCollator>
#include <QDragEnterEvent>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QLayout>
#include <QPainter>
#include <QSortFilterProxyModel>
#include <QStringListModel>
#include <QStyledItemDelegate>
#include <QTimer>
#include <QCollator>
#include <QLayout>
#include <QPainter>
namespace
Kontact
{
namespace
Kontact
{
class
SelectionModel
:
public
QItemSelectionModel
{
Q_OBJECT
...
...
@@ -73,9 +74,7 @@ class Model : public QStringListModel
{
Q_OBJECT
public:
enum
SpecialRoles
{
PluginName
=
Qt
::
UserRole
};
enum
SpecialRoles
{
PluginName
=
Qt
::
UserRole
};
explicit
Model
(
Navigator
*
parentNavigator
=
nullptr
)
:
QStringListModel
(
parentNavigator
)
...
...
@@ -156,7 +155,8 @@ class SortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit
SortFilterProxyModel
(
QObject
*
parent
=
nullptr
)
:
QSortFilterProxyModel
(
parent
)
explicit
SortFilterProxyModel
(
QObject
*
parent
=
nullptr
)
:
QSortFilterProxyModel
(
parent
)
{
setDynamicSortFilter
(
true
);
sort
(
0
);
...
...
@@ -165,13 +165,11 @@ public:
protected:
bool
lessThan
(
const
QModelIndex
&
left
,
const
QModelIndex
&
right
)
const
override
{
auto
*
leftPlugin
=
static_cast
<
KontactInterface
::
Plugin
*>
(
left
.
internalPointer
());
auto
*
rightPlugin
=
static_cast
<
KontactInterface
::
Plugin
*>
(
right
.
internalPointer
());
auto
*
leftPlugin
=
static_cast
<
KontactInterface
::
Plugin
*>
(
left
.
internalPointer
());
auto
*
rightPlugin
=
static_cast
<
KontactInterface
::
Plugin
*>
(
right
.
internalPointer
());
if
(
leftPlugin
->
weight
()
==
rightPlugin
->
weight
())
{
//Optimize it
//
Optimize it
QCollator
col
;
return
col
.
compare
(
leftPlugin
->
title
(),
rightPlugin
->
title
())
<
0
;
}
...
...
@@ -197,7 +195,7 @@ public:
}
QStyleOptionViewItem
opt
(
*
static_cast
<
const
QStyleOptionViewItem
*>
(
&
option
));
//optionCopy.state |= QStyle::State_Active;
//
optionCopy.state |= QStyle::State_Active;
opt
.
decorationPosition
=
QStyleOptionViewItem
::
Top
;
const
int
height
=
0
;
painter
->
save
();
...
...
@@ -213,15 +211,14 @@ public:
const
int
y
=
opt
.
rect
.
y
()
+
(
opt
.
rect
.
height
()
-
size
-
spacing
-
textHeight
)
/
2
;
opt
.
icon
.
paint
(
painter
,
QRect
(
opt
.
rect
.
x
(),
y
,
opt
.
rect
.
width
(),
size
),
Qt
::
AlignCenter
,
QIcon
::
Normal
,
QIcon
::
On
);
painter
->
drawText
(
QRect
(
opt
.
rect
.
x
(),
y
+
size
+
spacing
,
opt
.
rect
.
width
(),
textHeight
),
index
.
data
(
Qt
::
DisplayRole
).
toString
(),
{
Qt
::
AlignCenter
});
painter
->
drawText
(
QRect
(
opt
.
rect
.
x
(),
y
+
size
+
spacing
,
opt
.
rect
.
width
(),
textHeight
),
index
.
data
(
Qt
::
DisplayRole
).
toString
(),
{
Qt
::
AlignCenter
});
}
else
if
(
mNavigator
->
showIcons
())
{
opt
.
icon
=
index
.
data
(
Qt
::
DecorationRole
).
value
<
QIcon
>
();
const
int
size
=
mNavigator
->
iconSize
()
+
height
;
opt
.
decorationSize
=
QSize
(
size
,
size
);
opt
.
icon
.
paint
(
painter
,
opt
.
rect
,
Qt
::
AlignCenter
,
QIcon
::
Normal
,
QIcon
::
On
);
}
else
if
(
mNavigator
->
showText
())
{
painter
->
drawText
(
opt
.
rect
,
index
.
data
(
Qt
::
DisplayRole
).
toString
(),
{
Qt
::
AlignCenter
});
painter
->
drawText
(
opt
.
rect
,
index
.
data
(
Qt
::
DisplayRole
).
toString
(),
{
Qt
::
AlignCenter
});
}
painter
->
restore
();
}
...
...
@@ -235,8 +232,7 @@ public:
QStyleOptionViewItem
optionCopy
(
*
static_cast
<
const
QStyleOptionViewItem
*>
(
&
option
));
optionCopy
.
decorationPosition
=
QStyleOptionViewItem
::
Top
;
optionCopy
.
decorationSize
=
mNavigator
->
showIcons
()
?
QSize
(
mNavigator
->
iconSize
(),
mNavigator
->
iconSize
())
:
QSize
();
optionCopy
.
decorationSize
=
mNavigator
->
showIcons
()
?
QSize
(
mNavigator
->
iconSize
(),
mNavigator
->
iconSize
())
:
QSize
();
optionCopy
.
textElideMode
=
Qt
::
ElideNone
;
return
QStyledItemDelegate
::
sizeHint
(
optionCopy
,
index
);
}
...
...
@@ -268,34 +264,22 @@ Navigator::Navigator(SidePaneBase *parent)
mShowIconsAction
->
setCheckable
(
true
);
mShowIconsAction
->
setActionGroup
(
viewMode
);
mShowIconsAction
->
setChecked
(
!
mShowText
&&
mShowIcons
);
setHelpText
(
mShowIconsAction
,
i18nc
(
"@info:status"
,
"Show sidebar items with icons and without text"
));
mShowIconsAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar items to have icons without text."
));
setHelpText
(
mShowIconsAction
,
i18nc
(
"@info:status"
,
"Show sidebar items with icons and without text"
));
mShowIconsAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar items to have icons without text."
));
mShowTextAction
=
new
QAction
(
i18nc
(
"@action:inmenu"
,
"Show Text Only"
),
this
);
mShowTextAction
->
setCheckable
(
true
);
mShowTextAction
->
setActionGroup
(
viewMode
);
mShowTextAction
->
setChecked
(
mShowText
&&
!
mShowIcons
);
setHelpText
(
mShowTextAction
,
i18nc
(
"@info:status"
,
"Show sidebar items with text and without icons"
));
mShowTextAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar items to have text without icons."
));
setHelpText
(
mShowTextAction
,
i18nc
(
"@info:status"
,
"Show sidebar items with text and without icons"
));
mShowTextAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar items to have text without icons."
));
mShowBothAction
=
new
QAction
(
i18nc
(
"@action:inmenu"
,
"Show Icons && Text"
),
this
);
mShowBothAction
->
setCheckable
(
true
);
mShowBothAction
->
setActionGroup
(
viewMode
);
mShowBothAction
->
setChecked
(
mShowText
&&
mShowIcons
);
setHelpText
(
mShowBothAction
,
i18nc
(
"@info:status"
,
"Show sidebar items with icons and text"
));
mShowBothAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar items to have icons and text."
));
setHelpText
(
mShowBothAction
,
i18nc
(
"@info:status"
,
"Show sidebar items with icons and text"
));
mShowBothAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar items to have icons and text."
));
auto
*
iconSize
=
new
QActionGroup
(
this
);
connect
(
iconSize
,
&
QActionGroup
::
triggered
,
this
,
&
Navigator
::
slotActionTriggered
);
...
...
@@ -304,42 +288,28 @@ Navigator::Navigator(SidePaneBase *parent)
mBigIconsAction
->
setCheckable
(
true
);
mBigIconsAction
->
setActionGroup
(
iconSize
);
mBigIconsAction
->
setChecked
(
mIconSize
==
KIconLoader
::
SizeLarge
);
setHelpText
(
mBigIconsAction
,
i18nc
(
"@info:status"
,
"Show large size sidebar icons"
));
mBigIconsAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar icons to be extra big."
));
setHelpText
(
mBigIconsAction
,
i18nc
(
"@info:status"
,
"Show large size sidebar icons"
));
mBigIconsAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar icons to be extra big."
));
mNormalIconsAction
=
new
QAction
(
i18nc
(
"@action:inmenu"
,
"Normal Icons"
),
this
);
mNormalIconsAction
->
setCheckable
(
true
);
mNormalIconsAction
->
setActionGroup
(
iconSize
);
mNormalIconsAction
->
setChecked
(
mIconSize
==
KIconLoader
::
SizeMedium
);
setHelpText
(
mNormalIconsAction
,
i18nc
(
"@info:status"
,
"Show normal size sidebar icons"
));
mNormalIconsAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar icons to be normal size."
));
setHelpText
(
mNormalIconsAction
,
i18nc
(
"@info:status"
,
"Show normal size sidebar icons"
));
mNormalIconsAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar icons to be normal size."
));
mSmallIconsAction
=
new
QAction
(
i18nc
(
"@action:inmenu"
,
"Small Icons"
),
this
);
mSmallIconsAction
->
setCheckable
(
true
);
mSmallIconsAction
->
setActionGroup
(
iconSize
);
mSmallIconsAction
->
setChecked
(
mIconSize
==
KIconLoader
::
SizeSmallMedium
);
setHelpText
(
mSmallIconsAction
,
i18nc
(
"@info:status"
,
"Show small size sidebar icons"
));
mSmallIconsAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar icons to be extra small."
));
setHelpText
(
mSmallIconsAction
,
i18nc
(
"@info:status"
,
"Show small size sidebar icons"
));
mSmallIconsAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want the sidebar icons to be extra small."
));
mHideSideBarAction
=
new
QAction
(
i18nc
(
"@action:inmenu"
,
"Hide Sidebar"
),
this
);
mHideSideBarAction
->
setCheckable
(
true
);
mHideSideBarAction
->
setChecked
(
false
);
setHelpText
(
mHideSideBarAction
,
i18nc
(
"@info:status"
,
"Hide the icon sidebar"
));
mHideSideBarAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want to hide the icon sidebar. Press F9 to unhide."
));
mHideSideBarAction
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Choose this option if you want to hide the icon sidebar. Press F9 to unhide."
));
connect
(
mHideSideBarAction
,
&
QAction
::
triggered
,
this
,
&
Navigator
::
slotHideSideBarTriggered
);
auto
*
sep
=
new
QAction
(
this
);
...
...
@@ -348,8 +318,7 @@ Navigator::Navigator(SidePaneBase *parent)
sep2
->
setSeparator
(
true
);
QList
<
QAction
*>
actionList
;
actionList
<<
mShowIconsAction
<<
mShowTextAction
<<
mShowBothAction
<<
sep
<<
mBigIconsAction
<<
mNormalIconsAction
<<
mSmallIconsAction
<<
sep2
actionList
<<
mShowIconsAction
<<
mShowTextAction
<<
mShowBothAction
<<
sep
<<
mBigIconsAction
<<
mNormalIconsAction
<<
mSmallIconsAction
<<
sep2
<<
mHideSideBarAction
;
insertActions
(
nullptr
,
actionList
);
...
...
@@ -367,8 +336,7 @@ Navigator::Navigator(SidePaneBase *parent)
viewport
()
->
setAcceptDrops
(
true
);
setDropIndicatorShown
(
true
);
connect
(
selectionModel
(),
&
QItemSelectionModel
::
currentChanged
,
this
,
&
Navigator
::
slotCurrentChanged
);
connect
(
selectionModel
(),
&
QItemSelectionModel
::
currentChanged
,
this
,
&
Navigator
::
slotCurrentChanged
);
}
void
Navigator
::
updatePlugins
(
const
QList
<
KontactInterface
::
Plugin
*>
&
plugins_
)
...
...
@@ -449,15 +417,12 @@ void Navigator::dragMoveEvent(QDragMoveEvent *event)
const
QModelIndex
dropIndex
=
indexAt
(
event
->
pos
());
if
(
!
dropIndex
.
isValid
()
||
!
(
dropIndex
.
model
()
->
flags
(
dropIndex
)
&
Qt
::
ItemIsEnabled
))
{
if
(
!
dropIndex
.
isValid
()
||
!
(
dropIndex
.
model
()
->
flags
(
dropIndex
)
&
Qt
::
ItemIsEnabled
))
{
event
->
setAccepted
(
false
);
return
;
}
else
{
const
QModelIndex
sourceIndex
=
static_cast
<
const
QSortFilterProxyModel
*>
(
model
())
->
mapToSource
(
dropIndex
);
auto
*
plugin
=
static_cast
<
KontactInterface
::
Plugin
*>
(
sourceIndex
.
internalPointer
());
const
QModelIndex
sourceIndex
=
static_cast
<
const
QSortFilterProxyModel
*>
(
model
())
->
mapToSource
(
dropIndex
);
auto
*
plugin
=
static_cast
<
KontactInterface
::
Plugin
*>
(
sourceIndex
.
internalPointer
());
if
(
!
plugin
->
canDecodeMimeData
(
event
->
mimeData
()))
{
event
->
setAccepted
(
false
);
return
;
...
...
@@ -478,10 +443,8 @@ void Navigator::dropEvent(QDropEvent *event)
if
(
!
dropIndex
.
isValid
())
{
return
;
}
else
{
const
QModelIndex
sourceIndex
=
static_cast
<
const
QSortFilterProxyModel
*>
(
model
())
->
mapToSource
(
dropIndex
);
auto
*
plugin
=
static_cast
<
KontactInterface
::
Plugin
*>
(
sourceIndex
.
internalPointer
());
const
QModelIndex
sourceIndex
=
static_cast
<
const
QSortFilterProxyModel
*>
(
model
())
->
mapToSource
(
dropIndex
);
auto
*
plugin
=
static_cast
<
KontactInterface
::
Plugin
*>
(
sourceIndex
.
internalPointer
());
plugin
->
processDropEvent
(
event
);
}
}
...
...
@@ -505,13 +468,11 @@ void Navigator::showEvent(QShowEvent *event)
void
Navigator
::
slotCurrentChanged
(
const
QModelIndex
&
current
)
{
if
(
!
current
.
isValid
()
||
!
current
.
internalPointer
()
||
!
(
current
.
model
()
->
flags
(
current
)
&
Qt
::
ItemIsEnabled
))
{
if
(
!
current
.
isValid
()
||
!
current
.
internalPointer
()
||
!
(
current
.
model
()
->
flags
(
current
)
&
Qt
::
ItemIsEnabled
))
{
return
;
}
QModelIndex
source
=
static_cast
<
const
QSortFilterProxyModel
*>
(
current
.
model
())
->
mapToSource
(
current
);
QModelIndex
source
=
static_cast
<
const
QSortFilterProxyModel
*>
(
current
.
model
())
->
mapToSource
(
current
);
Q_EMIT
pluginActivated
(
static_cast
<
KontactInterface
::
Plugin
*>
(
source
.
internalPointer
()));
}
...
...
src/iconsidepane.h
View file @
74e093f3
...
...
@@ -14,14 +14,16 @@
#include <QListView>
namespace
KontactInterface
{
namespace
KontactInterface
{
class
Core
;
class
Plugin
;
}
class
QAction
;
namespace
Kontact
{
namespace
Kontact
{
class
Model
;
class
MainWindow
;
class
Navigator
;
...
...
src/kcmkontact.cpp
View file @
74e093f3
...
...
@@ -13,17 +13,16 @@ using namespace Kontact;
#include <KontactInterface/Plugin>
#include <KAboutData>
#include <QComboBox>
#include <KServiceTypeTrader>
#include <KLocalizedString>
#include <KServiceTypeTrader>
#include <QComboBox>
#include <QCheckBox>
#include <QFormLayout>
#include <QHBoxLayout>
#include <QStandardItemModel>
extern
"C"
{
extern
"C"
{
Q_DECL_EXPORT
KCModule
*
create_kontactconfig
(
QWidget
*
parent
,
const
char
*
)
{
return
new
KcmKontact
(
parent
);
...
...
@@ -41,23 +40,21 @@ KcmKontact::KcmKontact(QWidget *parent)
forceStartupPluginCheckBox
->
setObjectName
(
QStringLiteral
(
"kcfg_ForceStartupPlugin"
));
pluginStartupLayout
->
addWidget
(
forceStartupPluginCheckBox
);
mPluginCombo
=
new
QComboBox
(
parent
);
mPluginCombo
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Select the initial plugin to use on each start"
));
mPluginCombo
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Select the plugin from this drop down list to be used as the "
"initial plugin each time Kontact is started. Otherw
is
e
,
Kontact "
"will restore the last active plugin from the previous usage."
)
);
connect
(
mPluginCombo
,
qOverload
<
int
>
(
&
QComboBox
::
currentIndexChanged
),
this
,
[
this
]()
{
Q_EMIT
changed
(
true
);
});
mPluginCombo
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Select the initial plugin to use on each start"
));
mPluginCombo
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Select the plugin from this drop down list to be used as the "
"initial plugin each time Kontact is started. Otherwise, Kontact "
"will restore the last active plugin from the previous usage."
));
connect
(
mPluginCombo
,
qOverload
<
int
>
(
&
QComboBox
::
currentIndexChanged
),
th
is
,
[
this
]()
{
Q_EMIT
changed
(
true
);
});
pluginStartupLayout
->
addWidget
(
mPluginCombo
);
mPluginCombo
->
setEnabled
(
false
);
pluginStartupLayout
->
addStretch
(
1
);
connect
(
forceStartupPluginCheckBox
,
&
QAbstractButton
::
toggled
,
mPluginCombo
,
&
QWidget
::
setEnabled
);
connect
(
forceStartupPluginCheckBox
,
&
QAbstractButton
::
toggled
,
mPluginCombo
,
&
QWidget
::
setEnabled
);
QCheckBox
*
showSideBarCheckbox
=
new
QCheckBox
(
Prefs
::
self
()
->
sideBarOpenItem
()
->
label
(),
this
);
showSideBarCheckbox
->
setObjectName
(
QStringLiteral
(
"kcfg_SideBarOpen"
));
...
...
@@ -71,9 +68,8 @@ void KcmKontact::load()
{
const
KConfigGroup
grp
(
Prefs
::
self
()
->
config
(),
"Plugins"
);
const
KService
::
List
offers
=
KServiceTypeTrader
::
self
()
->
query
(
QStringLiteral
(
"Kontact/Plugin"
),
QStringLiteral
(
"[X-KDE-KontactPluginVersion] == %1"
).
arg
(
KONTACT_PLUGIN_VERSION
));
const
KService
::
List
offers
=
KServiceTypeTrader
::
self
()
->
query
(
QStringLiteral
(
"Kontact/Plugin"
),
QStringLiteral
(
"[X-KDE-KontactPluginVersion] == %1"
).
arg
(
KONTACT_PLUGIN_VERSION
));
int
activeComponent
=
0
;
mPluginCombo
->
clear
();
...
...
@@ -92,11 +88,10 @@ void KcmKontact::load()
if
(
!
grp
.
readEntry
(
pluginName
+
QStringLiteral
(
"Enabled"
),
false
))
{
const
QStandardItemModel
*
qsm
=
qobject_cast
<
QStandardItemModel
*>
(
mPluginCombo
->
model
());
if
(
qsm
)
{
qsm
->
item
(
mPluginCombo
->
count
()
-
1
,
0
)
->
setEnabled
(
false
);
qsm
->
item
(
mPluginCombo
->
count
()
-
1
,
0
)
->
setEnabled
(
false
);
}
}
if
(
service
->
property
(
QStringLiteral
(
"X-KDE-PluginInfo-Name"
)).
toString
()
==
Prefs
::
self
()
->
activePlugin
())
{
activeComponent
=
mPluginList
.
count
()
-
1
;
}
}
...
...
@@ -115,20 +110,15 @@ void KcmKontact::save()
const
KAboutData
*
KcmKontact
::
aboutData
()
const
{
KAboutData
*
about
=
new
KAboutData
(
QStringLiteral
(
"kontactconfig"
),
i18nc
(
"@title"
,
"KDE Kontact"
),
QString
(),
QString
(),
KAboutLicense
::
GPL
,
i18nc
(
"@info:credit"
,
"(c), 2003 Cornelius Schumacher"
));
about
->
addAuthor
(
i18nc
(
"@info:credit"
,
"Cornelius Schumacher"
),
i18nc
(
"@info:credit"
,
"Developer"
),
QStringLiteral
(
"schumacher@kde.org"
));
about
->
addAuthor
(
i18nc
(
"@info:credit"
,
"Tobias Koenig"
),
i18nc
(
"@info:credit"
,
"Developer"
),
QStringLiteral
(
"tokoe@kde.org"
));
KAboutData
*
about
=
new
KAboutData
(
QStringLiteral
(
"kontactconfig"
),
i18nc
(
"@title"
,
"KDE Kontact"
),
QString
(),
QString
(),
KAboutLicense
::
GPL
,
i18nc
(
"@info:credit"
,
"(c), 2003 Cornelius Schumacher"
));
about
->
addAuthor
(
i18nc
(
"@info:credit"
,
"Cornelius Schumacher"
),
i18nc
(
"@info:credit"
,
"Developer"
),
QStringLiteral
(
"schumacher@kde.org"
));
about
->
addAuthor
(
i18nc
(
"@info:credit"
,
"Tobias Koenig"
),
i18nc
(
"@info:credit"
,
"Developer"
),
QStringLiteral
(
"tokoe@kde.org"
));
return
about
;
}
src/kcmkontact.h
View file @
74e093f3
...
...
@@ -13,7 +13,8 @@
#include <KService>
class
QComboBox
;
class
QCheckBox
;
namespace
Kontact
{
namespace
Kontact
{
class
KcmKontact
:
public
KCModule
{
Q_OBJECT
...
...
@@ -25,6 +26,7 @@ public:
void
save
()
override
;
const
KAboutData
*
aboutData
()
const
override
;
private:
KService
::
List
mPluginList
;
QComboBox
*
mPluginCombo
=
nullptr
;
...
...
src/kontactconfiguredialog.cpp
View file @
74e093f3
...
...
@@ -5,11 +5,11 @@
*/
#include "kontactconfiguredialog.h"
#include "kontact_debug.h"
#include <KConfig>
#include <KSharedConfig>
#include <QDBusReply>
#include <QDBusInterface>
#include
"kontact_debug.h"
#include
<QDBusReply>
#include <QPushButton>
using
namespace
Kontact
;
...
...
@@ -31,9 +31,8 @@ KontactConfigureDialog::~KontactConfigureDialog()
void
KontactConfigureDialog
::
emitConfigChanged
()
{
//Add code from plugins which needs to be call when we close kontact dialog config
QDBusInterface
kmailIface
(
QStringLiteral
(
"org.kde.kmail"
),
QStringLiteral
(
"/KMail"
),
QStringLiteral
(
"org.kde.kmail.kmail"
),
QDBusConnection
::
sessionBus
());
// Add code from plugins which needs to be call when we close kontact dialog config
QDBusInterface
kmailIface
(
QStringLiteral
(
"org.kde.kmail"
),
QStringLiteral
(
"/KMail"
),
QStringLiteral
(
"org.kde.kmail.kmail"
),
QDBusConnection
::
sessionBus
());
if
(
kmailIface
.
isValid
())
{
QDBusReply
<
void
>
reply
;
if
(
!
(
reply
=
kmailIface
.
call
(
QStringLiteral
(
"updateConfig"
))).
isValid
())
{
...
...
@@ -42,7 +41,9 @@ void KontactConfigureDialog::emitConfigChanged()
<<
"Error message was:"
<<
err
.
name
()
<<
":
\"
"
<<
err
.
message
()
<<
"
\"
"
;
}
}
QDBusInterface
knotesIface
(
QStringLiteral
(
"org.kde.kontact"
),
QStringLiteral
(
"/KNotes"
),
QStringLiteral
(
"org.kde.kontact.KNotes"
),
QDBusInterface
knotesIface
(
QStringLiteral
(
"org.kde.kontact"
),
QStringLiteral
(
"/KNotes"
),
QStringLiteral
(
"org.kde.kontact.KNotes"
),
QDBusConnection
::
sessionBus
());
if
(
knotesIface
.
isValid
())
{
QDBusReply
<
void
>
reply
;
...
...
src/kontactconfiguredialog.h
View file @
74e093f3
...
...
@@ -9,7 +9,8 @@
#include <ksettings/Dialog>
namespace
Kontact
{
namespace
Kontact
{
class
KontactConfigureDialog
:
public
KSettings
::
Dialog
{
Q_OBJECT
...
...
src/main.cpp
View file @
74e093f3
...
...
@@ -10,21 +10,21 @@
// Use the kdepim version
#include "kontact-version.h"
#include "mainwindow.h"
#include "kontact_debug.h"
#include "mainwindow.h"
#include "prefs.h"
using
namespace
Kontact
;
#include <KontactInterface/PimUniqueApplication>
#include <KontactInterface/Plugin>
#include <KontactInterface/UniqueAppHandler>
#include <KontactInterface/PimUniqueApplication>
#include <KAboutData>
#include <KCrash>
#include <KLocalizedString>
#include <KService>
#include <KServiceTypeTrader>
#include <KWindowSystem>
#include <KCrash>
#include <QCommandLineParser>
#include <QDBusConnection>
...
...
@@ -71,9 +71,8 @@ private:
static
void
listPlugins
()
{
const
KService
::
List
offers
=
KServiceTypeTrader
::
self
()
->
query
(
QStringLiteral
(
"Kontact/Plugin"
),
QStringLiteral
(
"[X-KDE-KontactPluginVersion] == %1"
).
arg
(
KONTACT_PLUGIN_VERSION
));
const
KService
::
List
offers
=
KServiceTypeTrader
::
self
()
->
query
(
QStringLiteral
(
"Kontact/Plugin"
),
QStringLiteral
(
"[X-KDE-KontactPluginVersion] == %1"
).
arg
(
KONTACT_PLUGIN_VERSION
));
const
KService
::
List
::
ConstIterator
end
(
offers
.
end
());
for
(
KService
::
List
::
ConstIterator
it
=
offers
.
begin
();
it
!=
end
;
++
it
)
{
KService
::
Ptr
service
=
(
*
it
);
...
...
@@ -88,16 +87,9 @@ static void listPlugins()
static
void
loadCommandLineOptions
(
QCommandLineParser
*
parser
)
{
parser
->
addOption
(
QCommandLineOption
(
QStringLiteral
(
"module"
),
i18n
(
"Start with a specific Kontact module"
),
QStringLiteral
(
"module"
)));
parser
->
addOption
(
QCommandLineOption
(
QStringLiteral
(
"iconify"
),
i18n
(
"Start in iconified (minimized) mode"
)));
parser
->
addOption
(
QCommandLineOption
(
QStringLiteral
(
"list"
),
i18n
(
"List all possible modules and exit"
)));
parser
->
addOption
(
QCommandLineOption
(
QStringLiteral
(
"module"
),
i18n
(
"Start with a specific Kontact module"
),
QStringLiteral
(
"module"
)));
parser
->
addOption
(
QCommandLineOption
(
QStringLiteral
(
"iconify"
),
i18n
(
"Start in iconified (minimized) mode"
)));
parser
->
addOption
(
QCommandLineOption
(
QStringLiteral
(
"list"
),
i18n
(
"List all possible modules and exit"
)));
}
int
KontactApp
::
activate
(
const
QStringList
&
args
,
const
QString
&
workingDir
)
...
...
@@ -177,8 +169,7 @@ int main(int argc, char **argv)
about
.
addAuthor
(
i18n
(
"Ingo Kl
\303\266
cker"
),
QString
(),
QStringLiteral
(
"kloecker@kde.org"
));
about
.
addAuthor
(
i18n
(
"Sven L
\303\274
ppken"
),
QString
(),
QStringLiteral
(
"sven@kde.org"
));
about
.
addAuthor
(
i18n
(
"Zack Rusin"
),
QString
(),
QStringLiteral
(
"zack@kde.org"
));
about
.
addAuthor
(
i18n
(
"Matthias Hoelzer-Kluepfel"
),
i18n
(
"Original Author"
),
QStringLiteral
(
"mhk@kde.org"
));
about
.
addAuthor
(
i18n
(
"Matthias Hoelzer-Kluepfel"
),
i18n
(
"Original Author"
),
QStringLiteral
(
"mhk@kde.org"
));
about
.
addCredit
(
i18n
(
"Torgny Nyblom"
),
i18n
(
"Git Migration"
),
QStringLiteral
(
"nyblom@kde.org"
));
about
.
setOrganizationDomain
(
"kde.org"
);
app
.
setAboutData
(
about
);
...
...
src/mainwindow.cpp
View file @
74e093f3
This diff is collapsed.
Click to expand it.
src/mainwindow.h
View file @
74e093f3
...
...