"Fossies" - the Fresh Open Source Software Archive

Member "scribus-1.5.6.1/scribus/ui/about.cpp" (14 Nov 2020, 20401 Bytes) of package /linux/misc/scribus-1.5.6.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "about.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.5.6_vs_1.5.6.1.

    1 /*
    2 For general Scribus (>=1.3.2) copyright and licensing information please refer
    3 to the COPYING file provided with the program. Following this notice may exist
    4 a copyright and/or license notice that predates the release of Scribus 1.3.2
    5 for which a new license (GPL+exception) is in place.
    6 */
    7 /***************************************************************************
    8 *                                                                         *
    9 *   This program is free software; you can redistribute it and/or modify  *
   10 *   it under the terms of the GNU General Public License as published by  *
   11 *   the Free Software Foundation; either version 2 of the License, or     *
   12 *   (at your option) any later version.                                   *
   13 *                                                                         *
   14 ***************************************************************************/
   15 #include <iostream> // only for debugging
   16 
   17 #include <QFile>
   18 #include <QLabel>
   19 #include <QPixmap>
   20 #include <QPushButton>
   21 #include <QShowEvent>
   22 #include <QString>
   23 #include <QStringList>
   24 #include <QTabWidget>
   25 #include <QTextStream>
   26 #include <QToolTip>
   27 #include <QWidget>
   28 
   29 #include <cairo.h>
   30 
   31 #include "about.h"
   32 #include "commonstrings.h"
   33 #include "scconfig.h"
   34 #include "scpaths.h"
   35 #ifdef HAVE_SVNVERSION
   36     #include "svnversion.h"
   37 #endif
   38 #include "util_ghostscript.h"
   39 #include "iconmanager.h"
   40 #include "upgradechecker.h"
   41 #include "langmgr.h"
   42 
   43 
   44 /*
   45 * The content for the About dialog is mostly built from the files in
   46 * // SCRIBUS_INSTALL_DIRECTORY/share/doc/scribus-1.3.5svn/
   47 * 
   48 * The format of the files should follow this pattern:
   49 * - AUTHOR
   50 *   Tr(Title)
   51 *   first_name name email_address
   52 *   first_name name email_address
   53 *   
   54 *   Tr(Title)
   55 *   ...
   56 *
   57 * - TRANSLATION
   58 *   Tr(Title)
   59 *   
   60 *   Language(language_code)
   61 *   first_name name (email_address)
   62 *
   63 *   Language(language_code)
   64 *   first_name name (email_address)
   65 *
   66 *
   67 *   Tr(Title)
   68 *   ...
   69 * - LINKS
   70 *   Tr(Title)
   71 *   url
   72 *
   73 *
   74 *   Tr(Title)
   75 *   ...
   76 *
   77 *
   78 *  Text which has to be translated has to be added to the local tr...Title()
   79 *  methods, otherwise in won't be added to the list of translatable strings
   80 *
   81 *  a.l.e
   82 */
   83 
   84 /*!
   85 \fn About::About( QWidget* parent, AboutMode diaMode )
   86 \author Franz Schmid
   87 \date
   88 \brief Constructor for About dialog box
   89 \param parent QWidget pointer to parent window
   90 \param diaMode a dialog mode. See AboutMode.
   91 \retval About dialog
   92 */
   93 About::About( QWidget* parent, AboutMode diaMode ) : QDialog( parent )
   94 {
   95     m_mode = diaMode;
   96     m_firstShow = true;
   97     setWindowTitle( tr("About Scribus %1").arg(VERSION) );
   98     setWindowIcon(IconManager::instance().loadIcon("AppIcon.png", true));
   99     setModal(true);
  100     aboutLayout = new QVBoxLayout( this );
  101     aboutLayout->setSpacing( 6 );
  102     aboutLayout->setMargin( 10 );
  103     tabWidget2 = new QTabWidget( this );
  104 //  tabWidget2->setMinimumSize( QSize( 438, 258 ) );
  105     tab = new QWidget( tabWidget2 );
  106     tabLayout1 = new QVBoxLayout( tab );
  107     tabLayout1->setSpacing( 6 );
  108     tabLayout1->setMargin( 15 );
  109     pixmapLabel1 = new QLabel( tab );
  110     pixmapLabel1->setPixmap(IconManager::instance().loadPixmap("scribus_splash.png", true));
  111     pixmapLabel1->setFixedSize(QSize(pixmapLabel1->pixmap()->width(), pixmapLabel1->pixmap()->height()));
  112     pixmapLabel1->setAlignment(Qt::AlignCenter);
  113     tabLayout1->addWidget( pixmapLabel1 );
  114     buildID = new QLabel( tab );
  115     buildID->setAlignment(Qt::AlignCenter);
  116     buildID->setTextInteractionFlags(Qt::TextSelectableByMouse);
  117     QString BUILD_DAY = "14";
  118     QString BUILD_MONTH = CommonStrings::november;
  119     QString BUILD_YEAR = "2020";
  120     QString BUILD_TIME = "";
  121     QString BUILD_TZ = "";
  122     QString BUILD_NAME = "";
  123 
  124     QString built = tr("%1 %2 %3").arg(BUILD_DAY, BUILD_MONTH, BUILD_YEAR);
  125     QString version = VERSION;
  126     if (BUILD_NAME != "")
  127         version += " \"" + BUILD_NAME + "\"";
  128     if (BUILD_NAME == "BleedingEdge")
  129         built = tr("%3-%2-%1 %4 %5").arg(BUILD_DAY, BUILD_MONTH, BUILD_YEAR, BUILD_TIME, BUILD_TZ);
  130 
  131 #if defined(HAVE_SVNVERSION) && defined(SVNVERSION)
  132     QString revText;
  133     revText=QString(tr("SVN Revision: %1")).arg(SVNVERSION);
  134     built+=" - ";
  135     built+=revText;
  136 #endif
  137     QString bu;
  138     bu += "C";
  139     bu += "-";
  140     bu += "-";
  141     bu += "T";
  142     bu += "-";
  143 #ifdef HAVE_FONTCONFIG
  144     bu += "F";
  145 #else
  146     bu += "*";
  147 #endif
  148     bu += "-";
  149     bu += "C";
  150     bu += cairo_version_string();
  151 
  152 // Some more information if we are not on a 32bit little endian Unix machine
  153 #if defined(Q_OS_WIN)
  154     bu += "-Windows";
  155 #elif defined(Q_OS_MAC)
  156     bu += "-Mac/";
  157 #elif defined(Q_OS_DARWIN)
  158     // dunno if anyone uses this...
  159     bu += "-Darwin";
  160 #endif
  161     if (QSysInfo::WordSize != 32)
  162         bu += QString("-%1bit").arg(QSysInfo::WordSize);
  163 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
  164     if (QSysInfo::ByteOrder==QSysInfo::BigEndian)
  165         bu += "-Big";
  166 #endif
  167     QString gsver(getGSVersion());
  168     if (!gsver.isEmpty())
  169         gsver = tr("Using Ghostscript version %1").arg(gsver);
  170     else
  171         gsver = tr("No Ghostscript version available");
  172     buildID->setText( tr("<p align=\"center\"><b>%1 %2</b></p><p align=\"center\">%3<br>%4 %5<br>%6</p>").arg( tr("Scribus Version"), version, built, tr("Build ID:"), bu, gsver));
  173     tabLayout1->addWidget( buildID, 0, Qt::AlignHCenter );
  174     tabWidget2->addTab( tab, tr( "&About" ) );
  175 
  176     /*! AUTHORS tab */
  177     tab_2 = new QWidget( tabWidget2 );
  178     tabLayout = new QHBoxLayout( tab_2 );
  179     tabLayout->setSpacing( 6 );
  180     tabLayout->setMargin( 10 );
  181     authorView = new QTextBrowser( tab_2 );
  182     authorView->setHtml(About::parseAuthorFile(ScPaths::instance().docDir() + "AUTHORS"));
  183     tabLayout->addWidget( authorView );
  184     tabWidget2->addTab( tab_2, tr("A&uthors"));
  185 
  186     /*! TRANSLATION tab */
  187     tab_3 = new QWidget( tabWidget2 );
  188     tabLayout_2 = new QHBoxLayout( tab_3 );
  189     tabLayout_2->setSpacing( 6 );
  190     tabLayout_2->setMargin( 10 );
  191     transView = new QTextBrowser( tab_3);
  192     transView->setHtml(About::parseTranslationFile(ScPaths::instance().docDir() + "TRANSLATION"));
  193     tabLayout_2->addWidget( transView );
  194     tabWidget2->addTab( tab_3, tr( "&Translations" ) );
  195 
  196     /*! ONLINE tab (03/04/2004 petr vanek) */
  197     tab_4 = new QWidget( tabWidget2 );
  198     onlineView = new QTextBrowser( tab_4 );
  199     onlineView->setHtml(About::parseLinksFile(ScPaths::instance().docDir() + "LINKS"));
  200     onlineView->setOpenExternalLinks(true);
  201     tabLayout_4 = new QHBoxLayout( tab_4 );
  202     tabLayout_4->setSpacing( 6 );
  203     tabLayout_4->setMargin( 10 );
  204     tabLayout_4->addWidget( onlineView );
  205     tabWidget2->addTab( tab_4, tr( "&Online" ) );
  206 
  207 
  208     /*! UPDATE tab */
  209     tab_5 = new QWidget( tabWidget2 );
  210     tabWidget2->addTab( tab_5, tr( "&Updates" ) );
  211     updateLayout = new QVBoxLayout( tab_5 );
  212     updateLayout->setSpacing( 6 );
  213     updateLayout->setMargin( 10 );
  214     checkForUpdateButton = new QPushButton( tr( "Check for Updates" ), tab_5 );
  215     updateView = new QTextBrowser( tab_5);
  216     updateLayout->addWidget( checkForUpdateButton );
  217     updateLayout->addWidget( updateView );
  218     
  219     /*! LICENCE tab */
  220     tab_Licence = new QWidget( tabWidget2 );
  221     tabWidget2->addTab( tab_Licence, tr( "&Licence" ) );
  222     licenceLayout = new QVBoxLayout( tab_Licence );
  223     licenceLayout->setSpacing( 6 );
  224     licenceLayout->setMargin( 10 );
  225     textViewLicence = new QTextBrowser( tab_Licence);
  226     licenceLayout->addWidget( textViewLicence );
  227     
  228     QFile licenceFile(ScPaths::instance().docDir() + "/COPYING");
  229     if (!licenceFile.open(QIODevice::ReadOnly | QIODevice::Text))
  230         textViewLicence->setPlainText(tr("Unable to open licence file. Please check your install directory or the Scribus website for licencing information.") );
  231     else
  232     {
  233         QTextStream inTS(&licenceFile);
  234         inTS.setAutoDetectUnicode(true);
  235         inTS.setCodec("UTF-8");
  236         QString licenceText = inTS.readAll();
  237         textViewLicence->setPlainText(licenceText);
  238     } 
  239 
  240     //Add tab widget to about window
  241     aboutLayout->addWidget( tabWidget2 );
  242 
  243     layout2 = new QHBoxLayout;
  244     layout2->setSpacing( 6 );
  245     layout2->setMargin( 0 );
  246     QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
  247     layout2->addItem( spacer );
  248     okButton = new QPushButton( tr( "&Close" ), this );
  249     okButton->setDefault( true );
  250     layout2->addWidget( okButton );
  251     aboutLayout->addLayout( layout2 );
  252     setMaximumSize(sizeHint());
  253 
  254 
  255     //tooltips
  256     buildID->setToolTip( "<qt>" + tr( "This panel shows the version, build date and compiled in library support in Scribus.")+"<br>"
  257     + tr("The C-C-T-F equates to C=littlecms C=CUPS T=TIFF support F=Fontconfig support.Last Letter is the renderer C=cairo or Q=Qt")+"<br>"
  258     + tr("Missing library support is indicated by a *. This also indicates the version of Ghostscript which Scribus has detected.")+"<br>"
  259     + tr("The Windows version does not use fontconfig or CUPS libraries." ) + "</qt>" );
  260     checkForUpdateButton->setToolTip( "<qt>" + tr( "Check for updates to Scribus. No data from your machine will be transferred off it." ) + "</qt>" );
  261     // signals and slots connections
  262     connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
  263     connect( checkForUpdateButton, SIGNAL( clicked() ), this, SLOT( runUpdateCheck() ) );
  264     resize(minimumSizeHint());
  265 }
  266 
  267 
  268 void About::showEvent (QShowEvent * event)
  269 {
  270     if (m_mode == About::CheckUpdates && m_firstShow)
  271         tabWidget2->setCurrentIndex(4);
  272     QDialog::showEvent(event);
  273 }
  274 
  275 
  276 
  277 QString About::trAuthorTitle(const QString& title)
  278 {
  279     QString result;
  280     if ( title == "Development Team:" )
  281         result = tr("Development Team:");
  282     else if ( title == "Mac OS&#174; X Aqua Port:" )
  283         result = tr("Mac OS&#174; X Aqua Port:");
  284     else if ( title == "OS/2&#174;/eComStation&#8482; Port:" )
  285         result = tr("OS/2&#174;/eComStation&#8482; Port:");
  286     else if ( title == "Windows&#174; Port:" )
  287         result = tr("Windows&#174; Port:");
  288     else if ( title == "Haiku Port:" )
  289         result = tr("Haiku Port:");
  290     else if ( title == "Contributions from:" )
  291         result = tr("Contributions from:");
  292     else if ( title == "Official Documentation:" )
  293         result = tr("Official Documentation:");
  294     else if ( title == "Doc Translators:" )
  295         result = tr("Doc Translators:");
  296     else if ( title == "Other Documentation:" )
  297         result = tr("Other Documentation:");
  298     else if ( title == "Webmasters:" )
  299         result = tr("Webmasters:");
  300     else if ( title == "Splash Screen:" )
  301         result = tr("Splash Screen:");
  302     else if ( title == "Tango Project Icons:" )
  303         result = tr("Tango Project Icons:");
  304     else if ( title == "Scribus 1.5.1+ Icon Set:" )
  305         result = tr("Scribus 1.5.1+ Icon Set:");
  306     else if ( title == "Refactoring text layout code, the new boxes model & CTL text layout, Oman House of Open Source Technology team:" )
  307         result = tr("Refactoring text layout code, the new boxes model & CTL text layout, Oman House of Open Source Technology team:");
  308     else
  309     {
  310         std::cout << "please add the untranslated title \"" << qPrintable(title) << "\" to About::trAuthorTitle()" << std::endl;
  311         result = title;
  312     }
  313     return result;
  314 }
  315 QString About::trTranslationTitle(const QString& title)
  316 {
  317     QString result;
  318     if ( title == "Official Translations and Translators (in order of locale shortcode):" )
  319         result = tr("Official Translations and Translators (in order of locale shortcode):");
  320     else if ( title == "Previous Translation Contributors:" )
  321         result = tr("Previous Translation Contributors:");
  322     else
  323     {
  324         std::cout << "please add the untranslated title \"" << qPrintable(title) << "\" to About::trTranslationTitle()" << std::endl;
  325         result = title;
  326     }
  327     return result;
  328 }
  329 
  330 
  331 QString About::trLinksTitle(const QString& title)
  332 {
  333     QString result;
  334     if ( title == "Homepage" )
  335         result = tr("Homepage");
  336     else if ( title == "Online Reference" )
  337         result = tr("Online Reference");
  338     else if ( title == "Wiki" )
  339         result = tr("Wiki");
  340     else if ( title == "Bugs and Feature Requests" )
  341         result = tr("Bugs and Feature Requests");
  342     else if ( title == "Developer Blog" )
  343         result = tr("Developer Blog");
  344     else if ( title == "Mailing List" )
  345         result = tr("Mailing List");
  346     else
  347     {
  348         std::cout << "please add the untranslated title \"" << qPrintable(title) << "\" to About::trLinksTitle()" << std::endl;
  349         result = title;
  350     }
  351     return result;
  352 }
  353 
  354 
  355 /*!
  356 * parse a text file and return an author list in an html table:
  357 * left the names and right the contact address
  358 * the html table can be "split" in sections
  359 * @param QString fileName the file to be parsed
  360 * @return QString the html table
  361 */
  362 QString About::parseAuthorFile(const QString& fileName)
  363 {
  364     QString result;
  365     QString file;
  366     QFile authorsFile(fileName);
  367     if (authorsFile.open(QIODevice::ReadOnly | QIODevice::Text))
  368     {
  369         QTextStream inTS(&authorsFile);
  370         inTS.setCodec("UTF-8");
  371         inTS.setAutoDetectUnicode(true);
  372         QString lineTS;
  373         QStringList fieldTS;
  374         QString name;
  375         QString contact;
  376         bool isTitle = true;
  377         bool startText = false;
  378         bool startTitle = false;
  379         result = "<table>";
  380         while (!inTS.atEnd())
  381         {
  382             lineTS = inTS.readLine();
  383             // convert (r) "�" to &#174, "�" to &#8482
  384             // lineTS = QString::fromUtf8(lineTS);
  385             lineTS.replace("<", "&lt;");
  386             lineTS.replace(">", "&gt;");
  387             lineTS.replace("�", "&#174;");
  388             lineTS.replace("�", "&#8482;");
  389             name = "";
  390             contact = "";
  391             if (!lineTS.isEmpty())
  392             {
  393                 if (isTitle)
  394                 {
  395                     startTitle = false;
  396                     result += "<tr><td><b>" + About::trAuthorTitle(lineTS) + "</b></td><td></td></tr>";
  397                 }
  398                 else
  399                 {
  400                     startText = false;
  401                     fieldTS = lineTS.split(" ");
  402                     contact = fieldTS.isEmpty() ? QString() : fieldTS.takeLast();
  403                     name = fieldTS.isEmpty() ? QString() : fieldTS.join(" ");
  404                     result += "<tr><td>" +name + "</td><td>" + (contact == "@" ? "" : contact) + "</td></tr>";
  405                 }
  406             } // if is empty line
  407             else
  408             {
  409                 // empty lines switch between title and text
  410                 if (!startText && !startTitle)
  411                 {
  412                     isTitle = !isTitle;
  413                     if (isTitle)
  414                     {
  415                         result += "<tr><td></td><td></td></tr>";
  416                         startTitle = true;
  417                     }
  418                     else
  419                     {
  420                         startText = true;
  421                     }
  422                 }
  423             } // else is empty line
  424         } // while ! atEnd
  425         result += "<table>";
  426     } // if file found
  427     else
  428     {
  429         if (!fileName.isEmpty())
  430         {
  431             QStringList field = fileName.split("/");
  432             if (!field.isEmpty())
  433             {
  434                 file = field.takeLast();
  435             }
  436         }
  437         result = tr("Unable to open %1 file. Please check your install directory or the Scribus website for %1 information.").arg(file);
  438         result = "";
  439     } // else file found
  440     return result;
  441 } // parseTextFile()
  442 
  443 /*!
  444 * parse a text file and return an author list in an html table:
  445 * left the names and right the contact address
  446 * the html table can be "split" in sections
  447 * @param QString fileName the file to be parsed
  448 * @return QString the html table
  449 */
  450 QString About::parseTranslationFile(const QString& fileName)
  451 {
  452     QString result;
  453     QString file;
  454     QFile translationFile(fileName);
  455     if (translationFile.open(QIODevice::ReadOnly | QIODevice::Text))
  456     {
  457         QTextStream inTS(&translationFile);
  458         inTS.setCodec("UTF-8");
  459         inTS.setAutoDetectUnicode(true);
  460         QString lineTS;
  461         QStringList fieldTS;
  462         QString code;
  463         QString name;
  464         QString contact;
  465 //      LanguageManager langmgr;
  466 //      langmgr.init(false);
  467         bool isSectionTitle = true;
  468         bool isTitle = false;
  469         bool startText = false;
  470         bool startTitle = false;
  471         result = "<table>";
  472 
  473         QMap<QString, QString> sections;
  474         QMap<QString, QString> languages;
  475         QMultiMap<QString, QString> names;
  476         QString currLang;
  477         int section=0;
  478         QString snum;
  479         while (!inTS.atEnd())
  480         {
  481             lineTS = inTS.readLine();
  482             lineTS.replace("<", "&lt;");
  483             lineTS.replace(">", "&gt;");
  484             name = "";
  485             contact = "";
  486             if (!lineTS.isEmpty())
  487             {
  488                 if  (isSectionTitle)
  489                 {
  490                     ++section;
  491                     snum.setNum(section);
  492                     //result += "<tr><td><b><i>"+About::trTranslationTitle(lineTS)+"</i></b></td><td></td></tr>";
  493 
  494                     sections.insert(snum, "<tr><td><b><i>"+About::trTranslationTitle(lineTS)+"</i></b></td><td></td></tr>");
  495                     isSectionTitle = false;
  496                     isTitle = false;
  497                     startTitle = false;
  498                 }
  499                 else if (isTitle)
  500                 {
  501                     startTitle = false;
  502                     fieldTS = lineTS.split(" ");
  503                     code = (fieldTS.isEmpty() ? "" : fieldTS.takeLast());
  504                     if (!code.isEmpty())
  505                     {
  506                         code.replace("(", "");
  507                         code.replace(")", "");
  508                         code = LanguageManager::instance()->getLangFromAbbrev(code);
  509                     }
  510                     //result += "<tr><td><b>"+code+"</b></td><td></td></tr>";
  511                     languages.insert(snum+":"+code, "<tr><td><b>"+code+"</b></td><td></td></tr>");
  512                     isTitle = false;
  513                     currLang=code;
  514 
  515                 } // if is title
  516                 else
  517                 {
  518                     startText = false;
  519                     fieldTS = lineTS.split(" ");
  520                     contact = (fieldTS.isEmpty() ? "" : fieldTS.takeLast());
  521                     contact.replace("(", "");
  522                     contact.replace(")", "");
  523                     name = (fieldTS.isEmpty() ? "" : fieldTS.join(" "));
  524                     //result += "<tr><td>"+name+"</td><td>"+(contact == "@" ? "" : contact)+"</td></tr>";
  525                     names.insert(snum+":"+code, "<tr><td>"+name+"</td><td>"+(contact == "@" ? "" : contact)+"</td></tr>");
  526                 } // else is title
  527             } // if is empty line
  528             else
  529             {
  530                 // empty lines switch between title and text
  531                 if (!startText && !startTitle)
  532                 {
  533                     isTitle = !isTitle;
  534                     if (isTitle)
  535                     {
  536                         //result += "<tr><td></td><td></td></tr>";
  537                         startTitle = true;
  538                     }
  539                     else
  540                     {
  541                         startText = true;
  542                     }
  543                 //
  544                 // multiple empty lines start a section instead of marking a title
  545                 }
  546                 else if (startTitle)
  547                 {
  548                     isTitle = false;
  549                     isSectionTitle = true;
  550                 }
  551             } // else is empty line
  552         } // while ! atEnd
  553 
  554         QMapIterator<QString, QString> s(sections);
  555         while (s.hasNext())
  556         {
  557             s.next();
  558             result += s.value();
  559             result += "<tr><td></td><td></td></tr>";
  560             QMapIterator<QString, QString> l(languages);
  561             while (l.hasNext())
  562             {
  563                 l.next();
  564                 QStringList sl=l.key().split(":");
  565                 if (s.key()==sl.first())
  566                 {
  567                     result += l.value();
  568 
  569                     QMapIterator<QString, QString> n(names);
  570                     while (n.hasNext())
  571                     {
  572                         n.next();
  573                         if (n.key()==l.key())
  574                             result += n.value();
  575                     }
  576                     result += "<tr><td></td><td></td></tr>";
  577                 }
  578             }
  579             result += "<tr><td></td><td></td></tr><tr><td></td><td></td></tr>";
  580         }
  581         result += "<table>";
  582     } // if file found
  583     else
  584     {
  585         if (!fileName.isEmpty())
  586         {
  587             QStringList field = fileName.split("/");
  588             if (!field.isEmpty())
  589             {
  590                 file = field.takeLast();
  591             }
  592         }
  593         result = tr("Unable to open %1 file. Please check your install directory or the Scribus website for %1 information.").arg(file);
  594         result = "";
  595     } // else file found
  596     return result;
  597 } // parseTranslationFile()
  598 
  599 /*!
  600 * parse a text file and return a links list in html format:
  601 * left the names and right the contact address
  602 * the html table can be "split" in sections
  603 * @param QString fileName the file to be parsed
  604 * @return QString the html table
  605 */
  606 QString About::parseLinksFile(const QString& fileName)
  607 {
  608     QString result;
  609     QString file;
  610     QFile linksFile(fileName);
  611     if (linksFile.open(QIODevice::ReadOnly | QIODevice::Text))
  612     {
  613         QTextStream inTS(&linksFile);
  614         inTS.setCodec("UTF-8");
  615         inTS.setAutoDetectUnicode(true);
  616         QString lineTS;
  617         bool isTitle = true;
  618         result = "<table>";
  619         while (!inTS.atEnd())
  620         {
  621             lineTS = inTS.readLine();
  622             // convert (r) "�" to &#174, "�" to &#8482
  623             // lineTS = QString::fromUtf8(lineTS);
  624             lineTS.replace("<", "&lt;");
  625             lineTS.replace(">", "&gt;");
  626             lineTS.replace("�", "&#174;");
  627             lineTS.replace("�", "&#8482;");
  628             if (!lineTS.isEmpty())
  629             {
  630                 if (isTitle)
  631                 {
  632                     isTitle = false;
  633                     result += "<tr><td><b>"+About::trLinksTitle(lineTS)+"</b></td></tr>";
  634 
  635                 } // if is title
  636                 else
  637                 {
  638                     result += "<tr><td><a href=\""+lineTS+"\">"+lineTS+"</a></td></tr>";
  639                 } // else is title
  640             } // if is empty line
  641             else
  642             {
  643                 // empty lines switch to title (one line)
  644               result += "<tr><td></td></tr>";
  645               isTitle = true;
  646             } // else is empty line
  647         } // while ! atEnd
  648         result += "<table>";
  649     } // if file found
  650     else
  651     {
  652         if (!fileName.isEmpty())
  653         {
  654             QStringList field = fileName.split("/");
  655             if (!field.isEmpty())
  656             {
  657                 file = field.takeLast();
  658             }
  659         }
  660         result = tr("Unable to open %1 file. Please check your install directory or the Scribus website for %1 information.").arg(file);
  661         result = "";
  662     } // else file found
  663     return result;
  664 } // parseLinksFile()
  665 
  666 void About::setVisible (bool visible)
  667 {
  668     QDialog::setVisible(visible);
  669     if (m_firstShow  && (m_mode == About::CheckUpdates) && visible)
  670     {
  671         m_firstShow = false;
  672         runUpdateCheck();
  673     }
  674 }
  675 
  676 void About::runUpdateCheck()
  677 {
  678     updateView->clear();
  679     UpgradeCheckerGUI uc(updateView);
  680     disconnect( checkForUpdateButton, SIGNAL( clicked() ), this, SLOT( runUpdateCheck() ) );
  681     uc.fetch();
  682     connect( checkForUpdateButton, SIGNAL( clicked() ), this, SLOT( runUpdateCheck() ) );
  683 }