r16180 by craig - Allow user to jump into help from GS missing warning, as first example of context help

scribus-commit scribus-commit at lists.scribus.net
Wed Dec 29 14:02:43 CET 2010


Author: craig
Date: Wed Dec 29 13:02:43 2010
New Revision: 16180

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16180
Log:
Allow user to jump into help from GS missing warning, as first example of context help

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/ui/helpbrowser.cpp
    trunk/Scribus/scribus/ui/helpbrowser.h

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16180&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Dec 29 13:02:43 2010
@@ -5352,11 +5352,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()
@@ -7826,8 +7842,9 @@
 		pagePalette->rebuildPages();
 	}
 }
-void ScribusMainWindow::ShowSubs()
-{
+int ScribusMainWindow::ShowSubs()
+{
+	bool showGSHelp=false;
 	if (!ScCore->haveGS())
 	{
 		QMessageBox mb(this);
@@ -7838,14 +7855,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();
@@ -7871,7 +7892,15 @@
 
 	activateWindow();
 	if (!scriptIsRunning())
+	{
 		raise();
+		if (showGSHelp)
+		{
+			slotOnlineHelp("", "toolbox5.html");
+			return QMessageBox::Help;
+		}
+	}
+	return 0;
 }
 
 void ScribusMainWindow::doPrintPreview()

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16180&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Wed Dec 29 13:02:43 2010
@@ -155,7 +155,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);
@@ -375,7 +375,8 @@
 	void slotHelpAboutPlugins();
     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();
@@ -668,7 +669,7 @@
 	PrefsManager *prefsManager;
 	FormatsManager *formatsManager;
 
-	HelpBrowser* helpBrowser;
+	QPointer<HelpBrowser> helpBrowser;
 };
 
 #endif

Modified: trunk/Scribus/scribus/ui/helpbrowser.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16180&path=/trunk/Scribus/scribus/ui/helpbrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/helpbrowser.cpp (original)
+++ trunk/Scribus/scribus/ui/helpbrowser.cpp Wed Dec 29 13:02:43 2010
@@ -489,11 +489,10 @@
 		textBrowser->setUrl( 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;
-
 	if (jumpToFile.isEmpty())
 	{
 		toLoad = finalBaseDir + "/"; //clean this later to handle 5 char locales
@@ -514,12 +513,14 @@
 		}
 	}
 	else
-		toLoad=jumpToFile;
-
+	{
+		toLoad=ScPaths::instance().docDir() + language + "/" + jumpToFile;
+	}
 	if (!noDocs)
 		loadHelp(toLoad);
 	else
-		displayNoHelp();
+		if (!dontChangeIfAlreadyLoaded)
+			displayNoHelp();
 }
 
 void HelpBrowser::loadHelp(const QString& filename)

Modified: trunk/Scribus/scribus/ui/helpbrowser.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16180&path=/trunk/Scribus/scribus/ui/helpbrowser.h
==============================================================================
--- trunk/Scribus/scribus/ui/helpbrowser.h (original)
+++ trunk/Scribus/scribus/ui/helpbrowser.h Wed Dec 29 13:02:43 2010
@@ -85,6 +85,9 @@
 	
 	static bool firstRun;
 
+public slots:
+	void jumpToHelpSection(const QString& jumpToSection, const QString& jumpToFile="", bool dontChangeIfAlreadyLoaded=false);
+
 protected:
 	void closeEvent(QCloseEvent * event);
 
@@ -137,7 +140,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);




More information about the scribus-commit mailing list