r16186 by craig - Backport HelpBrowser changes, add in damaged file help document (empty) and help button for gs start error and damaged file error

scribus-commit scribus-commit at lists.scribus.net
Thu Dec 30 15:18:49 CET 2010


Author: craig
Date: Thu Dec 30 14:18:49 2010
New Revision: 16186

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16186
Log:
Backport HelpBrowser changes, add in damaged file help document (empty) and help button for gs start error and damaged file error

Added:
    branches/Version135/Scribus/scribus/doc/en/fileproblems.html
Modified:
    branches/Version135/Scribus/scribus/doc/en/menu.xml
    branches/Version135/Scribus/scribus/helpbrowser.cpp
    branches/Version135/Scribus/scribus/helpbrowser.h
    branches/Version135/Scribus/scribus/scribus.cpp
    branches/Version135/Scribus/scribus/scribus.h
    branches/Version135/Scribus/scribus/scribuscore.cpp

Modified: branches/Version135/Scribus/scribus/doc/en/menu.xml
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16186&path=/branches/Version135/Scribus/scribus/doc/en/menu.xml
==============================================================================
--- branches/Version135/Scribus/scribus/doc/en/menu.xml (original)
+++ branches/Version135/Scribus/scribus/doc/en/menu.xml Thu Dec 30 14:18:49 2010
@@ -110,6 +110,7 @@
 		<submenuitem text="Hints &amp; FAQs" file="topten.html">
 			<submenuitem text="Help" file="faq1.html"/>
 			<submenuitem text="Development" file="faq3.html"/>
+			<submenuitem text="Problems with Document Files" file="fileproblems.html"/>
 		</submenuitem>
 	</area>
 	<area text="My Tutorials" file="tutorials.html" section="tutorials">

Modified: branches/Version135/Scribus/scribus/helpbrowser.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16186&path=/branches/Version135/Scribus/scribus/helpbrowser.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/helpbrowser.cpp (original)
+++ branches/Version135/Scribus/scribus/helpbrowser.cpp Thu Dec 30 14:18:49 2010
@@ -449,7 +449,7 @@
 		textBrowser->setSource( QUrl::fromLocalFile(mHistory[i].url) );
 }
 
-void HelpBrowser::jumpToHelpSection(const QString& jumpToSection, const QString& jumpToFile)
+void HelpBrowser::jumpToHelpSection(const QString& jumpToSection, const QString& jumpToFile, bool dontChangeIfAlreadyLoaded)
 {
 	QString toLoad;
 	bool noDocs=false;
@@ -474,12 +474,16 @@
 		}
 	}
 	else
-		toLoad=jumpToFile;
-
+//		toLoad=jumpToFile;
+	{
+		toLoad=ScPaths::instance().docDir() + language + "/" + jumpToFile;
+	}
 	if (!noDocs)
 		loadHelp(toLoad);
 	else
-		displayNoHelp();
+//		displayNoHelp();
+		if (!dontChangeIfAlreadyLoaded)
+			displayNoHelp();
 }
 
 void HelpBrowser::loadHelp(const QString& filename)

Modified: branches/Version135/Scribus/scribus/helpbrowser.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16186&path=/branches/Version135/Scribus/scribus/helpbrowser.h
==============================================================================
--- branches/Version135/Scribus/scribus/helpbrowser.h (original)
+++ branches/Version135/Scribus/scribus/helpbrowser.h Thu Dec 30 14:18:49 2010
@@ -81,6 +81,9 @@
 	
 	static bool firstRun;
 
+public slots:
+	void jumpToHelpSection(const QString& jumpToSection, const QString& jumpToFile="", bool dontChangeIfAlreadyLoaded=false);
+
 protected:
 	void closeEvent(QCloseEvent * event);
 
@@ -129,7 +132,6 @@
 protected slots:
 	virtual void languageChange();
 	void histChosen(QAction* i);
-	void jumpToHelpSection(const QString& jumpToSection, const QString& jumpToFile="");
 	void loadHelp(const QString& filename);
 	void loadMenu();
 	void showLinkContents(const QString &link);

Modified: branches/Version135/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16186&path=/branches/Version135/Scribus/scribus/scribus.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribus.cpp (original)
+++ branches/Version135/Scribus/scribus/scribus.cpp Thu Dec 30 14:18:49 2010
@@ -3907,7 +3907,14 @@
 		{
 			delete fileLoader;
 			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
-			QMessageBox::critical(this, tr("Fatal Error"), "<qt>"+ tr("File %1 is not in an acceptable format").arg(FName)+"</qt>", CommonStrings::tr_OK);
+			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);
+			msgBox.setInformativeText(infoMsg);
+			int i=msgBox.exec();
+			if (i==QMessageBox::Help)
+				slotOnlineHelp("", "fileproblems.html");
 			return false;
 		}
 		bool is12doc=false;
@@ -5511,11 +5518,27 @@
 	dia.exec();
 }
 
-void ScribusMainWindow::slotOnlineHelp()
-{
-	helpBrowser = new HelpBrowser(0, tr("Scribus Manual"), ScCore->getGuiLanguage());
-	connect(helpBrowser, SIGNAL(closed()), this, SLOT(slotOnlineHelpClosed()));
-	helpBrowser->show();
+void ScribusMainWindow::slotOnlineHelp(const QString & jumpToSection, const QString & jumpToFile)
+{
+	if (!helpBrowser)
+	{
+		helpBrowser = new HelpBrowser(0, tr("Scribus Manual"), ScCore->getGuiLanguage(), jumpToSection, jumpToFile);
+		connect(helpBrowser, SIGNAL(closed()), this, SLOT(slotOnlineHelpClosed()));
+	}
+	else //just set the requested page
+	{
+		if (!jumpToSection.isNull() || !jumpToFile.isNull())
+		{
+			helpBrowser->jumpToHelpSection(jumpToSection, jumpToFile, true);
+		}
+	}
+	slotRaiseOnlineHelp();
+}
+
+void ScribusMainWindow::slotRaiseOnlineHelp()
+{
+	if (helpBrowser)
+		helpBrowser->show();
 }
 
 void ScribusMainWindow::slotOnlineHelpClosed()
@@ -7696,9 +7719,9 @@
 		prefsOrg(&dia);
 }
 
-void ScribusMainWindow::ShowSubs()
-{
-	QString mess;
+int ScribusMainWindow::ShowSubs()
+{
+	bool showGSHelp=false;
 	if (!ScCore->haveGS())
 	{
 		QMessageBox mb(this);
@@ -7709,14 +7732,18 @@
 #else
 		msg2 += tr("Until this is remedied, you cannot import EPS images or use PostScript Print Preview. ")+"\n";
 #endif
-		msg2 += tr("Please read our <a href=\"http://wiki.scribus.net/index.php/Ghostscript\">help and installation instructions</a>.") + "</qt>";
+		//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 read Scribus-related Ghostscript help and installation instructions.") + "</qt>";
 		QMessageBox msgBox;
 		msgBox.addButton(QMessageBox::Ok);
+		msgBox.addButton(QMessageBox::Help);
 		msgBox.setIcon(QMessageBox::Warning);
 		msgBox.setWindowTitle( tr("Ghostscript is missing") );
 		msgBox.setText(msg);
 		msgBox.setInformativeText(msg2);
-		msgBox.exec();
+		int i=msgBox.exec();
+		if (i==QMessageBox::Help)
+			showGSHelp=true;
 	}
 
 	propertiesPalette->startup();
@@ -7741,7 +7768,15 @@
 
 	activateWindow();
 	if (!scriptIsRunning())
+	{
 		raise();
+		if (showGSHelp)
+		{
+			slotOnlineHelp("", "toolbox5.html");
+			return QMessageBox::Help;
+		}
+	}
+	return 0;
 }
 
 void ScribusMainWindow::doPrintPreview()

Modified: branches/Version135/Scribus/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16186&path=/branches/Version135/Scribus/scribus/scribus.h
==============================================================================
--- branches/Version135/Scribus/scribus/scribus.h (original)
+++ branches/Version135/Scribus/scribus/scribus.h Thu Dec 30 14:18:49 2010
@@ -152,7 +152,7 @@
 	void keyPressEvent(QKeyEvent *k);
 	void keyReleaseEvent(QKeyEvent *k);
 	void setTBvals(PageItem *currItem);
-	void ShowSubs();
+	int ShowSubs();
 	void applyNewMaster(QString name);
 	void updateRecent(QString fn);
 	void doPasteRecent(QString data);
@@ -362,9 +362,10 @@
 	/** \brief shows an about dialog*/
 	void slotHelpAbout();
 	void slotHelpAboutPlugins();
-    void slotHelpAboutQt();
+	void slotHelpAboutQt();
 	void slotHelpCheckUpdates();
-	void slotOnlineHelp();
+	void slotRaiseOnlineHelp();
+	void slotOnlineHelp(const QString & jumpToSection=QString::null, const QString & jumpToFile=QString::null);
 	void slotOnlineHelpClosed();
 	void ToggleTips();
 	void ToggleMouseTips();
@@ -645,7 +646,7 @@
 	PrefsManager *prefsManager;
 	FormatsManager *formatsManager;
 
-	HelpBrowser* helpBrowser;
+	QPointer<HelpBrowser> helpBrowser;
 };
 
 #endif

Modified: branches/Version135/Scribus/scribus/scribuscore.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16186&path=/branches/Version135/Scribus/scribus/scribuscore.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribuscore.cpp (original)
+++ branches/Version135/Scribus/scribus/scribuscore.cpp Thu Dec 30 14:18:49 2010
@@ -122,20 +122,27 @@
 	connect(ScQApp, SIGNAL(lastWindowClosed()), ScQApp, SLOT(quit()));
 
 	scribus->show();
-	scribus->ShowSubs();
-
-	if (!m_Files.isEmpty())
-	{
-		for (int i = 0; i < m_Files.size(); ++i)
-			scribus->loadDoc(m_Files.at(i));
-	}
-	else
-	{
-		if (PrefsManager::instance()->appPrefs.showStartupDialog)
-			scribus->startUpDialog();
+	int subsRet=scribus->ShowSubs();
+	if (subsRet==0)
+	{
+		if (!m_Files.isEmpty())
+		{
+			for (int i = 0; i < m_Files.size(); ++i)
+				scribus->loadDoc(m_Files.at(i));
+		}
 		else
-			scribus->setFocus();
-	}
+		{
+			if (PrefsManager::instance()->appPrefs.showStartupDialog)
+				scribus->startUpDialog();
+			else
+				scribus->setFocus();
+		}
+	}	
+	else if (subsRet==QMessageBox::Help)
+	{
+		scribus->slotRaiseOnlineHelp();
+	}
+
 	qApp->setOverrideCursor(QCursor(Qt::ArrowCursor));
 
 	// A hook for plugins and scripts to trigger on. Some plugins and scripts




More information about the scribus-commit mailing list