KDevelop API Documentation

buildtools/pascal/service.cpp

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2001-2002 by Bernd Gehrmann * 00003 * bernd@kdevelop.org * 00004 * Copyright (C) 2003 Alexander Dymo * 00005 * cloudtemple@mksat.net * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 ***************************************************************************/ 00013 #include <qcombobox.h> 00014 #include <qvaluelist.h> 00015 00016 #include <kservice.h> 00017 #include <kdebug.h> 00018 00019 #include "service.h" 00020 00021 00022 void ServiceComboBox::insertStringList(QComboBox *combo, const QValueList<KService::Ptr> &list, 00023 QStringList *names, QStringList *execs) 00024 { 00025 QValueList<KService::Ptr>::ConstIterator it; 00026 for (it = list.begin(); it != list.end(); ++it) { 00027 combo->insertItem((*it)->comment()); 00028 (*names) << (*it)->desktopEntryName(); 00029 (*execs) << (*it)->exec(); 00030 kdDebug() << "insertStringList item " << (*it)->name() << "," << (*it)->exec() << endl; 00031 } 00032 } 00033 00034 QString ServiceComboBox::currentText(QComboBox *combo, const QStringList &names) 00035 { 00036 if (combo->currentItem() == -1) 00037 return QString::null; 00038 return names[combo->currentItem()]; 00039 } 00040 00041 void ServiceComboBox::setCurrentText(QComboBox *combo, const QString &str, const QStringList &names) 00042 { 00043 QStringList::ConstIterator it; 00044 int i = 0; 00045 for (it = names.begin(); it != names.end(); ++it) { 00046 if (*it == str) { 00047 combo->setCurrentItem(i); 00048 break; 00049 } 00050 ++i; 00051 } 00052 } 00053 00054 int ServiceComboBox::itemForText(const QString &str, const QStringList &names) 00055 { 00056 QStringList::ConstIterator it; 00057 int i = 0; 00058 for (it = names.begin(); it != names.end(); ++it) { 00059 if (*it == str) { 00060 return i; 00061 } 00062 ++i; 00063 } 00064 return 0; 00065 } 00066 00067 QString ServiceComboBox::defaultCompiler() 00068 { 00069 KTrader::OfferList offers = KTrader::self()->query("KDevelop/CompilerOptions", "[X-KDevelop-Language] == 'Pascal'"); 00070 QValueList<KService::Ptr>::ConstIterator it; 00071 for (it = offers.begin(); it != offers.end(); ++it) { 00072 if ((*it)->property("X-KDevelop-Default").toBool()) { 00073 return (*it)->name();; 00074 } 00075 } 00076 return ""; 00077 }
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:38:52 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003