void NfsDeviceHandler::getURL( KURL &absolutePath, const KURL &relativePath ) { absolutePath.setPath( m_mountPoint ); absolutePath.addPath( relativePath.path() ); absolutePath.cleanPath(); }
KURL SystemDirNotify::toSystemURL(const KURL &url) { kdDebug() << "SystemDirNotify::toSystemURL(" << url << ")" << endl; init(); QMap<KURL,KURL>::const_iterator it = m_urlMap.begin(); QMap<KURL,KURL>::const_iterator end = m_urlMap.end(); for (; it!=end; ++it) { KURL base = it.key(); if ( base.isParentOf(url) ) { QString path = KURL::relativePath(base.path(), url.path()); KURL result = it.data(); result.addPath(path); result.cleanPath(); kdDebug() << result << endl; return result; } } kdDebug() << "KURL()" << endl; return KURL(); }
void ValgrindPart::getActiveFiles() { activeFiles.clear(); if ( project() ) { QStringList projectFiles = project()->allFiles(); QString projectDirectory = project()->projectDirectory(); KURL url; for ( QStringList::Iterator it = projectFiles.begin(); it != projectFiles.end(); ++it ) { KURL url( projectDirectory + "/" + (*it) ); url.cleanPath( true ); activeFiles += url.path(); kdDebug() << "set project file: " << url.path().latin1() << endl; } } }
ViewProperties::ViewProperties(KURL url) : m_changedProps(false), m_autoSave(true), m_subDirValidityHidden(false) { url.cleanPath(true); m_filepath = url.path(); if ((m_filepath.length() < 1) || (m_filepath.at(0) != QChar('/'))) { return; } // we try and save it to a file in the directory being viewed // if the directory is not writable by the user or the directory is not local // we store the properties information in a local file DolphinSettings& settings = DolphinSettings::instance(); if (settings.isSaveView()) { QString rootDir("/"); // TODO: should this be set to the root of the bookmark, if any? if (url.isLocalFile()) { QFileInfo info(m_filepath); if (!info.isWritable()) { QString basePath = KGlobal::instance()->instanceName(); basePath.append("/view_properties/local"); rootDir = locateLocal("data", basePath); m_filepath = rootDir + m_filepath; } } else { QString basePath = KGlobal::instance()->instanceName(); basePath.append("/view_properties/remote/").append(url.host()); rootDir = locateLocal("data", basePath); m_filepath = rootDir + m_filepath; } QDir dir(m_filepath); QFile file(m_filepath + FILE_NAME); PropertiesNode node(&file); const bool isValidForSubDirs = !node.isEmpty() && node.isValidForSubDirs(); while ((dir.path() != rootDir) && dir.cdUp()) { QFile file(dir.path() + FILE_NAME); PropertiesNode parentNode(&file); if (!parentNode.isEmpty()) { const bool inheritProps = parentNode.isValidForSubDirs() && (parentNode.subDirProperties().m_timeStamp > node.localProperties().m_timeStamp); if (inheritProps) { node.setLocalProperties(parentNode.subDirProperties()); break; } } } m_node = node; if (isValidForSubDirs) { m_subDirValidityHidden = true; } m_node.setValidForSubDirs(false); } }
void PoAuxiliary::loadAuxiliary() { if(loadTimer->isActive()) loadTimer->stop(); if(loading) return; loading=true; error=false; QString path=url; if(path.contains("@LANG@")) { path.replace("@LANG@",langCode); } if(path.contains("@PACKAGE@")) { int pos=package.findRev("/"); if( pos<0 ) pos=0; path.replace("@PACKAGE@",package.mid(pos)); } if(path.contains("@PACKAGEDIR@")) { QString packagedir; int pos=package.findRev("/"); if( pos > 0 ) packagedir=package.left(pos); else packagedir=""; path.replace("@PACKAGEDIR@",packagedir); kdDebug(KBABEL_SEARCH) << "Packagedir found " << packagedir << endl; } QRegExp reg("@DIR[0-9]+@"); if(path.contains(reg)) { int pos=reg.search(path); int len = reg.matchedLength(); while(pos>=0) { QString num=path.mid(pos+4,len-5); bool ok; int number=num.toInt(&ok); if(ok) { QString dir=directory(editedFile,number); QString s("@DIR%1@"); path.replace(s.arg(number),dir); pos+=dir.length(); } pos=reg.search(path); len = reg.matchedLength(); } } KURL u; QRegExp rel("^[a-zA-Z]+:"); if(rel.search(path) >= 0) { u=path; } else if(path[0] != '/') // relative path { KURL temp(editedFile); QString dir = temp.directory(); kdDebug(KBABEL_SEARCH) << dir << endl; u.setPath(dir+"/"+path); u.cleanPath(); kdDebug(KBABEL_SEARCH) << u.prettyURL() << endl; } else { u.setPath(path); } emit progressStarts(i18n("Loading PO auxiliary")); connect(catalog, SIGNAL(signalProgress(int)) , this, SIGNAL(progress(int))); ConversionStatus stat = catalog->openURL(u); if( stat != OK && stat != RECOVERED_PARSE_ERROR) { kdDebug(KBABEL_SEARCH) << "error while opening file " << u.prettyURL() << endl; if( !error ) { error = true; errorMsg = i18n("Error while trying to open file for PO Auxiliary module:\n%1") .arg(u.prettyURL()); emit hasError(errorMsg); } } else { error = false; // build index for fast search msgidDict.clear(); msgstrDict.clear(); emit progressStarts(i18n("Building index")); int total = catalog->numberOfEntries(); for(int i=0; i < total; i++) { if( (100*(i+1))%total < 100 ) { emit progress((100*(i+1))/total); kapp->processEvents(100); } Entry *e = new Entry; // FIXME: should care about plural forms e->orig = catalog->msgid(i).first(); e->orig.replace("\n",""); kdWarning() << "PoAuxialiary does not support plural forms" << endl; e->translation = catalog->msgstr(i).first(); e->comment = catalog->comment(i); e->fuzzy = catalog->isFuzzy(i); msgidDict.insert(catalog->msgid(i,true).first(),e); msgstrDict.insert(e->translation,e); } auxPackage = catalog->packageName(); auxURL = catalog->currentURL().url(); auxTranslator = catalog->lastTranslator(); } disconnect(catalog, SIGNAL(signalProgress(int)) , this, SIGNAL(progress(int))); emit progressEnds(); initialized=true; loading=false; catalog->clear(); }