27 using namespace Kontact;
29 #include <KontactInterface/Plugin>
33 #include <KServiceTypeTrader>
36 #include <QHBoxLayout>
37 #include <QVBoxLayout>
43 KComponentData inst(
"kcmkontact" );
51 QBoxLayout *topLayout =
new QVBoxLayout(
this );
52 QBoxLayout *pluginStartupLayout =
new QHBoxLayout();
53 topLayout->addItem( pluginStartupLayout );
54 topLayout->addStretch();
57 addWidBool(
Prefs::self()->forceStartupPluginItem(),
this );
58 pluginStartupLayout->addWidget( forceStartupPlugin->
checkBox() );
64 pluginStartupLayout->addWidget( selection->
comboBox() );
65 selection->
comboBox()->setEnabled(
false );
67 pluginStartupLayout->addStretch( 1 );
69 connect( forceStartupPlugin->
checkBox(), SIGNAL(toggled(
bool)),
70 selection->
comboBox(), SLOT(setEnabled(
bool)) );
76 KAboutData *about =
new KAboutData(
78 ki18nc(
"@title",
"KDE Kontact" ),
81 KAboutData::License_GPL,
82 ki18nc(
"@info:credit",
"(c), 2003 Cornelius Schumacher" ) );
84 about->addAuthor( ki18nc(
"@info:credit",
"Cornelius Schumacher" ),
85 ki18nc(
"@info:credit",
"Developer" ),
86 "schumacher@kde.org" );
87 about->addAuthor( ki18nc(
"@info:credit",
"Tobias Koenig" ),
88 ki18nc(
"@info:credit",
"Developer" ),
98 mPluginCombo->setToolTip(
99 i18nc(
"@info:tooltip",
"Select the initial plugin to use on each start" ) );
100 mPluginCombo->setWhatsThis(
101 i18nc(
"@info:whatsthis",
102 "Select the plugin from this drop down list to be used as the "
103 "initial plugin each time Kontact is started. Otherwise, Kontact "
104 "will restore the last active plugin from the previous usage." ) );
105 connect( mPluginCombo, SIGNAL(currentIndexChanged(
int)), SIGNAL(
changed()) );
114 const KService::List offers = KServiceTypeTrader::self()->query(
115 QString::fromLatin1(
"Kontact/Plugin" ),
116 QString::fromLatin1(
"[X-KDE-KontactPluginVersion] == %1" ).arg( KONTACT_PLUGIN_VERSION ) );
118 int activeComponent = 0;
119 mPluginCombo->clear();
121 KService::List::ConstIterator end( offers.end() );
122 for ( KService::List::ConstIterator it = offers.begin(); it != end; ++it ) {
123 KService::Ptr service = *it;
125 QVariant var = service->property( QLatin1String(
"X-KDE-KontactPluginHasPart") );
126 if ( var.isValid() && var.toBool() == false ) {
129 mPluginCombo->addItem( service->name() );
130 mPluginList.append( service );
132 if ( service->property( QLatin1String(
"X-KDE-PluginInfo-Name") ).toString() == mItem->value() ) {
133 activeComponent = mPluginList.count() - 1;
137 mPluginCombo->setCurrentIndex( activeComponent );
142 KService::Ptr ptr = mPluginList.at( mPluginCombo->currentIndex() );
143 mItem->setValue( ptr->property( QLatin1String(
"X-KDE-PluginInfo-Name") ).toString() );
149 widgets.append( mPluginCombo );
154 #include "kcmkontact.moc"
virtual const KAboutData * aboutData() const
QList< QWidget * > widgets() const
virtual void addWid(KPrefsWid *)
KCModule * create_kontactconfig(QWidget *parent, const char *)
KComboBox * comboBox() const
PluginSelection(KConfigSkeleton::ItemString *item, QWidget *parent)
KcmKontact(const KComponentData &inst, QWidget *parent=0)