void CMainWindow::on_trvCharts_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous) { if(current == 0) { return; } previous = 0; m_clickedItem = current; QString lPath(current->data(0, Qt::UserRole).toString()); if(lPath.right(4).toLower() == ".pdf" ) { CDatabaseManager::s_Field lfld; mdb->GetField(lPath.left(4),&lfld); m_contextMenu->setTitle(lfld.Name); m_actRemove->setEnabled(false); m_actShowInReader->setEnabled(true); m_actUpdate->setEnabled(false); } else { m_contextMenu->setTitle(current->text(0)); m_actRemove->setEnabled(true); m_actShowInReader->setEnabled(false); m_actUpdate->setEnabled(true); } }
Resource* FileURLResolver::resolveURL (zstring const& aUrl, EntityData const* aEntityData) { switch ( aEntityData->getKind() ) { case EntityData::COLLECTION: #ifndef ZORBA_NO_FULL_TEXT case EntityData::THESAURUS: #endif /* ZORBA_NO_FULL_TEXT */ return nullptr; default: break; } uri::scheme lScheme = uri::get_scheme(aUrl); if (lScheme != uri::file) { return NULL; } try { std::string lPath( fs::normalize_path(aUrl) ); if (fs::get_type(lPath) == fs::file) { std::ifstream* lStream = new std::ifstream(lPath.c_str()); return new StreamResource( lStream, &fileStreamReleaser, "", true /* seekable */); } return NULL; } catch ( std::invalid_argument const &e ) { throw XQUERY_EXCEPTION( err::XPTY0004, ERROR_PARAMS( e.what() ) ); } }
void ShellExpandFilenameExpr ( const std::string& aFilenameExpr , const boost::filesystem::path& aParentPath , std::vector< boost::filesystem::path >& aFiles ) { try { // boost::lock_guard<boost::mutex> lLock ( gUtilityMutex ); //struct which will store the shell expansions of the expression wordexp_t lShellExpansion; wordexp ( aFilenameExpr.c_str() , &lShellExpansion , 0 ); for ( std::size_t i = 0 ; i != lShellExpansion.we_wordc ; i++ ) { boost::filesystem::path lPath ( lShellExpansion.we_wordv[i] ); log ( Debug() , "lPath was " , Quote ( lPath.c_str() ) ); log ( Debug() , "aParentPath is " , Quote ( aParentPath.c_str() ) ); lPath = boost::filesystem::absolute ( lPath , aParentPath ); log ( Debug() , "lPath now " , Quote ( lPath.c_str() ) ); if ( boost::filesystem::exists ( lPath ) ) { if ( boost::filesystem::is_regular_file ( lPath ) ) { aFiles.push_back ( lPath ); } } } wordfree ( &lShellExpansion ); } catch ( const std::exception& aExc ) { uhal::exception::ExpandingShellExpressionFailed lExc; log ( lExc , "Caught exception: " , Quote ( aExc.what() ) ); throw lExc; } if ( ! aFiles.size() ) { uhal::exception::FileNotFound lExc; log ( lExc , "No matching files for expression " , Quote ( aFilenameExpr ) , " with parent path " , Quote ( aParentPath.c_str() ) ); throw lExc; } else { log ( Debug() , "Shell expansion of " , Quote ( aFilenameExpr.c_str() ) , " returned:" ); for ( std::vector< boost::filesystem::path >::iterator lIt = aFiles.begin() ; lIt != aFiles.end() ; ++lIt ) { log ( Debug() , " > [file] " , lIt->c_str() ); } } }