TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
4.9KB

  1. /*
  2. This file is part of KitchenSync.
  3. Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  15. */
  16. #include <tqfile.h>
  17. #include <tqlayout.h>
  18. #include <kaboutdata.h>
  19. #include <kapplication.h>
  20. #include <kdebug.h>
  21. #include <khtml_part.h>
  22. #include <khtmlview.h>
  23. #include <kiconloader.h>
  24. #include <klocale.h>
  25. #include <krun.h>
  26. #include <kstandarddirs.h>
  27. #include "aboutpage.h"
  28. static TQString readFile( const TQString &fileName )
  29. {
  30. TQFile file( fileName );
  31. if ( !file.open( IO_ReadOnly ) ) {
  32. kdDebug() << "Unable to open file '" << fileName << "'" << endl;
  33. return TQCString();
  34. }
  35. TQString content = TQString::fromUtf8( file.readAll() );
  36. file.close();
  37. return content;
  38. }
  39. AboutPage::AboutPage( TQWidget *parent )
  40. : TQWidget( parent, "AboutPage" )
  41. {
  42. TQVBoxLayout *tqlayout = new TQVBoxLayout( this );
  43. TQString location = locate( "data", "kitchensync/about/main.html" );
  44. TQString content = readFile( location );
  45. content = content.tqarg( locate( "data", "libtdepim/about/kde_infopage.css" ) );
  46. if ( kapp->reverseLayout() )
  47. content = content.tqarg( "@import \"%1\";" ).tqarg( locate( "data", "libtdepim/about/kde_infopage_rtl.css" ) );
  48. else
  49. content = content.tqarg( "" );
  50. KHTMLPart *part = new KHTMLPart( this );
  51. tqlayout->addWidget( part->view() );
  52. part->begin( KURL( location ) );
  53. TQString appName( i18n( "KDE KitchenSync" ) );
  54. TQString catchPhrase( i18n( "Get Synchronized!" ) );
  55. TQString quickDescription( i18n( "The KDE Synchronization Tool" ) );
  56. part->write( content.tqarg( TQFont().pointSize() + 2 ).tqarg( appName )
  57. .tqarg( catchPhrase ).tqarg( quickDescription ).tqarg( htmlText() ) );
  58. part->end();
  59. connect( part->browserExtension(),
  60. TQT_SIGNAL( openURLRequest( const KURL&, const KParts::URLArgs& ) ),
  61. TQT_SLOT( handleUrl( const KURL& ) ) );
  62. connect( part->browserExtension(),
  63. TQT_SIGNAL( createNewWindow( const KURL&, const KParts::URLArgs& ) ),
  64. TQT_SLOT( handleUrl( const KURL& ) ) );
  65. }
  66. void AboutPage::handleUrl( const KURL &url )
  67. {
  68. if ( url.protocol() == "exec" ) {
  69. if ( url.path() == "/addGroup" )
  70. emit addGroup();
  71. } else
  72. new KRun( url, this );
  73. }
  74. TQString AboutPage::htmlText() const
  75. {
  76. KIconLoader *iconloader = KGlobal::iconLoader();
  77. int iconSize = iconloader->currentSize( KIcon::Desktop );
  78. TQString handbook_icon_path = iconloader->iconPath( "contents2", KIcon::Desktop );
  79. TQString html_icon_path = iconloader->iconPath( "html", KIcon::Desktop );
  80. TQString wizard_icon_path = iconloader->iconPath( "wizard", KIcon::Desktop );
  81. TQString info = i18n( "<h2 style='text-align:center; margin-top: 0px;'>Welcome to KitchenSync %1</h2>"
  82. "<p>%1</p>"
  83. "<table align=\"center\">"
  84. "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>"
  85. "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>"
  86. "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>"
  87. "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>"
  88. "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>"
  89. "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>"
  90. "</table>" )
  91. .tqarg( kapp->aboutData()->version() )
  92. .tqarg( i18n( "KitchenSync synchronizes your e-mail, addressbook, calendar, to-do list and more." ) )
  93. .tqarg( "help:/kitchensync" )
  94. .tqarg( iconSize )
  95. .tqarg( iconSize )
  96. .tqarg( handbook_icon_path )
  97. .tqarg( "help:/kitchensync" )
  98. .tqarg( i18n( "Read Manual" ) )
  99. .tqarg( i18n( "Learn more about KitchenSync and its components" ) )
  100. .tqarg( "http://pim.kde.org" )
  101. .tqarg( iconSize )
  102. .tqarg( iconSize )
  103. .tqarg( html_icon_path )
  104. .tqarg( "http://pim.kde.org" )
  105. .tqarg( i18n( "Visit KitchenSync Website" ) )
  106. .tqarg( i18n( "Access online resources and tutorials" ) )
  107. .tqarg( "exec:/addGroup" )
  108. .tqarg( iconSize )
  109. .tqarg( iconSize )
  110. .tqarg( wizard_icon_path )
  111. .tqarg( "exec:/addGroup" )
  112. .tqarg( i18n( "Add Synchronization Group" ) )
  113. .tqarg( i18n( "Create group of tqdevices for synchronization" ) );
  114. return info;
  115. }
  116. #include "aboutpage.moc"