View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0012774 | Scribus | User Interface | public | 2014-10-14 23:22 | 2015-01-30 22:38 |
Reporter | william | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Intel 64 bit | OS | Fedora Linux | OS Version | 20 |
Product Version | 1.5.0svn | ||||
Fixed in Version | 1.5.0svn | ||||
Summary | 0012774: [patch] Write messages to cerr instead of QMessageBox when Scribus is run without a GUI | ||||
Description | The patches at http://bugs.scribus.net/view.php?id=12572 add --no-gui and --python-script options to allow Scribus to run a script from the command line and then exit using scribus --no-gui --python-script myscript.py This is useful for running Scribus in shell scripts or under the control of another application, but if the script has any errors, Scribus still opens a GUI dialog with QMessageBox. The patches that I am posting here build on those patches by creating a ScribusMessageBox class that inherits from QMessageBox. If Scribus has a GUI, ScribusMessageBox member functions call the corresponding QMessageBox function. If Scribus does not have a GUI, ScribusMessageBox member functions write the message to cerr. For calls that require a returned button, ScribusMessageBox returns the default button when there is no GUI, but it also has an optional parameter to specify an alternate default. For example, questions like "Do you really want to replace your existing image?" in ScribusMainWindow::slotGetClipboardImage() can have a default of No with a GUI but return Yes when there is no GUI so that scripts can actually do something. I changed every occurrence of QMessageBox to be safe even though some of them are probably accessible only through the GUI. This patch can be applied without the patches in http://bugs.scribus.net/view.php?id=12572 although it will have no effect on Scribus without the --no-gui option or some other way to control ScCore->usingGUI(). | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
|
|
Please name your patch files .patch.. or at least .txt.. .pat is a gimp pattern. |
|
There is already a ScMessageBox class. ScribusMessageBox code should go in that class. |
|
I saw that, but I noticed that nothing used it. Also, ScMessageBox uses the deprecated QMessageBox API, see http://qt-project.org/doc/qt-5/qmessagebox-obsolete.html In my ScribusMessageBox, I implemented only the new, preferred API and converted uses of the obsolete functions the new functions. Would it be acceptable if I replaced the insides of ScMessageBox with my code and changed the patch to use ScMessageBox instead of ScribusMessageBox? |
|
>> Would it be acceptable if I replaced the insides of ScMessageBox with my code and changed the patch to use ScMessageBox instead of ScribusMessageBox? Yep! |
|
I uploaded a revised version of the patches as scribus15-20141018-181033-messagebox.patch I changed the class from ScribusMessageBox to ScMessageBox. The new class is in scribus/ui/scmessagebox.cpp instead of scribus/scribusmessagebox.cpp. When I needed to add an #include, I added an include for ui/scrmessagebox.h instead of scribus.h. I updated the only use of the old ScMessageBox in ScribusMainWindow::slotPageImport() at line 3209 of scribus.cpp. I added more comments in scmessagebox.cpp and .h. |
|
scribus15-20141018-200614-messagebox.patch (135,418 bytes)
--- scribus15/scribus/canvasmode_framelinks.cpp- 2014-08-07 21:22:06.271835423 -0400 +++ scribus15/scribus/canvasmode_framelinks.cpp 2014-10-18 20:00:58.686504956 -0400 @@ -188,12 +188,12 @@ { if (bb->prevInChain() != NULL) { - QMessageBox msgBox(QMessageBox::Question, tr("Linking Text Frames"), + ScMessageBox msgBox(QMessageBox::Question, tr("Linking Text Frames"), "<qt>" + ScribusView::tr("You are trying to insert a frame into an existing text chain, where would you like to insert it?") + "<qt>"); - //QMessageBox msgBox; QPushButton *cancelButton = msgBox.addButton(CommonStrings::tr_Cancel, QMessageBox::RejectRole); QPushButton *beforeButton = msgBox.addButton(tr("Before"), QMessageBox::AcceptRole); QPushButton *afterButton = msgBox.addButton(tr("After"), QMessageBox::AcceptRole); + msgBox.setDefaultBatchButton(afterButton); msgBox.exec(); if ((QPushButton *) msgBox.clickedButton() == cancelButton) break; @@ -248,14 +248,14 @@ { //CB Mouse is released when this messagebox takes focus m_canvas->m_viewMode.m_MouseButtonPressed = false; - QMessageBox::warning(m_view, ScribusView::tr("Linking Text Frames"), + ScMessageBox::warning(m_view, ScribusView::tr("Linking Text Frames"), "<qt>" + ScribusView::tr("You are trying to link a frame to itself.") + "</qt>"); } else { //CB Mouse is released when this messagebox takes focus m_canvas->m_viewMode.m_MouseButtonPressed = false; - QMessageBox::warning(m_view, ScribusView::tr("Linking Text Frames"), + ScMessageBox::warning(m_view, ScribusView::tr("Linking Text Frames"), "<qt>" + ScribusView::tr("You are trying to link a non-empty frame to frame which is already linked.") + "</qt>"); } } --- scribus15/scribus/canvasmode_normal.cpp- 2014-09-01 19:46:39.031628634 -0400 +++ scribus15/scribus/canvasmode_normal.cpp 2014-10-18 20:00:58.686504956 -0400 @@ -1543,18 +1543,18 @@ else { QString message = tr("Page %1 does not exist!").arg(currItem->annotation().Ziel() + 1); - QMessageBox::warning(m_view, CommonStrings::trWarning, message, CommonStrings::tr_OK); + ScMessageBox::warning(m_view, CommonStrings::trWarning, message); } } else if (currItem->annotation().ActionType() == Annotation::Action_URI) { QString message = tr("Link Target is Web URL.\nURL: %1").arg(currItem->annotation().Extern()); - QMessageBox::information(m_view, tr("Information"), message, CommonStrings::tr_OK); + ScMessageBox::information(m_view, tr("Information"), message); } else if ((currItem->annotation().ActionType() == Annotation::Action_GoToR_FileAbs) || (currItem->annotation().ActionType() == Annotation::Action_GoToR_FileRel)) { QString message = tr("Link Target is external File.\nFile: %1\nPage: %2").arg(currItem->annotation().Extern()).arg(currItem->annotation().Ziel() + 1); - QMessageBox::information(m_view, tr("Information"), message, CommonStrings::tr_OK); + ScMessageBox::information(m_view, tr("Information"), message); } } --- scribus15/scribus/collect4output.cpp- 2014-08-07 21:22:06.613837956 -0400 +++ scribus15/scribus/collect4output.cpp 2014-10-18 20:00:58.686504956 -0400 @@ -99,9 +99,8 @@ bool created = dir.mkpath(directories[i]); if (!created) { - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, - "<qt>" + tr("Cannot create directory:\n%1").arg(directories[i]) + "</qt>", - CommonStrings::tr_OK); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, + "<qt>" + tr("Cannot create directory:\n%1").arg(directories[i]) + "</qt>"); return false; } } @@ -120,9 +119,8 @@ if (!collectItems()) { QString errorMsg( tr("Cannot collect all files for output for file:\n%1").arg(newName) ); - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, - "<qt>" + errorMsg + "</qt>", - CommonStrings::tr_OK); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, + "<qt>" + errorMsg + "</qt>"); return errorMsg; } @@ -135,7 +133,7 @@ if (!collectDocument()) { QString errorMsg( tr("Cannot collect the file: \n%1").arg(newName) ); - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, "<qt>" + errorMsg + "</qt>", CommonStrings::tr_OK); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, "<qt>" + errorMsg + "</qt>"); return errorMsg; } --- scribus15/scribus/fileloader.cpp- 2014-08-14 13:53:53.261452577 -0400 +++ scribus15/scribus/fileloader.cpp 2014-10-18 20:00:58.686504956 -0400 @@ -481,7 +481,7 @@ { mess += it.key() + tr(" was replaced by: ")+ it.value() +"\n"; } - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, mess, 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, mess); } } --- scribus15/scribus/latexhelpers.cpp- 2014-08-07 21:22:05.823832106 -0400 +++ scribus15/scribus/latexhelpers.cpp 2014-10-18 20:00:58.686504956 -0400 @@ -30,7 +30,7 @@ #include "prefsmanager.h" #include "scpaths.h" - +#include "ui/scmessagebox.h" LatexHighlighter::LatexHighlighter(QTextDocument *document) : QSyntaxHighlighter(document) @@ -101,10 +101,10 @@ QFile f(fn); if (!f.open(QIODevice::ReadOnly)) { - QMessageBox::critical(0, QObject::tr("Error"), "<qt>" + + ScMessageBox::critical(0, QObject::tr("Error"), "<qt>" + QObject::tr("Opening the configfile %1 failed! %2").arg( fn, f.errorString()) - + "</qt>", 1, 0, 0); + + "</qt>"); } xml.setDevice(&f); @@ -428,11 +428,11 @@ error[filename] = hasError; if (hasError) { - QMessageBox::critical(0, QObject::tr("Error"), "<qt>" + + ScMessageBox::critical(0, QObject::tr("Error"), "<qt>" + QObject::tr("Parsing the configfile %1 failed! Depending on the type of the error " "render frames might not work correctly!\n%2").arg( filename, parser->error()) - + "</qt>", 1, 0, 0); + + "</qt>"); } } --- scribus15/scribus/loadsaveplugin.cpp- 2014-10-18 15:03:06.212405324 -0400 +++ scribus15/scribus/loadsaveplugin.cpp 2014-10-18 20:00:58.687504963 -0400 @@ -442,8 +442,7 @@ { if (ScCore->usingGUI()) { - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, - plug->lastError(), CommonStrings::tr_OK); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, plug->lastError()); } else { @@ -509,8 +508,7 @@ { if (ScCore->usingGUI()) { - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, - plug->lastError(), CommonStrings::tr_OK); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, plug->lastError()); } else { --- scribus15/scribus/main_nix.cpp- 2014-10-18 20:00:58.675504880 -0400 +++ scribus15/scribus/main_nix.cpp 2014-10-18 20:00:58.687504963 -0400 @@ -133,7 +133,7 @@ if (ScribusQApp::useGUI) { ScCore->closeSplash(); - QMessageBox::critical(ScMW, sigHdr, sigMsg, QObject::tr("&OK")); + ScMessageBox::critical(ScMW, sigHdr, sigMsg); ScMW->emergencySave(); ScMW->close(); } --- scribus15/scribus/main_win32.cpp- 2014-10-18 20:00:58.675504880 -0400 +++ scribus15/scribus/main_win32.cpp 2014-10-18 20:03:12.553435342 -0400 @@ -287,7 +287,7 @@ if (ScribusQApp::useGUI) { ScCore->closeSplash(); - QMessageBox::critical(ScMW, expHdr, expMsg, QObject::tr("&OK")); + ScMessageBox::critical(ScMW, expHdr, expMsg); ScMW->emergencySave(); ScMW->close(); } @@ -325,7 +325,7 @@ ScCore->closeSplash(); QString expHdr = QObject::tr("Scribus Crash"); QString expMsg = msg; - QMessageBox::critical(ScMW, expHdr, expMsg, QObject::tr("&OK")); + ScMessageBox::critical(ScMW, expHdr, expMsg); ScMW->emergencySave(); ScMW->close(); } --- scribus15/scribus/pageitem_latexframe.cpp- 2014-08-07 21:22:06.624838037 -0400 +++ scribus15/scribus/pageitem_latexframe.cpp 2014-10-18 20:00:58.687504963 -0400 @@ -158,7 +158,7 @@ if (firstWarning && !killed) { bool editorRunning = internalEditor && internalEditor->isVisible(); - QMessageBox msgBox; + ScMessageBox msgBox; msgBox.setText(tr("Running the external application failed!")); QString informativeText = tr("This is usually a problem with your input. Please check the program's output."); if (!editorRunning) { @@ -240,9 +240,9 @@ update(); //Show error marker if (firstWarningTmpfile) { - QMessageBox::critical(0, tr("Error"), "<qt>" + + ScMessageBox::critical(0, tr("Error"), "<qt>" + tr("Could not create a temporary file to run the application!") - + "</qt>", 1, 0, 0); + + "</qt>"); firstWarningTmpfile = false; } qCritical() << "RENDER FRAME:" << tr("Could not create a temporary file to run the application!"); @@ -260,9 +260,9 @@ update(); //Show error marker if (firstWarningLatexMissing) { - QMessageBox::critical(0, tr("Error"), + ScMessageBox::critical(0, tr("Error"), "<qt>" + tr("The config file didn't specify a executable path!") + - "</qt>",1, 0, 0); + "</qt>"); firstWarningLatexMissing = false; } qCritical() << "RENDER FRAME:" << tr("The config file didn't specify a executable path!"); @@ -408,14 +408,14 @@ if (firstWarning) { if (latex->error() == QProcess::FailedToStart) { - QMessageBox::critical(0, tr("Error"), "<qt>" + + ScMessageBox::critical(0, tr("Error"), "<qt>" + tr("The application \"%1\" failed to start! Please check the path: "). arg(config->executable()) - + "</qt>", 1, 0, 0); + + "</qt>"); } else { - QMessageBox::critical(0, tr("Error"), "<qt>" + + ScMessageBox::critical(0, tr("Error"), "<qt>" + tr("The application \"%1\" crashed!").arg(config->executable()) - + "</qt>", 1, 0, 0); + + "</qt>"); } firstWarning = false; } --- scribus15/scribus/pluginmanager.cpp- 2014-08-07 21:22:05.310828307 -0400 +++ scribus15/scribus/pluginmanager.cpp 2014-10-18 20:00:58.687504963 -0400 @@ -228,11 +228,10 @@ failedStr += "</ul>"; if (splashShown) ScCore->showSplash(false); - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, "<qt>" + tr("There is a problem loading %1 of %2 plugins. %3 This is probably caused by some kind of dependency issue or old plugins existing in your install directory. If you clean out your install directory and reinstall and this still occurs, please report it on bugs.scribus.net." ).arg(allPlugs.count()-loaded).arg(allPlugs.count()).arg(failedStr) - + "</qt>", - CommonStrings::tr_OK); + + "</qt>"); if (splashShown) ScCore->showSplash(true); } --- scribus15/scribus/plugins/colorwheel/cwdialog.cpp- 2014-08-07 21:22:06.846839681 -0400 +++ scribus15/scribus/plugins/colorwheel/cwdialog.cpp 2014-10-18 20:00:58.687504963 -0400 @@ -338,7 +338,7 @@ status += "<p>" + tr("Now opening the color manager.") + "</p></qt>"; if (err) { - QMessageBox::information(this, tr("Color Merging"), status); + ScMessageBox::information(this, tr("Color Merging"), status); m_Doc->scMW()->managePaints(); return; } @@ -486,7 +486,7 @@ else { colorList->clear(); - QMessageBox::information(this, windowTitle(), + ScMessageBox::information(this, windowTitle(), "<qt>" + tr("Unable to find the requested color. " "You have probably selected black, gray or white. " "There is no way to process this color.") + "</qt>"); --- scribus15/scribus/plugins/export/pixmapexport/export.cpp- 2014-08-07 21:22:07.763846472 -0400 +++ scribus15/scribus/plugins/export/pixmapexport/export.cpp 2014-10-18 20:00:58.687504963 -0400 @@ -120,13 +120,13 @@ QFileInfo fi(ex->exportDir); if (!fi.isDir()) { - QMessageBox::warning(doc->scMW(), tr("Save as Image"), + ScMessageBox::warning(doc->scMW(), tr("Save as Image"), tr("The target location %1 must be an existing directory").arg(ex->exportDir)); return false; } if (!fi.isWritable()) { - QMessageBox::warning(doc->scMW(), tr("Save as Image"), + ScMessageBox::warning(doc->scMW(), tr("Save as Image"), tr("The target location %1 must be writable").arg(ex->exportDir)); return false; } @@ -191,7 +191,7 @@ QImage im(doc->view()->PageToPixmap(pageNr, qRound(pixmapSize * enlargement * (pageDPI / 72.0) / 100.0), false, background)); if (im.isNull()) { - QMessageBox::warning(doc->scMW(), tr("Save as Image"), tr("Insufficient memory for this image size.")); + ScMessageBox::warning(doc->scMW(), tr("Save as Image"), tr("Insufficient memory for this image size.")); doc->scMW()->setStatusBarInfoText( tr("Insufficient memory for this image size.")); return false; } @@ -204,10 +204,12 @@ QString fn = QDir::toNativeSeparators(fileName); // QApplication::restoreOverrideCursor(); QApplication::changeOverrideCursor(Qt::ArrowCursor); - over = QMessageBox::question(doc->scMW(), tr("File exists. Overwrite?"), + over = ScMessageBox::question(doc->scMW(), tr("File exists. Overwrite?"), fn +"\n"+ tr("exists already. Overwrite?"), // hack for multiple overwriting (petr) - (single == true) ? QMessageBox::Yes | QMessageBox::No : QMessageBox::Yes | QMessageBox::No | QMessageBox::YesToAll); + (single == true) ? QMessageBox::Yes | QMessageBox::No : QMessageBox::Yes | QMessageBox::No | QMessageBox::YesToAll, + QMessageBox::NoButton, // GUI default + QMessageBox::YesToAll); // batch default QApplication::changeOverrideCursor(QCursor(Qt::WaitCursor)); if (over == QMessageBox::Yes || over == QMessageBox::YesToAll) doFileSave = true; @@ -218,7 +220,7 @@ saved = im.save(fileName, bitmapType.toLocal8Bit().constData(), quality); if (!saved && doFileSave) { - QMessageBox::warning(doc->scMW(), tr("Save as Image"), tr("Error writing the output file(s).")); + ScMessageBox::warning(doc->scMW(), tr("Save as Image"), tr("Error writing the output file(s).")); doc->scMW()->setStatusBarInfoText( tr("Error writing the output file(s).")); } return saved; --- scribus15/scribus/plugins/export/svgexplugin/svgexplugin.cpp- 2014-08-07 21:22:07.735846265 -0400 +++ scribus15/scribus/plugins/export/svgexplugin/svgexplugin.cpp 2014-10-18 20:00:58.688504970 -0400 @@ -51,6 +51,7 @@ #include "util.h" #include "ui/customfdialog.h" #include "ui/guidemanager.h" +#include "ui/scmessagebox.h" #include "sccolorengine.h" #include "util_formats.h" #include "util_math.h" @@ -169,9 +170,11 @@ QFile f(fileName); if (f.exists()) { - int exit = QMessageBox::warning(doc->scMW(), CommonStrings::trWarning, + int exit = ScMessageBox::warning(doc->scMW(), CommonStrings::trWarning, QObject::tr("Do you really want to overwrite the file:\n%1 ?").arg(fileName), - QMessageBox::Yes | QMessageBox::No); + QMessageBox::Yes | QMessageBox::No, + QMessageBox::NoButton, // GUI default + QMessageBox::Yes); // batch default if (exit == QMessageBox::No) return true; } --- scribus15/scribus/plugins/export/xpsexport/xpsexplugin.cpp- 2014-08-07 21:22:07.751846383 -0400 +++ scribus15/scribus/plugins/export/xpsexport/xpsexplugin.cpp 2014-10-18 20:00:58.688504970 -0400 @@ -54,6 +54,7 @@ #include "util.h" #include "ui/customfdialog.h" #include "ui/guidemanager.h" +#include "ui/scmessagebox.h" #include "sccolorengine.h" #include "util_formats.h" #include "util_math.h" @@ -183,9 +184,11 @@ QFile f(fileName); if (f.exists()) { - int exit = QMessageBox::warning(doc->scMW(), CommonStrings::trWarning, + int exit = ScMessageBox::warning(doc->scMW(), CommonStrings::trWarning, QObject::tr("Do you really want to overwrite the file:\n%1 ?").arg(fileName), - QMessageBox::Yes | QMessageBox::No); + QMessageBox::Yes | QMessageBox::No, + QMessageBox::NoButton, // GUI default + QMessageBox::Yes); // batch default if (exit == QMessageBox::No) return true; } --- scribus15/scribus/plugins/fileloader/scribus12format/scribus12format.cpp- 2014-10-14 12:50:58.276969120 -0400 +++ scribus15/scribus/plugins/fileloader/scribus12format/scribus12format.cpp 2014-10-18 20:00:58.688504970 -0400 @@ -21,6 +21,7 @@ #include "scribusview.h" #include "scribuscore.h" #include "sctextstream.h" +#include "ui/scmessagebox.h" #include "units.h" #include "util.h" #include "util_color.h" @@ -1364,7 +1365,7 @@ if (m_mwProgressBar!=0) m_mwProgressBar->setValue(DOC.childNodes().count()); - QMessageBox::warning(ScCore->primaryMainWindow(), + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("You have opened a file produced by Scribus 1.2.x.\n" "If you save it in this version, it will no longer be readable by older Scribus versions.")); --- scribus15/scribus/plugins/fileloader/scribus13format/scribus13format.cpp- 2014-10-14 12:50:58.411970104 -0400 +++ scribus15/scribus/plugins/fileloader/scribus13format/scribus13format.cpp 2014-10-18 20:00:58.689504977 -0400 @@ -19,6 +19,7 @@ #include "sctextstream.h" #include "sccolorengine.h" +#include "ui/scmessagebox.h" #include "undomanager.h" #include "units.h" #include "util.h" @@ -1186,7 +1187,7 @@ if (m_mwProgressBar!=0) m_mwProgressBar->setValue(DOC.childNodes().count()); - QMessageBox::warning(ScCore->primaryMainWindow(), + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("You have opened a file produced by Scribus 1.3.3.x.\n" "If you save it in this version, it will no longer be readable by older Scribus versions.")); --- scribus15/scribus/plugins/gettext/docim/docim.cpp- 2014-08-07 21:22:08.247850056 -0400 +++ scribus15/scribus/plugins/gettext/docim/docim.cpp 2014-10-18 20:00:58.689504977 -0400 @@ -9,6 +9,7 @@ #include "gtwriter.h" #include "scpaths.h" #include "scribusstructs.h" +#include "ui/scmessagebox.h" #include <QObject> #include <QByteArray> #include <QMessageBox> @@ -177,7 +178,7 @@ if (failed) { QString error = codec->toUnicode( errorBuffer.data() ); - QMessageBox::information(0, tr("Importing failed"), + ScMessageBox::information(0, tr("Importing failed"), tr("Importing Word document failed \n%1").arg(error), QMessageBox::Ok); return; --- scribus15/scribus/plugins/gettext/pdbim/pdbim.cpp- 2014-08-07 21:22:08.252850093 -0400 +++ scribus15/scribus/plugins/gettext/pdbim/pdbim.cpp 2014-10-18 20:00:58.689504977 -0400 @@ -19,6 +19,7 @@ #include "gtparagraphstyle.h" #include "scribusstructs.h" #include "scribuscore.h" +#include "ui/scmessagebox.h" /*! \brief A dummy 0 filler (helper procedure) @@ -91,7 +92,7 @@ if (!m_pdfp) { - QMessageBox::warning(ScCore->primaryMainWindow(), QObject::tr("PDB Import", "PDB Importer"), + ScMessageBox::warning(ScCore->primaryMainWindow(), QObject::tr("PDB Import", "PDB Importer"), "<qt>" + QObject::tr("Could not open file %1", "PDB Importer").arg(fname) + "</qt>", QMessageBox::Ok, QMessageBox::NoButton); return; @@ -100,7 +101,7 @@ if (strncmp(m_header.type, DOC_TYPE, sizeof(m_header.type) ) || strncmp( m_header.creator, DOC_CREATOR, sizeof(m_header.creator))) { - QMessageBox::warning(ScCore->primaryMainWindow(), QObject::tr("PDB Import", "PDB Importer"), + ScMessageBox::warning(ScCore->primaryMainWindow(), QObject::tr("PDB Import", "PDB Importer"), "<qt>" + QObject::tr("This file is not recognized as a PDB document. Please, report this as a bug if you are sure it is one.", "PDB Importer") + "</qt>", QMessageBox::Ok, QMessageBox::NoButton); return; --- scribus15/scribus/plugins/gettext/xtgim/xtgscanner.cpp- 2014-08-07 21:22:08.196849679 -0400 +++ scribus15/scribus/plugins/gettext/xtgim/xtgscanner.cpp 2014-10-18 20:00:58.689504977 -0400 @@ -34,6 +34,7 @@ #include "fonts/scface.h" #include "scribusdoc.h" #include "text/specialchars.h" +#include "ui/scmessagebox.h" XtgScanner::XtgScanner (QString documentName, TextWriter *wr, QString& buffer, bool textOnly, bool prefix) @@ -1290,7 +1291,7 @@ void XtgScanner::showWarning(QString &name) { - QMessageBox msgBox; + ScMessageBox msgBox; msgBox.setWindowTitle("Message"); QString message = "Style " + name + " is not defined, falling back to Scribus Default"; msgBox.setText(message); --- scribus15/scribus/plugins/import/ai/importaiplugin.cpp- 2014-09-05 16:06:31.441245659 -0400 +++ scribus15/scribus/plugins/import/ai/importaiplugin.cpp 2014-10-18 20:00:58.689504977 -0400 @@ -20,6 +20,7 @@ #include "util_formats.h" #include "ui/customfdialog.h" +#include "ui/scmessagebox.h" #include "ui/scmwmenumanager.h" #include <QApplication> @@ -162,7 +163,7 @@ if (tempBuf.startsWith("%PDF")) { qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox msgBox(ScCore->primaryMainWindow()); + ScMessageBox msgBox(ScCore->primaryMainWindow()); msgBox.setText( tr("This file contains 2 versions of the data.")); msgBox.setInformativeText( tr("Choose which one should be imported")); msgBox.setIcon(QMessageBox::Question); @@ -176,7 +177,7 @@ const FileFormat *fmt = LoadSavePlugin::getFormatByExt("pdf"); if (!fmt) { - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The PDF Import plugin could not be found"), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The PDF Import plugin could not be found")); return false; } qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); @@ -186,7 +187,7 @@ if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted)) UndoManager::instance()->setUndoEnabled(true); if (!success) - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported"), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported")); return success; } qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); @@ -197,7 +198,7 @@ const FileFormat *fmt = LoadSavePlugin::getFormatByExt("eps"); if (!fmt) { - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The EPS Import plugin could not be found"), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The EPS Import plugin could not be found")); return false; } qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); @@ -207,7 +208,7 @@ if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted)) UndoManager::instance()->setUndoEnabled(true); if (!success) - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported"), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported")); return success; } } @@ -221,7 +222,7 @@ if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted)) UndoManager::instance()->setUndoEnabled(true); if (!success) - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported"), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported")); delete dia; return success; } --- scribus15/scribus/plugins/import/cdr/importcdr.cpp- 2014-08-07 21:22:07.159841999 -0400 +++ scribus15/scribus/plugins/import/cdr/importcdr.cpp 2014-10-18 20:00:58.689504977 -0400 @@ -362,7 +362,7 @@ { ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW(); qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org")); qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); }*/ return false; @@ -385,7 +385,7 @@ { ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW(); qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org")); qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); } return false; --- scribus15/scribus/plugins/import/cdr/importcdrplugin.cpp- 2014-08-14 13:53:53.224452314 -0400 +++ scribus15/scribus/plugins/import/cdr/importcdrplugin.cpp 2014-10-18 20:00:58.689504977 -0400 @@ -18,6 +18,7 @@ #include "util_formats.h" #include "ui/customfdialog.h" +#include "ui/scmessagebox.h" #include "ui/scmwmenumanager.h" #include <QMessageBox> @@ -155,7 +156,7 @@ const FileFormat *fmt = LoadSavePlugin::getFormatByExt("cdt"); if (!fmt) { - QMessageBox::warning(mw, CommonStrings::trWarning, tr("The Uniconverter Import plugin could not be found"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("The Uniconverter Import plugin could not be found")); return false; } flags &= ~LoadSavePlugin::lfCreateDoc; @@ -164,7 +165,7 @@ { if (flags & LoadSavePlugin::lfCreateDoc) { - QMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org")); } return false; } --- scribus15/scribus/plugins/import/oodraw/oodrawimp.cpp- 2014-10-18 15:03:06.090404433 -0400 +++ scribus15/scribus/plugins/import/oodraw/oodrawimp.cpp 2014-10-18 20:00:58.690504984 -0400 @@ -43,6 +43,7 @@ #include "third_party/zip/scribus_zip.h" #include "ui/customfdialog.h" #include "ui/propertiespalette.h" +#include "ui/scmessagebox.h" #include "ui/scmwmenumanager.h" #include "undomanager.h" #include "util.h" @@ -203,9 +204,9 @@ if (dia.importCanceled) { if ((!importDone) || (dia.importFailed)) - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported"), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The file could not be imported")); else if (dia.unsupported) - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("This file contains some unsupported features"), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("This file contains some unsupported features")); } return importDone; } @@ -415,7 +416,7 @@ drawPage = offDraw.namedItem( "draw:page" ); if (drawPage.isNull()) { - QMessageBox::warning( m_Doc->scMW(), CommonStrings::trWarning, tr("This document does not seem to be an OpenOffice Draw file.") ); + ScMessageBox::warning( m_Doc->scMW(), CommonStrings::trWarning, tr("This document does not seem to be an OpenOffice Draw file.") ); return false; } else --- scribus15/scribus/plugins/import/pdf/importpdfplugin.cpp- 2014-08-14 13:53:53.230452356 -0400 +++ scribus15/scribus/plugins/import/pdf/importpdfplugin.cpp 2014-10-18 20:00:58.690504984 -0400 @@ -23,6 +23,7 @@ #include "util.h" #include "ui/customfdialog.h" +#include "ui/scmessagebox.h" #include "ui/scmwmenumanager.h" int importpdf_getPluginAPIVersion() @@ -211,7 +212,7 @@ else { qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The Import plugin cannot handle Postscript files"), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, tr("The Import plugin cannot handle Postscript files")); qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); return false; } --- scribus15/scribus/plugins/import/pm/importpm.cpp- 2014-09-01 19:46:38.905627525 -0400 +++ scribus15/scribus/plugins/import/pm/importpm.cpp 2014-10-18 20:00:58.690504984 -0400 @@ -348,7 +348,7 @@ { ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW(); qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org")); qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); } return false; --- scribus15/scribus/plugins/import/ps/importps.cpp- 2014-08-07 21:22:07.284842925 -0400 +++ scribus15/scribus/plugins/import/ps/importps.cpp 2014-10-18 20:00:58.690504984 -0400 @@ -40,6 +40,7 @@ #include "ui/customfdialog.h" #include "ui/multiprogressdialog.h" #include "ui/propertiespalette.h" +#include "ui/scmessagebox.h" #include "undomanager.h" #include "util.h" #include "util_color.h" @@ -425,7 +426,7 @@ if (progressDialog) progressDialog->close(); QString mess = tr("Importing File:\n%1\nfailed!").arg(fn); - QMessageBox::critical(0, tr("Fatal Error"), mess, 1, 0, 0); + ScMessageBox::critical(0, tr("Fatal Error"), mess); return false; } if(progressDialog && !cancel) { @@ -764,7 +765,7 @@ if (failedImages > 0) { QString mess = tr("Converting of %1 images failed!").arg(failedImages); - QMessageBox::critical(0, tr("Error"), mess, 1, 0, 0); + ScMessageBox::critical(0, tr("Error"), mess); } } --- scribus15/scribus/plugins/import/pub/importpub.cpp- 2014-08-07 21:22:07.351843421 -0400 +++ scribus15/scribus/plugins/import/pub/importpub.cpp 2014-10-18 20:00:58.690504984 -0400 @@ -356,7 +356,7 @@ { ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW(); qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org")); qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); } return false; --- scribus15/scribus/plugins/import/svg/svgplugin.cpp- 2014-10-18 15:03:06.094404462 -0400 +++ scribus15/scribus/plugins/import/svg/svgplugin.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -43,6 +43,7 @@ #include "selection.h" #include "ui/customfdialog.h" #include "ui/propertiespalette.h" +#include "ui/scmessagebox.h" #include "ui/scmwmenumanager.h" #include "undomanager.h" #include "util.h" @@ -195,9 +196,9 @@ if (dia->importCanceled) { if (dia->importFailed) - QMessageBox::warning(mw, CommonStrings::trWarning, tr("The file could not be imported"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("The file could not be imported")); // else if (dia->unsupported) - // QMessageBox::warning(mw, CommonStrings::trWarning, tr("SVG file contains some unsupported features"), 1, 0, 0); + // ScMessageBox::warning(mw, CommonStrings::trWarning, tr("SVG file contains some unsupported features")); } delete dia; --- scribus15/scribus/plugins/import/uniconvertor/uniconvplugin.cpp- 2014-08-07 21:22:07.508844584 -0400 +++ scribus15/scribus/plugins/import/uniconvertor/uniconvplugin.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -28,6 +28,7 @@ #include "commonstrings.h" #include "scribuscore.h" +#include "ui/scmessagebox.h" #include "undomanager.h" int uniconvertorplugin_getPluginAPIVersion() @@ -153,7 +154,7 @@ if (!uniconv.waitForStarted(120000)) { qWarning() << "Uniconvertor failed:" << PrefsManager::instance()->uniconvExecutable() << arguments; - QMessageBox::warning(mw, CommonStrings::trWarning, + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Starting Uniconvertor failed! The executable name in " "File->Preferences->External Tools may be incorrect or the " "software has been uninstalled since preferences " @@ -163,7 +164,7 @@ } if (!uniconv.waitForFinished(120000)) { qDebug() << "Uniconv exit code:" << uniconv.exitCode(); - QMessageBox::warning(mw, CommonStrings::trWarning, + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Uniconvertor did not exit correctly: %1").arg( uniconv.errorString()).arg(QString(uniconv.readAll()))); delete tempFile; @@ -171,7 +172,7 @@ } if (uniconv.exitCode()) { qDebug() << "Uniconv exit code:" << uniconv.exitCode(); - QMessageBox::warning(mw, CommonStrings::trWarning, + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Uniconvertor failed to convert the file: %1").arg( QString(uniconv.readAll()))); delete tempFile; @@ -181,7 +182,7 @@ //Import SVG const FileFormat *fmt = LoadSavePlugin::getFormatByExt("svg"); if (!fmt) { - QMessageBox::warning(mw, CommonStrings::trWarning, tr("The SVG Import plugin could not be found"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("The SVG Import plugin could not be found")); delete tempFile; return false; } --- scribus15/scribus/plugins/import/vsd/importvsd.cpp- 2014-08-07 21:22:07.485844413 -0400 +++ scribus15/scribus/plugins/import/vsd/importvsd.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -358,7 +358,7 @@ { ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW(); qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("Parsing failed!\n\nPlease submit your file (if possible) to the\nDocument Liberation Project http://www.documentliberation.org")); qApp->changeOverrideCursor(QCursor(Qt::WaitCursor)); } } --- scribus15/scribus/plugins/import/wmf/wmfimportplugin.cpp- 2014-08-14 13:53:53.170451929 -0400 +++ scribus15/scribus/plugins/import/wmf/wmfimportplugin.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -29,6 +29,7 @@ #include "selection.h" #include "undomanager.h" #include "loadsaveplugin.h" +#include "ui/scmessagebox.h" #include "util.h" #include "util_formats.h" #include "fonts/scfontmetrics.h" @@ -172,9 +173,9 @@ if (dia->importCanceled) { if (dia->importFailed) - QMessageBox::warning(mw, CommonStrings::trWarning, tr("The file could not be imported"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("The file could not be imported")); else if (dia->unsupported) - QMessageBox::warning(mw, CommonStrings::trWarning, tr("WMF file contains some unsupported features"), 1, 0, 0); + ScMessageBox::warning(mw, CommonStrings::trWarning, tr("WMF file contains some unsupported features")); } bool success = !dia->importFailed; --- scribus15/scribus/plugins/myplugin/mypluginimpl.cpp- 2014-08-07 21:22:06.851839718 -0400 +++ scribus15/scribus/plugins/myplugin/mypluginimpl.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -6,6 +6,7 @@ */ #include "mypluginimpl.h" #include "scribusdoc.h" +#include "ui/scmessagebox.h" #include <QString> #include <QMessageBox> @@ -18,7 +19,7 @@ bool MyPluginImpl::run(const QString & target, ScribusDoc* doc) { // Do the bulk of your work here - QMessageBox::information( + ScMessageBox::information( (QWidget*)doc->scMW(), tr("Scribus - My Plugin"), tr("The plugin worked!"), --- scribus15/scribus/plugins/picbrowser/picturebrowser.cpp- 2014-08-07 21:22:07.709846072 -0400 +++ scribus15/scribus/plugins/picbrowser/picturebrowser.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -12,6 +12,7 @@ #include "findimage.h" #include "previewimage.h" #include "loadimage.h" +#include "ui/scmessagebox.h" #include "fileloader.h" #include "loadsaveplugin.h" @@ -405,7 +406,7 @@ if ( ( previewIconIndex < 0 ) || ( previewIconIndex > pImages->previewImagesList.size() ) ) { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "No Image(s) Selected" ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "No Image(s) Selected" ) ); return; } @@ -728,7 +729,7 @@ switch ( crt->type ) { case 0: -// QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "File not found or file is not a collection file" ) ); +// ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "File not found or file is not a collection file" ) ); break; case 1: @@ -751,7 +752,7 @@ if ( !currItem ) { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "You have to create a category first" ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "You have to create a category first" ) ); return; } } @@ -831,7 +832,7 @@ if ( !tmpCrt->type ) { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), QString ( "A collection was not found:\n%1\nit will be created" ).arg ( tmpCrt->xmlFile ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), QString ( "A collection was not found:\n%1\nit will be created" ).arg ( tmpCrt->xmlFile ) ); tmpCollection = new imageCollection; tmpCollection->imageFiles = tmpCrt->addImages; } @@ -915,7 +916,7 @@ { if ( ( previewIconIndex < 0 ) || ( previewIconIndex > pModel->modelItemsList.size() ) ) { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "No image(s) selected" ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "No image(s) selected" ) ); return; } @@ -960,7 +961,7 @@ if ( pageList.isEmpty() ) { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "No page/image frame selected" ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "No page/image frame selected" ) ); return; } @@ -1066,7 +1067,7 @@ if ( !dir.exists() ) { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "Directory does not exist" ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "Directory does not exist" ) ); return; } @@ -1261,7 +1262,7 @@ if ( !currItem ) { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "You have to create a category first" ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "You have to create a category first" ) ); return; } } @@ -1331,7 +1332,7 @@ if ( !currItem ) { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "You have to select something you want to export" ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "You have to select something you want to export" ) ); return; } @@ -1440,7 +1441,7 @@ } else { - QMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "No tag entered" ) ); + ScMessageBox::warning ( this, tr ( "Picture Browser Error" ), tr ( "No tag entered" ) ); } } --- scribus15/scribus/plugins/scripter/api_dialogs.cpp- 2014-08-07 21:22:08.922855055 -0400 +++ scribus15/scribus/plugins/scripter/api_dialogs.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -8,6 +8,7 @@ #include <QMessageBox> #include "api_dialogs.h" +#include "ui/scmessagebox.h" DialogsAPI::DialogsAPI() : QObject(SCRIPTER) { @@ -28,7 +29,7 @@ */ void DialogsAPI::alert(const QString & message) { - QMessageBox::information( + ScMessageBox::information( 0, //(QWidget*)doc->scMW(), tr("Alert - Scribus"), message, --- scribus15/scribus/plugins/scripter/scripterimpl.cpp- 2014-08-07 21:22:08.883854766 -0400 +++ scribus15/scribus/plugins/scripter/scripterimpl.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -12,6 +12,7 @@ #include <QApplication> #include "scripterimpl.h" +#include "ui/scmessagebox.h" ScripterImpl::ScripterImpl() : QObject(QApplication::instance()) @@ -325,7 +326,7 @@ */ void ScripterImpl::aboutScripter() { - QMessageBox::information( + ScMessageBox::information( 0, //(QWidget*)doc->scMW(), tr("Scribus - Scripter Plugin"), tr("If you see this box, Scripter probably works :)"), --- scribus15/scribus/plugins/scriptplugin/cmddialog.cpp- 2014-08-07 21:22:08.003848249 -0400 +++ scribus15/scribus/plugins/scriptplugin/cmddialog.cpp 2014-10-18 20:00:58.691504991 -0400 @@ -8,6 +8,7 @@ #include "cmdutil.h" #include "scribuscore.h" #include "ui/customfdialog.h" +#include "ui/scmessagebox.h" #include "ui/stylemanager.h" #include <QMessageBox> @@ -85,7 +86,9 @@ if (!PyArg_ParseTupleAndKeywords(args, kw, "eses|iiii", kwargs, "utf-8", &caption, "utf-8", &message, &ico, &butt1, &butt2, &butt3)) return NULL; QApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox mb(QString::fromUtf8(caption), QString::fromUtf8(message), ico, butt1, butt2, butt3, ScCore->primaryMainWindow()); + // ScMessageBox mb(ico, butt1, butt2, butt3, ScCore->primaryMainWindow()); + ScMessageBox mb(ico, QString::fromUtf8(caption), QString::fromUtf8(message), QMessageBox::Ok, ScCore->primaryMainWindow()); + mb.setDefaultButton(QMessageBox::Ok); result = mb.exec(); // QApplication::restoreOverrideCursor(); return PyInt_FromLong(static_cast<long>(result)); --- scribus15/scribus/plugins/scriptplugin/scriptercore.cpp- 2014-10-18 20:00:58.684504942 -0400 +++ scribus15/scribus/plugins/scriptplugin/scriptercore.cpp 2014-10-18 20:00:58.692504998 -0400 @@ -24,6 +24,7 @@ #include "ui/pagepalette.h" //TODO Move the calls to this to a signal #include "ui/layers.h" //TODO Move the calls to this to a signal #include "ui/outlinepalette.h" //TODO Move the calls to this to a signal +#include "ui/scmessagebox.h" #include "ui/scmwmenumanager.h" #include "pconsole.h" #include "scraction.h" @@ -327,7 +328,7 @@ cp->setText(errorMsg); ScCore->closeSplash(); qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor)); - QMessageBox::warning(ScCore->primaryMainWindow(), + ScMessageBox::warning(ScCore->primaryMainWindow(), tr("Script error"), "<qt><p>" + tr("If you are running an official script report it at <a href=\"http://bugs.scribus.net\">bugs.scribus.net</a> please.") @@ -424,7 +425,7 @@ if (result == NULL) { PyErr_Print(); - QMessageBox::warning(ScCore->primaryMainWindow(), tr("Script error"), + ScMessageBox::warning(ScCore->primaryMainWindow(), tr("Script error"), "<qt>" + tr("There was an internal error while trying the " "command you entered. Details were printed to " "stderr. ") + "</qt>"); @@ -587,7 +588,7 @@ if (PyRun_SimpleString(cmd.data())) { PyErr_Print(); - QMessageBox::warning(ScCore->primaryMainWindow(), tr("Script error"), + ScMessageBox::warning(ScCore->primaryMainWindow(), tr("Script error"), tr("Setting up the Python plugin failed. " "Error details were printed to stderr. ")); return false; --- scribus15/scribus/plugins/short-words/prefs_shortwords.cpp- 2014-08-07 21:22:08.360850893 -0400 +++ scribus15/scribus/plugins/short-words/prefs_shortwords.cpp 2014-10-18 20:00:58.692504998 -0400 @@ -12,6 +12,7 @@ #include "swsyntaxhighlighter.h" #include "version.h" #include "scpaths.h" +#include "ui/scmessagebox.h" #include "commonstrings.h" Prefs_ShortWords::Prefs_ShortWords(QWidget* parent) @@ -67,10 +68,12 @@ { if (cfgEdit->document()->isModified() && QFile::exists(RC_PATH_USR)) { - if ((QMessageBox::warning(this, tr("Short Words"), + if ((ScMessageBox::warning(this, tr("Short Words"), "<qt>" + tr("User configuration exists already. " "Do you really want to overwrite it?") + "</qt>", - QMessageBox::Yes|QMessageBox::No) + QMessageBox::Yes|QMessageBox::No, + QMessageBox::NoButton, // GUI default + QMessageBox::Yes) // batch default ) == QMessageBox::No) return; } @@ -78,9 +81,8 @@ QFile f(RC_PATH_USR); if (!f.open(QIODevice::WriteOnly)) { - QMessageBox::warning(this, tr("Short Words"), - "<qt>" + tr("Cannot write file %1.").arg(RC_PATH_USR) + "</qt>", - CommonStrings::tr_OK); + ScMessageBox::warning(this, tr("Short Words"), + "<qt>" + tr("Cannot write file %1.").arg(RC_PATH_USR) + "</qt>"); } QTextStream stream(&f); stream.setCodec("UTF-8"); --- scribus15/scribus/plugins/short-words/swprefsgui.cpp- 2014-08-07 21:22:08.363850915 -0400 +++ scribus15/scribus/plugins/short-words/swprefsgui.cpp 2014-10-18 20:00:58.692504998 -0400 @@ -8,6 +8,7 @@ #include "swsyntaxhighlighter.h" #include "version.h" #include "scpaths.h" +#include "ui/scmessagebox.h" #include "commonstrings.h" #include <QDir> @@ -106,10 +107,12 @@ { if (cfgEdit->document()->isModified() && QFile::exists(RC_PATH_USR)) { - if ((QMessageBox::warning(this, tr("Short Words"), + if ((ScMessageBox::warning(this, tr("Short Words"), "<qt>" + tr("User configuration exists already. " "Do you really want to overwrite it?") + "</qt>", - QMessageBox::Yes|QMessageBox::No) + QMessageBox::Yes|QMessageBox::No, + QMessageBox::NoButton, // GUI default + QMessageBox::Yes) // batch default ) == QMessageBox::No) return; } @@ -117,9 +120,8 @@ QFile f(RC_PATH_USR); if (!f.open(QIODevice::WriteOnly)) { - QMessageBox::warning(this, tr("Short Words"), - "<qt>" + tr("Cannot write file %1.").arg(RC_PATH_USR) + "</qt>", - CommonStrings::tr_OK); + ScMessageBox::warning(this, tr("Short Words"), + "<qt>" + tr("Cannot write file %1.").arg(RC_PATH_USR) + "</qt>"); } QTextStream stream(&f); stream.setCodec("UTF-8"); --- scribus15/scribus/plugins/tools/pathcut/pathcut.cpp- 2014-08-07 21:22:06.761839052 -0400 +++ scribus15/scribus/plugins/tools/pathcut/pathcut.cpp 2014-10-18 20:00:58.692504998 -0400 @@ -29,6 +29,7 @@ #include "scribusdoc.h" #include "appmodes.h" #include "selection.h" +#include "ui/scmessagebox.h" #include "util.h" #include "util_icon.h" #include <QPainterPathStroker> @@ -123,7 +124,7 @@ QString vers = QString(qVersion()).left(5); if (vers < "4.3.3") { - QMessageBox::information(doc->scMW(), tr("Qt Version too old"), tr("This plugin requires at least version 4.3.3 of the Qt library")); + ScMessageBox::information(doc->scMW(), tr("Qt Version too old"), tr("This plugin requires at least version 4.3.3 of the Qt library")); return true; } ScribusDoc* currDoc = doc; @@ -154,7 +155,7 @@ QPainterPath objekt = mm.map(Item2->PoLine.toQPainterPath(true)); if ((objekt.contains(QPointF(start.x(), start.y()))) || (objekt.contains(QPointF(end.x(), end.y())))) { - QMessageBox::information(doc->scMW(), tr("Error"), tr("The cutting line must cross the polygon and\nboth end points must lie outside of the polygon")); + ScMessageBox::information(doc->scMW(), tr("Error"), tr("The cutting line must cross the polygon and\nboth end points must lie outside of the polygon")); return true; } QPainterPath result = objekt.subtracted(cutter); --- scribus15/scribus/plugins/tools/spellcheck/aspellplugin.cpp- 2014-08-07 21:22:06.824839519 -0400 +++ scribus15/scribus/plugins/tools/spellcheck/aspellplugin.cpp 2014-10-18 20:00:58.692504998 -0400 @@ -101,7 +101,7 @@ { doc->scMW()->scrActions[m_actionInfo.name]->setEnabled(false); doc->scMW()->scrActions[m_actionInfo.name]->setVisible(false); - QMessageBox::warning(doc->scMW(), tr("Aspell Plugin Error"), aspellPluginImpl->errorMessage()); + ScMessageBox::warning(doc->scMW(), tr("Aspell Plugin Error"), aspellPluginImpl->errorMessage()); } delete aspellPluginImpl; return true; --- scribus15/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp- 2014-08-07 21:22:06.822839504 -0400 +++ scribus15/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp 2014-10-18 20:00:58.692504998 -0400 @@ -265,7 +265,7 @@ // Called once all words in the current text, i.e., in 'fcontent' // have been spell-checked. Pops up an information dialog. QString completeMsg(tr("Spelling check complete")); - QMessageBox::information(fdoc->scMW(), tr("Spell Checker"), completeMsg); + ScMessageBox::information(fdoc->scMW(), tr("Spell Checker"), completeMsg); if( fFrame && fFrame->asTextFrame() ) fFrame->asTextFrame()->invalidateLayout(); // if( fnchanges.fntot > 0 ) @@ -456,11 +456,13 @@ // the dictionary is to open the spell checker dialog. However, // changing the dictionary does not recheck first word // --- ask user if he wants to restart spellchecker with new lang - if (QMessageBox::question(this, + if (ScMessageBox::question(this, tr("Spell Checker"), tr("Do you want start from the beginning of the selection " "with new language selected?"), - QMessageBox::Yes | QMessageBox::No) + QMessageBox::Yes | QMessageBox::No, + QMessageBox::NoButton, // GUI default + QMessageBox::Yes) // batch default == QMessageBox::Yes) { fpos = 0; --- scribus15/scribus/prefsmanager.cpp- 2014-10-14 12:50:58.274969106 -0400 +++ scribus15/scribus/prefsmanager.cpp 2014-10-18 20:00:58.693505005 -0400 @@ -829,10 +829,13 @@ bool splashShown=ScCore->splashShowing(); if (splashShown) ScCore->showSplash(false); - if ( (QMessageBox::question( ScCore->primaryMainWindow(), tr("Migrate Old Scribus Settings?"), + if ( ScMessageBox::question( ScCore->primaryMainWindow(), tr("Migrate Old Scribus Settings?"), tr("Scribus has detected existing Scribus 1.3.5 preferences files.\n" "Do you want to migrate them to the new Scribus version?"), - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::NoButton))==QMessageBox::Yes ) + QMessageBox::Yes | QMessageBox::No, + QMessageBox::NoButton, // GUI default + QMessageBox::Yes // batch default + )==QMessageBox::Yes ) { for (uint i=0;i<4;++i) { @@ -2684,16 +2687,14 @@ // triggered by a signal sent from here and displayed by ScribusMainWindow. void PrefsManager::alertSavePrefsFailed() const { - QMessageBox::critical(ScCore->primaryMainWindow(), tr("Error Writing Preferences"), + ScMessageBox::critical(ScCore->primaryMainWindow(), tr("Error Writing Preferences"), "<qt>" + tr("Scribus was not able to save its preferences:<br>" "%1<br>" "Please check file and directory permissions and " "available disk space.", "scribus app error") .arg(lastError()) - + "</qt>", - QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape, - QMessageBox::NoButton); + + "</qt>"); } // It's hard to say whether this should be here and called from ReadPrefs, or @@ -2703,15 +2704,13 @@ bool splashShowing = ScCore->splashShowing(); if (splashShowing) ScCore->showSplash(false); - QMessageBox::critical(ScCore->primaryMainWindow(), tr("Error Loading Preferences"), + ScMessageBox::critical(ScCore->primaryMainWindow(), tr("Error Loading Preferences"), "<qt>" + tr("Scribus was not able to load its preferences:<br>" "%1<br>" "Default settings will be loaded.") .arg(lastError()) - + "</qt>", - QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape, - QMessageBox::NoButton); + + "</qt>"); ScCore->showSplash(splashShowing); } --- scribus15/scribus/scimage.cpp- 2014-10-18 15:03:06.213405332 -0400 +++ scribus15/scribus/scimage.cpp 2014-10-18 20:00:58.693505005 -0400 @@ -2319,7 +2319,7 @@ { if (ScCore->usingGUI() && pDataLoader->issuedErrorMsg() && showMsg) { - QMessageBox::critical(ScCore->primaryMainWindow(), CommonStrings::trWarning, pDataLoader->getMessage(), 1, 0, 0); + ScMessageBox::critical(ScCore->primaryMainWindow(), CommonStrings::trWarning, pDataLoader->getMessage()); } else if (pDataLoader->issuedErrorMsg()) { @@ -2698,7 +2698,7 @@ imgInfo.isEmbedded = false; if (ScCore->usingGUI() && pDataLoader->issuedWarningMsg() && showMsg) { - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, pDataLoader->getMessage(), 1, 0, 0); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, pDataLoader->getMessage()); } else if (pDataLoader->issuedErrorMsg()) { --- scribus15/scribus/scribus.cpp- 2014-10-14 12:50:58.796972914 -0400 +++ scribus15/scribus/scribus.cpp 2014-10-18 20:00:58.694505012 -0400 @@ -741,9 +741,11 @@ bool ScribusMainWindow::warningVersion(QWidget *parent) { bool retval = false; - int t = QMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" + + int t = ScMessageBox::warning(parent, QObject::tr("Scribus Development Version"), "<qt>" + QObject::tr("You are running a development version of Scribus 1.5.x. The document you are working with was created in Scribus 1.2.x. Saving the current file under 1.5.x renders it unable to be edited in Scribus 1.2.x versions. To preserve the ability to edit in 1.2.x, save this file under a different name and further edit the newly named file and the original will be untouched. Are you sure you wish to proceed with this operation?") + "</qt>", - QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel); + QMessageBox::Ok | QMessageBox::Cancel, + QMessageBox::Cancel, // GUI default + QMessageBox::Ok); // batch default if (t == QMessageBox::Ok) retval = true; return retval; @@ -3206,28 +3208,34 @@ if (nrToImport > (doc->DocPages.count() - doc->currentPage()->pageNr())) { qApp->setOverrideCursor(QCursor(Qt::ArrowCursor)); - int scmReturn=ScMessageBox::information(this, tr("Import Page(s)"), "<qt>" + + ScMessageBox msgBox; + msgBox.setIcon(QMessageBox::Information); + msgBox.setText(tr("Import Page(s)")); + msgBox.setInformativeText("<qt>" + QObject::tr("<p>You are trying to import more pages than there are available in the current document counting from the active page.</p>Choose one of the following:" "<ul><li><b>Create</b> missing pages</li>" "<li><b>Import</b> pages until the last page</li>" - "<li><b>Cancel</b></li></ul>") + "</qt>", - QObject::tr("C&reate"), - QObject::tr("&Import"), - CommonStrings::tr_Cancel, 2, 2); - switch( scmReturn ) + "<li><b>Cancel</b></li></ul>") + "</qt>"); + QPushButton *createButton = msgBox.addButton(tr("C&reate"), QMessageBox::AcceptRole); + QPushButton *importButton = msgBox.addButton(tr("&Import"), QMessageBox::AcceptRole); + QPushButton *cancelButton = msgBox.addButton(CommonStrings::tr_Cancel, QMessageBox::RejectRole); + msgBox.setDefaultButton(cancelButton); + msgBox.setDefaultBatchButton(createButton); + msgBox.exec(); + if (msgBox.clickedButton() == createButton) { - case 0: - addNewPages(doc->DocPages.count(), 2, - nrToImport - (doc->DocPages.count() - doc->currentPage()->pageNr()), - doc->pageHeight(), doc->pageWidth(), doc->pageOrientation(), doc->pageSize(), true); - break; - case 1: - nrToImport = doc->DocPages.count() - doc->currentPage()->pageNr(); - break; - case 2: - doIt = false; - mainWindowStatusLabel->setText(""); - break; + addNewPages(doc->DocPages.count(), 2, + nrToImport - (doc->DocPages.count() - doc->currentPage()->pageNr()), + doc->pageHeight(), doc->pageWidth(), doc->pageOrientation(), doc->pageSize(), true); + } + else if (msgBox.clickedButton() == importButton) + { + nrToImport = doc->DocPages.count() - doc->currentPage()->pageNr(); + } + else + { + doIt = false; + mainWindowStatusLabel->setText(""); } qApp->restoreOverrideCursor(); } @@ -3339,8 +3347,8 @@ QFileInfo fi(fileName); if (!fi.exists()) { - QMessageBox::warning(this, CommonStrings::trWarning, tr("File does not exist on the specified path :\n%1").arg(QDir::toNativeSeparators(fileName)), - CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, tr("File does not exist on the specified path :\n%1").arg(QDir::toNativeSeparators(fileName)), + QMessageBox::Ok); return false; } @@ -3371,7 +3379,7 @@ if (docNameUnmodified == platfName) { qApp->restoreOverrideCursor(); - QMessageBox::information(this, tr("Document is already opened"), + ScMessageBox::information(this, tr("Document is already opened"), tr("This document is already in use." "You'll be switched into its window now.")); windowsMenuActivated(i); @@ -3391,7 +3399,7 @@ QString title = tr("Fatal Error") ; QString msg = "<qt>"+ tr("File %1 is not in an acceptable format").arg(FName)+"</qt>"; QString infoMsg = "<qt>" + tr("The file may be damaged or may have been produced in a later version of Scribus.") + "</qt>"; - QMessageBox msgBox(QMessageBox::Critical, title, msg, QMessageBox::Ok | QMessageBox::Help, this); + ScMessageBox msgBox(QMessageBox::Critical, title, msg, QMessageBox::Ok | QMessageBox::Help, this); msgBox.setInformativeText(infoMsg); int i=msgBox.exec(); if (i==QMessageBox::Help) @@ -3589,7 +3597,7 @@ { mess += missing[m] + tr(" was replaced by: ")+replacement[m]+"\n"; } - QMessageBox::warning(this, CommonStrings::trWarning, mess, 1, 0, 0); + ScMessageBox::warning(this, CommonStrings::trWarning, mess); } doc->SoftProofing = doc->cmsSettings().SoftProofOn; doc->Gamut = doc->cmsSettings().GamutCheck; @@ -3817,7 +3825,10 @@ { if (currItem->itemText.length() != 0) { - int t = QMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your text?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your text?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t == QMessageBox::No) return; } @@ -3873,7 +3884,10 @@ { int t = QMessageBox::Yes; if (currItem->PictureIsAvailable) - t = QMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to replace your existing image?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to replace your existing image?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t == QMessageBox::Yes) { QImage img = QApplication::clipboard()->image(); @@ -3997,9 +4011,11 @@ if ((doc->hasName) && (doc->isModified()) && (!doc->masterPageMode()) && (!doc->isConverted)) { ScribusWin* tw = ActWin; - int t = QMessageBox::warning(this, CommonStrings::trWarning, "<qt>" + + int t = ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>" + QObject::tr("The changes to your document have not been saved and you have requested to revert them. Do you wish to continue?") + "</qt>", - QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t == QMessageBox::No) return; @@ -4034,9 +4050,9 @@ QString fn(doc->DocName), savedFileName; ret = DoFileSave(fn, &savedFileName); if (!ret && !savedFileName.isEmpty()) - QMessageBox::warning(this, CommonStrings::trWarning, tr("Your document was saved to a temporary file and could not be moved: \n%1").arg( QDir::toNativeSeparators(savedFileName) ), CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, tr("Your document was saved to a temporary file and could not be moved: \n%1").arg( QDir::toNativeSeparators(savedFileName) )); else if (!ret) - QMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot write the file: \n%1").arg( QDir::toNativeSeparators(fn) ), CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot write the file: \n%1").arg( QDir::toNativeSeparators(fn) )); } else ret = slotFileSaveAs(); @@ -4100,9 +4116,9 @@ QString savedFileName; ret = DoFileSave(fna, &savedFileName); if (!ret && !savedFileName.isEmpty()) - QMessageBox::warning(this, CommonStrings::trWarning, tr("Your document was saved to a temporary file and could not be moved: \n%1").arg( QDir::toNativeSeparators(savedFileName) ), CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, tr("Your document was saved to a temporary file and could not be moved: \n%1").arg( QDir::toNativeSeparators(savedFileName) )); else if (!ret) - QMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot write the file: \n%1").arg( QDir::toNativeSeparators(fn) ), CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot write the file: \n%1").arg( QDir::toNativeSeparators(fn) )); else doc->pdfOptions().fileName = ""; // #1482 reset the pdf file name } @@ -4244,9 +4260,11 @@ { if (doc->checkerProfiles()[doc->curCheckProfile()].ignoreErrors) { - int t = QMessageBox::warning(this, CommonStrings::trWarning, + int t = ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Scribus has detected some errors. Consider using the Preflight Verifier to correct them")+"</qt>", - QMessageBox::Abort | QMessageBox::Ignore); + QMessageBox::Abort | QMessageBox::Ignore, + QMessageBox::NoButton, // GUI default + QMessageBox::Ignore); // batch default if (t == QMessageBox::Abort) return; } @@ -4328,7 +4346,7 @@ QString message = tr("Printing failed!"); if (!printError.isEmpty()) message += QString("\n%1").arg(printError); - QMessageBox::warning(this, CommonStrings::trWarning, message, CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, message); } else doc->Print_Options.firstUse = false; @@ -4414,7 +4432,7 @@ currItem=doc->m_Selection->itemAt(i); if ((currItem->asTextFrame() || currItem->asPathText()) && currItem==storyEditor->currentItem() && doc==storyEditor->currentDocument()) { - QMessageBox::critical(this, tr("Cannot Cut In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The cut operation will be cancelled").arg(currItem->itemName()), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + ScMessageBox::critical(this, tr("Cannot Cut In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The cut operation will be cancelled").arg(currItem->itemName())); return; } } @@ -4980,7 +4998,7 @@ void ScribusMainWindow::slotHelpAboutQt() { - QMessageBox::aboutQt(this, tr("About Qt")); + ScMessageBox::aboutQt(this, tr("About Qt")); } void ScribusMainWindow::slotHelpCheckUpdates() @@ -5771,7 +5789,7 @@ if (newMode==modeDrawLatex && !prefsManager->renderFrameConfigured()) { - QMessageBox::critical(this, "Render Frames Not Configured", "Your Render Frame configuration seems to be invalid. Please check the settings in the External Tools section of the Preferences dialog."); + ScMessageBox::critical(this, "Render Frames Not Configured", "Your Render Frame configuration seems to be invalid. Please check the settings in the External Tools section of the Preferences dialog."); return; } @@ -6442,7 +6460,7 @@ prefsManager->setNewPrefs(newPrefs); QString message = tr("An error occurred while opening monitor profile.\nFormer monitor profile will be used." ); if (ScCore->usingGUI()) - QMessageBox::warning(this, CommonStrings::trWarning, message, QMessageBox::Ok, 0, 0); + ScMessageBox::warning(this, CommonStrings::trWarning, message); else qWarning( "%s", message.toLocal8Bit().data() ); } @@ -6525,7 +6543,7 @@ /* if (!ScCore->haveGS()) { - QMessageBox mb(this); + ScMessageBox mb(this); QString msg = tr("Ghostscript is not installed on your system, or Scribus is not configured with the path to the software."); QString msg2("<qt>"); #ifndef _WIN32 @@ -6535,7 +6553,7 @@ #endif //msg2 += tr("Please read our <a href=\"http://wiki.scribus.net/index.php/Ghostscript\">help and installation instructions</a>.") + "</qt>"; msg2 += tr("Click the Help button to read Scribus-related Ghostscript help and installation instructions.") + "</qt>"; - QMessageBox msgBox; + ScMessageBox msgBox; msgBox.addButton(QMessageBox::Ok); msgBox.addButton(QMessageBox::Help); msgBox.setIcon(QMessageBox::Warning); @@ -6604,7 +6622,7 @@ if ( PPreview::usePostscriptPreview(currentPrinter, currentEngine) && ( !ScCore->haveGS() ) ) { QString mess = tr("Ghostscript is missing : PostScript Print Preview is not available")+"\n\n"; - QMessageBox::warning(this, CommonStrings::trWarning, mess, 1, 0, 0); + ScMessageBox::warning(this, CommonStrings::trWarning, mess); return; } PPreview *dia = new PPreview(this, view, doc, currentPrinter, currentEngine); @@ -6656,9 +6674,11 @@ { if (doc->checkerProfiles()[doc->curCheckProfile()].ignoreErrors) { - int t = QMessageBox::warning(this, CommonStrings::trWarning, + int t = ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Scribus has detected some errors. Consider using the Preflight Verifier to correct them")+"</qt>", - QMessageBox::Abort | QMessageBox::Ignore); + QMessageBox::Abort | QMessageBox::Ignore, + QMessageBox::NoButton, // GUI default + QMessageBox::Ignore); // batch default if (t == QMessageBox::Abort) return; } @@ -6741,9 +6761,11 @@ { if (doc->checkerProfiles()[doc->curCheckProfile()].ignoreErrors) { - int t = QMessageBox::warning(this, CommonStrings::trWarning, + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Scribus detected some errors.\nConsider using the Preflight Verifier to correct them."), - QMessageBox::Abort | QMessageBox::Ignore); + QMessageBox::Abort | QMessageBox::Ignore, + QMessageBox::NoButton, // GUI default, + QMessageBox::Ignore); // batch default if (t == QMessageBox::Abort) return; } @@ -6808,7 +6830,7 @@ QString message = tr("Cannot write the file: \n%1").arg(fn); if (!epsError.isEmpty()) message += QString("\n%1").arg(epsError); - QMessageBox::warning(this, CommonStrings::trWarning, message, CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, message); } } } @@ -6838,9 +6860,11 @@ { if (doc->checkerProfiles()[doc->curCheckProfile()].ignoreErrors) { - int t = QMessageBox::warning(this, CommonStrings::trWarning, + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Detected some errors.\nConsider using the Preflight Verifier to correct them"), - QMessageBox::Abort | QMessageBox::Ignore); + QMessageBox::Abort | QMessageBox::Ignore, + QMessageBox::NoButton, // GUI default + QMessageBox::Ignore); // batch default if (t == QMessageBox::Abort) return; } @@ -6942,7 +6966,7 @@ QString message = tr("Cannot write the file: \n%1").arg(doc->pdfOptions().fileName); if (!errorMsg.isEmpty()) message = QString("%1\n%2").arg(message).arg(errorMsg); - QMessageBox::warning(this, CommonStrings::trWarning, message, CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, message); return; } aa++; @@ -6964,7 +6988,7 @@ QString message = tr("Cannot write the file: \n%1").arg(doc->pdfOptions().fileName); if (!errorMsg.isEmpty()) message = QString("%1\n%2").arg(message).arg(errorMsg); - QMessageBox::warning(this, CommonStrings::trWarning, message, CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, message); } } if (doc->pdfOptions().useDocBleeds) @@ -7491,13 +7515,14 @@ } if (lockedCount!=0 && lockedCount!=selectedItemCount) { - QMessageBox msgBox; + ScMessageBox msgBox; QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); QPushButton *lockButton = msgBox.addButton(tr("&Lock All"), QMessageBox::AcceptRole); msgBox.addButton(tr("&Unlock All"), QMessageBox::AcceptRole); msgBox.setIcon(QMessageBox::Warning); msgBox.setWindowTitle(CommonStrings::trWarning); msgBox.setText( tr("Some objects are locked.")); + msgBox.setDefaultBatchButton(lockButton); msgBox.exec(); if (msgBox.clickedButton() == abortButton) return; @@ -8181,7 +8206,7 @@ if (ExternalApp != 0) { QString ieExe = QDir::toNativeSeparators(imageEditorExecutable); - QMessageBox::information(this, tr("Information"), "<qt>" + tr("The program %1 is already running!").arg(ieExe) + "</qt>", 1, 0, 0); + ScMessageBox::information(this, tr("Information"), "<qt>" + tr("The program %1 is already running!").arg(ieExe) + "</qt>"); return; } if (currItem->PictureIsAvailable) @@ -8220,7 +8245,7 @@ { delete ExternalApp; ExternalApp = 0; - QMessageBox::critical(this, CommonStrings::trWarning, "<qt>" + tr("The program %1 is missing!").arg(imageEditorExecutable) + "</qt>", 1, 0, 0); + ScMessageBox::critical(this, CommonStrings::trWarning, "<qt>" + tr("The program %1 is missing!").arg(imageEditorExecutable) + "</qt>"); return; } connect(ExternalApp, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(imageEditorExited(int, QProcess::ExitStatus))); @@ -8558,9 +8583,11 @@ PageItem_ImageFrame* imageItem=currItem->asImageFrame(); int t=QMessageBox::Yes; if (imageItem->PictureIsAvailable) - t = QMessageBox::warning(this, CommonStrings::trWarning, + t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to replace your existing image?"), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t != QMessageBox::Yes) return; --- scribus15/scribus/scribus.h- 2014-09-13 21:37:06.434956251 -0400 +++ scribus15/scribus/scribus.h 2014-10-18 20:00:58.694505012 -0400 @@ -59,6 +59,7 @@ #include "scribusdoc.h" #include "styleoptions.h" #include "ui/customfdialog.h" +#include "ui/scmessagebox.h" class ActionManager; class AlignDistributePalette; --- scribus15/scribus/scribuscore.cpp- 2014-10-18 20:00:58.677504893 -0400 +++ scribus15/scribus/scribuscore.cpp 2014-10-18 20:00:58.695505018 -0400 @@ -321,7 +321,7 @@ closeSplash(); QString mess = tr("There are no fonts found on your system."); mess += "\n" + tr("Exiting now."); - QMessageBox::critical(0, tr("Fatal Error"), mess, 1, 0, 0); + ScMessageBox::critical(0, tr("Fatal Error"), mess); } else setSplashStatus( tr("Font System Initialized") ); --- scribus15/scribus/scribusdoc.cpp- 2014-10-18 15:03:05.970403557 -0400 +++ scribus15/scribus/scribusdoc.cpp 2014-10-18 20:00:58.697505032 -0400 @@ -1055,10 +1055,7 @@ CloseCMSProfiles(); docPrefsData.colorPrefs.DCMSset.CMSinUse = false; QString message = tr("An error occurred while opening ICC profiles, color management is not enabled." ); - if (ScCore->usingGUI()) - QMessageBox::warning(m_ScMW, CommonStrings::trWarning, message, QMessageBox::Ok, 0, 0); - else - qWarning( "%s", message.toLocal8Bit().data() ); + ScMessageBox::warning(m_ScMW, CommonStrings::trWarning, message); } return true; } @@ -11543,7 +11540,10 @@ return; if (ScCore->usingGUI() && useWarning) { - int t = QMessageBox::warning(m_ScMW, CommonStrings::trWarning, tr("Do you really want to clear the content of all selected frames?"), QMessageBox::Yes, QMessageBox::No | QMessageBox::Default); + int t = ScMessageBox::warning(m_ScMW, CommonStrings::trWarning, tr("Do you really want to clear the content of all selected frames?"), + QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No), + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t == QMessageBox::No) return; } @@ -11634,7 +11634,7 @@ m_ScMW->storyEditor->setCurrentDocumentAndItem(this, NULL); else { - QMessageBox::critical(m_ScMW, tr("Cannot Delete In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The delete operation will be cancelled").arg(currItem->itemName()), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + ScMessageBox::critical(m_ScMW, tr("Cannot Delete In-Use Item"), tr("The item %1 is currently being edited by Story Editor. The delete operation will be cancelled").arg(currItem->itemName())); itemSelection->delaySignalsOff(); return; } @@ -12266,13 +12266,14 @@ int t = 2; if (oneLocked) { - QMessageBox msgBox; + ScMessageBox msgBox; QPushButton *abortButton = msgBox.addButton(QMessageBox::Cancel); QPushButton *lockButton = msgBox.addButton(tr("&Unlock All"), QMessageBox::AcceptRole); QPushButton *unlockButton = msgBox.addButton(tr("&Skip locked objects"), QMessageBox::AcceptRole); msgBox.setIcon(QMessageBox::Warning); msgBox.setWindowTitle(CommonStrings::trWarning); msgBox.setText( tr("Some objects are locked.")); + msgBox.setDefaultBatchButton(lockButton); msgBox.exec(); if (msgBox.clickedButton() == abortButton) return false; @@ -18608,7 +18609,7 @@ if (!errStr.isEmpty() && ScCore->usingGUI()) { - QMessageBox::warning(this->scMW(), QObject::tr("Unacceptable settings for note style"), "<qt>"+ errStr +"</qt>", QMessageBox::Ok, QMessageBox::Abort | QMessageBox::Default); + ScMessageBox::warning(this->scMW(), QObject::tr("Unacceptable settings for note style"), "<qt>"+ errStr +"</qt>"); return false; } return true; --- scribus15/scribus/scribusview.cpp- 2014-10-14 12:50:58.273969099 -0400 +++ scribus15/scribus/scribusview.cpp 2014-10-18 20:00:58.697505032 -0400 @@ -313,9 +313,8 @@ // warning popping up in case colour management and out-of-gamut-display are active // as from #4346: Add a preview for daltonian - PV if (Doc->HasCMS && Doc->Gamut) - QMessageBox::information(m_ScMW, tr("Preview Mode"), - "<qt>" + tr("CMS is active. Therefore the color display may not match the perception by visually impaired") + "</qt>", - QMessageBox::Ok); + ScMessageBox::information(m_ScMW, tr("Preview Mode"), + "<qt>" + tr("CMS is active. Therefore the color display may not match the perception by visually impaired") + "</qt>"); } else { @@ -3215,7 +3214,7 @@ cont=true; if (currItem==m_ScMW->storyEditor->currentItem() && Doc==m_ScMW->storyEditor->currentDocument()) { - QMessageBox::information(m_ScMW, tr("Cannot Convert In-Use Item"), "<qt>" + tr("The item %1 is currently being edited by Story Editor. The convert to outlines operation for this item will be skipped").arg(currItem->itemName()) + "</qt>", QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + ScMessageBox::information(m_ScMW, tr("Cannot Convert In-Use Item"), "<qt>" + tr("The item %1 is currently being edited by Story Editor. The convert to outlines operation for this item will be skipped").arg(currItem->itemName()) + "</qt>"); cont=true; } //Deselect(); --- scribus15/scribus/scribuswin.cpp- 2014-08-07 21:22:03.256813096 -0400 +++ scribus15/scribus/scribuswin.cpp 2014-10-18 20:00:58.697505032 -0400 @@ -68,11 +68,12 @@ m_MainWindow->newActWin(getSubWin()); if (m_Doc->isModified() && (m_Doc->viewCount == 1)) { - int exit = QMessageBox::information(m_MainWindow, CommonStrings::trWarning, tr("Document:")+" "+ + int exit = ScMessageBox::information(m_MainWindow, CommonStrings::trWarning, tr("Document:")+" "+ QDir::toNativeSeparators(m_Doc->DocName)+"\n"+ tr("has been changed since the last save."), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, - QMessageBox::Cancel); + QMessageBox::Cancel, // GUI default + QMessageBox::Discard); // batch default if (exit == QMessageBox::Cancel) { ce->ignore(); --- scribus15/scribus/ui/charselect.cpp- 2014-08-07 21:22:04.751824167 -0400 +++ scribus15/scribus/ui/charselect.cpp 2014-10-18 20:00:58.697505032 -0400 @@ -18,6 +18,7 @@ #include "scpaths.h" #include "scribusdoc.h" #include "scribusview.h" +#include "ui/scmessagebox.h" #include "util.h" #include "util_icon.h" @@ -259,7 +260,7 @@ m_userTableModel->addCharacter(line); else { - QMessageBox::warning(this, tr("Error"), + ScMessageBox::warning(this, tr("Error"), "<qt>" + tr("Error reading file %1 - file is corrupted propably.").arg(f) + "</qt>", QMessageBox::Ok, QMessageBox::NoButton); break; @@ -301,7 +302,7 @@ file.close(); } else - QMessageBox::warning(this, tr("Error"), + ScMessageBox::warning(this, tr("Error"), "<qt>" + tr("Cannot write file %1").arg(f) + "</qt>", QMessageBox::Ok, QMessageBox::NoButton); } @@ -310,10 +311,9 @@ { if (m_userTableModel->characters().count() > 0 && - !QMessageBox::question(this, tr("Empty the Palette?"), + ScMessageBox::question(this, tr("Empty the Palette?"), "<qt>" + tr("You will remove all characters from this palette. Are you sure?") + "</qt>", - CommonStrings::trYesKey, CommonStrings::trNoKey, - QString::null, 0, 1 ) + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes ) { m_userTableModel->setCharacters(CharClassDef()); --- scribus15/scribus/ui/cmykfw.cpp- 2014-08-07 21:22:03.780816977 -0400 +++ scribus15/scribus/ui/cmykfw.cpp 2014-10-18 20:00:58.697505032 -0400 @@ -43,6 +43,7 @@ #include "scribusdoc.h" #include "scrspinbox.h" #include "swatchcombo.h" +#include "ui/scmessagebox.h" #include "util.h" #include "util_color.h" #include "util_formats.h" @@ -935,14 +936,14 @@ // if condition 10/21/2004 pv #1191 - just be sure that user cannot create "None" color if (ColorName->text().isEmpty()) { - QMessageBox::information(this, CommonStrings::trWarning, tr("You cannot create a color without a name.\nPlease give it a name"), 0); + ScMessageBox::information(this, CommonStrings::trWarning, tr("You cannot create a color without a name.\nPlease give it a name")); ColorName->setFocus(); ColorName->selectAll(); return; } if (ColorName->text() == CommonStrings::None || ColorName->text() == CommonStrings::tr_NoneColor) { - QMessageBox::information(this, CommonStrings::trWarning, tr("You cannot create a color named \"%1\".\nIt is a reserved name for transparent color").arg(ColorName->text()), 0); + ScMessageBox::information(this, CommonStrings::trWarning, tr("You cannot create a color named \"%1\".\nIt is a reserved name for transparent color").arg(ColorName->text())); ColorName->setFocus(); ColorName->selectAll(); return; @@ -951,7 +952,7 @@ { if (EColors->contains(ColorName->text())) { - QMessageBox::information(this, CommonStrings::trWarning, tr("The name of the color already exists.\nPlease choose another one."), CommonStrings::tr_OK, 0, 0, 0, QMessageBox::Ok); + ScMessageBox::information(this, CommonStrings::trWarning, tr("The name of the color already exists.\nPlease choose another one.")); ColorName->selectAll(); ColorName->setFocus(); return; --- scribus15/scribus/ui/collectforoutput_ui.cpp- 2014-08-07 21:22:03.756816799 -0400 +++ scribus15/scribus/ui/collectforoutput_ui.cpp 2014-10-18 20:00:58.698505039 -0400 @@ -89,9 +89,8 @@ if (!collectItems()) { QString errorMsg( tr("Cannot collect all files for output for file:\n%1").arg(newName) ); - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, - "<qt>" + errorMsg + "</qt>", - CommonStrings::tr_OK); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, + "<qt>" + errorMsg + "</qt>"); return errorMsg; } progressDialog->setOverallProgress(itemCount+patternCount); @@ -112,7 +111,7 @@ if (!collectDocument()) { QString errorMsg( tr("Cannot collect the file: \n%1").arg(newName) ); - QMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, "<qt>" + errorMsg + "</qt>", CommonStrings::tr_OK); + ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, "<qt>" + errorMsg + "</qt>"); return errorMsg; } --- scribus15/scribus/ui/curvewidget.cpp- 2014-08-07 21:22:04.831824760 -0400 +++ scribus15/scribus/ui/curvewidget.cpp 2014-10-18 20:00:58.698505039 -0400 @@ -27,6 +27,7 @@ #include "prefsfile.h" #include "prefsmanager.h" #include "scclocale.h" +#include "ui/scmessagebox.h" #include "util.h" #include "util_color.h" #include "util_icon.h" @@ -475,7 +476,7 @@ fx.close(); } else - QMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot write the file: \n%1").arg(fileName), CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot write the file: \n%1").arg(fileName)); } } } --- scribus15/scribus/ui/gradientaddedit.cpp- 2014-08-07 21:22:04.773824330 -0400 +++ scribus15/scribus/ui/gradientaddedit.cpp 2014-10-18 20:00:58.698505039 -0400 @@ -25,6 +25,7 @@ ***************************************************************************/ #include "gradientaddedit.h" +#include "ui/scmessagebox.h" #include <QMessageBox> gradientEditDialog::gradientEditDialog(QWidget* parent, QString name, VGradient gradient, ColorList doco, ScribusDoc *doc, QHash<QString, VGradient> *gradients, bool newFlag) : QDialog(parent) @@ -55,7 +56,7 @@ { if (gradientName->text().isEmpty()) { - QMessageBox::information(this, CommonStrings::trWarning, tr("You cannot create a gradient without a name\nPlease give it a name"), 0); + ScMessageBox::information(this, CommonStrings::trWarning, tr("You cannot create a gradient without a name\nPlease give it a name")); gradientName->setFocus(); gradientName->selectAll(); return; @@ -64,7 +65,7 @@ { if (m_gradients->contains(gradientName->text())) { - QMessageBox::information(this, CommonStrings::trWarning, tr("The name of the gradient already exists,\nplease choose another one."), CommonStrings::tr_OK, 0, 0, 0, QMessageBox::Ok); + ScMessageBox::information(this, CommonStrings::trWarning, tr("The name of the gradient already exists,\nplease choose another one.")); gradientName->selectAll(); gradientName->setFocus(); return; --- scribus15/scribus/ui/javadocs.cpp- 2014-09-06 20:26:16.835904225 -0400 +++ scribus15/scribus/ui/javadocs.cpp 2014-10-18 20:00:58.698505039 -0400 @@ -21,6 +21,7 @@ #include "query.h" #include "scpage.h" #include "scribusdoc.h" +#include "ui/scmessagebox.h" #include "util_icon.h" @@ -119,10 +120,12 @@ if (!currentItem) return; - int exit = QMessageBox::warning(this, + int exit = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to delete this script?"), - QMessageBox::Yes | QMessageBox::No); + QMessageBox::Yes | QMessageBox::No, + QMessageBox::NoButton, // GUI default + QMessageBox::Yes); // batch default if (exit == QMessageBox::Yes) { QString name = currentItem->text(); @@ -145,4 +148,4 @@ QListWidgetItem* currentItem = Scripts->currentItem(); EditScript->setEnabled(currentItem != 0); DeleteScript->setEnabled(currentItem != 0); -} \ No newline at end of file +} --- scribus15/scribus/ui/latexeditor.cpp- 2014-08-07 21:22:03.773816925 -0400 +++ scribus15/scribus/ui/latexeditor.cpp 2014-10-18 20:00:58.698505039 -0400 @@ -22,6 +22,7 @@ #include "latexhelpers.h" #include "pageitem_latexframe.h" #include "prefsmanager.h" +#include "ui/scmessagebox.h" #include <QDebug> #include <QFile> @@ -119,17 +120,17 @@ void LatexEditor::extEditorClicked() { if (extEditor->state() != QProcess::NotRunning) { - QMessageBox::information(0, tr("Information"), + ScMessageBox::information(0, tr("Information"), "<qt>" + tr("An editor for this frame is already running!") + - "</qt>", 1, 0, 0); + "</qt>"); return; } QString full_command = PrefsManager::instance()->latexEditorExecutable(); if (full_command.isEmpty()) { - QMessageBox::information(0, tr("Information"), + ScMessageBox::information(0, tr("Information"), "<qt>" + tr("Please specify an editor in the preferences!") + - "</qt>",1, 0, 0); + "</qt>"); return; } @@ -162,9 +163,9 @@ QTemporaryFile *editortempfile = new QTemporaryFile( QDir::tempPath() + "/scribus_temp_editor_XXXXXX"); if (!editortempfile->open()) { - QMessageBox::critical(0, tr("Error"), "<qt>" + + ScMessageBox::critical(0, tr("Error"), "<qt>" + tr("Could not create a temporary file to run the external editor!") - + "</qt>", 1, 0, 0); + + "</qt>"); } extEditorFile = getLongPathName(editortempfile->fileName()); editortempfile->setAutoRemove(false); @@ -203,9 +204,9 @@ if (exitCode && extEditor) { qCritical() << "RENDER FRAME: Editor failed. Output was: " << qPrintable(QString(extEditor->readAllStandardOutput())); - QMessageBox::critical(0, tr("Error"), "<qt>" + + ScMessageBox::critical(0, tr("Error"), "<qt>" + tr("Running the editor failed with exitcode %d!").arg(exitCode) + - "</qt>", 1, 0, 0); + "</qt>"); return; } } @@ -220,10 +221,10 @@ { externalEditorPushButton->setEnabled(true); externalEditorPushButton->setText( tr("Run External Editor...") ); - QMessageBox::critical(0, tr("Error"), "<qt>" + + ScMessageBox::critical(0, tr("Error"), "<qt>" + tr("Running the editor \"%1\" failed!"). arg(PrefsManager::instance()->latexEditorExecutable()) + - "</qt>", 1, 0, 0); + "</qt>"); } void LatexEditor::exitEditor() @@ -381,9 +382,9 @@ QFileInfo fi(currentConfigFile); if (!fi.exists() || !fi.isReadable()) { - QMessageBox::critical(0, QObject::tr("Error"), "<qt>" + + ScMessageBox::critical(0, QObject::tr("Error"), "<qt>" + QObject::tr("Configfile %1 not found or the file is not readable"). - arg(currentConfigFile) + "</qt>", 1, 0, 0); + arg(currentConfigFile) + "</qt>"); return; } --- scribus15/scribus/ui/layers.cpp- 2014-08-14 13:53:53.263452591 -0400 +++ scribus15/scribus/ui/layers.cpp 2014-10-18 20:00:58.698505039 -0400 @@ -309,9 +309,11 @@ bool delToo = false; if (m_Doc->layerContainsItems(layerID)) { - int scmReturn = QMessageBox::warning(this, tr("Delete Layer"), + int scmReturn = ScMessageBox::warning(this, tr("Delete Layer"), tr("Do you want to delete all objects on this layer too?"), - QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No); + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (scmReturn == QMessageBox::Cancel) return; delToo = (scmReturn != QMessageBox::No); --- scribus15/scribus/ui/masterpagepalette.cpp- 2014-08-14 13:53:53.265452605 -0400 +++ scribus15/scribus/ui/masterpagepalette.cpp 2014-10-18 20:00:58.698505039 -0400 @@ -141,10 +141,12 @@ if (m_doc->DocPages[i]->MPageNam == m_masterPage) extraWarn = tr("This master page is used at least once in the document."); } - int exit = QMessageBox::warning(this, + int exit = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to delete master page \"%1\"?").arg(m_masterPage)+"\n"+extraWarn, - QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::Cancel); + QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::Cancel, + QMessageBox::NoButton, // GUI default + QMessageBox::YesToAll); // batch default if (exit == QMessageBox::YesToAll) forceDelete = true; @@ -488,7 +490,7 @@ QString oldName(item->text()); if ((oldName == CommonStrings::masterPageNormal) || (oldName == CommonStrings::trMasterPageNormal) || (oldName == CommonStrings::trMasterPageNormalLeft) || (oldName == CommonStrings::trMasterPageNormalMiddle) || (oldName == CommonStrings::trMasterPageNormalRight)) { - QMessageBox::information( this, tr("Unable to Rename Master Page"), tr("The Normal page is not allowed to be renamed."), QMessageBox::Ok ); + ScMessageBox::information( this, tr("Unable to Rename Master Page"), tr("The Normal page is not allowed to be renamed.") ); return; } bool ok; --- scribus15/scribus/ui/notesstyleseditor.cpp- 2014-10-14 12:50:58.558971171 -0400 +++ scribus15/scribus/ui/notesstyleseditor.cpp 2014-10-18 20:00:58.698505039 -0400 @@ -361,9 +361,11 @@ void NotesStylesEditor::on_DeleteButton_clicked() { QString nsName = NSlistBox->currentText(); - int t = QMessageBox::warning(m_Doc->scMW(), tr("Warning! Deleting Notes Style"), "<qt>" + + int t = ScMessageBox::warning(m_Doc->scMW(), tr("Warning! Deleting Notes Style"), "<qt>" + tr("You are going to delete notes style %1. All notes and marks using that style are also going to be deleted.").arg(nsName) + "</qt>", - QMessageBox::Ok, QMessageBox::Abort | QMessageBox::Default); + QMessageBox::Ok | QMessageBox::Abort, + QMessageBox::Abort, // GUI default + QMessageBox::Ok); // batch default if (t == QMessageBox::Ok) { m_Doc->deleteNotesStyle(nsName); --- scribus15/scribus/ui/outlinepalette.cpp- 2014-08-07 21:22:03.779816969 -0400 +++ scribus15/scribus/ui/outlinepalette.cpp 2014-10-18 20:00:58.699505046 -0400 @@ -661,7 +661,7 @@ } if (found) { - QMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>", CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>"); ite->setText(col, NameOld); } else --- scribus15/scribus/ui/pagepalette_masterpages.cpp- 2014-08-07 21:22:04.710823864 -0400 +++ scribus15/scribus/ui/pagepalette_masterpages.cpp 2014-10-18 20:00:58.699505046 -0400 @@ -165,10 +165,12 @@ if (m_doc->DocPages[i]->MPageNam == m_currentPage) extraWarn = tr("This master page is used at least once in the document."); } - int exit = QMessageBox::warning(this, + int exit = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to delete master page \"%1\"?").arg(m_currentPage)+"\n"+extraWarn, - QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::Cancel); + QMessageBox::Yes | QMessageBox::YesToAll | QMessageBox::No | QMessageBox::Cancel, + QMessageBox::NoButton, // GUI default + QMessageBox::YesToAll); // batch default if (exit == QMessageBox::YesToAll) forceDelete = true; @@ -523,7 +525,7 @@ (newName == CommonStrings::masterPageNormalMiddle) || (newName == CommonStrings::trMasterPageNormalMiddle) || (newName == CommonStrings::masterPageNormalRight) || (newName == CommonStrings::trMasterPageNormalRight)) { - QMessageBox::information( this, tr("Unable to Rename Master Page"), tr("The Normal page is not allowed to be renamed."), QMessageBox::Ok ); + ScMessageBox::information( this, tr("Unable to Rename Master Page"), tr("The Normal page is not allowed to be renamed."), QMessageBox::Ok ); success = false; } if (newName.isEmpty()) --- scribus15/scribus/ui/pagepalette_pages.cpp- 2014-10-17 15:39:25.454347425 -0400 +++ scribus15/scribus/ui/pagepalette_pages.cpp 2014-10-18 20:00:58.699505046 -0400 @@ -94,10 +94,12 @@ if (currView->Doc->DocPages[i]->MPageNam == tmp) extraWarn = tr("This master page is used at least once in the document."); } - int exit = QMessageBox::warning(this, + int exit = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to delete this master page?")+"\n"+extraWarn, - QMessageBox::Yes | QMessageBox::No); + QMessageBox::Yes | QMessageBox::No, + QMessageBox::NoButton, // GUI default + QMessageBox::Yes); // batch default if (exit == QMessageBox::Yes) { bool oldMPMode = currView->Doc->masterPageMode(); --- scribus15/scribus/ui/pagepalette_widgets.cpp- 2014-08-07 21:22:04.812824619 -0400 +++ scribus15/scribus/ui/pagepalette_widgets.cpp 2014-10-18 20:00:58.699505046 -0400 @@ -23,6 +23,7 @@ #include "pagepalette_widgets.h" #include "sccombobox.h" #include "scpage.h" +#include "ui/scmessagebox.h" #include "util_icon.h" @@ -116,9 +117,9 @@ if (currentItem()) { e->accept(); - if (!QMessageBox::question(this, tr("Delete Master Page?"), + if (ScMessageBox::question(this, tr("Delete Master Page?"), "<qt>" + tr("Are you sure you want to delete this master page?") + "</qt>", - CommonStrings::trYesKey, CommonStrings::trNoKey, QString::null, 0, 1 )) + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) { emit DelMaster(currentItem()->text()); } @@ -390,9 +391,9 @@ if (k == Qt::Key_Delete) { e->accept(); - if (!QMessageBox::question(this, tr("Delete Page?"), + if (ScMessageBox::question(this, tr("Delete Page?"), "<qt>" + tr("Are you sure you want to delete this page?") + "</qt>", - CommonStrings::trYesKey, CommonStrings::trNoKey, QString::null, 0, 1 )) + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) { bool dummy; int pageToDelete=GetPage(currentRow(), currentColumn(), &dummy); --- scribus15/scribus/ui/paintmanager.cpp- 2014-10-01 21:17:50.440553866 -0400 +++ scribus15/scribus/ui/paintmanager.cpp 2014-10-18 20:00:58.699505046 -0400 @@ -796,7 +796,10 @@ { if (it == gradientItems) { - int t = QMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your gradients?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your gradients?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t == QMessageBox::No) return; replaceMap.clear(); @@ -816,7 +819,10 @@ { if (it == colorItems) { - int t = QMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your colors and gradients?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your colors and gradients?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t == QMessageBox::No) return; replaceMap.clear(); @@ -875,7 +881,10 @@ { if (it == patternItems) { - int t = QMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your patterns?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your patterns?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t == QMessageBox::No) return; replaceMapPatterns.clear(); @@ -1057,7 +1066,7 @@ if (!fileName.isEmpty()) dirs->set("colors", fileName.left(fileName.lastIndexOf("/"))); if (!importColorsFromFile(fileName, m_colorList)) - QMessageBox::information(this, tr("Information"), "<qt>" + tr("The file %1 does not contain colors which can be imported.\nIf the file was a PostScript-based, try to import it with File -> Import. \nNot all files have DSC conformant comments where the color descriptions are located.\n This prevents importing colors from some files.\nSee the Edit Colors section of the documentation for more details.").arg(fileName) + "</qt>", 1, 0, 0); + ScMessageBox::information(this, tr("Information"), "<qt>" + tr("The file %1 does not contain colors which can be imported.\nIf the file was a PostScript-based, try to import it with File -> Import. \nNot all files have DSC conformant comments where the color descriptions are located.\n This prevents importing colors from some files.\nSee the Edit Colors section of the documentation for more details.").arg(fileName) + "</qt>"); else { updateGradientList(); --- scribus15/scribus/ui/pdfopts.cpp- 2014-08-07 21:22:03.765816866 -0400 +++ scribus15/scribus/ui/pdfopts.cpp 2014-10-18 20:00:58.699505046 -0400 @@ -39,6 +39,7 @@ #include "scribusdoc.h" #include "scribusview.h" #include "ui/customfdialog.h" +#include "ui/scmessagebox.h" #include "ui/scrspinbox.h" #include "units.h" #include "util.h" @@ -161,9 +162,11 @@ QString dirPath = QDir::toNativeSeparators(fi.absolutePath()); if (!QFile::exists(fi.absolutePath())) { - if (QMessageBox::question(this, tr( "Save as PDF" ), + if (ScMessageBox::question(this, tr( "Save as PDF" ), tr("%1 does not exists and will be created, continue?").arg(dirPath), - QMessageBox::Ok | QMessageBox::Cancel) + QMessageBox::Ok | QMessageBox::Cancel, + QMessageBox::NoButton, // GUI default + QMessageBox::Ok) // batch default == QMessageBox::Cancel) { return; @@ -177,10 +180,9 @@ { if (!d.mkpath(fi.absolutePath())) { - QMessageBox::warning(this, + ScMessageBox::warning(this, CommonStrings::trWarning, - tr("Cannot create directory: \n%1").arg(dirPath), - CommonStrings::tr_OK); + tr("Cannot create directory: \n%1").arg(dirPath)); return; } } --- scribus15/scribus/ui/picsearchoptions.cpp- 2014-08-07 21:22:04.750824160 -0400 +++ scribus15/scribus/ui/picsearchoptions.cpp 2014-10-18 20:00:58.699505046 -0400 @@ -32,6 +32,7 @@ #include <QLabel> #include "picsearchoptions.h" #include "filesearch.h" +#include "ui/scmessagebox.h" PicSearchOptions::PicSearchOptions(QWidget* parent, const QString & fileName, const QString & searchBase) : QDialog( parent ) { @@ -100,9 +101,11 @@ QString searchBase = directoryEdit->text(); if (searchBase.isEmpty() || !QDir().exists(searchBase)) { - if (QMessageBox::warning(this, tr("Scribus - Image Search"), tr("Base directory for search does not exist.\nPlease choose another one."), + if (ScMessageBox::warning(this, tr("Scribus - Image Search"), tr("Base directory for search does not exist.\nPlease choose another one."), QMessageBox::Ok | QMessageBox::Default | QMessageBox::Escape | QMessageBox::Cancel, - QMessageBox::NoButton) != QMessageBox::Ok) + QMessageBox::NoButton, // GUI default + QMessageBox::Ok) // batch default + != QMessageBox::Ok) return; slotChangeSearchDir(); @@ -137,7 +140,7 @@ enableGuiWhileSearching(true); if (!userCancelled) // A running search failed - QMessageBox::warning(this, tr("Scribus - Image Search"), tr("The search failed: %1").arg(search->lastError()), + ScMessageBox::warning(this, tr("Scribus - Image Search"), tr("The search failed: %1").arg(search->lastError()), QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape, QMessageBox::NoButton); reject(); --- scribus15/scribus/ui/picstatus.cpp- 2014-08-07 21:22:04.720823938 -0400 +++ scribus15/scribus/ui/picstatus.cpp 2014-10-18 20:00:58.700505053 -0400 @@ -447,7 +447,7 @@ lastSearchPath = dia->getLastDirSearched(); if (dia->getMatches().count() == 0) { - QMessageBox::information(this, tr("Scribus - Image Search"), tr("No images named \"%1\" were found.").arg(dia->getFileName()), + ScMessageBox::information(this, tr("Scribus - Image Search"), tr("No images named \"%1\" were found.").arg(dia->getFileName()), QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape, QMessageBox::NoButton); } --- scribus15/scribus/ui/prefs_documentsections.cpp- 2014-08-07 21:22:04.793824478 -0400 +++ scribus15/scribus/ui/prefs_documentsections.cpp 2014-10-18 20:00:58.700505053 -0400 @@ -13,6 +13,7 @@ #include "commonstrings.h" #include "prefsstructs.h" #include "scribusdoc.h" +#include "ui/scmessagebox.h" Prefs_DocumentSections::Prefs_DocumentSections(QWidget* parent, ScribusDoc* doc) : Prefs_Pane(parent), @@ -178,7 +179,7 @@ if (outOfRange) { updateTable(); - QMessageBox::warning(parentWidget(), tr("Page Number Out Of Bounds"),"<qt>"+ tr("The value you have entered is outside the range of page numbers in the current document (%1-%2).").arg(1).arg(m_maxpageindex+1)+"</qt>",QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + ScMessageBox::warning(parentWidget(), tr("Page Number Out Of Bounds"),"<qt>"+ tr("The value you have entered is outside the range of page numbers in the current document (%1-%2).").arg(1).arg(m_maxpageindex+1)+"</qt>"); } } --- scribus15/scribus/ui/prefs_externaltools.cpp- 2014-08-07 21:22:04.795824493 -0400 +++ scribus15/scribus/ui/prefs_externaltools.cpp 2014-10-18 20:00:58.700505053 -0400 @@ -13,6 +13,7 @@ #include "prefsstructs.h" #include "latexhelpers.h" #include "commonstrings.h" +#include "ui/scmessagebox.h" #include "util_file.h" #include "util_ghostscript.h" @@ -163,7 +164,7 @@ uniconvertorLineEdit->setText("uniconv"); else { - QMessageBox::warning(0, CommonStrings::trWarning, tr("Uniconvertor executable not found!"), 1, 0, 0); + ScMessageBox::warning(0, CommonStrings::trWarning, tr("Uniconvertor executable not found!")); uniconvertorLineEdit->setText(""); } } @@ -213,9 +214,11 @@ if (fInfo.exists()) { cmd.append(parms); - int ret = QMessageBox::question(this, tr("LaTeX Command"), + int ret = ScMessageBox::question(this, tr("LaTeX Command"), tr("Scribus has found the following pdflatex command:\n%1\nDo you want to use this?").arg(cmd), - QMessageBox::Yes|QMessageBox::No,QMessageBox::No); + QMessageBox::Yes|QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (ret==QMessageBox::Yes) { commands[config]=cmd; --- scribus15/scribus/ui/prefs_keyboardshortcuts.cpp- 2014-08-07 21:22:03.761816836 -0400 +++ scribus15/scribus/ui/prefs_keyboardshortcuts.cpp 2014-10-18 20:00:58.700505053 -0400 @@ -21,6 +21,7 @@ #include "scpaths.h" #include "scplugin.h" #include "scraction.h" +#include "ui/scmessagebox.h" #include "util.h" #include "util_icon.h" @@ -496,11 +497,10 @@ releaseKeyboard(); if (checkKey(keyCode)) { - QMessageBox::information(this, CommonStrings::trWarning, + ScMessageBox::information(this, CommonStrings::trWarning, tr("The %1 key sequence is already in use by \"%2\"") .arg(getTrKeyText(keyCode)) - .arg(getAction(keyCode)), - CommonStrings::tr_OK); + .arg(getAction(keyCode))); selectedLVI->setText(1,keyMap[lviToActionMap[selectedLVI]].keySequence.toString()); keyDisplay->setText(keyMap[lviToActionMap[selectedLVI]].keySequence.toString()); } --- scribus15/scribus/ui/propertiespalette_xyz.cpp- 2014-10-10 19:55:42.137362947 -0400 +++ scribus15/scribus/ui/propertiespalette_xyz.cpp 2014-10-18 20:00:58.700505053 -0400 @@ -1225,7 +1225,7 @@ } if (found) { - QMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>", CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>"); nameEdit->setText(NameOld); nameEdit->setFocus(); } --- scribus15/scribus/ui/query.cpp- 2014-08-07 21:22:04.790824456 -0400 +++ scribus15/scribus/ui/query.cpp 2014-10-18 20:00:58.700505053 -0400 @@ -14,6 +14,7 @@ #include <QValidator> #include <QRegExpValidator> #include "commonstrings.h" +#include "ui/scmessagebox.h" #include "util_icon.h" Query::Query( QWidget* parent, const char* name, bool modal, QString text, QString titel ) : QDialog( parent ) @@ -67,7 +68,7 @@ { if (forbiddenList.contains(answerEdit->text())) { - QMessageBox::warning(this, CommonStrings::trWarning, tr("Name \"%1\" is not allowed.\nPlease choose another.").arg(answerEdit->text()), CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, tr("Name \"%1\" is not allowed.\nPlease choose another.").arg(answerEdit->text())); return; } } @@ -77,11 +78,12 @@ { if (checkMode) { - int ret = QMessageBox::warning(this, + int ret = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Name \"%1\" already exists.\nDo you want to replace the current contents?").arg(answerEdit->text()), QMessageBox::Yes | QMessageBox::No, - QMessageBox::No); + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (ret == QMessageBox::No) return; else @@ -89,7 +91,7 @@ } else { - QMessageBox::warning(this, CommonStrings::trWarning, tr("Name \"%1\" is not unique.\nPlease choose another.").arg(answerEdit->text()), CommonStrings::tr_OK); + ScMessageBox::warning(this, CommonStrings::trWarning, tr("Name \"%1\" is not unique.\nPlease choose another.").arg(answerEdit->text())); return; } } --- scribus15/scribus/ui/scmessagebox.cpp- 2014-08-07 21:22:04.775824345 -0400 +++ scribus15/scribus/ui/scmessagebox.cpp 2014-10-18 20:00:58.700505053 -0400 @@ -5,9 +5,13 @@ for which a new license (GPL+exception) is in place. */ /*************************************************************************** + scmessagebox.cpp - replacement for QMessageBox + ------------------- begin : Oct 2005 copyright : (C) 2005 by Craig Bradney email : cbradney@zip.com.au + copyright : (C) 2014 by William Bader + email : williambader@hotmail.com ***************************************************************************/ /*************************************************************************** @@ -19,236 +23,177 @@ * * ***************************************************************************/ -#include "scmessagebox.h" +#include <QMessageBox> + +#include <iostream> + +#include "scconfig.h" #include "scribuscore.h" +#include "ui/scmessagebox.h" -extern ScribusQApp* ScQApp; +/* +** ScMessageBox +*/ -int ScMessageBox::swapButtonValues(int &b0, int &b1, int &b2) +// Initialize private variables + +void ScMessageBox::initScMessageBox(void) { - int buttonsUsed=1; - if (ScCore->reverseDialogButtons()) - { - //Last button not used, and 2nd one used, swap 1st and 2nd. - if (b2==0 && b1!=0) //Could be: if ((b2==0 || b2==QMessageBox::NoButton) && b1!=0) but NoButton is 0x0000, for now. - { - int t=b1; - b1=b0; - b0=t; - buttonsUsed=2; - } - //All three buttons used, swap the outside ones only - if (b2!=0 && b1!=0 && b0!=0) - { - int t; - if (ScCore->isMacGUI()) - { - // Mac order is "No, Cancel, Yes" - t = b2; - b2 = b0; - b0 = b1; - b1 = t; - } - else - { - // If Unix order is "Cancel, No, Yes" - t = b2; - b2=b0; - b0=t; - } - buttonsUsed=3; - } - } - return buttonsUsed; + messageTitle = ""; + defaultBatchPushButton = NULL; + defaultBatchStandardButton = QMessageBox::NoButton; } -int ScMessageBox::swapButtonValues(QString &b0Text, QString &b1Text, QString &b2Text, int &defaultButton, int &escapeButton) +// Constructors for the property-based API + +ScMessageBox::ScMessageBox(QWidget *parent): + QMessageBox(parent) { - int buttonsUsed=1; - if (ScCore->reverseDialogButtons()) - { - //Last button not used, and 2nd one used, swap 1st and 2nd. - if (b2Text.isEmpty() && !b1Text.isEmpty()) - { - QString tText=b1Text; - b1Text=b0Text; - b0Text=tText; - if (defaultButton==0) - defaultButton=1; - else - if (defaultButton==1) - defaultButton=0; - if (escapeButton==0) - escapeButton=1; - else - if (escapeButton==1) - escapeButton=0; - buttonsUsed=2; - } - //All three buttons used, swap the outside ones only - if (!b2Text.isEmpty() && !b1Text.isEmpty() && !b0Text.isEmpty()) - { - QString tText; - if (ScCore->isMacGUI()) - { - // Mac order is "No, Cancel, Yes" - tText = b2Text; - b2Text = b0Text; - b0Text = b1Text; - b1Text = tText; - - switch (defaultButton) { - case 0: - defaultButton=2; - break; - case 1: - - break; - case 2: - defaultButton=0; - } - - switch (escapeButton) { - case 0: - escapeButton=2; - break; - case 1: - escapeButton=0; - break; - case 2: - escapeButton=1; - } - } - else - { - // Unix order is "Cancel, No, Yes" - tText = b2Text; - b2Text=b0Text; - b0Text=tText; - if (defaultButton==0) - defaultButton=2; - else - if (defaultButton==2) - defaultButton=0; - if (escapeButton==0) - escapeButton=2; - else - if (escapeButton==2) - escapeButton=0; - } - buttonsUsed=3; - } - } - return buttonsUsed; + initScMessageBox(); } -int ScMessageBox::swapReturnValues(const int b0Val, const int b1Val, const int b2Val, const int returnVal, const int buttonsUsed) +ScMessageBox::ScMessageBox(Icon icon, const QString &title, const QString &text, StandardButtons buttons, QWidget *parent, Qt::WindowFlags flags): + QMessageBox(icon, title, text, buttons, parent, flags) { - int retVal=returnVal; - if (ScCore->reverseDialogButtons()) - { - //Last button not used, and 2nd one used, swap 1st and 2nd. - if (buttonsUsed==2) - { - if (returnVal==b0Val) - retVal=b1Val; - else - if (returnVal==b1Val) - retVal=b0Val; - } - - //All three buttons used, swap the outside ones only - if (buttonsUsed==3) + initScMessageBox(); + messageTitle = title; +} + +// Find a default button in batch mode +// Take the default batch button if present +// Otherwise take the normal default button if present +// Otherwise look for a standard button + +QMessageBox::StandardButton ScMessageBox::findDefaultButton(QMessageBox::StandardButtons buttons, + QMessageBox::StandardButton defaultButton, QMessageBox::StandardButton defaultBatchButton) +{ + QMessageBox::StandardButton result = ((defaultBatchButton != QMessageBox::NoButton)? defaultBatchButton: defaultButton); + + if (result == QMessageBox::NoButton) { + QMessageBox::StandardButton buttonList[] = { QMessageBox::Yes, QMessageBox::Ok, + QMessageBox::Cancel, QMessageBox::Close, QMessageBox::Discard, + QMessageBox::No, QMessageBox::Abort, QMessageBox::Ignore, QMessageBox::NoButton }; + for (int i = 0; buttonList[ i ] != QMessageBox::NoButton; i++) { - if (ScCore->isMacGUI()) { - if (returnVal == b0Val) - retVal = b1Val; - else if (returnVal == b1Val) - retVal = b2Val; - else if (returnVal == b2Val) - retVal = b0Val; - } - else + if ((buttons & buttonList[ i ]) != 0) { - if (returnVal==b0Val) - retVal=b2Val; - else - if (returnVal==b2Val) - retVal=b0Val; - + result = buttonList[ i ]; + break; } } } - return retVal; + + return result; } -int ScMessageBox::information ( QWidget * parent, const QString & caption, const QString & text, int button0, int button1, int button2) +void ScMessageBox::setDefaultBatchButton(QPushButton *button) { - int b0=button0, b1=button1, b2=button2; - /*int buttonsUsed=*/ swapButtonValues(b0, b1, b2); - int stdReturn=QMessageBox::information(parent, caption, text, b0, b1, b2); - return stdReturn /*swapReturnValues(b0, b1, b2, stdReturn, buttonsUsed)*/; + defaultBatchPushButton = button; } -int ScMessageBox::information ( QWidget * parent, const QString & caption, const QString & text, const QString & button0Text, const QString & button1Text, const QString & button2Text, int defaultButtonNumber, int escapeButtonNumber) +void ScMessageBox::setDefaultBatchButton(StandardButton button) { - QString b0Text=button0Text, b1Text=button1Text, b2Text=button2Text; - int defaultButton=defaultButtonNumber, escapeButton=escapeButtonNumber; - int buttonsUsed=swapButtonValues(b0Text, b1Text, b2Text, defaultButton, escapeButton); - int stdReturn=QMessageBox::information(parent, caption, text, b0Text, b1Text, b2Text, defaultButton, escapeButton); - return swapReturnValues(0, 1, 2, stdReturn, buttonsUsed); + defaultBatchStandardButton = button; } -int ScMessageBox::question ( QWidget * parent, const QString & caption, const QString & text, int button0, int button1, int button2) +int ScMessageBox::exec() { - int b0=button0, b1=button1, b2=button2; - /*int buttonsUsed=*/ swapButtonValues(b0, b1, b2); - int stdReturn=QMessageBox::question(parent, caption, text, b0, b1, b2); - return stdReturn /*swapReturnValues(b0, b1, b2, stdReturn, buttonsUsed)*/; + if (ScCore->usingGUI()) + { + return QMessageBox::exec(); + } + + QString msg = messageTitle + text() + " " + informativeText() + " " + detailedText(); + + std::cerr << msg.toLocal8Bit().data() << std::endl; + + return static_cast<int>(findDefaultButton(QMessageBox::standardButtons(), QMessageBox::NoButton, defaultBatchStandardButton)); } -int ScMessageBox::question ( QWidget * parent, const QString & caption, const QString & text, const QString & button0Text, const QString & button1Text, const QString & button2Text, int defaultButtonNumber, int escapeButtonNumber) +QAbstractButton *ScMessageBox::clickedButton() const { - QString b0Text=button0Text, b1Text=button1Text, b2Text=button2Text; - int defaultButton=defaultButtonNumber, escapeButton=escapeButtonNumber; - int buttonsUsed=swapButtonValues(b0Text, b1Text, b2Text, defaultButton, escapeButton); - int stdReturn=QMessageBox::question(parent, caption, text, b0Text, b1Text, b2Text, defaultButton, escapeButton); - return swapReturnValues(0, 1, 2, stdReturn, buttonsUsed); + if (ScCore->usingGUI()) + { + return QMessageBox::clickedButton(); + } + + return defaultBatchPushButton? defaultBatchPushButton: QMessageBox::defaultButton(); } -int ScMessageBox::warning ( QWidget * parent, const QString & caption, const QString & text, int button0, int button1, int button2) +// Static function API +// These functions correspond to the QMessageBox functions +// except that they have an additional optional parameter +// to set the returned button when there is no GUI. + +QMessageBox::StandardButton ScMessageBox::information(QWidget *parent, const QString &title, const QString &text, + StandardButtons buttons, StandardButton defaultButton, StandardButton defaultBatchButton) { - int b0=button0, b1=button1, b2=button2; - /*int buttonsUsed=*/ swapButtonValues(b0, b1, b2); - int stdReturn=QMessageBox::warning(parent, caption, text, b0, b1, b2); - return stdReturn /*swapReturnValues(b0, b1, b2, stdReturn, buttonsUsed)*/; + if (ScCore->usingGUI()) + { + return QMessageBox::information(parent, title, text, buttons, defaultButton); + } + + std::cerr << title.toLocal8Bit().data() << " " << text.toLocal8Bit().data() << std::endl; + + return findDefaultButton(buttons, defaultButton, defaultBatchButton); } -int ScMessageBox::warning ( QWidget * parent, const QString & caption, const QString & text, const QString & button0Text, const QString & button1Text, const QString & button2Text, int defaultButtonNumber, int escapeButtonNumber) +QMessageBox::StandardButton ScMessageBox::question(QWidget *parent, const QString &title, const QString &text, + StandardButtons buttons, StandardButton defaultButton, StandardButton defaultBatchButton) { - QString b0Text=button0Text, b1Text=button1Text, b2Text=button2Text; - int defaultButton=defaultButtonNumber, escapeButton=escapeButtonNumber; - int buttonsUsed=swapButtonValues(b0Text, b1Text, b2Text, defaultButton, escapeButton); - int stdReturn=QMessageBox::warning(parent, caption, text, b0Text, b1Text, b2Text, defaultButton, escapeButton); - return swapReturnValues(0, 1, 2, stdReturn, buttonsUsed); + if (ScCore->usingGUI()) + { + return QMessageBox::question(parent, title, text, buttons, defaultButton); + } + + std::cerr << title.toLocal8Bit().data() << " " << text.toLocal8Bit().data() << std::endl; + + return findDefaultButton(buttons, defaultButton, defaultBatchButton); } -int ScMessageBox::critical ( QWidget * parent, const QString & caption, const QString & text, int button0, int button1, int button2) +QMessageBox::StandardButton ScMessageBox::warning(QWidget *parent, const QString &title, const QString &text, + StandardButtons buttons, StandardButton defaultButton, StandardButton defaultBatchButton) { - int b0=button0, b1=button1, b2=button2; - /*int buttonsUsed=*/ swapButtonValues(b0, b1, b2); - int stdReturn=QMessageBox::critical(parent, caption, text, b0, b1, b2); - return stdReturn /*swapReturnValues(b0, b1, b2, stdReturn, buttonsUsed)*/; + if (ScCore->usingGUI()) + { + return QMessageBox::warning(parent, title, text, buttons, defaultButton); + } + + std::cerr << title.toLocal8Bit().data() << " " << text.toLocal8Bit().data() << std::endl; + + return findDefaultButton(buttons, defaultButton, defaultBatchButton); } -int ScMessageBox::critical ( QWidget * parent, const QString & caption, const QString & text, const QString & button0Text, const QString & button1Text, const QString & button2Text, int defaultButtonNumber, int escapeButtonNumber) +QMessageBox::StandardButton ScMessageBox::critical(QWidget *parent, const QString &title, const QString &text, + StandardButtons buttons, StandardButton defaultButton, StandardButton defaultBatchButton) { - QString b0Text=button0Text, b1Text=button1Text, b2Text=button2Text; - int defaultButton=defaultButtonNumber, escapeButton=escapeButtonNumber; - int buttonsUsed=swapButtonValues(b0Text, b1Text, b2Text, defaultButton, escapeButton); - int stdReturn=QMessageBox::critical(parent, caption, text, b0Text, b1Text, b2Text, defaultButton, escapeButton); - return swapReturnValues(0, 1, 2, stdReturn, buttonsUsed); + if (ScCore->usingGUI()) + { + return QMessageBox::critical(parent, title, text, buttons, defaultButton); + } + + std::cerr << title.toLocal8Bit().data() << " " << text.toLocal8Bit().data() << std::endl; + + return findDefaultButton(buttons, defaultButton, defaultBatchButton); } +void ScMessageBox::about(QWidget *parent, const QString &title, const QString &text) +{ + if (ScCore->usingGUI()) + { + QMessageBox::about(parent, title, text); + } + + std::cerr << title.toLocal8Bit().data() << " " << text.toLocal8Bit().data() << std::endl; +} + +void ScMessageBox::aboutQt(QWidget *parent, const QString &title) +{ + if (ScCore->usingGUI()) + { + QMessageBox::aboutQt(parent, title); + } + std::cerr << title.toLocal8Bit().data() << std::endl; +} --- scribus15/scribus/ui/scmessagebox.h- 2014-08-07 21:22:03.765816866 -0400 +++ scribus15/scribus/ui/scmessagebox.h 2014-10-18 20:00:58.701505060 -0400 @@ -25,25 +25,70 @@ #include "scribusapi.h" + /** + * \brief This class provides alternate versions of QMessageBox functions + * that write to log files when Scribus does not have a GUI. + * This class is identical to QMessageBox except that provides an optional default batch button. + * In batch mode, functions return the default batch button when it is not NoButton, + * otherwise they return the default button when it is not NoButton, + * otherwise they return one of the standard buttons. + * If a dialog asks "Are you sure that you want to do this?", + * the default button can be No to keep users from accidentally destroying data, + * while the batch button can be Yes to allow scripts to do what they need. + * This class does not include QMessageBox functions marked obsolete in Qt5. + * Use non-obsolete functions instead. + */ class SCRIBUS_API ScMessageBox : public QMessageBox { Q_OBJECT public: - //Basic copies of the normal constructors - static int information ( QWidget * parent, const QString & caption, const QString & text, int button0, int button1 = 0, int button2 = 0 ); - static int information ( QWidget * parent, const QString & caption, const QString & text, const QString & button0Text = QString::null, const QString & button1Text = QString::null, const QString & button2Text = QString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1 ); - static int question ( QWidget * parent, const QString & caption, const QString & text, int button0, int button1 = 0, int button2 = 0 ); - static int question ( QWidget * parent, const QString & caption, const QString & text, const QString & button0Text = QString::null, const QString & button1Text = QString::null, const QString & button2Text = QString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1 ); - static int warning ( QWidget * parent, const QString & caption, const QString & text, int button0, int button1, int button2 = 0 ); - static int warning ( QWidget * parent, const QString & caption, const QString & text, const QString & button0Text = QString::null, const QString & button1Text = QString::null, const QString & button2Text = QString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1 ); - static int critical ( QWidget * parent, const QString & caption, const QString & text, int button0, int button1, int button2 = 0 ); - static int critical ( QWidget * parent, const QString & caption, const QString & text, const QString & button0Text = QString::null, const QString & button1Text = QString::null, const QString & button2Text = QString::null, int defaultButtonNumber = 0, int escapeButtonNumber = -1 ); - - //Swap the values the buttons are passing in, return the number of buttons used - static int swapButtonValues(int &b0, int &b1, int &b2); - static int swapButtonValues(QString &b0Text, QString &b1Text, QString &b2Text, int &defaultButton, int &escapeButton); - //Swap the return values attained from the QMessageBox class so in main code we dont have to check for swapped buttons. - static int swapReturnValues(const int, const int, const int, const int, const int); + // Property-based API + + ScMessageBox(QWidget *parent = 0); + + ScMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, + QMessageBox::StandardButtons buttons = QMessageBox::NoButton, QWidget *parent = 0, + Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); + + int exec(); + + QAbstractButton *clickedButton() const; + + void setDefaultBatchButton(QPushButton *button); + + void setDefaultBatchButton(StandardButton button); + + // Static function API + + static QMessageBox::StandardButton information(QWidget *parent, const QString &title, const QString &text, + StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, StandardButton defaultBatchButton = NoButton); + + static QMessageBox::StandardButton question(QWidget *parent, const QString &title, const QString &text, + StandardButtons buttons = StandardButtons(Yes | No), StandardButton defaultButton = NoButton, StandardButton defaultBatchButton = NoButton); + + static QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, + StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, StandardButton defaultBatchButton = NoButton); + + static QMessageBox::StandardButton critical(QWidget *parent, const QString &title, const QString &text, + StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, StandardButton defaultBatchButton = NoButton); + + static void about(QWidget *parent, const QString &title, const QString &text); + static void aboutQt(QWidget *parent, const QString &title = QString()); + +private: + // Saved fields for the property-based API + + QString messageTitle; + QPushButton *defaultBatchPushButton; + StandardButton defaultBatchStandardButton; + + // Initialize private variables + + void initScMessageBox(void); + + // Find the appropriate default button + + static QMessageBox::StandardButton findDefaultButton(QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton, StandardButton defaultBatchButton); }; #endif --- scribus15/scribus/ui/scrapbookpalette.cpp- 2014-08-07 21:22:03.769816895 -0400 +++ scribus15/scribus/ui/scrapbookpalette.cpp 2014-10-18 20:00:58.701505060 -0400 @@ -1363,7 +1363,10 @@ { if (!activeBView->canWrite) return; - int t = QMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to delete all entries?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to delete all entries?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default if (t == QMessageBox::No) return; QMap<QString,BibView::Elem>::Iterator it; --- scribus15/scribus/ui/search.cpp- 2014-08-07 21:22:04.736824056 -0400 +++ scribus15/scribus/ui/search.cpp 2014-10-18 20:00:58.701505060 -0400 @@ -528,7 +528,7 @@ m_item->update(); DoReplace->setEnabled(false); AllReplace->setEnabled(false); - QMessageBox::information(this, tr("Search/Replace"), tr("Search finished"), CommonStrings::tr_OK); + ScMessageBox::information(this, tr("Search/Replace"), tr("Search finished")); m_item->itemText.setCursorPosition(0); m_notFound = false; } @@ -642,9 +642,8 @@ } else { - QMessageBox::information(this, tr("Search/Replace"), - tr("Search finished, found %1 matches").arg(matchesFound), - CommonStrings::tr_OK); + ScMessageBox::information(this, tr("Search/Replace"), + tr("Search finished, found %1 matches").arg(matchesFound)); matchesFound = 0; m_notFound = false; QTextCursor cursor = storyTextEdit->textCursor(); --- scribus15/scribus/ui/smcellstyle.cpp- 2014-08-07 21:22:04.828824738 -0400 +++ scribus15/scribus/ui/smcellstyle.cpp 2014-10-18 20:00:58.701505060 -0400 @@ -13,6 +13,7 @@ #include "prefsmanager.h" #include "smcellstyle.h" #include "smcellstylewidget.h" +#include "ui/scmessagebox.h" SMCellStyle::SMCellStyle() : StyleItem(),m_widget(0), m_page(0), m_doc(0) { @@ -500,7 +501,7 @@ } if (parentLoop) - QMessageBox::warning(this->widget(), CommonStrings::trWarning, tr("Setting that style as parent would create an infinite loop."), CommonStrings::tr_OK); + ScMessageBox::warning(this->widget(), CommonStrings::trWarning, tr("Setting that style as parent would create an infinite loop.")); selected(sel); --- scribus15/scribus/ui/smtablestyle.cpp- 2014-08-07 21:22:03.775816940 -0400 +++ scribus15/scribus/ui/smtablestyle.cpp 2014-10-18 20:00:58.701505060 -0400 @@ -13,6 +13,7 @@ #include "prefsmanager.h" #include "smtablestyle.h" #include "smtablestylewidget.h" +#include "ui/scmessagebox.h" SMTableStyle::SMTableStyle() : StyleItem(),m_widget(0), m_page(0), m_doc(0) { @@ -502,7 +503,7 @@ } if (parentLoop) - QMessageBox::warning(this->widget(), CommonStrings::trWarning, tr("Setting that style as parent would create an infinite loop."), CommonStrings::tr_OK); + ScMessageBox::warning(this->widget(), CommonStrings::trWarning, tr("Setting that style as parent would create an infinite loop.")); selected(sel); --- scribus15/scribus/ui/smtextstyles.cpp- 2014-09-01 19:46:39.033628653 -0400 +++ scribus15/scribus/ui/smtextstyles.cpp 2014-10-18 20:00:58.702505067 -0400 @@ -1776,7 +1776,7 @@ } if (parentLoop) - QMessageBox::warning(this->widget(), CommonStrings::trWarning, tr("Setting that style as parent would create an infinite loop."), CommonStrings::tr_OK); + ScMessageBox::warning(this->widget(), CommonStrings::trWarning, tr("Setting that style as parent would create an infinite loop.")); selected(sel); @@ -2703,7 +2703,7 @@ } if (parentLoop) - QMessageBox::warning(this->widget(), CommonStrings::trWarning, tr("Setting that style as parent would create an infinite loop."), CommonStrings::tr_OK); + ScMessageBox::warning(this->widget(), CommonStrings::trWarning, tr("Setting that style as parent would create an infinite loop.")); selected(sel); --- scribus15/scribus/ui/storyeditor.cpp- 2014-08-07 21:22:04.818824663 -0400 +++ scribus15/scribus/ui/storyeditor.cpp 2014-10-18 20:00:58.702505067 -0400 @@ -79,6 +79,7 @@ #include "styleselect.h" #include "ui/charselect.h" #include "ui/customfdialog.h" +#include "ui/scmessagebox.h" #include "ui/spalette.h" #include "ui/stylemanager.h" #include "units.h" @@ -2163,11 +2164,10 @@ if (m_textChanged) { m_blockUpdate = true; - int t = QMessageBox::warning(this, CommonStrings::trWarning, + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you want to save your changes?"), - QMessageBox::Yes|QMessageBox::Default, - QMessageBox::No, - QMessageBox::Cancel|QMessageBox::Escape); + QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, + QMessageBox::No); qApp->processEvents(); if (t == QMessageBox::Yes) { @@ -2760,9 +2760,11 @@ if (m_textChanged) { m_blockUpdate = true; - int t = QMessageBox::warning(this, CommonStrings::trWarning, + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to lose all your changes?"), - QMessageBox::Yes, QMessageBox::No | QMessageBox::Default); + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default qApp->processEvents(); if (t == QMessageBox::No) { @@ -2789,9 +2791,11 @@ if (!Editor->document()->isEmpty()) { m_blockUpdate = true; - int t = QMessageBox::warning(this, CommonStrings::trWarning, + int t = ScMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your text?"), - QMessageBox::Yes, QMessageBox::No | QMessageBox::Default); + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No, // GUI default + QMessageBox::Yes); // batch default qApp->processEvents(); if (t == QMessageBox::No) { --- scribus15/scribus/ui/stylemanager.cpp- 2014-08-07 21:22:04.713823886 -0400 +++ scribus15/scribus/ui/stylemanager.cpp 2014-10-18 20:00:58.702505067 -0400 @@ -28,6 +28,7 @@ #include "styleitem.h" #include "stylemanager.h" #include "ui/customfdialog.h" +#include "ui/scmessagebox.h" #include "ui/styleview.h" const QString StyleManager::SEPARATOR = "$$$$"; // dumb but it works @@ -1061,9 +1062,8 @@ if (!shortcut.isNull() && shortcutExists(shortcut)) { - QMessageBox::information(this, CommonStrings::trWarning, - tr("This key sequence is already in use"), - CommonStrings::tr_OK); + ScMessageBox::information(this, CommonStrings::trWarning, + tr("This key sequence is already in use")); if (m_shortcutWidget) m_shortcutWidget->setShortcut(m_item->shortcut(sitem->text(NAME_COL))); return; --- scribus15/scribus/urllauncher.cpp- 2014-08-07 21:22:06.280835490 -0400 +++ scribus15/scribus/urllauncher.cpp 2014-10-18 20:00:58.702505067 -0400 @@ -74,7 +74,7 @@ int ret=System(extBrowser, args); if (ret!=0) { - QMessageBox::StandardButton sb=QMessageBox::critical(p, tr("External Web Browser Failed to Start"), tr("Scribus was not able to start the external web browser application %1. Please check the setting in Preferences.\nWould you like to start the system's default browser instead?").arg(PrefsManager::instance()->extBrowserExecutable()), QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Ok); + QMessageBox::StandardButton sb=ScMessageBox::critical(p, tr("External Web Browser Failed to Start"), tr("Scribus was not able to start the external web browser application %1. Please check the setting in Preferences.\nWould you like to start the system's default browser instead?").arg(PrefsManager::instance()->extBrowserExecutable()), QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Ok); if (sb==QMessageBox::Ok) QDesktopServices::openUrl(link); } --- scribus15/scribus/util.cpp- 2014-08-07 21:22:03.754816784 -0400 +++ scribus15/scribus/util.cpp 2014-10-18 20:00:58.702505067 -0400 @@ -36,6 +36,7 @@ #include "scribusview.h" #include "scribusdoc.h" #include "scpainter.h" +#include "ui/scmessagebox.h" #include <signal.h> @@ -361,9 +362,11 @@ if (fi.exists()) { QString fn = QDir::toNativeSeparators(filename); - int t = QMessageBox::warning(parent, QObject::tr("File exists"), + int t = ScMessageBox::warning(parent, QObject::tr("File exists"), "<qt>"+ QObject::tr("A file named '%1' already exists.<br/>Do you want to replace it with the file you are saving?").arg(fn) +"</qt>", - QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel); + QMessageBox::Ok | QMessageBox::Cancel, + QMessageBox::Cancel, // GUI default + QMessageBox::Ok); // batch default if (t == QMessageBox::Cancel) retval = false; } |
|
I made two small changes to main_win32.cpp. The new patch file is scribus15-20141018-200614-messagebox.patch |
|
Applied, thanks! |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-10-14 23:22 | william | New Issue | |
2014-10-14 23:22 | william | File Added: scribus15-20141014-170606-messagebox.pat | |
2014-10-15 17:02 | Kunda | Relationship added | related to 0012572 |
2014-10-15 18:32 | cbradney | Note Added: 0034017 | |
2014-10-15 19:07 | jghali | Note Added: 0034018 | |
2014-10-15 20:30 | william | Note Added: 0034022 | |
2014-10-15 23:17 | jghali | Note Added: 0034023 | |
2014-10-18 23:46 | william | File Added: scribus15-20141018-181033-messagebox.patch | |
2014-10-18 23:57 | william | Note Added: 0034064 | |
2014-10-19 00:10 | william | File Added: scribus15-20141018-200614-messagebox.patch | |
2014-10-19 00:10 | william | File Deleted: scribus15-20141018-181033-messagebox.patch | |
2014-10-19 00:12 | william | Note Added: 0034065 | |
2014-10-21 22:08 | jghali | Note Added: 0034112 | |
2014-10-21 22:08 | jghali | Status | new => resolved |
2014-10-21 22:08 | jghali | Fixed in Version | => 1.5.0svn |
2014-10-21 22:08 | jghali | Resolution | open => fixed |
2014-10-21 22:08 | jghali | Assigned To | => jghali |
2014-10-24 22:57 | Kunda | Patch | => Yes |
2015-01-30 22:38 | cbradney | Status | resolved => closed |