TCollection_AsciiString aDestinationDir(DocFileName(theFileName, aDocName));
OSD_Path aDestination(aDestinationDir);
aFile.Copy(aDestination);
+ theResults.push_back(aDestinationDir.ToCString());
} else {
Events_Error::send(
std::string("Can not open file ") + aSubPath.ToCString() + " for saving");
// The following code creates a new tmp directory with a copy of files.
QString aTmpDir = theFiles.first();
- //LightApp_Driver aDriver;
- //QString aNewTmpDir = QString(aDriver.GetTmpDir("", false).c_str());
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( myModule->application()->activeStudy() );
QString aNewTmpDir = aStudy->GetTmpDir("", false).c_str();
if (!QFile::copy(aCurrentFile, aNewFile))
isDone = false;
}
+ if (isDone) {
+ myTmpDirectory = aNewTmpDir;
+ }
+ else {
+ removeDirectory(aNewTmpDir);
+ myTmpDirectory = "";
+ }
SessionPtr aMgr = ModelAPI_Session::get();
aMgr->load(qPrintable(aNewTmpDir));
bool NewGeom_DataModel::close()
{
myModule->workshop()->closeDocument();
+ removeDirectory(myTmpDirectory);
+ myTmpDirectory = "";
return LightApp_DataModel::close();
}
void NewGeom_DataModel::update(LightApp_DataObject* theObj, LightApp_Study* theStudy)
{
}
+
+void NewGeom_DataModel::removeDirectory(const QString& theDirectoryName)
+{
+ Qtx::rmDir(theDirectoryName);
+}
+
virtual void update(LightApp_DataObject* theObj = 0, LightApp_Study* theStudy = 0);
+protected:
+ /**
+ * Removes the directory with content if it exists
+ * \param theDirectoryName a directory name
+ */
+ static void removeDirectory(const QString& theDirectoryName);
+
private:
QString myStudyPath;
+ QString myTmpDirectory; /// a path to the temporary directory, created by opening a document file
+ /// it should be created because the files reading is postponed in the module. The directory
+ // should be removed after the model document is closed.
NewGeom_Module* myModule;
};
mySelector(0), myIsOpened(0), myPopupMgr(0)
{
myWorkshop = new XGUI_Workshop(this);
+ connect(myWorkshop, SIGNAL(commandStatusUpdated()),
+ this, SLOT(onUpdateCommandStatus()));
+
myProxyViewer = new NewGeom_SalomeViewer(this);
ModuleBase_Preferences::setResourceMgr(application()->resourceMgr());
pref->retrieve();
}
+//******************************************************
+void NewGeom_Module::onUpdateCommandStatus()
+{
+ getApp()->updateActions();
+}
+
//******************************************************
NewGeom_OCCSelector* NewGeom_Module::createSelector(SUIT_ViewManager* theMgr)
{
protected slots:
virtual void onViewManagerAdded(SUIT_ViewManager* theMgr);
void onDefaultPreferences();
+ // Obtains the current application and updates its actions
+ void onUpdateCommandStatus();
protected:
CAM_DataModel* createDataModel();
}
}
myActionsMgr->update();
+ emit commandStatusUpdated();
}
//******************************************************
signals:
void salomeViewerSelection();
void errorOccurred(const QString&);
+ //! the signal about the workshop actions states are updated.
+ void commandStatusUpdated();
public slots:
void updateCommandStatus();