X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_Operation.cxx;h=863d4333af775bba0d34daa2f727751853746344;hp=c26f5f69ee5d7139fb9a09ab0e9c225601f1f142;hb=f31477795020e2cfc50d5b625579285c644a6a96;hpb=ff3baa884d16a0ec5b3b42823a8aea166005db79 diff --git a/src/SMESHGUI/SMESHGUI_Operation.cxx b/src/SMESHGUI/SMESHGUI_Operation.cxx index c26f5f69e..863d4333a 100755 --- a/src/SMESHGUI/SMESHGUI_Operation.cxx +++ b/src/SMESHGUI/SMESHGUI_Operation.cxx @@ -1,23 +1,45 @@ -// SALOME SMESHGUI +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2005 CEA/DEN, EDF R&D +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// SMESH SMDS : implementaion of Salome mesh data structure +// File : SMESHGUI_Operation.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. +// SMESH includes // -// File : SMESHGUI_Operation.h -// Author : Sergey LITONIN -// Module : SALOME - #include "SMESHGUI_Operation.h" -#include -#include +#include "SMESHGUI.h" +#include "SMESHGUI_Dialog.h" + +// SALOME GUI includes #include +#include +#include #include #include +#include -#include +// Qt includes +#include /* Class : SMESHGUI_Operation @@ -29,8 +51,9 @@ // Purpose : Constructor //======================================================================= SMESHGUI_Operation::SMESHGUI_Operation() -: SalomeApp_Operation() +: LightApp_Operation() { + myHelpFileName = ""; } //======================================================================= @@ -62,6 +85,7 @@ void SMESHGUI_Operation::startOperation() disconnect( dlg(), SIGNAL( dlgApply() ), this, SLOT( onApply() ) ); disconnect( dlg(), SIGNAL( dlgCancel() ), this, SLOT( onCancel() ) ); disconnect( dlg(), SIGNAL( dlgClose() ), this, SLOT( onCancel() ) ); + disconnect( dlg(), SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); if( dlg()->testButtonFlags( QtxDialog::OK ) ) connect( dlg(), SIGNAL( dlgOk() ), this, SLOT( onOk() ) ); @@ -71,6 +95,9 @@ void SMESHGUI_Operation::startOperation() if( dlg()->testButtonFlags( QtxDialog::Cancel ) ) connect( dlg(), SIGNAL( dlgCancel() ), this, SLOT( onCancel() ) ); + + if( dlg()->testButtonFlags( QtxDialog::Help ) ) + connect( dlg(), SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); //if( dlg()->testButtonFlags( QtxDialog::Close ) ) //if dialog hasn't close, cancel, no and etc buttons, dlgClose will be emitted when dialog is closed not by OK @@ -79,7 +106,7 @@ void SMESHGUI_Operation::startOperation() initDialog(); } - SalomeApp_Operation::startOperation(); + LightApp_Operation::startOperation(); } //======================================================================= @@ -88,12 +115,12 @@ void SMESHGUI_Operation::startOperation() //======================================================================= bool SMESHGUI_Operation::isReadyToStart() const { - if ( !SalomeApp_Operation::isReadyToStart() ) + if ( !LightApp_Operation::isReadyToStart() ) return false; else if ( getSMESHGUI() == 0 ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NO_MODULE" ), tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NO_MODULE" ) ); return false; } else if ( isStudyLocked() ) @@ -108,7 +135,7 @@ bool SMESHGUI_Operation::isReadyToStart() const //======================================================================= void SMESHGUI_Operation::setDialogActive( const bool active ) { - SalomeApp_Operation::setDialogActive( active ); + LightApp_Operation::setDialogActive( active ); SMESHGUI_Dialog* d = dynamic_cast( dlg() ); if( d ) @@ -134,8 +161,8 @@ void SMESHGUI_Operation::onOk() { if( onApply() ) commit(); - else - abort(); + //else + // abort(); } //======================================================================= @@ -156,6 +183,30 @@ void SMESHGUI_Operation::onCancel() abort(); } +//======================================================================= +// name : onHelp +// Purpose : +//======================================================================= +void SMESHGUI_Operation::onHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(getSMESHGUI() ? app->moduleName(getSMESHGUI()->moduleName()) : QString(""), myHelpFileName); + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning( desktop(), tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName) ); + } +} + //======================================================================= // name : initDialog // Purpose : @@ -179,8 +230,8 @@ bool SMESHGUI_Operation::isStudyLocked( const bool theMess ) const if ( studyDS()->GetProperties()->IsLocked() ) { if ( theMess ) - SUIT_MessageBox::warn1 ( SMESHGUI::desktop(), QObject::tr( "WRN_WARNING" ), - QObject::tr( "WRN_STUDY_LOCKED" ), QObject::tr( "BUT_OK" ) ); + SUIT_MessageBox::warning( SMESHGUI::desktop(), tr( "WRN_WARNING" ), + tr( "WRN_STUDY_LOCKED" ) ); return true; } } @@ -208,19 +259,8 @@ bool SMESHGUI_Operation::isValid( SUIT_Operation* theOtherOp ) const } return theOtherOp && theOtherOp->inherits( "SMESHGUI_Operation" ) && - ( !anOps.contains( theOtherOp->className() ) || anOps.contains( className() ) ); + ( !anOps.contains( theOtherOp->metaObject()->className() ) || + anOps.contains( metaObject()->className() ) ); return true; } - - - - - - - - - - - -