kitchensync
aboutpage.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <tqfile.h>
00022 #include <tqlayout.h>
00023
00024 #include <tdeaboutdata.h>
00025 #include <tdeapplication.h>
00026 #include <kdebug.h>
00027 #include <tdehtml_part.h>
00028 #include <tdehtmlview.h>
00029 #include <kiconloader.h>
00030 #include <tdelocale.h>
00031 #include <krun.h>
00032 #include <kstandarddirs.h>
00033
00034 #include "aboutpage.h"
00035
00036 static TQString readFile( const TQString &fileName )
00037 {
00038 TQFile file( fileName );
00039 if ( !file.open( IO_ReadOnly ) ) {
00040 kdDebug() << "Unable to open file '" << fileName << "'" << endl;
00041 return TQCString();
00042 }
00043
00044 TQString content = TQString::fromUtf8( file.readAll() );
00045
00046 file.close();
00047
00048 return content;
00049 }
00050
00051 AboutPage::AboutPage( TQWidget *parent )
00052 : TQWidget( parent, "AboutPage" )
00053 {
00054 TQVBoxLayout *layout = new TQVBoxLayout( this );
00055
00056 TQString location = locate( "data", "kitchensync/about/main.html" );
00057 TQString content = readFile( location );
00058 content = content.arg( locate( "data", "libtdepim/about/kde_infopage.css" ) );
00059 if ( kapp->reverseLayout() )
00060 content = content.arg( "@import \"%1\";" ).arg( locate( "data", "libtdepim/about/kde_infopage_rtl.css" ) );
00061 else
00062 content = content.arg( "" );
00063
00064 TDEHTMLPart *part = new TDEHTMLPart( this );
00065 layout->addWidget( part->view() );
00066
00067 part->begin( KURL( location ) );
00068
00069 TQString appName( i18n( "TDE KitchenSync" ) );
00070 TQString catchPhrase( i18n( "Get Synchronized!" ) );
00071 TQString quickDescription( i18n( "The TDE Synchronization Tool" ) );
00072
00073 part->write( content.arg( TQFont().pointSize() + 2 ).arg( appName )
00074 .arg( catchPhrase ).arg( quickDescription ).arg( htmlText() ) );
00075 part->end();
00076
00077 connect( part->browserExtension(),
00078 TQT_SIGNAL( openURLRequest( const KURL&, const KParts::URLArgs& ) ),
00079 TQT_SLOT( handleUrl( const KURL& ) ) );
00080
00081 connect( part->browserExtension(),
00082 TQT_SIGNAL( createNewWindow( const KURL&, const KParts::URLArgs& ) ),
00083 TQT_SLOT( handleUrl( const KURL& ) ) );
00084 }
00085
00086 void AboutPage::handleUrl( const KURL &url )
00087 {
00088 if ( url.protocol() == "exec" ) {
00089 if ( url.path() == "/addGroup" )
00090 emit addGroup();
00091 } else
00092 new KRun( url, this );
00093 }
00094
00095 TQString AboutPage::htmlText() const
00096 {
00097 TDEIconLoader *iconloader = TDEGlobal::iconLoader();
00098 int iconSize = iconloader->currentSize( TDEIcon::Desktop );
00099
00100 TQString handbook_icon_path = iconloader->iconPath( "contents2", TDEIcon::Desktop );
00101 TQString html_icon_path = iconloader->iconPath( "text-html", TDEIcon::Desktop );
00102 TQString wizard_icon_path = iconloader->iconPath( "wizard", TDEIcon::Desktop );
00103
00104 TQString info = i18n( "<h2 style='text-align:center; margin-top: 0px;'>Welcome to KitchenSync %1</h2>"
00105 "<p>%1</p>"
00106 "<table align=\"center\">"
00107 "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>"
00108 "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>"
00109 "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>"
00110 "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>"
00111 "<tr><td><a href=\"%1\"><img width=\"%1\" height=\"%1\" src=\"%1\" /></a></td>"
00112 "<td><a href=\"%1\">%1</a><br><span id=\"subtext\"><nobr>%1</td></tr>"
00113 "</table>" )
00114 .arg( kapp->aboutData()->version() )
00115 .arg( i18n( "KitchenSync synchronizes your e-mail, addressbook, calendar, to-do list and more." ) )
00116 .arg( "help:/kitchensync" )
00117 .arg( iconSize )
00118 .arg( iconSize )
00119 .arg( handbook_icon_path )
00120 .arg( "help:/kitchensync" )
00121 .arg( i18n( "Read Manual" ) )
00122 .arg( i18n( "Learn more about KitchenSync and its components" ) )
00123 .arg( "http://pim.kde.org" )
00124 .arg( iconSize )
00125 .arg( iconSize )
00126 .arg( html_icon_path )
00127 .arg( "http://pim.kde.org" )
00128 .arg( i18n( "Visit KitchenSync Website" ) )
00129 .arg( i18n( "Access online resources and tutorials" ) )
00130 .arg( "exec:/addGroup" )
00131 .arg( iconSize )
00132 .arg( iconSize )
00133 .arg( wizard_icon_path )
00134 .arg( "exec:/addGroup" )
00135 .arg( i18n( "Add Synchronization Group" ) )
00136 .arg( i18n( "Create group of devices for synchronization" ) );
00137
00138 return info;
00139 }
00140
00141 #include "aboutpage.moc"
|