void K3bDataFileView::slotOpen() { if( K3bDataViewItem* viewItem = dynamic_cast<K3bDataViewItem*>( selectedItems().first() ) ) { K3bDataItem* item = viewItem->dataItem(); if( item->isFile() ) { K3bDataFileViewItem* fvi = static_cast<K3bDataFileViewItem*>( viewItem ); if( fvi->mimeType() && #if KDE_IS_VERSION(3,3,0) !KRun::isExecutableFile( KURL::fromPathOrURL(item->localPath()), fvi->mimeType()->name() ) #else !QFileInfo( item->localPath() ).isExecutable() #endif ) KRun::runURL( KURL::fromPathOrURL(item->localPath()), fvi->mimeType()->name() ); else KRun::displayOpenWithDialog( KURL::fromPathOrURL(item->localPath()) ); } } }
bool K3bIsoImager::writeJolietHideFile() { delete m_jolietHideFile; m_jolietHideFile = new KTempFile(); m_jolietHideFile->setAutoDelete(true); if( QTextStream* t = m_jolietHideFile->textStream() ) { K3bDataItem* item = m_doc->root(); while( item ) { if( item->hideOnRockRidge() ) { if( !item->isDir() ) // hiding directories does not work (all dirs point to the dummy-dir but we could introduce a second hidden dummy dir) *t << escapeGraftPoint( item->localPath() ) << endl; } item = item->nextSibling(); } m_jolietHideFile->close(); return true; } else return false; }
bool K3bIsoImager::writeSortWeightFile() { delete m_sortWeightFile; m_sortWeightFile = new KTempFile(); m_sortWeightFile->setAutoDelete(true); if( QTextStream* t = m_sortWeightFile->textStream() ) { // // We need to write the local path in combination with the sort weight // mkisofs will take care of multiple entries for one local file and always // use the highest weight // K3bDataItem* item = m_doc->root(); while( (item = item->nextSibling()) ) { // we skip the root here if( item->sortWeight() != 0 ) { if( m_doc->bootImages().containsRef( dynamic_cast<K3bBootItem*>(item) ) ) { // boot-image-backup-hack *t << escapeGraftPoint( static_cast<K3bBootItem*>(item)->tempPath() ) << " " << item->sortWeight() << endl; } else if( item->isDir() ) { // // Since we use dummy dirs for all directories in the filesystem and mkisofs uses the local path // for sorting we need to create a different dummy dir for every sort weight value. // *t << escapeGraftPoint( dummyDir( static_cast<K3bDirItem*>(item) ) ) << " " << item->sortWeight() << endl; } else *t << escapeGraftPoint( item->localPath() ) << " " << item->sortWeight() << endl; } } m_sortWeightFile->close(); return true; } else return false; }
int K3bIsoImager::writePathSpecForDir( K3bDirItem* dirItem, QTextStream& stream ) { if( !m_noDeepDirectoryRelocation && dirItem->depth() > 7 ) { kdDebug() << "(K3bIsoImager) found directory depth > 7. Enabling no deep directory relocation." << endl; m_noDeepDirectoryRelocation = true; } // now create the graft points int num = 0; for( QPtrListIterator<K3bDataItem> it( dirItem->children() ); it.current(); ++it ) { K3bDataItem* item = it.current(); bool writeItem = item->writeToCd(); if( item->isSymLink() ) { if( d->usedLinkHandling == Private::DISCARD_ALL || ( d->usedLinkHandling == Private::DISCARD_BROKEN && !item->isValid() ) ) writeItem = false; else if( d->usedLinkHandling == Private::FOLLOW ) { QFileInfo f( K3b::resolveLink( item->localPath() ) ); if( !f.exists() ) { emit infoMessage( i18n("Could not follow link %1 to non-existing file %2. Skipping...") .arg(item->k3bName()) .arg(f.filePath()), WARNING ); writeItem = false; } else if( f.isDir() ) { emit infoMessage( i18n("Ignoring link %1 to folder %2. K3b is unable to follow links to folders.") .arg(item->k3bName()) .arg(f.filePath()), WARNING ); writeItem = false; } } } else if( item->isFile() ) { QFileInfo f( item->localPath() ); if( !f.exists() ) { emit infoMessage( i18n("Could not find file %1. Skipping...").arg(item->localPath()), WARNING ); writeItem = false; } else if( !f.isReadable() ) { emit infoMessage( i18n("Could not read file %1. Skipping...").arg(item->localPath()), WARNING ); writeItem = false; } } if( writeItem ) { num++; // some versions of mkisofs seem to have a bug that prevents to use filenames // that contain one or more backslashes if( item->writtenPath().contains("\\") ) m_containsFilesWithMultibleBackslashes = true; if( item->isDir() ) { stream << escapeGraftPoint( item->writtenPath() ) << "=" << escapeGraftPoint( dummyDir( static_cast<K3bDirItem*>(item) ) ) << "\n"; int x = writePathSpecForDir( dynamic_cast<K3bDirItem*>(item), stream ); if( x >= 0 ) num += x; else return -1; } else { writePathSpecForFile( static_cast<K3bFileItem*>(item), stream ); } } } return num; }