@@ -2381,14 +2381,14 @@ void NotebookWindow::newFile()
23812381 {
23822382 if (subject_->hasChanged ())
23832383 {
2384- int res = QMessageBox::question (this , tr (" Save document?" ), tr (" The document has been modified. Do you want to save the changes?" ), QMessageBox::Yes | QMessageBox::Default, QMessageBox:: No, QMessageBox::Cancel );
2384+ int res = QMessageBox::question (this , tr (" Save document?" ), tr (" The document has been modified. Do you want to save the changes?" ), QMessageBox::Yes | QMessageBox::No, QMessageBox::No );
23852385 if (res == QMessageBox::Yes)
23862386 {
23872387 save ();
23882388 if (subject_->getFilename ().isNull ())
23892389 return ;
23902390 }
2391- else if (res == QMessageBox::Cancel )
2391+ else if (res == QMessageBox::No )
23922392 return ;
23932393 }
23942394
@@ -2465,7 +2465,7 @@ void NotebookWindow::openFile(const QString filename)
24652465 }
24662466 catch (std::exception &e)
24672467 {
2468- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" In OpenFile(), Exception: \n " ) + e.what (), " OK " );
2468+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" In OpenFile(), Exception: \n " ) + e.what ());
24692469 openFile ();
24702470 }
24712471}
@@ -2643,13 +2643,13 @@ void NotebookWindow::helpText()
26432643 }
26442644 else
26452645 {
2646- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Could not find the help document OMNotebookHelp.onb" ), " OK " );
2646+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Could not find the help document OMNotebookHelp.onb" ));
26472647 }
26482648 }
26492649 catch (std::exception &e)
26502650 {
26512651 QString msg = tr (" In HelpText(), Exception: \n " ) + e.what ();
2652- QMessageBox::warning ( 0 , tr (" Warning" ), msg, " OK " );
2652+ QMessageBox::warning (nullptr , tr (" Warning" ), msg);
26532653 }
26542654}
26552655
@@ -2792,7 +2792,7 @@ void NotebookWindow::print()
27922792 if ( title.isEmpty () )
27932793 title = " (untitled)" ;
27942794
2795- QMessageBox::information ( 0 , tr (" Document printed" ), tr ( " The document %1 has been printed on %2." ).arg (title, printer.printerName ()), " OK " );
2795+ QMessageBox::information (nullptr , tr (" Document printed" ), tr ( " The document %1 has been printed on %2." ).arg (title, printer.printerName ()));
27962796 }
27972797
27982798 delete dlg;
@@ -2855,7 +2855,7 @@ void NotebookWindow::pdf()
28552855 title.remove ( " \n " );
28562856 if ( title.isEmpty () )
28572857 title = " (untitled)" ;
2858- QMessageBox::information ( 0 , tr (" Document exported" ), tr (" The document %1 has been exported as PDF to %2." ).arg (title, filename), " OK " );
2858+ QMessageBox::information (nullptr , tr (" Document exported" ), tr (" The document %1 has been exported as PDF to %2." ).arg (title, filename));
28592859 }
28602860}
28612861
@@ -2912,7 +2912,7 @@ void NotebookWindow::changeStyle(QAction *action)
29122912 else
29132913 {
29142914 // 2006-01-30 AF, add message box
2915- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Not a valid style name: %1" ).arg (action->text ()), " OK " );
2915+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Not a valid style name: %1" ).arg (action->text ()));
29162916 }
29172917
29182918 updateChapterCounters ();
@@ -3021,7 +3021,7 @@ void NotebookWindow::changeFontSize( QAction *action )
30213021 else
30223022 {
30233023 // 2006-01-30 AF, add message box
3024- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Not a value between %1 and %2." ).arg (6 ).arg (200 ), " OK " );
3024+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Not a value between %1 and %2." ).arg (6 ).arg (200 ));
30253025 }
30263026 }
30273027 }
@@ -3036,7 +3036,7 @@ void NotebookWindow::changeFontSize( QAction *action )
30363036 {
30373037 // 2006-01-30 AF, add message box
30383038 QString msg = " Not a correct font size" ;
3039- QMessageBox::warning ( 0 , tr (" Warning" ), msg, " OK " );
3039+ QMessageBox::warning (nullptr , tr (" Warning" ), msg);
30403040 }
30413041 }
30423042}
@@ -3129,7 +3129,7 @@ void NotebookWindow::changeTextAlignment( QAction *action )
31293129 {
31303130 // 2006-01-30 AF, add message box
31313131 QString msg = " Unable to find the correct alignment" ;
3132- QMessageBox::warning ( 0 , tr (" Warning" ), msg, " OK " );
3132+ QMessageBox::warning (nullptr , tr (" Warning" ), msg);
31333133 }
31343134}
31353135
@@ -3160,7 +3160,7 @@ void NotebookWindow::changeVerticalAlignment( QAction *action )
31603160 {
31613161 // 2006-01-30 AF, add message box
31623162 QString msg = " Unable to find the correct vertical alignment" ;
3163- QMessageBox::warning ( 0 , tr (" Warning" ), msg, " OK " );
3163+ QMessageBox::warning (nullptr , tr (" Warning" ), msg);
31643164 }
31653165}
31663166
@@ -3187,7 +3187,7 @@ void NotebookWindow::changeBorder( QAction *action )
31873187 else
31883188 {
31893189 // 2006-01-30 AF, add message box
3190- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Not a value between %1 and %2." ).arg (0 ).arg (30 ), " OK " );
3190+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Not a value between %1 and %2." ).arg (0 ).arg (30 ));
31913191 }
31923192 }
31933193 }
@@ -3202,7 +3202,7 @@ void NotebookWindow::changeBorder( QAction *action )
32023202 else
32033203 {
32043204 // 2006-01-30 AF, add message box
3205- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Error converting string to integer." ), " OK " );
3205+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Error converting string to integer." ));
32063206 }
32073207 }
32083208}
@@ -3229,7 +3229,7 @@ void NotebookWindow::changeMargin( QAction *action )
32293229 else
32303230 {
32313231 // 2006-01-30 AF, add message box
3232- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Not a value between %1 and %2." ).arg (0 ).arg (80 ), " OK " );
3232+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Not a value between %1 and %2." ).arg (0 ).arg (80 ));
32333233 }
32343234 }
32353235 }
@@ -3243,7 +3243,7 @@ void NotebookWindow::changeMargin( QAction *action )
32433243 else
32443244 {
32453245 // 2006-01-30 AF, add message box
3246- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Error converting string to integer." ), " OK " );
3246+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Error converting string to integer." ));
32473247 }
32483248 }
32493249}
@@ -3270,7 +3270,7 @@ void NotebookWindow::changePadding( QAction *action )
32703270 else
32713271 {
32723272 // 2006-01-30 AF, add message box
3273- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Not a value between %1 and %2." ).arg (0 ).arg (60 ), " OK " );
3273+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Not a value between %1 and %2." ).arg (0 ).arg (60 ));
32743274 }
32753275 }
32763276 }
@@ -3284,7 +3284,7 @@ void NotebookWindow::changePadding( QAction *action )
32843284 else
32853285 {
32863286 // 2006-01-30 AF, add message box
3287- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Error converting string to integer." ), " OK " );
3287+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Error converting string to integer." ));
32883288 }
32893289 }
32903290}
@@ -3517,8 +3517,8 @@ void NotebookWindow::insertLink()
35173517 }
35183518 else
35193519 {
3520- QMessageBox::warning ( this , " Error" ,
3521- tr (" A text that should make up the link, must be selected" ), " OK " );
3520+ QMessageBox::warning (this , " Error" ,
3521+ tr (" A text that should make up the link, must be selected" ));
35223522 }
35233523 }
35243524}
@@ -3652,7 +3652,7 @@ void NotebookWindow::openOldFile()
36523652 catch (std::exception &e )
36533653 {
36543654 QString msg = QString (" In NotebookWindow(), Exception:\r\n " ) + e.what ();
3655- QMessageBox::warning ( 0 , tr (" Warning" ), msg, " OK " );
3655+ QMessageBox::warning (nullptr , tr (" Warning" ), msg);
36563656 openOldFile ();
36573657 }
36583658}
@@ -3700,7 +3700,7 @@ void NotebookWindow::pureText()
37003700 if ( title.isEmpty () )
37013701 title = " (untitled)" ;
37023702
3703- QMessageBox::information ( 0 , " Document exported" , tr (" The document %1 has been exported as pure text to %2." ).arg (title,filename), " OK " );
3703+ QMessageBox::information (nullptr , " Document exported" , tr (" The document %1 has been exported as pure text to %2." ).arg (title,filename));
37043704 }
37053705}
37063706
@@ -3724,7 +3724,7 @@ void NotebookWindow::deleteCurrentCell()
37243724
37253725void NotebookWindow::deleteCurrentCellAsk ()
37263726{
3727- if (QMessageBox::warning ( 0 , " Delete Cell" , tr (" Delete current cell?\n This action cannot be undone!" ), QMessageBox::Ok|QMessageBox::Default,QMessageBox::Cancel ) == QMessageBox::Ok)
3727+ if (QMessageBox::warning (nullptr , " Delete Cell" , tr (" Delete current cell?\n This action cannot be undone!" ), QMessageBox::Ok|QMessageBox::Default,QMessageBox::Cancel ) == QMessageBox::Ok)
37283728 {
37293729 subject_->cursorDeleteCell ();
37303730 updateChapterCounters ();
@@ -3951,7 +3951,7 @@ void NotebookWindow::shiftselectedcells()
39513951 else
39523952 {
39533953 QString msg=tr (" This functionality works only on the selected cells. Put the cursor to a position where you want to shift and then select cells you like to move and press this button." );
3954- QMessageBox::warning ( 0 , tr (" Warning" ), msg, " OK " );
3954+ QMessageBox::warning (nullptr , tr (" Warning" ), msg);
39553955 }
39563956}
39573957
@@ -3966,13 +3966,13 @@ void NotebookWindow::shiftcellsUp()
39663966 {
39673967 if ( dynamic_cast <CellGroup*>(current->previous ()) )
39683968 {
3969- QMessageBox::warning ( 0 , tr (" Warning" ), err_hierarchy, " OK " );
3969+ QMessageBox::warning (nullptr , tr (" Warning" ), err_hierarchy);
39703970 }
39713971 else
39723972 {
39733973 if (current->isClosed ())
39743974 {
3975- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Cannot move closed cells." ), " OK " );
3975+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Cannot move closed cells." ));
39763976 return ;
39773977 }
39783978 // qDebug()<<"not a groupcell" ;
@@ -4049,12 +4049,12 @@ void NotebookWindow::shiftcellsUp()
40494049 }
40504050 else
40514051 {
4052- QMessageBox::warning ( 0 , tr (" Warning" ), err_hierarchy, " OK " );
4052+ QMessageBox::warning (nullptr , tr (" Warning" ), err_hierarchy);
40534053 }
40544054 }
40554055 else
40564056 {
4057- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" This functionality does not work on selected cells. Click on the cell to move up, and press this action." ), " OK " );
4057+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" This functionality does not work on selected cells. Click on the cell to move up, and press this action." ));
40584058 }
40594059}
40604060
@@ -4073,13 +4073,13 @@ void NotebookWindow::shiftcellsDown()
40734073 if ( typeid (CellGroup) == typeid (*next))
40744074 {
40754075 // qDebug()<<"group cell";
4076- QMessageBox::warning ( 0 , tr (" Warning" ), err_hierarchy, " OK " );
4076+ QMessageBox::warning (nullptr , tr (" Warning" ), err_hierarchy);
40774077 }
40784078 else
40794079 {
40804080 if (current->isClosed ())
40814081 {
4082- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" Cannot move closed cells." ), " OK " );
4082+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" Cannot move closed cells." ));
40834083 return ;
40844084 }
40854085 // qDebug()<<"not a group cell";
@@ -4160,7 +4160,7 @@ void NotebookWindow::shiftcellsDown()
41604160 }
41614161 else
41624162 {
4163- QMessageBox::warning ( 0 , tr (" Warning" ), tr (" This functionality does not work on selected cells. Click on the cell to move down, and press this action" ), " OK " );
4163+ QMessageBox::warning (nullptr , tr (" Warning" ), tr (" This functionality does not work on selected cells. Click on the cell to move down, and press this action" ));
41644164 }
41654165}
41664166
0 commit comments