Fixed link handling in aboutdialog
authorjhilmer
Tue, 16 Aug 2005 17:27:34 +0000
changeset 15347cd4ae30000
parent 152 8429b60b68e6
child 154 fa05daf043a8
Fixed link handling in aboutdialog
aboutdialog.cpp
aboutdialog.h
tex/vym.changelog
     1.1 --- a/aboutdialog.cpp	Tue Aug 16 17:26:55 2005 +0000
     1.2 +++ b/aboutdialog.cpp	Tue Aug 16 17:27:34 2005 +0000
     1.3 @@ -1,67 +1,85 @@
     1.4 +/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
     1.5 +
     1.6 +#include <qmime.h>
     1.7 +#include <qprocess.h>
     1.8 +
     1.9  #include "aboutdialog.h"
    1.10  #include "version.h"
    1.11 +#include "settings.h"
    1.12 +#include "mainwindow.h"
    1.13  
    1.14 -#include "icons/vym-48x48.xpm"
    1.15 +extern Main *mainWindow;
    1.16 +extern Settings settings;
    1.17  
    1.18  AboutDialog::AboutDialog( QWidget *parent, const char *name)
    1.19      : QDialog( parent, name)
    1.20  {
    1.21 -	mainLayout=new QVBoxLayout( this);
    1.22 + 
    1.23 +    mainLayout=new QVBoxLayout( this, 10);
    1.24  
    1.25 -	tabs=new QTabWidget (this);
    1.26 +    tabs=new QTabWidget (this);
    1.27 +    credits=new AboutTextBrowser (this,"credits");
    1.28  
    1.29 -	credits=new QTextBrowser (this,"credits");
    1.30 -
    1.31 -	
    1.32 -	credits->setText (
    1.33 -		"<h3>VYM - View Your Mind </h3>"
    1.34 -		"<p> A tool to put the things you have got in your mind into a map.</p>"
    1.35 -			"<ul>"
    1.36 -				"<li> (c) by Uwe Drechsel (vym@InSilmaril.de)</li>"
    1.37 -				"<li> vym is released under the GPL (Gnu General Public License)"
    1.38 -				", with one exception (see the file \"LICENSE\"which "
    1.39 -				"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
    1.40 -				"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
    1.41 -    					"http://www.InSilmaril.de/vym</a></li>"
    1.42 -			"<li> Credits " 
    1.43 -				"<ul>"
    1.44 -					"<li>Jakob Hilmer for image drag and drop patch </li>"
    1.45 -					"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
    1.46 -					"<li>Clemens Kraus for stylesheets and script used for HTML-export "
    1.47 -					"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
    1.48 -					"<li>Alexander Johannesen for providing stylesheets from his xsiteable project " 
    1.49 -					"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
    1.50 -					"<li>Ken Wimer and Olaf Hering for Mac support</li>"
    1.51 -				"</ul>"
    1.52 -			"</li>");
    1.53 -	credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
    1.54 -	credits->mimeSourceFactory();
    1.55 +    credits->setText (
    1.56 +	"<h3><img src=\"vym_logo\">VYM - View Your Mind </h3>"
    1.57 +	"<p> A tool to put the things you have got in your mind into a map.</p>"
    1.58 +	"<ul>"
    1.59 +	"<li> (c) by Uwe Drechsel (<a href=\"mailto:vym@InSilmaril.de\">vym@InSilmaril.de</a>)</li>"
    1.60 +	"<li> vym is released under the GPL (Gnu General Public License)"
    1.61 +	", with one exception (see the file \"LICENSE\"which "
    1.62 +	"comes with vym). This exception is needed to build vym with QT libraries for proprietary operating systems.</li>"
    1.63 +	"<li> Project homepage <a href=\"http:/www.InSilmaril.de/vym\">"
    1.64 +	"http://www.InSilmaril.de/vym</a></li>"
    1.65 +	"<li> Credits " 
    1.66 +	"<ul>"
    1.67 +	"<li>Jakob Hilmer for image drag and drop patch </li>"
    1.68 +	"<li>Thomas Schraitle for the stylesheet  used for XHTML-export </li>"
    1.69 +	"<li>Clemens Kraus for stylesheets and script used for HTML-export "
    1.70 +	"<a href=\"http://www.clemens-kraus.de\">(www.clemens-kraus.de)</a></li>"
    1.71 +	"<li>Alexander Johannesen for providing stylesheets from his xsiteable project " 
    1.72 +	"<a href=\"http://www.shelter.nu/xsiteable/xsiteable.html\">(www.shelter.nu/xsiteable/xsiteable.html)</a>. </li>"
    1.73 +	"<li>Ken Wimer and Olaf Hering for Mac support</li>"
    1.74 +	"</ul>"
    1.75 +	"</li>");
    1.76 +    credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
    1.77      tabs->addTab (credits,"Credits");
    1.78  
    1.79 -	license=new QTextBrowser (this,"license");
    1.80 -	license->setText ("License text...");
    1.81 -	credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
    1.82 -	tabs->addTab (license,"License");
    1.83 +    license=new AboutTextBrowser (this,"license");
    1.84 +    license->setText ("License text...");
    1.85 +    credits->setFrameStyle( QFrame::Panel | QFrame::Plain );
    1.86 +    tabs->addTab (license,"License");
    1.87  
    1.88 -	mainLayout->addWidget (tabs);
    1.89 -	tabs->showPage (credits);
    1.90 +    mainLayout->addWidget (tabs);
    1.91 +    tabs->showPage (credits);
    1.92  
    1.93 -	okbutton =new QPushButton (this,"okbutton");
    1.94 -	okbutton->setText ("ok");
    1.95 -	okbutton->setMaximumSize (QSize (50,30));
    1.96 -	okbutton->setAutoDefault (true);
    1.97 +    okbutton =new QPushButton (this,"okbutton");
    1.98 +    okbutton->setText (tr("Ok"));
    1.99 +    okbutton->setMaximumSize (QSize (50,30));
   1.100 +    okbutton->setAutoDefault (true);
   1.101      mainLayout->addWidget( okbutton); 
   1.102  
   1.103 -	connect (credits,SIGNAL ( linkClicked(const QString&)),this ,SLOT ( openLink(const QString&)));
   1.104 -//	connect( credits, SIGNAL( sourceChanged(const QString& ) ),
   1.105 -//	     this, SLOT( openLink( const QString&) ) );
   1.106 -
   1.107 -
   1.108 -	connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
   1.109 +    connect( okbutton, SIGNAL( clicked() ), this, SLOT( accept() ) );
   1.110  }
   1.111  
   1.112 +AboutTextBrowser::AboutTextBrowser(QWidget *parent, const char *name)
   1.113 +    : QTextBrowser(parent, name)
   1.114 +{
   1.115 +    
   1.116 +}
   1.117  
   1.118 -void AboutDialog::openLink(const QString &url)
   1.119 +void AboutTextBrowser::setSource(const QString &name)
   1.120  {
   1.121 -//	okbutton->setText (url);
   1.122 +    QMimeSourceFactory *factory = QMimeSourceFactory::defaultFactory();
   1.123 +    const QMimeSource *data = factory->data(name);
   1.124 +    if (data) {
   1.125 +	QTextBrowser::setSource(name);
   1.126 +    } else {
   1.127 +	QProcess *proc = new QProcess( this );
   1.128 +	proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL" ));
   1.129 +	proc->addArgument( name);
   1.130 +	
   1.131 +	if ( !proc->start() ) 
   1.132 +	    if (mainWindow->settingsURL() ) 
   1.133 +		setSource(name);
   1.134 +    }
   1.135  }
     2.1 --- a/aboutdialog.h	Tue Aug 16 17:26:55 2005 +0000
     2.2 +++ b/aboutdialog.h	Tue Aug 16 17:27:34 2005 +0000
     2.3 @@ -1,3 +1,4 @@
     2.4 +/* emacs: -*- Mode: C; c-style: "bsd"; c-basic-offset: 4; c-recognize-knr-p: nil; -*- */
     2.5  #ifndef ABOUTDIALOG_H
     2.6  #define ABOUTDIALOG_H
     2.7  
     2.8 @@ -8,7 +9,7 @@
     2.9  #include <qpushbutton.h>
    2.10  #include <qstring.h>
    2.11  
    2.12 -
    2.13 +class AboutTextBrowser;
    2.14  /////////////////////////////////////////////////////////////////////////////
    2.15  class AboutDialog :public QDialog
    2.16  {
    2.17 @@ -17,14 +18,10 @@
    2.18  public:
    2.19  	AboutDialog(QWidget* parent = 0, const char* name = 0);
    2.20  
    2.21 -
    2.22 -public slots:
    2.23 -	virtual void openLink (const QString &);
    2.24 -
    2.25  private:
    2.26  	QTabWidget *tabs;
    2.27 -	QTextBrowser *credits;
    2.28 -	QTextBrowser *license;
    2.29 +	AboutTextBrowser *credits;
    2.30 +	AboutTextBrowser *license;
    2.31  
    2.32  	QBoxLayout *mainLayout;
    2.33  	QBoxLayout *topLayout;
    2.34 @@ -33,4 +30,13 @@
    2.35  	
    2.36  };
    2.37  
    2.38 +class AboutTextBrowser : public QTextBrowser
    2.39 +{
    2.40 +  Q_OBJECT;
    2.41 + public:
    2.42 +  AboutTextBrowser(QWidget *parent, const char *name = 0);
    2.43 + public slots:
    2.44 +   void setSource(const QString &name);
    2.45 +};
    2.46 +
    2.47  #endif
     3.1 --- a/tex/vym.changelog	Tue Aug 16 17:26:55 2005 +0000
     3.2 +++ b/tex/vym.changelog	Tue Aug 16 17:27:34 2005 +0000
     3.3 @@ -1,3 +1,8 @@
     3.4 +-------------------------------------------------------------------
     3.5 +Tue Aug 16 19:22:56 CEST 2005 - jhilmer
     3.6 +
     3.7 +- Bugfix: Fixed link handling in aboutdialog.
     3.8 +
     3.9  -------------------------------------------------------------------
    3.10  Tue Aug 16 12:25:09 CEST 2005 - uwe
    3.11