Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/views/khomeview_p.h
Show All 39 Lines | |||||
40 | #include <QWheelEvent> | 40 | #include <QWheelEvent> | ||
41 | #include <QPrintDialog> | 41 | #include <QPrintDialog> | ||
42 | #include <QPrinter> | 42 | #include <QPrinter> | ||
43 | #include <QPointer> | 43 | #include <QPointer> | ||
44 | #ifdef ENABLE_WEBENGINE | 44 | #ifdef ENABLE_WEBENGINE | ||
45 | #include <QWebEngineView> | 45 | #include <QWebEngineView> | ||
46 | #else | 46 | #else | ||
47 | #include <KWebView> | 47 | #include <KWebView> | ||
48 | #include <QWebFrame> | ||||
48 | #endif | 49 | #endif | ||
49 | 50 | | |||
50 | // ---------------------------------------------------------------------------- | 51 | // ---------------------------------------------------------------------------- | ||
51 | // KDE Includes | 52 | // KDE Includes | ||
52 | 53 | | |||
53 | #include <KChartAbstractCoordinatePlane> | 54 | #include <KChartAbstractCoordinatePlane> | ||
54 | #include <KChartChart> | 55 | #include <KChartChart> | ||
55 | #include <KLocalizedString> | 56 | #include <KLocalizedString> | ||
▲ Show 20 Lines • Show All 362 Lines • ▼ Show 20 Line(s) | 418 | { | |||
418 | m_view->setZoomFactor(KMyMoneySettings::zoomFactor()); | 419 | m_view->setZoomFactor(KMyMoneySettings::zoomFactor()); | ||
419 | 420 | | |||
420 | QList<MyMoneyAccount> list; | 421 | QList<MyMoneyAccount> list; | ||
421 | if (MyMoneyFile::instance()->storage()) | 422 | if (MyMoneyFile::instance()->storage()) | ||
422 | MyMoneyFile::instance()->accountList(list); | 423 | MyMoneyFile::instance()->accountList(list); | ||
423 | if (list.isEmpty()) { | 424 | if (list.isEmpty()) { | ||
424 | m_view->setHtml(KWelcomePage::welcomePage(), QUrl("file://")); | 425 | m_view->setHtml(KWelcomePage::welcomePage(), QUrl("file://")); | ||
425 | } else { | 426 | } else { | ||
427 | // keep current location on page | ||||
428 | int scrollBarPos = 0; | ||||
429 | #ifdef ENABLE_WEBENGINE | ||||
430 | /// @todo cannot test this | ||||
431 | #else | ||||
432 | scrollBarPos = m_view->page()->mainFrame()->scrollBarValue(Qt::Vertical); | ||||
433 | #endif | ||||
434 | | ||||
426 | //clear the forecast flag so it will be reloaded | 435 | //clear the forecast flag so it will be reloaded | ||
427 | m_forecast.setForecastDone(false); | 436 | m_forecast.setForecastDone(false); | ||
428 | 437 | | |||
429 | const QString filename = QStandardPaths::locate(QStandardPaths::AppConfigLocation, "html/kmymoney.css"); | 438 | const QString filename = QStandardPaths::locate(QStandardPaths::AppConfigLocation, "html/kmymoney.css"); | ||
430 | QString header = QString("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"%1\">\n").arg(QUrl::fromLocalFile(filename).url()); | 439 | QString header = QString("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">\n<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"%1\">\n").arg(QUrl::fromLocalFile(filename).url()); | ||
431 | 440 | | |||
432 | header += KMyMoneyUtils::variableCSS(); | 441 | header += KMyMoneyUtils::variableCSS(); | ||
433 | 442 | | |||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
492 | 501 | | |||
493 | m_html += "<div id=\"returnlink\">"; | 502 | m_html += "<div id=\"returnlink\">"; | ||
494 | m_html += link(VIEW_WELCOME, QString()) + i18n("Show KMyMoney welcome page") + linkend(); | 503 | m_html += link(VIEW_WELCOME, QString()) + i18n("Show KMyMoney welcome page") + linkend(); | ||
495 | m_html += "</div>"; | 504 | m_html += "</div>"; | ||
496 | m_html += "<div id=\"vieweffect\"></div>"; | 505 | m_html += "<div id=\"vieweffect\"></div>"; | ||
497 | m_html += footer; | 506 | m_html += footer; | ||
498 | 507 | | |||
499 | m_view->setHtml(m_html, QUrl("file://")); | 508 | m_view->setHtml(m_html, QUrl("file://")); | ||
509 | | ||||
510 | if (scrollBarPos) { | ||||
511 | #ifdef ENABLE_WEBENGINE | ||||
512 | /// @todo cannot test this | ||||
513 | #else | ||||
514 | m_view->page()->mainFrame()->setScrollBarValue(Qt::Vertical, scrollBarPos); | ||||
wojnilowicz: Can't this and setScrollPos be integrated in loadView? It would be shorter and wouldn't need… | |||||
515 | #endif | ||||
516 | } | ||||
500 | } | 517 | } | ||
501 | } | 518 | } | ||
502 | 519 | | |||
503 | void showNetWorthGraph() | 520 | void showNetWorthGraph() | ||
504 | { | 521 | { | ||
505 | Q_Q(KHomeView); | 522 | Q_Q(KHomeView); | ||
506 | m_html += QString("<div class=\"shadow\"><div class=\"displayblock\"><div class=\"summaryheader\">%1</div>\n<div class=\"gap\"> </div>\n").arg(i18n("Net Worth Forecast")); | 523 | m_html += QString("<div class=\"shadow\"><div class=\"displayblock\"><div class=\"summaryheader\">%1</div>\n<div class=\"gap\"> </div>\n").arg(i18n("Net Worth Forecast")); | ||
507 | 524 | | |||
508 | MyMoneyReport reportCfg = MyMoneyReport( | 525 | MyMoneyReport reportCfg = MyMoneyReport( | ||
wojnilowicz: "!= 0" is redundant here. | |||||
509 | MyMoneyReport::eAssetLiability, | 526 | MyMoneyReport::eAssetLiability, | ||
510 | MyMoneyReport::eMonths, | 527 | MyMoneyReport::eMonths, | ||
511 | TransactionFilter::Date::UserDefined, // overridden by the setDateFilter() call below | 528 | TransactionFilter::Date::UserDefined, // overridden by the setDateFilter() call below | ||
512 | MyMoneyReport::eDetailTotal, | 529 | MyMoneyReport::eDetailTotal, | ||
513 | i18n("Net Worth Forecast"), | 530 | i18n("Net Worth Forecast"), | ||
514 | i18n("Generated Report")); | 531 | i18n("Generated Report")); | ||
515 | 532 | | |||
516 | reportCfg.setChartByDefault(true); | 533 | reportCfg.setChartByDefault(true); | ||
▲ Show 20 Lines • Show All 1468 Lines • Show Last 20 Lines |
Can't this and setScrollPos be integrated in loadView? It would be shorter and wouldn't need managing m_scrollBarPos.