void TIconView::setCategory( const QString& path ) { this->clear(); QPixmap _icon = DesktopIcon( "go", KIcon::SizeMedium ); // defaultIcon KServiceGroup::Ptr category = KServiceGroup::group( path ); if ( !category || !category->isValid() ) return; KServiceGroup::List list = category->entries( true, true ); KServiceGroup::List::ConstIterator it = list.begin(); for ( ; it != list.end(); ++it ) { KSycocaEntry *p = ( *it ); if ( p->isType( KST_KService ) ) { // KCModuleInfo(KService*) KCModuleInfo *minfo = new KCModuleInfo( static_cast<KService*>( p ) ); if ( minfo->icon() ) _icon = DesktopIcon( minfo->icon(), KIcon::SizeLarge ); TIconViewItem* _item = new TIconViewItem( this, minfo->moduleName(), _icon, minfo ); connect( this, SIGNAL( executed( QIconViewItem* ) ), this, SLOT( slotItemSelected( QIconViewItem* ) ) ); } // ignore second level subGroups! }
void ModuleView::updatePageIconHeader( KPageWidgetItem * page, bool light ) { if( !page ) { // Page is invalid. Probably means we have a race condition during closure of everyone so do nothing return; } KCModuleProxy * moduleProxy = d->mPages.value( page ); KCModuleInfo * moduleInfo = d->mModules.value( page ); if( !moduleInfo ) { // Seems like we have some form of a race condition going on here... return; } page->setHeader( moduleInfo->comment() ); page->setIcon( QIcon::fromTheme( moduleInfo->icon() ) ); if( light ) { return; } if( moduleProxy && moduleProxy->realModule()->useRootOnlyMessage() ) { page->setHeader( "<b>" + moduleInfo->comment() + "</b><br><i>" + moduleProxy->realModule()->rootOnlyMessage() + "</i>" ); page->setIcon( KDE::icon( moduleInfo->icon(), QStringList() << "dialog-warning" ) ); } }
void Navigator::insertKCMDocs( const QString &name, NavigatorItem *topItem, const QString &type ) { kDebug(1400) << "Requested KCM documents for ID" << name; QString systemsettingskontrolconstraint = "[X-KDE-System-Settings-Parent-Category] != ''"; QString konquerorcontrolconstraint = "[X-KDE-PluginKeyword] == 'khtml_general'\ or [X-KDE-PluginKeyword] == 'performance'\ or [X-KDE-PluginKeyword] == 'bookmarks'"; QString filemanagercontrolconstraint = "[X-KDE-PluginKeyword] == 'behavior'\ or [X-KDE-PluginKeyword] == 'dolphinviewmodes'\ or [X-KDE-PluginKeyword] == 'dolphinnavigation'\ or [X-KDE-PluginKeyword] == 'dolphinservices'\ or [X-KDE-PluginKeyword] == 'dolphingeneral'\ or [X-KDE-PluginKeyword] == 'trash'"; QString browsercontrolconstraint = "[X-KDE-PluginKeyword] == 'khtml_behavior'\ or [X-KDE-PluginKeyword] == 'proxy'\ or [X-KDE-PluginKeyword] == 'khtml_appearance'\ or [X-KDE-PluginKeyword] == 'khtml_filter'\ or [X-KDE-PluginKeyword] == 'cache'\ or [X-KDE-PluginKeyword] == 'cookie'\ or [X-KDE-PluginKeyword] == 'useragent'\ or [X-KDE-PluginKeyword] == 'khtml_java_js'\ or [X-KDE-PluginKeyword] == 'khtml_plugins'"; /* missing in browsercontrolconstraint History no X-KDE-PluginKeyword in kcmhistory.desktop */ QString othercontrolconstraint = "[X-KDE-PluginKeyword] == 'cgi'"; KService::List list; if ( type == QString("kcontrol") ) { list = KServiceTypeTrader::self()->query( "KCModule", systemsettingskontrolconstraint ); } else if ( type == QString("konquerorcontrol") ) { list = KServiceTypeTrader::self()->query( "KCModule", konquerorcontrolconstraint ); } else if ( type == QString("browsercontrol") ) { list = KServiceTypeTrader::self()->query( "KCModule", browsercontrolconstraint ); } else if ( type == QString("filemanagercontrol") ) { list = KServiceTypeTrader::self()->query( "KCModule", filemanagercontrolconstraint ); } else if ( type == QString("othercontrol") ) { list = KServiceTypeTrader::self()->query( "KCModule", othercontrolconstraint ); } else if ( type == QString("kinfocenter") ) { list = KServiceTypeTrader::self()->query( "KCModule", "[X-KDE-ParentApp] == 'kinfocenter'" ); } for ( KService::List::const_iterator it = list.constBegin(); it != list.constEnd(); ++it ) { KService::Ptr s = (*it); KCModuleInfo m = KCModuleInfo(s); QString desktopFile = KStandardDirs::locate( "services", m.fileName() ); createItemFromDesktopFile( topItem, desktopFile ); } topItem->sortChildren( 0, Qt::AscendingOrder /* ascending */ ); }
void ModuleView::moduleHelp() { KCModuleInfo * activeModule = d->mModules.value( d->mPageWidget->currentPage() ); if( !activeModule ) { return; } QString docPath = activeModule->docPath(); if( docPath.isEmpty() ) { return; } QUrl url( "help:/"+docPath ); QProcess::startDetached("khelpcenter", QStringList() << url.url()); }
void TIconView::setCategory( const QString& path ) { clear(); QPixmap _icon = DesktopIcon( "go", KIcon::SizeMedium ); // defaultIcon KServiceGroup::Ptr category = KServiceGroup::group( path ); if ( !category || !category->isValid() ) return; TIconViewItem *_item; KServiceGroup::List list = category->entries( true, true ); KServiceGroup::List::ConstIterator it = list.begin(); KServiceGroup::List::ConstIterator end = list.end(); for ( ; it != end; ++it ) { KSycocaEntry *p = ( *it ); if ( p->isType( KST_KService ) ) { // KCModuleInfo(KService*) KCModuleInfo *minfo = new KCModuleInfo( static_cast<KService*>( p ) ); if (showExtras == false) { KSimpleConfig cfg(minfo->fileName()); cfg.setDesktopGroup(); if ( cfg.readEntry("Categories").contains("X-KDE-tasma-extra") ) continue; } if ( minfo->icon() ) _icon = DesktopIcon( minfo->icon(), KIcon::SizeLarge ); _item = new TIconViewItem( this, minfo->moduleName(), _icon, minfo , minfo->comment()); } // ignore second level subGroups! } list.clear(); }
void Dialog::createDialogFromServices() { // read .setdlg files QString setdlgpath = locate("appdata", KGlobal::instance()->instanceName() + ".setdlg"); QStringList setdlgaddon = KGlobal::dirs()->findAllResources("appdata", "ksettingsdialog/*.setdlg"); if(!setdlgpath.isNull()) parseGroupFile(setdlgpath); if(setdlgaddon.size() > 0) for(QStringList::ConstIterator it = setdlgaddon.begin(); it != setdlgaddon.end(); ++it) parseGroupFile(*it); // now we process the KCModule services for(QValueList< KService::Ptr >::ConstIterator it = d->services.begin(); it != d->services.end(); ++it) { // we create the KCModuleInfo KCModuleInfo *info = new KCModuleInfo(*it); QString parentid; QVariant tmp = info->service()->property("X-KDE-CfgDlgHierarchy", QVariant::String); if(tmp.isValid()) parentid = tmp.toString(); d->pagetree.insert(info, parentid); } // At this point d->pagetree holds a nice structure of the pages we want // to show. It's not going to change anymore so we can sort it now. d->pagetree.sort(); int dialogface = KJanusWidget::IconList; if(d->pagetree.needTree()) dialogface = KJanusWidget::TreeList; else if(d->pagetree.singleChild()) dialogface = KJanusWidget::Plain; kdDebug(700) << "creating KCMultiDialog" << endl; d->dlg = new KCMultiDialog(dialogface, i18n("Configure"), d->parentwidget); if(dialogface == KJanusWidget::TreeList) d->dlg->setShowIconsInTreeList(true); // TODO: Don't show the reset button until the issue with the // KPluginSelector::load() method is solved. // Problem: // KCMultiDialog::show() call KCModule::load() to reset all KCMs // (KPluginSelector::load() resets all plugin selections and all plugin // KCMs). // The reset button calls KCModule::load(), too but in this case we want the // KPluginSelector to only reset the current visible plugin KCM and not // touch the plugin selections. // I have no idea how to check that in KPluginSelector::load()... // d->dlg->showButton( KDialogBase::User1, true ); if(!d->staticlistview) d->dlg->addButtonBelowList(i18n("Select Components..."), this, SLOT(configureTree())); connect(d->dlg, SIGNAL(okClicked()), Dispatcher::self(), SLOT(syncConfiguration())); connect(d->dlg, SIGNAL(applyClicked()), Dispatcher::self(), SLOT(syncConfiguration())); connect(d->dlg, SIGNAL(configCommitted(const QCString &)), Dispatcher::self(), SLOT(reparseConfiguration(const QCString &))); d->pagetree.addToDialog(d->dlg); if(dialogface == KJanusWidget::TreeList) d->dlg->unfoldTreeList(); }