Changeset View
Changeset View
Standalone View
Standalone View
mainwindow.cpp
Show All 18 Lines | |||||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #include "mainwindow.h" | 22 | #include "mainwindow.h" | ||
23 | 23 | | |||
24 | #include "history.h" | 24 | #include "history.h" | ||
25 | #include "view.h" | 25 | #include "view.h" | ||
26 | #include "searchengine.h" | 26 | #include "searchengine.h" | ||
27 | #include "fontdialog.h" | | |||
28 | #include "khc_debug.h" | 27 | #include "khc_debug.h" | ||
29 | #include "navigator.h" | 28 | #include "navigator.h" | ||
30 | #include "grantleeformatter.h" | 29 | #include "grantleeformatter.h" | ||
31 | #include "bookmarkowner.h" | 30 | #include "bookmarkowner.h" | ||
32 | 31 | | |||
33 | #include <QAction> | 32 | #include <QAction> | ||
34 | #include <QDBusConnection> | 33 | #include <QDBusConnection> | ||
35 | #include <QDialog> | 34 | #include <QDialog> | ||
Show All 10 Lines | |||||
46 | #include <QVBoxLayout> | 45 | #include <QVBoxLayout> | ||
47 | 46 | | |||
48 | #include <KActionCollection> | 47 | #include <KActionCollection> | ||
49 | #include <KActionMenu> | 48 | #include <KActionMenu> | ||
50 | #include <KBookmarkManager> | 49 | #include <KBookmarkManager> | ||
51 | #include <KBookmarkMenu> | 50 | #include <KBookmarkMenu> | ||
52 | #include <KConfig> | 51 | #include <KConfig> | ||
53 | #include <KConfigGroup> | 52 | #include <KConfigGroup> | ||
54 | #include <KHTMLSettings> | 53 | #include <KLocalizedString> | ||
55 | #include <KHTMLView> | | |||
56 | #include <KRun> | 54 | #include <KRun> | ||
57 | #include <KStandardAction> | 55 | #include <KStandardAction> | ||
58 | #include <KStartupInfo> | 56 | #include <KStartupInfo> | ||
59 | #include <KWindowConfig> | 57 | #include <KWindowConfig> | ||
60 | 58 | | |||
61 | #include <KIO/Job> | 59 | #include <KIO/Job> | ||
62 | 60 | | |||
63 | #include <prefs.h> | 61 | #include <prefs.h> | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 105 | MainWindow::MainWindow() | |||
108 | : KXmlGuiWindow(nullptr), | 106 | : KXmlGuiWindow(nullptr), | ||
109 | mLogDialog( nullptr ) | 107 | mLogDialog( nullptr ) | ||
110 | { | 108 | { | ||
111 | setObjectName( QStringLiteral( "MainWindow" ) ); | 109 | setObjectName( QStringLiteral( "MainWindow" ) ); | ||
112 | 110 | | |||
113 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/KHelpCenter"), this, QDBusConnection::ExportScriptableSlots); | 111 | QDBusConnection::sessionBus().registerObject(QStringLiteral("/KHelpCenter"), this, QDBusConnection::ExportScriptableSlots); | ||
114 | mSplitter = new QSplitter( this ); | 112 | mSplitter = new QSplitter( this ); | ||
115 | 113 | | |||
116 | mDoc = new View( mSplitter, this, KHTMLPart::DefaultGUI, actionCollection() ); | 114 | mDoc = new View( mSplitter, actionCollection() ); | ||
117 | connect( mDoc, &View::setWindowCaption, this, &MainWindow::setWindowTitle ); | 115 | connect( mDoc, &View::titleChanged, this, &MainWindow::setWindowTitle ); | ||
118 | connect( mDoc, &KParts::Part::setStatusBarText, this, &MainWindow::statusBarRichTextMessage ); | 116 | connect( mDoc->page(), &QWebEnginePage::linkHovered, this, &MainWindow::statusBarMessage ); | ||
119 | connect( mDoc, &View::onURL, this, &MainWindow::statusBarMessage ); | 117 | connect( mDoc, &QWebEngineView::loadStarted, this, &MainWindow::slotStarted ); | ||
120 | connect( mDoc, &View::started, this, &MainWindow::slotStarted ); | 118 | connect( mDoc, &View::loadFinished, this, &MainWindow::documentCompleted ); | ||
121 | connect( mDoc, QOverload<>::of(&View::completed), this, &MainWindow::documentCompleted ); | | |||
122 | connect( mDoc, &View::searchResultCacheAvailable, this, &MainWindow::enableLastSearchAction ); | 119 | connect( mDoc, &View::searchResultCacheAvailable, this, &MainWindow::enableLastSearchAction ); | ||
123 | 120 | | |||
124 | connect( mDoc, &View::selectionChanged, this, &MainWindow::enableCopyTextAction ); | 121 | connect( mDoc, &View::selectionChanged, this, &MainWindow::enableCopyTextAction ); | ||
125 | 122 | | |||
126 | statusBar()->showMessage(i18n("Preparing Index")); | 123 | statusBar()->showMessage(i18n("Preparing Index")); | ||
127 | 124 | | |||
128 | connect( mDoc->browserExtension(), &KParts::BrowserExtension::openUrlRequest, this, &MainWindow::slotOpenURLRequest ); | | |||
129 | | ||||
130 | mNavigator = new Navigator( mDoc, mSplitter ); | 125 | mNavigator = new Navigator( mDoc, mSplitter ); | ||
131 | mNavigator->setObjectName( QStringLiteral("nav") ); | 126 | mNavigator->setObjectName( QStringLiteral("nav") ); | ||
132 | connect( mNavigator, &Navigator::itemSelected, this, QOverload<const QString &>::of(&MainWindow::viewUrl) ); | 127 | connect( mNavigator, &Navigator::itemSelected, this, QOverload<const QString &>::of(&MainWindow::viewUrl) ); | ||
133 | connect( mNavigator, &Navigator::glossSelected, this, &MainWindow::slotGlossSelected ); | 128 | connect( mNavigator, &Navigator::glossSelected, this, &MainWindow::slotGlossSelected ); | ||
134 | connect( mNavigator, &Navigator::setStatusBarText, this, &MainWindow::statusBarMessage ); | 129 | connect( mNavigator, &Navigator::setStatusBarText, this, &MainWindow::statusBarMessage ); | ||
135 | 130 | | |||
136 | mSplitter->insertWidget(0, mNavigator); | 131 | mSplitter->insertWidget(0, mNavigator); | ||
137 | mSplitter->setStretchFactor(mSplitter->indexOf(mNavigator), 0); | 132 | mSplitter->setStretchFactor(mSplitter->indexOf(mNavigator), 0); | ||
138 | setCentralWidget( mSplitter ); | 133 | setCentralWidget( mSplitter ); | ||
139 | QList<int> sizes; | 134 | QList<int> sizes; | ||
140 | sizes << 220 << 580; | 135 | sizes << 220 << 580; | ||
141 | mSplitter->setSizes(sizes); | 136 | mSplitter->setSizes(sizes); | ||
142 | 137 | | |||
143 | { | | |||
144 | if ( Prefs::useKonqSettings() ) { | | |||
145 | KConfig konqCfg( QStringLiteral("konquerorrc") ); | | |||
146 | const_cast<KHTMLSettings *>( mDoc->settings() )->init( &konqCfg ); | | |||
147 | } | | |||
148 | const int fontScaleFactor = Prefs::fontzoomfactor(); | | |||
149 | mDoc->setFontScaleFactor( fontScaleFactor ); | | |||
150 | } | | |||
151 | | ||||
152 | setupActions(); | 138 | setupActions(); | ||
153 | 139 | | |||
154 | foreach (QAction *act, mDoc->actionCollection()->actions()) | | |||
155 | actionCollection()->addAction(act->objectName(), act); | | |||
156 | 140 | | |||
157 | setupBookmarks(); | 141 | setupBookmarks(); | ||
158 | 142 | | |||
159 | setupGUI(QSize(800, 600), ToolBar | Keys | StatusBar | Create); | 143 | setupGUI(QSize(800, 600), ToolBar | Keys | StatusBar | Create); | ||
160 | setAutoSaveSettings(); | 144 | setAutoSaveSettings(); | ||
161 | 145 | | |||
162 | History::self().installMenuBarHook( this ); | 146 | History::self().installMenuBarHook( this ); | ||
163 | 147 | | |||
Show All 13 Lines | |||||
177 | 161 | | |||
178 | void MainWindow::enableCopyTextAction() | 162 | void MainWindow::enableCopyTextAction() | ||
179 | { | 163 | { | ||
180 | mCopyText->setEnabled( mDoc->hasSelection() ); | 164 | mCopyText->setEnabled( mDoc->hasSelection() ); | ||
181 | } | 165 | } | ||
182 | 166 | | |||
183 | void MainWindow::saveProperties( KConfigGroup &config ) | 167 | void MainWindow::saveProperties( KConfigGroup &config ) | ||
184 | { | 168 | { | ||
185 | config.writePathEntry( "URL" , mDoc->baseURL().url() ); | 169 | config.writePathEntry( "URL" , mDoc->url().toString() ); | ||
186 | } | 170 | } | ||
187 | 171 | | |||
188 | void MainWindow::readProperties( const KConfigGroup &config ) | 172 | void MainWindow::readProperties( const KConfigGroup &config ) | ||
189 | { | 173 | { | ||
190 | mDoc->slotReload( QUrl( config.readPathEntry( "URL", QString() ) ) ); | 174 | mDoc->slotReload( QUrl( config.readPathEntry( "URL", QString() ) ) ); | ||
191 | } | 175 | } | ||
192 | 176 | | |||
193 | void MainWindow::readConfig() | 177 | void MainWindow::readConfig() | ||
Show All 15 Lines | 188 | { | |||
209 | Prefs::self()->save(); | 193 | Prefs::self()->save(); | ||
210 | } | 194 | } | ||
211 | 195 | | |||
212 | void MainWindow::setupActions() | 196 | void MainWindow::setupActions() | ||
213 | { | 197 | { | ||
214 | actionCollection()->addAction( KStandardAction::Quit, this, SLOT(close()) ); | 198 | actionCollection()->addAction( KStandardAction::Quit, this, SLOT(close()) ); | ||
215 | actionCollection()->addAction( KStandardAction::Print, this, SLOT(print()) ); | 199 | actionCollection()->addAction( KStandardAction::Print, this, SLOT(print()) ); | ||
216 | 200 | | |||
217 | QAction *prevPage = actionCollection()->addAction( QStringLiteral("prevPage") ); | | |||
218 | prevPage->setText( i18n( "Previous Page" ) ); | | |||
219 | actionCollection()->setDefaultShortcut(prevPage, Qt::CTRL+Qt::Key_PageUp ); | | |||
220 | prevPage->setWhatsThis( i18n( "Moves to the previous page of the document" ) ); | | |||
221 | connect( prevPage, &QAction::triggered, mDoc, &View::prevPage ); | | |||
222 | | ||||
223 | QAction *nextPage = actionCollection()->addAction( QStringLiteral("nextPage") ); | | |||
224 | nextPage->setText( i18n( "Next Page" ) ); | | |||
225 | actionCollection()->setDefaultShortcut(nextPage, Qt::CTRL + Qt::Key_PageDown ); | | |||
226 | nextPage->setWhatsThis( i18n( "Moves to the next page of the document" ) ); | | |||
227 | connect( nextPage, &QAction::triggered, mDoc, &View::nextPage ); | | |||
228 | | ||||
229 | QAction *home = KStandardAction::home( this, SLOT(slotShowHome()), this ); | 201 | QAction *home = KStandardAction::home( this, SLOT(slotShowHome()), this ); | ||
230 | actionCollection()->addAction( home->objectName(), home ); | 202 | actionCollection()->addAction( home->objectName(), home ); | ||
231 | home->setText(i18n("Table of &Contents")); | 203 | home->setText(i18n("Table of &Contents")); | ||
232 | home->setToolTip(i18n("Table of contents")); | 204 | home->setToolTip(i18n("Table of contents")); | ||
233 | home->setWhatsThis(i18n("Go back to the table of contents")); | 205 | home->setWhatsThis(i18n("Go back to the table of contents")); | ||
234 | 206 | | |||
235 | mCopyText = KStandardAction::copy( this, SLOT(slotCopySelectedText()), this ); | 207 | mCopyText = KStandardAction::copy( this, SLOT(slotCopySelectedText()), this ); | ||
236 | actionCollection()->addAction( QStringLiteral("copy_text"), mCopyText ); | 208 | actionCollection()->addAction( QStringLiteral("copy_text"), mCopyText ); | ||
Show All 11 Lines | 214 | /* | |||
248 | if ( debugGroup.readEntry( "SearchErrorLog", false) ) { | 220 | if ( debugGroup.readEntry( "SearchErrorLog", false) ) { | ||
249 | action = actionCollection()->addAction(QLatin1String("show_search_stderr")); | 221 | action = actionCollection()->addAction(QLatin1String("show_search_stderr")); | ||
250 | action->setText( i18n("Show Search Error Log") ); | 222 | action->setText( i18n("Show Search Error Log") ); | ||
251 | connect( action, &QAction::triggered, this, &View::showSearchStderr ); | 223 | connect( action, &QAction::triggered, this, &View::showSearchStderr ); | ||
252 | } | 224 | } | ||
253 | */ | 225 | */ | ||
254 | History::self().setupActions( actionCollection() ); | 226 | History::self().setupActions( actionCollection() ); | ||
255 | 227 | | |||
256 | QAction *action = actionCollection()->addAction(QStringLiteral("configure_fonts" )); | | |||
257 | action->setText( i18n( "Configure Fonts..." ) ); | | |||
258 | connect( action, &QAction::triggered, this, &MainWindow::slotConfigureFonts ); | | |||
259 | | ||||
260 | action = actionCollection()->addAction(QStringLiteral("incFontSizes")); | | |||
261 | action->setText( i18n( "Increase Font Sizes" ) ); | | |||
262 | action->setIcon( QIcon::fromTheme( QStringLiteral("zoom-in") ) ); | | |||
263 | connect( action, &QAction::triggered, this, &MainWindow::slotIncFontSizes ); | | |||
mlaurent: We still have zoom support in webengine. see setZoomFactor
I think that it's useful to be able… | |||||
264 | | ||||
265 | action = actionCollection()->addAction(QStringLiteral("decFontSizes")); | | |||
266 | action->setText( i18n( "Decrease Font Sizes" ) ); | | |||
267 | action->setIcon( QIcon::fromTheme( QStringLiteral("zoom-out") ) ); | | |||
268 | connect( action, &QAction::triggered, this, &MainWindow::slotDecFontSizes ); | | |||
269 | } | 228 | } | ||
270 | 229 | | |||
271 | void MainWindow::setupBookmarks() | 230 | void MainWindow::setupBookmarks() | ||
272 | { | 231 | { | ||
273 | const QString location = QStandardPaths::writableLocation( QStandardPaths::DataLocation ); | 232 | const QString location = QStandardPaths::writableLocation( QStandardPaths::DataLocation ); | ||
274 | QDir().mkpath( location ); | 233 | QDir().mkpath( location ); | ||
275 | const QString file = location + QStringLiteral( "/bookmarks.xml" ); | 234 | const QString file = location + QStringLiteral( "/bookmarks.xml" ); | ||
276 | 235 | | |||
277 | KBookmarkManager *manager = KBookmarkManager::managerForFile( file, QStringLiteral( "khelpcenter" ) ); | 236 | KBookmarkManager *manager = KBookmarkManager::managerForFile( file, QStringLiteral( "khelpcenter" ) ); | ||
278 | manager->setParent( this ); | 237 | manager->setParent( this ); | ||
279 | BookmarkOwner *owner = new BookmarkOwner( mDoc, manager ); | 238 | BookmarkOwner *owner = new BookmarkOwner( mDoc, manager ); | ||
280 | connect( owner, &BookmarkOwner::openUrl, this, QOverload<const QUrl &>::of(&MainWindow::openUrl) ); | 239 | connect( owner, &BookmarkOwner::openUrl, this, QOverload<const QUrl &>::of(&MainWindow::openUrl) ); | ||
281 | KActionMenu *actmenu = actionCollection()->add<KActionMenu>( QStringLiteral( "bookmarks" ) ); | 240 | KActionMenu *actmenu = actionCollection()->add<KActionMenu>( QStringLiteral( "bookmarks" ) ); | ||
282 | actmenu->setText( i18nc( "@title:menu", "&Bookmarks" ) ); | 241 | actmenu->setText( i18nc( "@title:menu", "&Bookmarks" ) ); | ||
283 | KBookmarkMenu *bookmenu = new KBookmarkMenu( manager, owner, actmenu->menu(), actionCollection() ); | 242 | KBookmarkMenu *bookmenu = new KBookmarkMenu( manager, owner, actmenu->menu(), actionCollection() ); | ||
284 | bookmenu->setParent( owner ); | 243 | bookmenu->setParent( owner ); | ||
285 | } | 244 | } | ||
286 | 245 | | |||
287 | void MainWindow::slotCopySelectedText() | 246 | void MainWindow::slotCopySelectedText() | ||
288 | { | 247 | { | ||
289 | mDoc->copySelectedText(); | 248 | mDoc->copySelectedText(); | ||
290 | } | 249 | } | ||
291 | 250 | | |||
292 | void MainWindow::print() | 251 | void MainWindow::slotStarted() | ||
Print support can be implemented I use a code as it: QPointer<QEventLoop> loop = new QEventLoop; bool result = false; QTimer::singleShot(timeout, loop.data(), &QEventLoop::quit); print(printer, [loop, &result](bool res) { if (loop && loop->isRunning()) { result = res; loop->quit(); } }); loop->exec(); delete loop; return result; } mlaurent: Print support can be implemented
I use a code as it:
bool WebEnginePage::execPrintPreviewPage… | |||||
293 | { | | |||
294 | mDoc->view()->print(); | | |||
295 | } | | |||
296 | | ||||
297 | void MainWindow::slotStarted(KIO::Job *job) | | |||
298 | { | 252 | { | ||
299 | if (job) | | |||
300 | connect(job, &KIO::Job::infoMessage, this, &MainWindow::slotInfoMessage); | | |||
301 | | ||||
302 | History::self().updateActions(); | 253 | History::self().updateActions(); | ||
303 | } | 254 | } | ||
304 | 255 | | |||
305 | void MainWindow::goInternalUrl( const QUrl &url ) | 256 | void MainWindow::goInternalUrl( const QUrl &url ) | ||
306 | { | 257 | { | ||
307 | mDoc->closeUrl(); | 258 | mDoc->stop(); | ||
308 | slotOpenURLRequest( url ); | 259 | slotOpenURLRequest( url ); | ||
309 | } | 260 | } | ||
310 | 261 | | |||
311 | void MainWindow::slotOpenURLRequest( const QUrl &url, | 262 | void MainWindow::slotOpenURLRequest( const QUrl &url) | ||
312 | const KParts::OpenUrlArguments &args, | | |||
313 | const KParts::BrowserArguments &browserArgs ) | | |||
314 | { | 263 | { | ||
315 | qCDebug(KHC_LOG) << url.url(); | 264 | qCDebug(KHC_LOG) << url.url(); | ||
316 | 265 | | |||
317 | mNavigator->selectItem( url ); | 266 | mNavigator->selectItem( url ); | ||
318 | viewUrl( url, args, browserArgs ); | 267 | viewUrl( url ); | ||
319 | } | 268 | } | ||
320 | 269 | | |||
321 | void MainWindow::viewUrl( const QString &url ) | 270 | void MainWindow::viewUrl( const QString &url ) | ||
322 | { | 271 | { | ||
323 | viewUrl( QUrl( url ) ); | 272 | viewUrl( QUrl( url ) ); | ||
324 | } | 273 | } | ||
325 | 274 | | |||
326 | void MainWindow::viewUrl( const QUrl &url, const KParts::OpenUrlArguments &args, const KParts::BrowserArguments &browserArgs ) | 275 | void MainWindow::viewUrl( const QUrl &url ) | ||
327 | { | 276 | { | ||
328 | stop(); | 277 | stop(); | ||
329 | 278 | | |||
330 | QString proto = url.scheme().toLower(); | 279 | QString proto = url.scheme().toLower(); | ||
331 | 280 | | |||
332 | if ( proto == QLatin1String("khelpcenter") ) { | 281 | if ( proto == QLatin1String("khelpcenter") ) { | ||
333 | History::self().createEntry(); | 282 | History::self().createEntry(); | ||
334 | mNavigator->openInternalUrl( url ); | 283 | mNavigator->openInternalUrl( url ); | ||
Show All 19 Lines | |||||
354 | 303 | | |||
355 | if ( !own ) { | 304 | if ( !own ) { | ||
356 | new KRun( url,this ); | 305 | new KRun( url,this ); | ||
357 | return; | 306 | return; | ||
358 | } | 307 | } | ||
359 | 308 | | |||
360 | History::self().createEntry(); | 309 | History::self().createEntry(); | ||
361 | 310 | | |||
362 | mDoc->setArguments( args ); | | |||
363 | mDoc->browserExtension()->setBrowserArguments( browserArgs ); | | |||
364 | | ||||
365 | if ( proto == QLatin1String("glossentry") ) { | 311 | if ( proto == QLatin1String("glossentry") ) { | ||
366 | QString decodedEntryId = QUrl::fromPercentEncoding( QUrl::toPercentEncoding(url.path()) ); | 312 | QString decodedEntryId = QUrl::fromPercentEncoding( QUrl::toPercentEncoding(url.path()) ); | ||
367 | slotGlossSelected( mNavigator->glossEntry( decodedEntryId ) ); | 313 | slotGlossSelected( mNavigator->glossEntry( decodedEntryId ) ); | ||
368 | mNavigator->slotSelectGlossEntry( decodedEntryId ); | 314 | mNavigator->slotSelectGlossEntry( decodedEntryId ); | ||
369 | } else { | 315 | } else { | ||
370 | mDoc->openUrl( url ); | 316 | mDoc->load( url ); | ||
371 | } | 317 | } | ||
372 | } | 318 | } | ||
373 | 319 | | |||
374 | void MainWindow::documentCompleted() | 320 | void MainWindow::documentCompleted() | ||
375 | { | 321 | { | ||
376 | History::self().updateCurrentEntry( mDoc ); | 322 | History::self().updateCurrentEntry( mDoc ); | ||
377 | History::self().updateActions(); | 323 | History::self().updateActions(); | ||
378 | } | 324 | } | ||
Show All 34 Lines | 357 | else { | |||
413 | viewUrl( url ); | 359 | viewUrl( url ); | ||
414 | } | 360 | } | ||
415 | } | 361 | } | ||
416 | 362 | | |||
417 | void MainWindow::slotGlossSelected(const GlossaryEntry &entry) | 363 | void MainWindow::slotGlossSelected(const GlossaryEntry &entry) | ||
418 | { | 364 | { | ||
419 | stop(); | 365 | stop(); | ||
420 | History::self().createEntry(); | 366 | History::self().createEntry(); | ||
421 | mDoc->begin( QUrl( QStringLiteral("glossentry:") + entry.id() ) ); | 367 | mDoc->setInternalHtml( mDoc->grantleeFormatter()->formatGlossaryEntry( entry ), QUrl( QStringLiteral("glossentry:") + entry.id() ) ); | ||
422 | mDoc->write( mDoc->grantleeFormatter()->formatGlossaryEntry( entry ) ); | | |||
423 | mDoc->end(); | | |||
424 | } | 368 | } | ||
425 | 369 | | |||
426 | void MainWindow::stop() | 370 | void MainWindow::stop() | ||
427 | { | 371 | { | ||
428 | mDoc->closeUrl(); | 372 | mDoc->stop(); | ||
429 | History::self().updateCurrentEntry( mDoc ); | 373 | History::self().updateCurrentEntry( mDoc ); | ||
430 | } | 374 | } | ||
431 | 375 | | |||
432 | void MainWindow::showHome() | 376 | void MainWindow::showHome() | ||
433 | { | 377 | { | ||
434 | slotShowHome(); | 378 | slotShowHome(); | ||
435 | } | 379 | } | ||
436 | 380 | | |||
Show All 26 Lines | 406 | if ( !mLogDialog ) { | |||
463 | mLogDialog = new LogDialog( this ); | 407 | mLogDialog = new LogDialog( this ); | ||
464 | } | 408 | } | ||
465 | 409 | | |||
466 | mLogDialog->setLog( log ); | 410 | mLogDialog->setLog( log ); | ||
467 | mLogDialog->show(); | 411 | mLogDialog->show(); | ||
468 | mLogDialog->raise(); | 412 | mLogDialog->raise(); | ||
469 | } | 413 | } | ||
470 | 414 | | |||
471 | void MainWindow::slotIncFontSizes() | | |||
472 | { | | |||
473 | mDoc->slotIncFontSizes(); | | |||
474 | updateFontScaleActions(); | | |||
475 | } | | |||
476 | | ||||
477 | void MainWindow::slotDecFontSizes() | | |||
478 | { | | |||
479 | mDoc->slotDecFontSizes(); | | |||
480 | updateFontScaleActions(); | | |||
481 | } | | |||
482 | | ||||
483 | void MainWindow::updateFontScaleActions() | | |||
484 | { | | |||
485 | actionCollection()->action( QStringLiteral("incFontSizes") )->setEnabled( mDoc->fontScaleFactor() + mDoc->fontScaleStepping() <= 300 ); | | |||
486 | actionCollection()->action( QStringLiteral("decFontSizes") )->setEnabled( mDoc->fontScaleFactor() - mDoc->fontScaleStepping() >= 20 ); | | |||
487 | | ||||
488 | Prefs::setFontzoomfactor( mDoc->fontScaleFactor() ); | | |||
489 | Prefs::self()->save(); | | |||
490 | } | | |||
491 | | ||||
492 | void MainWindow::slotConfigureFonts() | | |||
493 | { | | |||
494 | FontDialog dlg( this ); | | |||
495 | if ( dlg.exec() == QDialog::Accepted ) | | |||
496 | { | | |||
497 | if (mDoc->baseURL().isEmpty()) | | |||
498 | { | | |||
499 | const_cast<KHTMLSettings *>( mDoc->settings() )->init( KSharedConfig::openConfig().data() ); | | |||
500 | slotShowHome(); | | |||
501 | } | | |||
502 | else mDoc->slotReload(); | | |||
503 | } | | |||
504 | } | | |||
505 | | ||||
506 | 415 | | |||
507 | // vim:ts=2:sw=2:et | 416 | // vim:ts=2:sw=2:et |
We still have zoom support in webengine. see setZoomFactor
I think that it's useful to be able to increase/decrease it.