File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
OMEdit/OMEditGUI/Modeling Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -2308,14 +2308,20 @@ void LibraryTreeModel::readLibraryTreeItemClassTextFromText(LibraryTreeItem *pLi
23082308QString LibraryTreeModel::readLibraryTreeItemClassTextFromFile (LibraryTreeItem *pLibraryTreeItem)
23092309{
23102310 QString contents = " " ;
2311- QFile file (pLibraryTreeItem->getFileName ());
2312- if (!file.open (QIODevice::ReadOnly)) {
2313- QMessageBox::critical (MainWindow::instance (), QString (Helper::applicationName).append (" - " ).append (Helper::error),
2314- GUIMessages::getMessage (GUIMessages::ERROR_OPENING_FILE).arg (pLibraryTreeItem->getFileName ())
2315- .arg (file.errorString ()), Helper::ok);
2316- } else {
2317- contents = QString (file.readAll ());
2318- file.close ();
2311+ QFileInfo fileInfo (pLibraryTreeItem->getFileName ());
2312+ // if the file is encrypted use listFile
2313+ if (fileInfo.suffix ().compare (" moc" ) == 0 ) {
2314+ contents = MainWindow::instance ()->getOMCProxy ()->listFile (pLibraryTreeItem->getNameStructure ());
2315+ } else { // else read the file contents
2316+ QFile file (pLibraryTreeItem->getFileName ());
2317+ if (!file.open (QIODevice::ReadOnly)) {
2318+ QMessageBox::critical (MainWindow::instance (), QString (Helper::applicationName).append (" - " ).append (Helper::error),
2319+ GUIMessages::getMessage (GUIMessages::ERROR_OPENING_FILE).arg (pLibraryTreeItem->getFileName ())
2320+ .arg (file.errorString ()), Helper::ok);
2321+ } else {
2322+ contents = QString (file.readAll ());
2323+ file.close ();
2324+ }
23192325 }
23202326 return contents;
23212327}
You can’t perform that action at this time.
0 commit comments