From 43cc179d7462eb701b84c0d39c493506b89d8864 Mon Sep 17 00:00:00 2001 From: rnv Date: Tue, 9 Dec 2008 12:27:18 +0000 Subject: [PATCH] Fix for IPAL20744, IPAL20745 and IPAL20747 --- src/SalomeApp/SalomeApp_Application.cxx | 6 +-- src/SalomeApp/SalomeApp_NoteBookDlg.cxx | 53 +++++++++++++++++---- src/SalomeApp/SalomeApp_NoteBookDlg.h | 2 + src/SalomeApp/resources/SalomeApp_msg_en.ts | 10 +++- 4 files changed, 56 insertions(+), 15 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index b0b149203..dc61774f7 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -720,10 +720,8 @@ void SalomeApp_Application::onNoteBook() SalomeApp_Study* appStudy = dynamic_cast( activeStudy() ); if ( appStudy ) { _PTR(Study) aStudy = appStudy->studyDS(); - SalomeApp_NoteBookDlg aDlg(desktop(),aStudy); - aDlg.exec(); - updateCommandsStatus(); - updateDesktopTitle(); + SalomeApp_NoteBookDlg *aDlg = new SalomeApp_NoteBookDlg(desktop(),aStudy); + aDlg->show(); } } diff --git a/src/SalomeApp/SalomeApp_NoteBookDlg.cxx b/src/SalomeApp/SalomeApp_NoteBookDlg.cxx index 6d6c69fba..fd7c139b0 100644 --- a/src/SalomeApp/SalomeApp_NoteBookDlg.cxx +++ b/src/SalomeApp/SalomeApp_NoteBookDlg.cxx @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -659,7 +660,8 @@ SalomeApp_NoteBookDlg::SalomeApp_NoteBookDlg(QWidget * parent, _PTR(Study) theSt QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), myStudy(theStudy) { - setModal(true); + setModal(false); + setAttribute( Qt::WA_DeleteOnClose); setObjectName("SalomeApp_NoteBookDlg"); setWindowTitle(tr("NOTEBOOK_TITLE")); QGridLayout* aLayout = new QGridLayout(this); @@ -674,8 +676,9 @@ SalomeApp_NoteBookDlg::SalomeApp_NoteBookDlg(QWidget * parent, _PTR(Study) theSt myRemoveButton = new QPushButton(tr("BUT_REMOVE")); aLayout->addWidget(myRemoveButton, 1, 0, 1, 1); + QSpacerItem* spacer = - new QSpacerItem(SPACER_SIZE, 5 , QSizePolicy::Expanding, QSizePolicy::Minimum); + new QSpacerItem(DEFAULT_SPACING, 5 , QSizePolicy::Expanding, QSizePolicy::Minimum); aLayout->addItem(spacer, 1, 1, 2, 1); myUpdateStudyBtn = new QPushButton(tr("BUT_UPDATE_STUDY")); @@ -688,18 +691,17 @@ SalomeApp_NoteBookDlg::SalomeApp_NoteBookDlg(QWidget * parent, _PTR(Study) theSt aLayout1->setMargin(DEFAULT_MARGIN); aLayout1->setSpacing(DEFAULT_SPACING); - myOkBtn = new QPushButton(tr("BUT_OK")); + myOkBtn = new QPushButton(tr("BUT_APPLY_AND_CLOSE")); aLayout1->addWidget(myOkBtn, 0, 0, 1, 1); myApplyBtn = new QPushButton(tr("BUT_APPLY")); aLayout1->addWidget(myApplyBtn, 0, 1, 1, 1); - QSpacerItem* spacer1 = - new QSpacerItem(SPACER_SIZE, 5, QSizePolicy::Expanding, QSizePolicy::Minimum); - aLayout1->addItem(spacer1, 0, 2, 1, 1); - + myHelpBtn = new QPushButton(tr("BUT_HELP")); + aLayout1->addWidget(myHelpBtn, 0, 2, 1, 1); + - myCancelBtn = new QPushButton(tr("BUT_CANCEL")); + myCancelBtn = new QPushButton(tr("BUT_CLOSE")); aLayout1->addWidget(myCancelBtn, 0, 3, 1, 1); aLayout->addWidget(groupBox, 2, 0, 1, 3); @@ -709,7 +711,8 @@ SalomeApp_NoteBookDlg::SalomeApp_NoteBookDlg(QWidget * parent, _PTR(Study) theSt connect( myCancelBtn, SIGNAL(clicked()), this, SLOT(onCancel()) ); connect( myUpdateStudyBtn, SIGNAL(clicked()), this, SLOT(onUpdateStudy()) ); connect( myRemoveButton, SIGNAL(clicked()), this, SLOT(onRemove())); - + connect( myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); + myTable->Init(myStudy); } @@ -733,6 +736,32 @@ void SalomeApp_NoteBookDlg::onOK() accept(); } +//============================================================================ +/*! Function : onHelp + * Purpose : [slot] + */ +//============================================================================ +void SalomeApp_NoteBookDlg::onHelp() +{ + QString aHelpFileName("using_notebook.html"); + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule("GUI",aHelpFileName); + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(aHelpFileName)); + } + +} //============================================================================ /*! Function : onApply * Purpose : [slot] @@ -797,8 +826,12 @@ void SalomeApp_NoteBookDlg::onApply() myStudy->SetBoolean(string(aName.toLatin1().constData()),aBVal); } } - myTable->ResetMaps(); + + SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if(app) + app->updateActions(); + } //============================================================================ diff --git a/src/SalomeApp/SalomeApp_NoteBookDlg.h b/src/SalomeApp/SalomeApp_NoteBookDlg.h index acb18f653..529b9245e 100644 --- a/src/SalomeApp/SalomeApp_NoteBookDlg.h +++ b/src/SalomeApp/SalomeApp_NoteBookDlg.h @@ -145,6 +145,7 @@ class SALOMEAPP_EXPORT SalomeApp_NoteBookDlg : public QDialog void onCancel(); void onRemove(); void onUpdateStudy(); + void onHelp(); protected: bool updateStudy(); @@ -157,6 +158,7 @@ class SALOMEAPP_EXPORT SalomeApp_NoteBookDlg : public QDialog QPushButton* myOkBtn; QPushButton* myApplyBtn; QPushButton* myCancelBtn; + QPushButton* myHelpBtn; _PTR(Study) myStudy; }; diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.ts b/src/SalomeApp/resources/SalomeApp_msg_en.ts index faf5d0e67..7b89f1726 100644 --- a/src/SalomeApp/resources/SalomeApp_msg_en.ts +++ b/src/SalomeApp/resources/SalomeApp_msg_en.ts @@ -255,7 +255,7 @@ Do you want to reload it ? MEN_DESK_FILE_NOTEBOOK - Notebook + Notebook... PRP_DESK_FILE_NOTEBOOK @@ -395,6 +395,14 @@ Do you really want to rename it? BUT_REMOVE Remove + + BUT_APPLY_AND_CLOSE + A&pply and Close + + + BUT_HELP + &Help + INCORRECT_DATA At least one variable has been defined incorrectly. -- 2.39.2