本文整理汇总了C++中KStandardDirs类的典型用法代码示例。如果您正苦于以下问题:C++ KStandardDirs类的具体用法?C++ KStandardDirs怎么用?C++ KStandardDirs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KStandardDirs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findFileName
static QString findFileName(const QString* tmpl,bool universal, const QString &profile) {
QString myFile, filename;
KStandardDirs *dirs = KGlobal::dirs();
QString tmp = *tmpl;
if (universal) {
dirs->saveLocation("data", "konqsidebartng/kicker_entries/", true);
tmp.prepend("/konqsidebartng/kicker_entries/");
} else {
dirs->saveLocation("data", "konqsidebartng/" + profile + "/entries/", true);
tmp.prepend("/konqsidebartng/" + profile + "/entries/");
}
filename = tmp.arg("");
myFile = locateLocal("data", filename);
if (QFile::exists(myFile)) {
for (ulong l = 0; l < ULONG_MAX; l++) {
filename = tmp.arg(l);
myFile = locateLocal("data", filename);
if (!QFile::exists(myFile)) {
break;
} else {
myFile = QString::null;
}
}
}
return myFile;
}
示例2: f
//scan the correct picture dir and get all the pics instead of loading with each filename
void KardView::loadPixmaps()
{
QStringList picsList;
KStandardDirs *dirs = KGlobal::dirs();
QStringList themesFiles = dirs->findAllResources("data", "kard/pics/"+theme+"/*.png");
themesFiles.sort();
int i=0;
if (!themesFiles.isEmpty()) {
for (QStringList::Iterator it = themesFiles.begin(); it != themesFiles.end(); ++it ) {
QFile f( *it);
QString picture = f.fileName();
picsList+=picture;
px[i].load(KStandardDirs::locate("data", picture));
if (theme == "opposites") {
if (i%2 ==0)
opp_numarr[i] = i;
else
opp_numarr[i] = i-1;
i++;
}
else {
px[i+1] = px[i];
i=i+2;
}
}
//TODO else tell no files had been found
}
}
示例3: config
/*!
\fn KmlExport::getConfig()
*/
int KmlExport::getConfig()
{
KConfig config("kipirc");
KConfigGroup group = config.group("KMLExport Settings");
m_localTarget = group.readEntry("localTarget", true);
m_optimize_googlemap = group.readEntry("optimize_googlemap", false);
m_iconSize = group.readEntry("iconSize", 33);
// googlemapSize = group.readNumEntry("googlemapSize");
m_size = group.readEntry("size", 320);
// UrlDestDir have to have the trailing
m_baseDestDir = group.readEntry("baseDestDir", QString("/tmp/"));
m_UrlDestDir = group.readEntry("UrlDestDir", QString("http://www.example.com/"));
m_KMLFileName = group.readEntry("KMLFileName", QString("kmldocument"));
m_altitudeMode = group.readEntry("Altitude Mode", 0);
m_GPXtracks = group.readEntry("UseGPXTracks", false);
m_GPXFile = group.readEntry("GPXFile", QString());
m_TimeZone = group.readEntry("Time Zone", 12);
m_LineWidth = group.readEntry("Line Width", 4);
m_GPXColor = group.readEntry("Track Color", "#17eeee" );
m_GPXOpacity = group.readEntry("Track Opacity", 64 );
m_GPXAltitudeMode = group.readEntry("GPX Altitude Mode", 0);
KStandardDirs dir;
m_tempDestDir = dir.saveLocation("tmp", "kipi-kmlrexportplugin-" + QString::number(getpid()) + '/');
m_imageDir = "images/";
m_googlemapSize = 32;
return 1;
}
示例4: QLatin1String
/**
* 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);
}
}
}
}
}
示例5: getFlightplanList
void KFFWin_Flightplan::getFlightplanList( QStringList & list )
{
KStandardDirs stddirs;
QString dirname;
QDir dir;
dirname = stddirs.saveLocation( "data" );
dir.cd( dirname );
if ( !dir.exists( "kfreeflight" ) )
{
dir.mkdir( "kfreeflight" );
}
dir.cd( "kfreeflight" );
if ( !dir.exists( "flightplans" ) )
{
dir.mkdir( "flightplans" );
}
dir.cd( "flightplans" );
list = dir.entryList( QDir::Files, QDir::Name );
}
示例6: kdDebug
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;
}
示例7: saveUserAddedThemes
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();
}
示例8: addVBoxPage
/*
* This creates a Tab OCR
*/
void KOCRBase::ocrIntro( )
{
m_ocrPage = addVBoxPage( i18n("OCR") );
// Caption - Label and image
/* labelstring */
(void) new QLabel( i18n("<b>Starting Optical Character Recognition with %1</b><p>").
arg( ocrEngineName() ), m_ocrPage );
// Find the kadmos logo and display if available
KStandardDirs stdDir;
QString logo = stdDir.findResource( "data", "kooka/pics/" + ocrEngineLogo() );
kdDebug(28000)<< "Reading logo " << logo << endl;
QPixmap pix;
QWidget *pa = m_ocrPage;
if( pix.load( logo ))
{
QHBox *hb_cap = new QHBox( m_ocrPage );
hb_cap->setSpacing( KDialog::spacingHint());
QLabel *imgLab = new QLabel( hb_cap );
imgLab->setAlignment( Qt::AlignHCenter | Qt::AlignTop );
imgLab->setPixmap( pix );
pa = hb_cap;
}
(void) new KActiveLabel( ocrEngineDesc(), pa );
}
示例9: dir
/**
* 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);
}
}
}
}
示例10: load
void Rad::load()
{
if (loaded)
return;
KStandardDirs *dirs = KGlobal::dirs();
QString radkfile = dirs->findResource("data", "kiten/radkfile");
if (radkfile.isNull())
{
KMessageBox::error(0, i18n("Kanji radical information file not installed, so radical searching cannot be used."));
return;
}
QFile f(radkfile);
if (!f.open(IO_ReadOnly))
{
KMessageBox::error(0, i18n("Kanji radical information could not be loaded, so radical searching cannot be used."));
}
QTextStream t(&f);
t.setCodec(QTextCodec::codecForName("eucJP"));
Radical cur;
while (!t.eof())
{
QString s = t.readLine();
QChar first = s.at(0);
if (first == '#') // comment!
{
// nothing
}
else if (first == '$') // header
{
// save previous one
if( !cur.kanji().isNull() )
list.append(cur);
//first entry is trim(last 4 chars).. <rad><space><strokes>
unsigned int strokes = s.right(2).toUInt();
QString radical = QString(s.at(2));
cur = Radical(radical, strokes);
}
else // continuation
{
cur.addKanji(s);
}
}
// we gotta append the last one!!
// this nagged jasonkb for a bit wondering why fue wasn't showing up ;)
list.append(cur);
f.close();
loaded = true;
}
示例11: defaultPressed
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);
}
示例12: KLineEdit
KRomajiEdit::KRomajiEdit(QWidget *parent, const char *name)
: KLineEdit(parent, name)
{
kana = "unset";
KStandardDirs *dirs = KGlobal::dirs();
QString romkana = dirs->findResource("data", "kiten/romkana.cnv");
if (romkana.isNull())
{
KMessageBox::error(0, i18n("Romaji information file not installed, so Romaji conversion cannot be used."));
return;
}
QFile f(romkana);
if (!f.open(IO_ReadOnly))
{
KMessageBox::error(0, i18n("Romaji information could not be loaded, so Romaji conversion cannot be used."));
}
QTextStream t(&f);
t.setCodec(QTextCodec::codecForName("eucJP"));
while (!t.eof())
{
QString s = t.readLine();
QChar first = s.at(0);
if (first == '#') // comment!
{
// nothing
}
else if (first == '$') // header
{
if (kana == "unset")
kana = "hiragana";
else
kana = "katakana";
}
else // body
{
QStringList things(QStringList::split(QChar(' '), s));
QString thekana(things.first());
QString romaji(*things.at(1));
if (kana == "hiragana")
hiragana[romaji] = thekana;
else if (kana == "katakana")
katakana[romaji] = thekana;
}
}
f.close();
kana = "english";
}
示例13: aboutToShowAddMenu
void addBackEnd::aboutToShowAddMenu()
{
if (!menu)
return;
KStandardDirs *dirs = KGlobal::dirs();
QStringList list = dirs->findAllResources("data","konqsidebartng/add/*.desktop",true,true);
libNames.setAutoDelete(true);
libNames.resize(0);
libParam.setAutoDelete(true);
libParam.resize(0);
menu->clear();
int i = 0;
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it, i++ )
{
KDesktopFile *confFile;
confFile = new KDesktopFile(*it, true);
if (! confFile->tryExec()) {
delete confFile;
i--;
continue;
}
if (m_universal) {
if (confFile->readEntry("X-KDE-KonqSidebarUniversal").upper()!="TRUE") {
delete confFile;
i--;
continue;
}
} else {
if (confFile->readEntry("X-KDE-KonqSidebarBrowser").upper()=="FALSE") {
delete confFile;
i--;
continue;
}
}
QString icon = confFile->readIcon();
if (!icon.isEmpty())
{
menu->insertItem(SmallIcon(icon),
confFile->readEntry("Name"), i);
} else {
menu->insertItem(confFile->readEntry("Name"), i);
}
libNames.resize(libNames.size()+1);
libNames.insert(libNames.count(), new QString(confFile->readEntry("X-KDE-KonqSidebarAddModule")));
libParam.resize(libParam.size()+1);
libParam.insert(libParam.count(), new QString(confFile->readEntry("X-KDE-KonqSidebarAddParam")));
delete confFile;
}
menu->insertSeparator();
menu->insertItem(i18n("Rollback to System Default"), i);
}
示例14: itemChanged
void ProjectSelectionPage::itemChanged( const QModelIndex& current, const QModelIndex& )
{
KStandardDirs* dirs = m_templatesModel->plugin()->componentData().dirs();
QString picPath = dirs->findResource("apptemplate_previews", m_templatesModel->data( current, Qt::UserRole+2 ).toString() );
if( picPath.isEmpty() )
{
picPath = dirs->findResource("apptemplate_previews", "default-kdevelop.png");
}
ui->preview->setPixmap( QPixmap( picPath ) );
ui->description->setText( m_templatesModel->data( current ).toString() );
validateData();
}
示例15: xmlBaseDir
QString ArchiveMan::xmlBaseDir() const
{
KStandardDirs stdDirs;
QString outputDir = KraftSettings::self()->pdfOutputDir();
if ( outputDir.isEmpty() ) {
outputDir = stdDirs.saveLocation( "data", "kraft/archiveXml", true );
}
if ( ! outputDir.endsWith( "/" ) ) outputDir += "/";
return outputDir;
}