1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : a widget to display a welcome page
10
* Copyright (C) 2006-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
12
* This program is free software; you can redistribute it
13
* and/or modify it under the terms of the GNU General
14
* Public License as published by the Free Software Foundation;
15
* either version 2, or (at your option)
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* ============================================================ */
29
#include <qfileinfo.h>
35
#include <khtml_part.h>
36
#include <khtmlview.h>
37
#include <kapplication.h>
39
#include <kstandarddirs.h>
44
#include "welcomepageview.h"
45
#include "welcomepageview.moc"
50
WelcomePageView::WelcomePageView(QWidget* parent)
53
widget()->setFocusPolicy(QWidget::WheelFocus);
54
// Let's better be paranoid and disable plugins (it defaults to enabled):
55
setPluginsEnabled(false);
56
setJScriptEnabled(false); // just make this explicit.
57
setJavaEnabled(false); // just make this explicit.
58
setMetaRefreshEnabled(false);
59
setURLCursor(KCursor::handCursor());
61
QString fontSize = QString::number(12);
62
QString appTitle = i18n("digiKam");
63
QString catchPhrase = QString(); // Not enough space for a catch phrase at default window size.
64
QString quickDescription = i18n("A Photo Management Application for KDE");
65
QString locationHtml = locate("data", "digikam/about/main.html");
66
QString locationCss = locate("data", "digikam/about/kde_infopage.css");
67
QString locationRtl = locate("data", "digikam/about/kde_infopage_rtl.css" );
68
QString rtl = kapp->reverseLayout() ? QString("@import \"%1\";" ).arg(locationRtl)
71
begin(KURL(locationHtml));
73
QString content = fileToString(locationHtml);
74
content = content.arg(locationCss) // %1
78
.arg(catchPhrase) // %5
79
.arg(quickDescription) // %6
80
.arg(infoPage()); // %7
86
connect(browserExtension(), SIGNAL(openURLRequest(const KURL &, const KParts::URLArgs &)),
87
this, SLOT(slotUrlOpen(const KURL &)));
90
WelcomePageView::~WelcomePageView()
94
void WelcomePageView::slotUrlOpen(const KURL &url)
96
KApplication::kApplication()->invokeBrowser(url.url());
99
QString WelcomePageView::infoPage()
103
"%1: digiKam version; "
106
"%4: prior digiKam version; "
107
"%5: prior KDE version; "
108
"%6: generated list of new features; "
109
"%7: First-time user text (only shown on first start); "
110
"%8: generated list of important changes; "
111
"--- end of comment ---",
112
"<h2 style='margin-top: 0px;'>Welcome to digiKam %1</h2><p>"
113
"digiKam is a photo management program for the K Desktop Environment. "
114
"It is designed to import, organize, and export your digital photographs on your computer."
115
"</p><p>You are currently in the Album view mode of digiKam. The Albums are the real "
116
"containers where your files are stored, they are identical with the folders "
117
"on disk.</p>\n<ul><li>"
118
"digiKam has many powerful features which are described in the "
119
"<a href=\"%2\">documentation</a></li>\n"
120
"<li>The <a href=\"%3\">digiKam homepage</A> provides information about "
121
"new versions of digiKam</li></ul>\n"
122
"%8\n<p>" // important changes
123
"Some of the new features in this release of digiKam include "
124
"(compared to digiKam %4):</p>\n"
127
"<p>We hope that you will enjoy digiKam.</p>\n"
128
"<p>Thank you,</p>\n"
129
"<p style='margin-bottom: 0px'> The digiKam Team</p>")
130
.arg(digikam_version) // current digiKam version
131
.arg("help:/digikam/index.html") // digiKam help:// URL
132
.arg("http://www.digikam.org") // digiKam homepage URL
133
.arg("0.8.2"); // previous digiKam release.
135
QStringList newFeatures;
136
newFeatures << i18n("16-bit/color/pixel image support");
137
newFeatures << i18n("Full color management support");
138
newFeatures << i18n("Native JPEG-2000 support");
139
newFeatures << i18n("Makernote and IPTC metadata support");
140
newFeatures << i18n("Photograph geolocation");
141
newFeatures << i18n("Extensive Sidebars");
142
newFeatures << i18n("Advanced RAW image decoding settings");
143
newFeatures << i18n("Fast RAW preview");
144
newFeatures << i18n("RAW Metadata support");
145
newFeatures << i18n("New advanced camera download options");
146
newFeatures << i18n("New advanced tag management");
147
newFeatures << i18n("New zooming/panning support in preview mode");
148
newFeatures << i18n("New Light Table provides easy comparison for similar images");
149
newFeatures << i18n("Camera Interface used as generic import tool");
150
newFeatures << i18n("New text, mime-type, and rating filters to search contents on icon view");
151
newFeatures << i18n("New options to easy navigate between albums, tags and collections");
152
newFeatures << i18n("New options to recursively show the contents of sub-folders");
153
newFeatures << i18n("New text filter to search contents on folder views");
154
newFeatures << i18n("New options to count of items on all folder views");
155
newFeatures << i18n("New tool to perform dates search around whole albums collection: Time-Line");
157
QString featureItems;
158
for ( uint i = 0 ; i < newFeatures.count() ; i++ )
159
featureItems += i18n("<li>%1</li>\n").arg( newFeatures[i] );
161
info = info.arg( featureItems );
163
// Add first-time user text (only shown on first start).
164
info = info.arg( QString() );
166
// Generated list of important changes
167
info = info.arg( QString() );
172
QCString WelcomePageView::fileToString(const QString &aFileName)
175
QFileInfo info(aFileName);
176
unsigned int readLen;
177
unsigned int len = info.size();
178
QFile file(aFileName);
180
if (aFileName.isEmpty() || len <= 0 ||
181
!info.exists() || info.isDir() || !info.isReadable() ||
182
!file.open(IO_Raw|IO_ReadOnly))
185
result.resize(len + 2);
186
readLen = file.readBlock(result.data(), len);
187
if (1 && result[len-1]!='\n')
189
result[len++] = '\n';
200
} // namespace Digikam