# HG changeset patch
# User jhilmer
# Date 1124213254 0
# Node ID 47cd4ae3000075497d671ea1d7ca65eb5ed040f0
# Parent  8429b60b68e6575c74a055e798768684a4c8302c
Fixed link handling in aboutdialog

diff -r 8429b60b68e6 -r 47cd4ae30000 aboutdialog.cpp
--- a/aboutdialog.cpp	Tue Aug 16 17:26:55 2005 +0000
+++ b/aboutdialog.cpp	Tue Aug 16 17:27:34 2005 +0000
@@ -1,67 +1,85 @@
+/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
+
+#include <qmime.h>
+#include <qprocess.h>
+
 #include "aboutdialog.h"
 #include "version.h"
+#include "settings.h"
+#include "mainwindow.h"
 
-#include "icons/vym-48x48.xpm"
+extern Main *mainWindow;
+extern Settings settings;
 
 AboutDialog::AboutDialog( QWidget *parent, const char *name)
     : QDialog( parent, name)
 {
-	mainLayout=new QVBoxLayout( this);
+ 
+    mainLayout=new QVBoxLayout( this, 10);
 
-	tabs=new QTabWidget (this);
+    tabs=new QTabWidget (this);
+    credits=new AboutTextBrowser (this,"credits");
 
-	credits=new QTextBrowser (this,"credits");
-
-	
-	credits->setText (
-		"<h3>VYM - View Your Mind </h3>"
-		"<p> A tool to put the things you have got in your mind into a map.</p>"
-			"<ul>"
-				"<li> (c) by Uwe Drechsel (vym@InSilmaril.de)</li>"
-				"<li> vym is released under the GPL (Gnu General Public License)"
-				", with one exception (see the file \"LICENSE\"which "
-				"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
-				"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
-    					"http://www.InSilmaril.de/vym</a></li>"
-			"<li> Credits " 
-				"<ul>"
-					"<li>Jakob Hilmer for image drag and drop patch </li>"
-					"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
-					"<li>Clemens Kraus for stylesheets and script used for HTML-export "
-					"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
-					"<li>Alexander Johannesen for providing stylesheets from his xsiteable project " 
-					"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
-					"<li>Ken Wimer and Olaf Hering for Mac support</li>"
-				"</ul>"
-			"</li>");
-	credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
-	credits->mimeSourceFactory();
+    credits->setText (
+	"<h3><img src=\"vym_logo\">VYM - View Your Mind </h3>"
+	"<p> A tool to put the things you have got in your mind into a map.</p>"
+	"<ul>"
+	"<li> (c) by Uwe Drechsel (<a href=\"mailto:vym@InSilmaril.de\">vym@InSilmaril.de</a>)</li>"
+	"<li> vym is released under the GPL (Gnu General Public License)"
+	", with one exception (see the file \"LICENSE\"which "
+	"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
+	"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
+	"http://www.InSilmaril.de/vym</a></li>"
+	"<li> Credits " 
+	"<ul>"
+	"<li>Jakob Hilmer for image drag and drop patch </li>"
+	"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
+	"<li>Clemens Kraus for stylesheets and script used for HTML-export "
+	"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
+	"<li>Alexander Johannesen for providing stylesheets from his xsiteable project " 
+	"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
+	"<li>Ken Wimer and Olaf Hering for Mac support</li>"
+	"</ul>"
+	"</li>");
+    credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
     tabs->addTab (credits,"Credits");
 
-	license=new QTextBrowser (this,"license");
-	license->setText ("License text...");
-	credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
-	tabs->addTab (license,"License");
+    license=new AboutTextBrowser (this,"license");
+    license->setText ("License text...");
+    credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
+    tabs->addTab (license,"License");
 
-	mainLayout->addWidget (tabs);
-	tabs->showPage (credits);
+    mainLayout->addWidget (tabs);
+    tabs->showPage (credits);
 
-	okbutton =new QPushButton (this,"okbutton");
-	okbutton->setText ("ok");
-	okbutton->setMaximumSize (QSize (50,30));
-	okbutton->setAutoDefault (true);
+    okbutton =new QPushButton (this,"okbutton");
+    okbutton->setText (tr("Ok"));
+    okbutton->setMaximumSize (QSize (50,30));
+    okbutton->setAutoDefault (true);
     mainLayout->addWidget( okbutton); 
 
-	connect (credits,SIGNAL ( linkClicked(const QString&)),this ,SLOT ( openLink(const QString&)));
-//	connect( credits, SIGNAL( sourceChanged(const QString& ) ),
-//	     this, SLOT( openLink( const QString&) ) );
-
-
-	connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
+    connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
 }
 
+AboutTextBrowser::AboutTextBrowser(QWidget *parent, const char *name)
+    : QTextBrowser(parent, name)
+{
+    
+}
 
-void AboutDialog::openLink(const QString &url)
+void AboutTextBrowser::setSource(const QString &name)
 {
-//	okbutton->setText (url);
+    QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
+    const QMimeSource *data = factory->data(name);
+    if (data) {
+	QTextBrowser::setSource(name);
+    } else {
+	QProcess *proc = new QProcess( this );
+	proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL" ));
+	proc->addArgument( name);
+	
+	if ( !proc->start() ) 
+	    if (mainWindow->settingsURL() ) 
+		setSource(name);
+    }
 }
diff -r 8429b60b68e6 -r 47cd4ae30000 aboutdialog.h
--- a/aboutdialog.h	Tue Aug 16 17:26:55 2005 +0000
+++ b/aboutdialog.h	Tue Aug 16 17:27:34 2005 +0000
@@ -1,3 +1,4 @@
+/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
 #ifndef ABOUTDIALOG_H
 #define ABOUTDIALOG_H
 
@@ -8,7 +9,7 @@
 #include <qpushbutton.h>
 #include <qstring.h>
 
-
+class AboutTextBrowser;
 /////////////////////////////////////////////////////////////////////////////
 class AboutDialog :public QDialog
 {
@@ -17,14 +18,10 @@
 public:
 	AboutDialog(QWidget* parent = 0, const char* name = 0);
 
-
-public slots:
-	virtual void openLink (const QString &);
-
 private:
 	QTabWidget *tabs;
-	QTextBrowser *credits;
-	QTextBrowser *license;
+	AboutTextBrowser *credits;
+	AboutTextBrowser *license;
 
 	QBoxLayout *mainLayout;
 	QBoxLayout *topLayout;
@@ -33,4 +30,13 @@
 	
 };
 
+class AboutTextBrowser : public QTextBrowser
+{
+  Q_OBJECT;
+ public:
+  AboutTextBrowser(QWidget *parent, const char *name = 0);
+ public slots:
+   void setSource(const QString &name);
+};
+
 #endif
diff -r 8429b60b68e6 -r 47cd4ae30000 tex/vym.changelog
--- a/tex/vym.changelog	Tue Aug 16 17:26:55 2005 +0000
+++ b/tex/vym.changelog	Tue Aug 16 17:27:34 2005 +0000
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Tue Aug 16 19:22:56 CEST 2005 - jhilmer
+
+- Bugfix: Fixed link handling in aboutdialog.
+
 -------------------------------------------------------------------
 Tue Aug 16 12:25:09 CEST 2005 - uwe