Beispiel #1
0
/**
 * There might be a "better" way of doing this, but I don't know it,
 * but I do know that this does work. :)  Feel free to improve the loading system,
 * there isn't much code anyway.
 */
void AudioCDEncoder::findAllPlugins(KIO::SlaveBase *slave, QList<AudioCDEncoder *>&encoders)
{
    QString foundEncoders;

		KStandardDirs standardDirs;
    QStringList dirs = standardDirs.findDirs("module", QLatin1String( "" ));
    for (QStringList::const_iterator it = dirs.constBegin(); it != dirs.constEnd(); ++it) {
        QDir dir(*it);
        if (!dir.exists()) {
            kDebug(7117) << "Directory given by KStandardDirs: " << dir.path() << " doesn't exists!";
            continue;
        }

        dir.setFilter(QDir::Files | QDir::Hidden);
        const QFileInfoList files = dir.entryInfoList();
        for (int i = 0; i < files.count(); ++i) {
            QFileInfo fi(files.at(i));
            if (0 < fi.fileName().count(QRegExp( QLatin1String( "^libaudiocd_encoder_.*.so$" )))) {
                QString fileName = (fi.fileName().mid(0, fi.fileName().indexOf(QLatin1Char( '.' ))));
                if (foundEncoders.contains(fileName)) {
                    kDebug(7117) << "Warning, encoder has been found twice!";
                    continue;
                }
                foundEncoders.append(fileName);
                KLibrary::void_function_ptr function = loadPlugin(fileName);
                if (function) {
                    void (*functionPointer) (KIO::SlaveBase *, QList<AudioCDEncoder*>&) =
                            (void (*)(KIO::SlaveBase *slave, QList<AudioCDEncoder *>&encoders)) function;
                    functionPointer(slave, encoders);
                }
            }
        }
    }
}
Beispiel #2
0
void ThemesDlg::saveUserAddedThemes()
{
    KStandardDirs ksd;
    QStringList t = themes();
    QStringList dirs = ksd.findDirs("data", QString(kapp->objectName()) + "/themes");
    QStringList::Iterator it = t.begin();
    bool remove;

    while (it != t.end()) {
        remove = false;
        QStringList::Iterator jtend(dirs.end());
        for (QStringList::Iterator jt = dirs.begin(); jt != jtend; ++jt) {
            if (QString(QFileInfo(*it).dir().path() + '/') == *jt) {
                remove = true;
                break;
            }
        }
        if (remove)
            it = t.erase(it);
        else
            ++it;
    }
    SuperKarambaSettings::setUserAddedThemes(t);
    SuperKarambaSettings::self()->writeConfig();
}
Beispiel #3
0
void DocMetaInfo::scanMetaInfo( bool force )
{
  if ( mLoaded && !force ) return;

  mLanguages = KGlobal::locale()->languagesTwoAlpha();

  kdDebug( 1400 ) << "LANGS: " << mLanguages.join( " " ) << endl;

  QStringList::ConstIterator it;
  for( it = mLanguages.begin(); it != mLanguages.end(); ++it ) {
    mLanguageNames.insert( *it, languageName( *it ) );
  }

  KConfig config( "khelpcenterrc" );
  config.setGroup( "General" );
  QStringList metaInfos = config.readListEntry( "MetaInfoDirs" );

  if ( metaInfos.isEmpty() ) {
    KStandardDirs* kstd = KGlobal::dirs();
    kstd->addResourceType( "data", "share/apps/khelpcenter" );
    metaInfos = kstd->findDirs( "data", "plugins" );
  }
  for( it = metaInfos.begin(); it != metaInfos.end(); it++) {
    kdDebug() << "DocMetaInfo::scanMetaInfo(): scanning " << *it << endl;
    scanMetaInfoDir( *it, &mRootEntry );
  }

  mLoaded = true;
}
/**
 * There might be a "better" way of doing this, but I don't know it,
 * but I do know that this does work. :)  Feel free to improve the loading system,
 * there isn't much code anyway.
 */
void AudioCDEncoder::findAllPlugins(KIO::SlaveBase *slave, QPtrList<AudioCDEncoder> &encoders){
    QString foundEncoders;

    KStandardDirs standardDirs;
    QStringList dirs = standardDirs.findDirs("module", "");
    for (QStringList::Iterator it = dirs.begin(); it != dirs.end(); ++it) {
        QDir dir(*it);
        if (!dir.exists()) {
            kdDebug(7117) << "Directory given by KStandardDirs: " << dir.path() << " doesn't exists!" << endl;
            continue;
        }
        dir.setFilter(QDir::Files | QDir::Hidden);
  
        QStringList list = dir.entryList( "libaudiocd_encoder_*.so");
        kdDebug() << "list " << list << endl;
        for (QStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) 
        {
            QString fileName = *it2;
            kdDebug() << fileName << endl;
            if (foundEncoders.contains(fileName)) {
                kdDebug(7117) << "Warning, encoder has been found twice!" << endl; 
                continue;
            }
            foundEncoders.append(fileName);
            fileName = fileName.mid(0, fileName.find('.'));
            void *function = loadPlugin(fileName);
            if(function){
                void (*functionPointer)(KIO::SlaveBase *, QPtrList<AudioCDEncoder> &) = (void (*)(KIO::SlaveBase *slave, QPtrList<AudioCDEncoder> &encoders)) function;
                functionPointer(slave, encoders);
            }
        } 
    }
}
void KSimPackageFileWidget::defaultPressed()
{
	KStandardDirs dirs;
	QStringList libList;

	m_files->setFileList(libList);   // Empty list!!!

	libList = dirs.findDirs(QString::fromLatin1("lib"),QString::fromLatin1("ksimus"));
	
	m_directories->setFileList(libList);
}
void KPrHtmlExportDialog::loadTemplatesList()
{
    KStandardDirs std;
    QStringList dirs = std.findDirs("data", "stage/templates/exportHTML/templates");
    for (QStringList::ConstIterator path=dirs.constBegin(); path!=dirs.constEnd(); ++path) {
        QDir dir(*path);
        dir.setFilter(QDir::Files);
        QStringList entries = dir.entryList();
        for (QStringList::ConstIterator entry=entries.constBegin(); entry!=entries.constEnd(); ++entry) {
            if (*entry != "." && *entry != "..") {
                QString name = *entry;
                if(name.endsWith(QLatin1String(".zip"), Qt::CaseInsensitive)){
                    name.chop(4);
                }
                ui.kcombobox->addItem(name, QVariant(QString(*path + *entry)));
            }
        }
    }
    ui.kcombobox->insertSeparator(ui.kcombobox->count());
}
/**
 * set the defaults from a config file
 */
void CodeGenerationPolicy::setDefaults(bool emitUpdateSignal)
{
    blockSignals(true); // we need to do this because otherwise most of these
    // settors below will each send the modifiedCodeContent() signal
    // needlessly (we can just make one call at the end).

    setCodeVerboseSectionComments(UmbrelloSettings::forceDoc());
    setCodeVerboseDocumentComments(UmbrelloSettings::forceSections());
    setLineEndingType(UmbrelloSettings::lineEndingType());
    setIndentationType(UmbrelloSettings::indentationType());
    setIndentationAmount(UmbrelloSettings::indentationAmount());
    setAutoGenerateConstructors(UmbrelloSettings::autoGenEmptyConstructors());
    setAttributeAccessorScope(UmbrelloSettings::defaultAttributeAccessorScope());
    setAssociationFieldScope(UmbrelloSettings::defaultAssocFieldScope());
    setCommentStyle(UmbrelloSettings::commentStyle());

    calculateIndentation();

    QString path = UmbrelloSettings::outputDirectory();
    if (path.isEmpty())
        path = QDir::homePath() + QLatin1String("/uml-generated-code/");
    setOutputDirectory (QDir (path));

    path = UmbrelloSettings::headingsDirectory();
    if (path.isEmpty()) {
        KStandardDirs stddirs;
        path =  stddirs.findDirs("data", QLatin1String("umbrello/headings")).first();
    }
    setHeadingFileDir (path);

    setIncludeHeadings(UmbrelloSettings::includeHeadings());
    setOverwritePolicy(UmbrelloSettings::overwritePolicy());
    setModifyPolicy(UmbrelloSettings::modnamePolicy());

    blockSignals(false); // "as you were citizen"

    if (emitUpdateSignal)
        emit modifiedCodeContent();
}
Beispiel #8
0
void ThemesDlg::populateListbox()
{
    ThemeWidget* item;
    QDir dir;
    QStringList dirs;
    QStringList t;
    KStandardDirs ksd;

    tableThemes->clear();

    item = new ThemeWidget;

    item->iconLabel->setPixmap(KIconLoader::global()->loadIcon("get-hot-new-stuff",
                               KIconLoader::NoGroup, KIconLoader::SizeHuge));
    item->setHeaderText(i18n("Get New Stuff"));
    item->setDescriptionText(i18n("Download new themes."));

    item->buttonGo->setText(i18n("New Stuff..."));
    item->buttonGo->setEnabled(true);
    QObject::connect(item->buttonGo, SIGNAL(clicked()),
                     this, SLOT(getNewStuff()));

    tableThemes->insertItem((QWidget*)(item));

    item = new ThemeWidget;
    item->iconLabel->setPixmap(KIconLoader::global()->loadIcon("document-open",
                               KIconLoader::NoGroup, KIconLoader::SizeHuge));
    item->setHeaderText(i18n("Open Local Theme"));
    item->setDescriptionText(i18n("Add local theme to the list."));
    item->buttonGo->setProperty("stdItem", 18);
    item->buttonGo->setText(i18nc("Open theme button", "Open..."));
    QObject::connect((QObject*)(item->buttonGo), SIGNAL(clicked()),
                     (QObject*)(this), SLOT(openLocalTheme()));
    tableThemes->insertItem((QWidget*)item);

    dirs = ksd.findDirs("data", QString(kapp->objectName()) + "/themes");
    // Get custom dirs from config here?
    QStringList::Iterator itend(dirs.end());
    for (QStringList::Iterator it = dirs.begin(); it != itend; ++it) {
        QStringList types;
        types << "*.skz" << "*.theme";

        dir.setPath(*it);

        t = dir.entryList(types);
        for (QStringList::Iterator it = t.begin(); it != t.end(); ++it) {
            item = new ThemeWidget(new ThemeFile(dir.filePath(*it)));
            tableThemes->insertItem((QWidget*)item);
            item->buttonGo->setText(i18n("Uninstall"));
            QObject::connect((QObject*)item->buttonGo, SIGNAL(clicked()),
                             (QObject*)this, SLOT(uninstall()));
        }
    }
    t = SuperKarambaSettings::userAddedThemes();
    for (QStringList::Iterator it = t.begin(); it != t.end(); ++it) {
        ThemeFile* file = new ThemeFile(*it);

        if (file->isValid()) {
            item = new ThemeWidget(file);
            tableThemes->insertItem((QWidget*)item);
            item->buttonGo->setText(i18n("Uninstall"));
            QObject::connect((QObject*)item->buttonGo, SIGNAL(clicked()),
                             (QObject*)this, SLOT(uninstall()));
        } else
            delete file;
    }
    tableThemes->setSelected(0);
}
Beispiel #9
0
void ThemeLoader::findColorStyles(QMenu *colors, const QString& configSelectedStyle)
{
    KStandardDirs kdirs;
    QStringList dirs = kdirs.findDirs("data", "kvkbd");

    QActionGroup *color_group = new QActionGroup(colors);
    color_group->setExclusive(true);


    QAction *item = new QAction(colors);
    item->setCheckable(true);
    item->setText("standart");
    item->setData(":/theme/standart.css");
    colors->addAction(item);
    color_group->addAction(item);
    
    



    colors->setTitle("Color Style");
    colors->setIcon(KIcon("preferences-desktop-color"));
    QListIterator<QString> itr(dirs);
    while (itr.hasNext()) {
        QString data_path = itr.next() + "colors";

        QFileInfo info(data_path);
        if (info.isDir() && info.isReadable()) {
            QDir colors_dir(info.absoluteFilePath(), "*.css");
            QFileInfoList list = colors_dir.entryInfoList();

            QListIterator<QFileInfo> itr(list);
            while (itr.hasNext()) {
                QFileInfo fileInfo = itr.next();
                //std::cout << qPrintable(QString("%1 %2").arg(fileInfo.size(), 10)
                //				    .arg(fileInfo.fileName()));
                //std::cout << std::endl;

                QAction *item = new QAction(this);
                item->setCheckable(true);

                item->setText(fileInfo.baseName());
                item->setData(fileInfo.absoluteFilePath());
                colors->addAction(item);
                color_group->addAction(item);


            }

        }

    }

    QString selectedStyle = configSelectedStyle;
    if (selectedStyle.length()<1) {
	selectedStyle = DEFAULT_CSS;
    }
    QAction *selectedAction = 0;
    
    QListIterator<QAction*> itrActions(color_group->actions());
    while (itrActions.hasNext()) {
        QAction *item = itrActions.next();
	
	if (item->data().toString() == selectedStyle) {
	    item->setChecked(true);
	    selectedAction = item;
	}
      
	
        connect(item, SIGNAL(triggered(bool)), this, SLOT(loadColorStyle()));
    }
    
    if (selectedAction) {
      selectedAction->trigger();
    }

}