1 #include "konq_aboutpage.h"
3 #include <QtCore/QTextCodec>
4 #include <QApplication>
7 #include <kaboutdata.h>
9 #include <kactioncollection.h>
11 #include <kiconloader.h>
13 #include <kmessagebox.h>
14 #include <kpluginfactory.h>
15 #include <ksavefile.h>
16 #include <kstandarddirs.h>
17 #include <ktoolinvocation.h>
19 K_PLUGIN_FACTORY(KonqAboutPageFactory
, registerPlugin
<KonqAboutPage
>();)
20 K_EXPORT_PLUGIN(KonqAboutPageFactory("konqaboutpage"))
22 K_GLOBAL_STATIC(KonqAboutPageSingleton
, s_staticData
)
24 KonqAboutPageSingleton::KonqAboutPageSingleton()
28 KonqAboutPageSingleton::~KonqAboutPageSingleton()
32 QString
KonqAboutPageSingleton::loadFile( const QString
& file
)
40 if ( !f
.open( QIODevice::ReadOnly
) )
47 // otherwise all embedded objects are referenced as about:/...
48 QString basehref
= QLatin1String("<BASE HREF=\"file:") +
49 file
.left( file
.lastIndexOf( '/' )) +
50 QLatin1String("/\">\n");
51 res
.replace("<head>", "<head>\n\t" + basehref
, Qt::CaseInsensitive
);
55 QString
KonqAboutPageSingleton::launch()
57 if (!m_launch_html
.isEmpty())
60 QString res
= loadFile( KStandardDirs::locate( "data", "konqueror/about/launch.html" ));
64 KIconLoader
*iconloader
= KIconLoader::global();
65 int iconSize
= iconloader
->currentSize(KIconLoader::Desktop
);
66 QString home_icon_path
= iconloader
->iconPath("go-home", KIconLoader::Desktop
);
67 QString remote_icon_path
= iconloader
->iconPath("folder-remote", KIconLoader::Desktop
);
68 QString wastebin_icon_path
= iconloader
->iconPath("user-trash-full", KIconLoader::Desktop
);
69 QString bookmarks_icon_path
= iconloader
->iconPath("bookmarks", KIconLoader::Desktop
);
70 QString home_folder
= QDir::homePath();
71 QString continue_icon_path
= iconloader
->iconPath(QApplication::isRightToLeft() ? "go-previous" : "go-next", KIconLoader::Small
);
73 res
= res
.arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage.css" ) );
74 if ( qApp
->layoutDirection() == Qt::RightToLeft
)
75 res
= res
.arg( "@import \"%1\";" ).arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage_rtl.css" ) );
79 res
= res
.arg( i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.") )
80 .arg( i18n( "Konqueror" ) )
81 .arg( i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.") )
82 .arg( i18n("Konqueror is a web browser, file manager and universal document viewer.") )
83 .arg( i18nc( "Link that points to the first page of the Konqueror 'about page', Starting Points contains links to Home, Network Folders, Trash, etc.", "Starting Points" ) )
84 .arg( i18n( "Introduction" ) )
85 .arg( i18n( "Tips" ) )
86 .arg( i18n( "Specifications" ) )
88 .arg( home_icon_path
)
89 .arg(iconSize
).arg(iconSize
)
91 .arg( i18n( "Home Folder" ) )
92 .arg( i18n( "Your personal files" ) )
93 .arg( wastebin_icon_path
)
94 .arg(iconSize
).arg(iconSize
)
95 .arg( i18n( "Trash" ) )
96 .arg( i18n( "Browse and restore the trash" ) )
97 .arg( remote_icon_path
)
98 .arg(iconSize
).arg(iconSize
)
99 .arg( i18n( "Network Folders" ) )
100 .arg( i18n( "Shared files and folders" ) )
101 .arg( bookmarks_icon_path
)
102 .arg(iconSize
).arg(iconSize
)
103 .arg( i18n( "My Bookmarks" ) )
104 .arg( i18n( "Quick access to your bookmarks" ) )
105 .arg( continue_icon_path
)
106 .arg( KIconLoader::SizeSmall
).arg( KIconLoader::SizeSmall
)
107 .arg( i18n( "Next: An Introduction to Konqueror" ) )
109 i18n("Search the Web");//i18n for possible future use
115 QString
KonqAboutPageSingleton::intro()
117 if (!m_intro_html
.isEmpty())
120 QString res
= loadFile( KStandardDirs::locate( "data", "konqueror/about/intro.html" ));
124 KIconLoader
*iconloader
= KIconLoader::global();
125 QString back_icon_path
= iconloader
->iconPath(QApplication::isRightToLeft() ? "go-next" : "go-previous", KIconLoader::Small
);
126 QString gohome_icon_path
= iconloader
->iconPath("go-home", KIconLoader::Small
);
127 QString continue_icon_path
= iconloader
->iconPath(QApplication::isRightToLeft() ? "go-previous" : "go-next", KIconLoader::Small
);
129 res
= res
.arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage.css" ) );
130 if ( qApp
->layoutDirection() == Qt::RightToLeft
)
131 res
= res
.arg( "@import \"%1\";" ).arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage_rtl.css" ) );
135 res
= res
.arg( i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.") )
136 .arg( i18n( "Konqueror" ) )
137 .arg( i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.") )
138 .arg( i18n( "Konqueror is a web browser, file manager and universal document viewer.") )
139 .arg( i18nc( "Link that points to the first page of the Konqueror 'about page', Starting Points contains links to Home, Network Folders, Trash, etc.", "Starting Points" ) )
140 .arg( i18n( "Introduction" ) )
141 .arg( i18n( "Tips" ) )
142 .arg( i18n( "Specifications" ) )
143 .arg( i18n( "Konqueror makes working with and managing your files easy. You can browse "
144 "both local and networked folders while enjoying advanced features "
145 "such as the powerful sidebar and file previews."
147 .arg( i18n( "Konqueror is also a full featured and easy to use web browser which you "
148 "can use to explore the Internet. "
149 "Enter the address (e.g. <a href=\"http://www.kde.org\">http://www.kde.org</a>) "
150 "of a web page you would like to visit in the location bar and press Enter, "
151 "or choose an entry from the Bookmarks menu.") )
152 .arg( i18n( "To return to the previous "
153 "location, press the back button <img width='16' height='16' src=\"%1\"></img> "
154 "in the toolbar. ", back_icon_path
) )
155 .arg( i18n( "To quickly go to your Home folder press the "
156 " home button <img width='16' height='16' src=\"%1\"></img>." , gohome_icon_path
) )
157 .arg( i18n( "For more detailed documentation on Konqueror click <a href=\"%1\">here</a>." ,
158 QString("exec:/khelpcenter")) )
159 .arg( i18n( "<em>Tuning Tip:</em> If you want the Konqueror web browser to start faster,"
160 " you can turn off this information screen by clicking <a href=\"%1\">here</a>. You can re-enable it"
161 " by choosing the Help -> Konqueror Introduction menu option, and then pressing "
162 "Settings -> Save View Profile \"Web Browsing\".", QString("config:/disable_overview")) )
163 .arg( "<img width='16' height='16' src=\"%1\">" ).arg( continue_icon_path
)
164 .arg( i18n( "Next: Tips & Tricks" ) )
172 QString
KonqAboutPageSingleton::specs()
174 if (!m_specs_html
.isEmpty())
177 KIconLoader
*iconloader
= KIconLoader::global();
178 QString res
= loadFile( KStandardDirs::locate( "data", "konqueror/about/specs.html" ));
179 QString continue_icon_path
= iconloader
->iconPath(QApplication::isRightToLeft() ? "go-previous" : "go-next", KIconLoader::Small
);
183 res
= res
.arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage.css" ) );
184 if ( qApp
->layoutDirection() == Qt::RightToLeft
)
185 res
= res
.arg( "@import \"%1\";" ).arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage_rtl.css" ) );
189 res
= res
.arg( i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.") )
190 .arg( i18n( "Konqueror" ) )
191 .arg( i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.") )
192 .arg( i18n("Konqueror is a web browser, file manager and universal document viewer.") )
193 .arg( i18nc( "Link that points to the first page of the Konqueror 'about page', Starting Points contains links to Home, Network Folders, Trash, etc.", "Starting Points" ) )
194 .arg( i18n( "Introduction" ) )
195 .arg( i18n( "Tips" ) )
196 .arg( i18n( "Specifications" ) )
197 .arg( i18n("Specifications") )
198 .arg( i18n("Konqueror is designed to embrace and support Internet standards. "
199 "The aim is to fully implement the officially sanctioned standards "
200 "from organizations such as the W3 and OASIS, while also adding "
201 "extra support for other common usability features that arise as "
202 "de facto standards across the Internet. Along with this support, "
203 "for such functions as favicons, Internet Keywords, and <A HREF=\"%1\">XBEL bookmarks</A>, "
204 "Konqueror also implements:", QString("http://pyxml.sourceforge.net/topics/xbel/")) )
205 .arg( i18n("Web Browsing") )
206 .arg( i18n("Supported standards") )
207 .arg( i18n("Additional requirements*") )
208 .arg( i18n("<A HREF=\"%1\">DOM</A> (Level 1, partially Level 2) based "
209 "<A HREF=\"%2\">HTML 4.01</A>", QString("http://www.w3.org/DOM"), QString("http://www.w3.org/TR/html4/")) )
210 .arg( i18n("built-in") )
211 .arg( i18n("<A HREF=\"%1\">Cascading Style Sheets</A> (CSS 1, partially CSS 2)", QString("http://www.w3.org/Style/CSS/")) )
212 .arg( i18n("built-in") )
213 .arg( i18n("<A HREF=\"%1\">ECMA-262</A> Edition 3 (roughly equals JavaScript 1.5)", QString("http://www.ecma.ch/ecma1/STAND/ECMA-262.HTM")) )
214 .arg( i18n("JavaScript disabled (globally). Enable JavaScript <A HREF=\"%1\">here</A>.", QString("exec:/kcmshell4 khtml_java_js")) )
215 .arg( i18n("JavaScript enabled (globally). Configure JavaScript <A HREF=\\\"%1\\\">here</A>.", QString("exec:/kcmshell4 khtml_java_js")) ) // leave the double backslashes here, they are necessary for javascript !
216 .arg( i18n("Secure <A HREF=\"%1\">Java</A><SUP>®</SUP> support", QString("http://java.sun.com")) )
217 .arg( i18n("JDK 1.2.0 (Java 2) compatible VM (<A HREF=\"%1\">Blackdown</A>, <A HREF=\"%2\">IBM</A> or <A HREF=\"%3\">Sun</A>)",
218 QString("http://www.blackdown.org"), QString("http://www.ibm.com"), QString("http://java.sun.com")) )
219 .arg( i18n("Enable Java (globally) <A HREF=\"%1\">here</A>.", QString("exec:/kcmshell4 khtml_java_js")) ) // TODO Maybe test if Java is enabled ?
220 .arg( i18n("Netscape Communicator<SUP>®</SUP> <A HREF=\"%4\">plugins</A> (for viewing <A HREF=\"%1\">Flash<SUP>®</SUP></A>, <A HREF=\"%2\">Real<SUP>®</SUP></A>Audio, <A HREF=\"%3\">Real<SUP>®</SUP></A>Video, etc.)",
221 QString("http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"),
222 QString("http://www.real.com"), QString("http://www.real.com"),
223 QString("about:plugins")) )
224 .arg( i18n("built-in") )
225 .arg( i18n("Secure Sockets Layer") )
226 .arg( i18n("(TLS/SSL v2/3) for secure communications up to 168bit") )
227 .arg( i18n("OpenSSL") )
228 .arg( i18n("Bidirectional 16bit unicode support") )
229 .arg( i18n("built-in") )
230 .arg( i18n("AutoCompletion for forms") )
231 .arg( i18n("built-in") )
232 .arg( i18nc("Title of an html 'group box' explaining konqueror features", "General") )
233 .arg( i18n("Feature") )
234 .arg( i18n("Details") )
235 .arg( i18n("Image formats") )
236 .arg( i18n("PNG<br />MNG<br />JPG<br />GIF") )
237 .arg( i18n("Transfer protocols") )
238 .arg( i18n("HTTP 1.1 (including gzip/bzip2 compression)") )
240 .arg( i18n("and <A HREF=\"%1\">many more...</A>", QString("exec:/kcmshell4 ioslaveinfo")) )
241 .arg( i18nc("A feature of Konqueror", "URL-Completion") )
242 .arg( i18n("Manual"))
244 .arg( i18n("(Short-) Automatic"))
245 .arg( "<img width='16' height='16' src=\"%1\">" ).arg( continue_icon_path
)
246 .arg( i18nc("Link that points to the first page of the Konqueror 'about page', Starting Points contains links to Home, Network Folders, Trash, etc.", "<a href=\"%1\">Return to Starting Points</a>", QString("about:konqueror")) )
254 QString
KonqAboutPageSingleton::tips()
256 if (!m_tips_html
.isEmpty())
259 QString res
= loadFile( KStandardDirs::locate( "data", "konqueror/about/tips.html" ));
263 KIconLoader
*iconloader
= KIconLoader::global();
264 QString viewmag_icon_path
=
265 iconloader
->iconPath("zoom-in", KIconLoader::Small
);
266 QString history_icon_path
=
267 iconloader
->iconPath("view-history", KIconLoader::Small
);
268 QString openterm_icon_path
=
269 iconloader
->iconPath("utilities-terminal", KIconLoader::Small
);
270 QString locationbar_erase_rtl_icon_path
=
271 iconloader
->iconPath("edit-clear-locationbar-rtl", KIconLoader::Small
);
272 QString locationbar_erase_icon_path
=
273 iconloader
->iconPath("edit-clear-locationbar-ltr", KIconLoader::Small
);
274 QString window_fullscreen_icon_path
=
275 iconloader
->iconPath("view-fullscreen", KIconLoader::Small
);
276 QString view_left_right_icon_path
=
277 iconloader
->iconPath("view-split-left-right", KIconLoader::Small
);
278 QString continue_icon_path
= iconloader
->iconPath(QApplication::isRightToLeft() ? "go-previous" : "go-next", KIconLoader::Small
);
280 res
= res
.arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage.css" ) );
281 if ( qApp
->layoutDirection() == Qt::RightToLeft
)
282 res
= res
.arg( "@import \"%1\";" ).arg( KStandardDirs::locate( "data", "kdeui/about/kde_infopage_rtl.css" ) );
286 res
= res
.arg( i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.") )
287 .arg( i18n( "Konqueror" ) )
288 .arg( i18nc("KDE 4 tag line, see http://kde.org/img/kde40.png", "Be free.") )
289 .arg( i18n("Konqueror is a web browser, file manager and universal document viewer.") )
290 .arg( i18nc( "Link that points to the first page of the Konqueror 'about page', Starting Points contains links to Home, Network Folders, Trash, etc.", "Starting Points" ) )
291 .arg( i18n( "Introduction" ) )
292 .arg( i18n( "Tips" ) )
293 .arg( i18n( "Specifications" ) )
294 .arg( i18n( "Tips & Tricks" ) )
295 .arg( i18n( "Use Internet-Keywords and Web-Shortcuts: by typing \"gg: KDE\" one can search the Internet, "
296 "using Google, for the search phrase \"KDE\". There are a lot of "
297 "Web-Shortcuts predefined to make searching for software or looking "
298 "up certain words in an encyclopedia a breeze. You can even "
299 "<a href=\"%1\">create your own</a> Web-Shortcuts." , QString("exec:/kcmshell4 ebrowsing")) )
300 .arg( i18n( "Use the magnifier button <img width='16' height='16' src=\"%1\"></img> in the"
301 " toolbar to increase the font size on your web page.", viewmag_icon_path
) )
302 .arg( i18n( "When you want to paste a new address into the Location toolbar you might want to "
303 "clear the current entry by pressing the black arrow with the white cross "
304 "<img width='16' height='16' src=\"%1\"></img> in the toolbar.",
305 QApplication::isRightToLeft() ? locationbar_erase_rtl_icon_path
: locationbar_erase_icon_path
))
306 .arg( i18n( "To create a link on your desktop pointing to the current page, "
307 "simply drag the \"Location\" label that is to the left of the Location toolbar, drop it on to "
308 "the desktop, and choose \"Link\"." ) )
309 .arg( i18n( "You can also find <img width='16' height='16' src=\"%1\" /> \"Full-Screen Mode\" "
310 "in the Settings menu. This feature is very useful for \"Talk\" "
311 "sessions.", window_fullscreen_icon_path
) )
312 .arg( i18n( "Divide et impera (lat. \"Divide and conquer\") - by splitting a window "
313 "into two parts (e.g. Window -> <img width='16' height='16' src=\"%1\" /> Split View "
314 "Left/Right) you can make Konqueror appear the way you like. You"
315 " can even load some example view-profiles (e.g. Midnight Commander)"
316 ", or create your own ones." , view_left_right_icon_path
))
317 .arg( i18n( "Use the <a href=\"%1\">user-agent</a> feature if the website you are visiting "
318 "asks you to use a different browser "
319 "(and do not forget to send a complaint to the webmaster!)" , QString("exec:/kcmshell4 useragent")) )
320 .arg( i18n( "The <img width='16' height='16' src=\"%1\"></img> History in your SideBar ensures "
321 "that you can keep track of the pages you have visited recently.", history_icon_path
) )
322 .arg( i18n( "Use a caching <a href=\"%1\">proxy</a> to speed up your"
323 " Internet connection.", QString("exec:/kcmshell4 proxy")) )
324 .arg( i18n( "Advanced users will appreciate the Konsole which you can embed into "
325 "Konqueror (Window -> <img width='16' height='16' SRC=\"%1\"></img> Show "
326 "Terminal Emulator).", openterm_icon_path
))
327 .arg( "<img width='16' height='16' src=\"%1\">" ).arg( continue_icon_path
)
328 .arg( i18n( "Next: Specifications" ) )
337 QString
KonqAboutPageSingleton::plugins()
339 if (!m_plugins_html
.isEmpty())
340 return m_plugins_html
;
342 QString res
= loadFile( KStandardDirs::locate( "data", qApp
->layoutDirection() == Qt::RightToLeft
? "konqueror/about/plugins_rtl.html" : "konqueror/about/plugins.html" ))
343 .arg(i18n("Installed Plugins"))
344 .arg(i18n("<td>Plugin</td><td>Description</td><td>File</td><td>Types</td>"))
345 .arg(i18n("Installed"))
346 .arg(i18n("<td>Mime Type</td><td>Description</td><td>Suffixes</td><td>Plugin</td>"));
350 m_plugins_html
= res
;
355 KonqAboutPage::KonqAboutPage(QWidget
*parentWidget
, QObject
*parent
, const QVariantList
& args
)
356 : KHTMLPart( parentWidget
, parent
, BrowserViewGUI
)
359 QTextCodec
* codec
= KGlobal::locale()->codecForEncoding();
361 setEncoding(codec
->name(), true);
363 setEncoding("iso-8859-1", true);
365 // about:blah isn't a kioslave -> disable View source
366 QAction
* act
= actionCollection()->action("viewDocumentSource");
368 act
->setEnabled( false );
372 KonqAboutPage::~KonqAboutPage()
376 bool KonqAboutPage::openUrl(const KUrl
&u
)
379 if (u
.url() == "about:plugins")
380 serve(s_staticData
->plugins(), "plugins");
381 else if (u
.url() == "about:konqueror/intro")
382 serve(s_staticData
->intro(), "konqueror/intro");
383 else if (u
.url() == "about:konqueror/specs")
384 serve(s_staticData
->specs(), "konqueror/specs");
385 else if (u
.url() == "about:konqueror/tips")
386 serve(s_staticData
->tips(), "konqueror/tips");
388 serve(s_staticData
->launch(), "konqueror");
393 bool KonqAboutPage::openFile()
398 void KonqAboutPage::saveState( QDataStream
&stream
)
404 void KonqAboutPage::restoreState( QDataStream
&stream
)
408 serve( m_htmlDoc
, m_what
);
411 void KonqAboutPage::serve( const QString
& html
, const QString
& what
)
414 begin( KUrl( QString("about:%1").arg(what
) ) );
420 bool KonqAboutPage::urlSelected( const QString
&url
, int button
, int state
, const QString
&target
,
421 const KParts::OpenUrlArguments
& args
,
422 const KParts::BrowserArguments
& browserArgs
)
425 if ( u
.protocol() == "exec" )
427 QStringList execArgs
= url
.mid( 6 ).split(QChar( ' ' ), QString::SkipEmptyParts
);
428 QString executable
= execArgs
.first();
429 execArgs
.erase( execArgs
.begin() );
430 KToolInvocation::kdeinitExec( executable
, execArgs
);
434 if ( url
== QLatin1String("about:konqueror") )
436 emit
browserExtension()->openUrlNotify();
437 serve(s_staticData
->launch(), "konqueror");
440 else if ( url
== QLatin1String("about:konqueror/intro") )
442 emit
browserExtension()->openUrlNotify();
443 serve(s_staticData
->intro(), "konqueror/intro");
446 else if ( url
== QLatin1String("about:konqueror/specs") )
448 emit
browserExtension()->openUrlNotify();
449 serve(s_staticData
->specs(), "konqueror/specs");
452 else if ( url
== QLatin1String("about:konqueror/tips") )
454 emit
browserExtension()->openUrlNotify();
455 serve(s_staticData
->tips(), "konqueror/tips");
459 else if ( url
== QLatin1String("config:/disable_overview") )
461 if ( KMessageBox::questionYesNo( widget(),
462 i18n("Do you want to disable showing "
463 "the introduction in the webbrowsing profile?"),
464 i18n("Faster Startup?"),KGuiItem(i18n("Disable")),KGuiItem(i18n("Keep")) )
465 == KMessageBox::Yes
)
467 QString profile
= KStandardDirs::locateLocal("data", "konqueror/profiles/webbrowsing");
468 KSaveFile
file( profile
);
470 QTextStream
stream(&file
);
471 stream
<< "[Profile]\n"
478 return KHTMLPart::urlSelected( url
, button
, state
, target
, args
, browserArgs
);
481 #include "konq_aboutpage.moc"