diff --git a/kmymoney/dialogs/settings/ksettingsgeneraldecl.ui b/kmymoney/dialogs/settings/ksettingsgeneraldecl.ui
index 3c5e1eeb4..1576154b8 100644
--- a/kmymoney/dialogs/settings/ksettingsgeneraldecl.ui
+++ b/kmymoney/dialogs/settings/ksettingsgeneraldecl.ui
@@ -1,655 +1,671 @@
KSettingsGeneralDecl
0
0
600
499
General Settings
-
3
Global
+
-
+
+
+ Startup options
+
+
+
-
+
+
+ Show splash screen
+
+
+
+
+
+
-
Autosave options
-
-
Autosave periodically
-
false
-
60
-
minutes
false
-
Qt::Horizontal
QSizePolicy::Expanding
308
22
-
Autosave when file is modified upon close
-
-
Setup number of backups to keep (local file only)
Whenever the current data is saved into a local file, KMyMoney keeps the selected number of previous states of the file.
Set it to 0 to turn the feature off.
true
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
20
1
-
Number of backups to keep (0=off)
-
Qt::Horizontal
40
20
-
Fiscal Year
-
Your fiscal year starts on
false
-
366
-
-
January
-
February
-
March
-
April
-
May
-
June
-
July
-
August
-
September
-
October
-
November
-
December
-
Qt::Horizontal
QSizePolicy::Expanding
282
17
-
External programs
-
Calculator
-
-
Qt::Vertical
QSizePolicy::Expanding
20
20
Views
-
Startup page options
-
Start with ho&mepage
true
-
Start with last selected view
-
Type of the KMyMoney view
-
List
true
-
Tree
-
Tabbed
-
Show title bar on each page
-
Synchronize account selection of ledger and investment view
-
Qt::Vertical
QSizePolicy::Expanding
20
319
Filter
-
Accounts / Categories
-
This option hides all categories in the categories view that are not used in at least a single transaction. They are still shown in the category selection lists.
Do not show unused categories
-
This option hides all accounts that have been closed by the user in views and selection lists.
You can use <b>View/Show all accounts</b> to temporarily show hidden accounts in the views.
Do not show closed accounts
-
Show equity accounts
-
This option will display the categories in the accounts view also.
Show categories in the accounts list view
-
Do not show zero balance equities
-
Schedules
-
This option hides all finished schedules in the schedules view.
Do not show finished schedules
-
Transactions
-
-
Do not show transactions prior to
false
-
-
-
Qt::Horizontal
QSizePolicy::Expanding
63
20
-
This option hides all reconciled transactions in the ledger view.
Do not show reconciled transactions
-
Qt::Vertical
QSizePolicy::Expanding
20
30
Support
-
Logging
-
-
Log path
-
true
-
...
-
On choosing a log file path please keep in mind that log files may contain sensitive data (e.g. passwords in clear-text etc).
true
-
Log imported statements
-
Log OFX transactions
-
Qt::Vertical
20
255
KComboBox
QComboBox
KLineEdit
QLineEdit
kMyMoneyDateInput
QFrame
1
kcfg_AutoSaveFile
toggled(bool)
m_periodFrame
setEnabled(bool)
103
274
188
263
diff --git a/kmymoney/kstartuplogo.cpp b/kmymoney/kstartuplogo.cpp
index 0077a54b9..e437b464a 100644
--- a/kmymoney/kstartuplogo.cpp
+++ b/kmymoney/kstartuplogo.cpp
@@ -1,73 +1,53 @@
/***************************************************************************
kstartuplogo.cpp
-------------------
- copyright : (C) 2000 by Michael Edwardes
- email : mte@users.sourceforge.net
+ copyright : (C) 2000 by Michael Edwardes
+ (C) 2017 by Łukasz Wojniłowicz
+
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "kstartuplogo.h"
+
// ----------------------------------------------------------------------------
// QT Includes
-#include
#include
-#include
-#include
+#include
// ----------------------------------------------------------------------------
// KDE Includes
-#include
-#include
+#include
#include
// ----------------------------------------------------------------------------
// Project Includes
-#include "kmymoneyglobalsettings.h"
-KStartupLogo::KStartupLogo() :
- QObject(0),
- m_splash(0)
+std::unique_ptr createStartupLogo()
{
- // splash screen setting
- if (!KMyMoneyGlobalSettings::showSplash())
- return;
-
- QString filename = QStandardPaths::locate(QStandardPaths::DataLocation, "pics/startlogo.png");
- QString localeFilename = KLocalizedString::localizedFilePath(filename);
- QPixmap logoOverlay(localeFilename);
-
+ KColorScheme scheme(QPalette::Active, KColorScheme::Selection);
+ QPixmap logoOverlay(KLocalizedString::localizedFilePath(
+ QStandardPaths::locate(QStandardPaths::DataLocation,
+ QStringLiteral("pics/startlogo.png"))));
QPixmap logoPixmap(logoOverlay.size());
- logoPixmap.fill(KColorScheme(QPalette::Active, KColorScheme::Selection).background(KColorScheme::NormalBackground).color());
+ logoPixmap.fill(scheme.background(KColorScheme::NormalBackground).color());
QPainter pixmapPainter(&logoPixmap);
pixmapPainter.drawPixmap(0, 0, logoOverlay, 0, 0, logoOverlay.width(), logoOverlay.height());
-
- if (!logoOverlay.isNull()) {
- QSplashScreen* splash = new QSplashScreen(logoPixmap, Qt::WindowStaysOnTopHint);
- splash->setFixedSize(logoPixmap.size());
-
- splash->show();
- splash->showMessage(i18n("Loading %1...", KAboutData::applicationData().version()), //krazy:exclude=qmethods
- Qt::AlignLeft | Qt::AlignBottom,
- KColorScheme(QPalette::Active, KColorScheme::Selection)
- .foreground(KColorScheme::NormalText).color());
- m_splash = splash;
- }
+ std::unique_ptr splash(new QSplashScreen(logoPixmap, Qt::WindowStaysOnTopHint));
+ splash->showMessage(i18n("Loading %1...", QCoreApplication::applicationVersion()), //krazy:exclude=qmethods
+ Qt::AlignLeft | Qt::AlignBottom,
+ scheme.foreground(KColorScheme::NormalText).color());
+ splash->show();
+ return splash;
}
-
-KStartupLogo::~KStartupLogo()
-{
- delete m_splash;
-}
-
diff --git a/kmymoney/kstartuplogo.h b/kmymoney/kstartuplogo.h
index b1f8a47dd..fd4ca510b 100644
--- a/kmymoney/kstartuplogo.h
+++ b/kmymoney/kstartuplogo.h
@@ -1,41 +1,34 @@
/***************************************************************************
kstartuplogo.h
-------------------
- copyright : (C) 2000 by Michael Edwardes
- email : mte@users.sourceforge.net
+ copyright : (C) 2000 by Michael Edwardes
+ (C) 2017 by Łukasz Wojniłowicz
+
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KSTARTUPLOGO_H
#define KSTARTUPLOGO_H
+#include
+
// ----------------------------------------------------------------------------
// QT Includes
-#include
-#include
+#include
// ----------------------------------------------------------------------------
// Project Includes
-// Simple class that just shows a picture
-class KStartupLogo : public QObject
-{
- Q_OBJECT
-public:
- KStartupLogo();
- ~KStartupLogo();
-
-private:
- QPointer m_splash;
-};
+
+std::unique_ptr createStartupLogo();
#endif
diff --git a/kmymoney/main.cpp b/kmymoney/main.cpp
index 360b4b7e0..f62629926 100644
--- a/kmymoney/main.cpp
+++ b/kmymoney/main.cpp
@@ -1,350 +1,348 @@
/***************************************************************************
main.cpp
-------------------
copyright : (C) 2001 by Michael Edwardes
email : mte@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include
#include
-#include
-
// ----------------------------------------------------------------------------
// QT Includes
#include
#include
#include
#include
#include
#include
#include
#ifdef KMM_DBUS
#include
#include
#include
#endif
// ----------------------------------------------------------------------------
// KDE Includes
#include
#include
#include
#include
#include
// ----------------------------------------------------------------------------
// Project Includes
#include "mymoney/mymoneyfile.h"
#include "kmymoney.h"
#include "kstartuplogo.h"
#include "kmymoneyutils.h"
#include "kmymoneyglobalsettings.h"
bool timersOn = false;
KMyMoneyApp* kmymoney;
-static int runKMyMoney(QApplication *a, std::unique_ptr splash, const QUrl & file, bool noFile);
+static int runKMyMoney(QApplication *a, std::unique_ptr splash, const QUrl & file, bool noFile);
int main(int argc, char *argv[])
{
KLocalizedString::setApplicationDomain("kmymoney");
{
// Copy KDE 4 config files to the KF5 location
Kdelibs4ConfigMigrator migrator(QStringLiteral("kmymoney"));
migrator.setConfigFiles(QStringList{"kmymoneyrc"});
migrator.setUiFiles(QStringList{"kmymoneyui.rc"});
migrator.migrate();
}
/**
* Create application first
*/
QApplication app(argc, argv);
/**
* construct about data
*/
QStringList features;
#ifdef Gpgmepp_FOUND
features << i18n("GPG encryption");
#endif
#ifdef KMM_ADDRESSBOOK_FOUND
features << i18n("Addressbook integration");
#endif
#ifdef KF5Holidays_FOUND
features << i18n("Holiday regions integration");
#endif
QString featuresDescription;
if (!features.empty())
featuresDescription = i18n("Compiled with the following optional features:\n%1", features.join(QLatin1Char('\n')));
KAboutData aboutData(QStringLiteral("kmymoney"), i18n("KMyMoney"), QStringLiteral(VERSION),
i18n("\nKMyMoney, the Personal Finance Manager by KDE.\n\nPlease consider contributing to this project with code and/or suggestions."), KAboutLicense::GPL,
i18n("(c) 2000-2017 The KMyMoney development team"),
featuresDescription,
QStringLiteral("http://kmymoney.org/"));
//Temporarily, the product name to report bugs in BKO is different than the application name
aboutData.setProductName("kmymoney");
aboutData.addAuthor(i18n("Michael Edwardes."), i18n("Initial idea, much initial source code, Project admin"), "mte@users.sourceforge.net");
aboutData.addAuthor(i18n("Thomas Baumgart"), i18n("Core engine, Release Manager, Project admin"), "ipwizard@users.sourceforge.net");
aboutData.addAuthor(i18n("Alvaro Soliverez"), i18n("Forecast, Reports"), "asoliverez@gmail.com");
aboutData.addAuthor(i18n("Cristian Oneț"), i18n("Developer"), "onet.cristian@gmail.com");
aboutData.addAuthor(i18n("Christian Dávid"), i18n("Developer"), "christian-david@web.de");
aboutData.addAuthor(i18n("Ace Jones"), i18n("Reporting logic, OFX Import"), "acejones@users.sourceforge.net");
aboutData.addAuthor(i18n("Tony Bloomfield"), i18n("Database backend, maintainer stable branch"), "tonybloom@users.sourceforge.net");
aboutData.addAuthor(i18n("Felix Rodriguez"), i18n("Project Admin"), "frodriguez@users.sourceforge.net");
aboutData.addAuthor(i18n("John C"), i18n("Developer"), "tacoturtle@users.sourceforge.net");
aboutData.addAuthor(i18n("Fernando Vilas"), i18n("Database backend"), "fvilas@iname.com");
aboutData.addCredit(i18n("Kevin Tambascio"), i18n("Initial investment support"), "ktambascio@users.sourceforge.net");
aboutData.addCredit(i18n("Javier Campos Morales"), i18n("Developer & Artist"), "javi_c@users.sourceforge.net");
aboutData.addCredit(i18n("Robert Wadley"), i18n("Icons & splash screen"), "rob@robntina.fastmail.us");
aboutData.addCredit(i18n("Laurent Montel"), i18n("Patches and port to kde4"), "montel@kde.org");
aboutData.addCredit(i18n("Wolfgang Rohdewald"), i18n("Patches"), "woro@users.sourceforge.net");
aboutData.addCredit(i18n("Marko Käning"), i18n("Patches, packaging and KF5-CI for OS X"), "mk-lists@email.de");
aboutData.addCredit(i18n("Allan Anderson ✝"), i18n("CSV import/export"), "");
aboutData.addCredit(i18n("Jack Ostroff"), i18n("Documentation and user support"), "ostroffjh@users.sourceforge.net");
aboutData.setOrganizationDomain("kde.org");
/**
* register about data
*/
KAboutData::setApplicationData(aboutData);
/**
* take component name and org. name from KAboutData
*/
app.setApplicationName(aboutData.componentName());
app.setApplicationDisplayName(aboutData.displayName());
app.setOrganizationDomain(aboutData.organizationDomain());
app.setApplicationVersion(aboutData.version());
/**
* enable high dpi icons
*/
app.setAttribute(Qt::AA_UseHighDpiPixmaps);
/**
* Create command line parser and feed it with known options
*/
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.setApplicationDescription(aboutData.shortDescription());
parser.addHelpOption();
parser.addVersionOption();
// language
const QCommandLineOption langOption(QStringLiteral("lang"), i18n("language to be used"));
parser.addOption(langOption);
// no file
const QCommandLineOption noFileOption(QStringLiteral("n"), i18n("do not open last used file"));
parser.addOption(noFileOption);
// timers
const QCommandLineOption timersOption(QStringLiteral("timers"), i18n("enable performance timers"));
parser.addOption(timersOption);
// no catch
const QCommandLineOption noCatchOption(QStringLiteral("nocatch"), i18n("do not globally catch uncaught exceptions"));
parser.addOption(noCatchOption);
#ifdef KMM_DEBUG
// The following options are only available when compiled in debug mode
// trace
const QCommandLineOption traceOption(QStringLiteral("trace"), i18n("turn on program traces"));
parser.addOption(traceOption);
// dump actions
const QCommandLineOption dumpActionsOption(QStringLiteral("dump-actions"), i18n("dump the names of all defined QAction objects to stdout and quit"));
parser.addOption(dumpActionsOption);
#endif
// INSERT YOUR COMMANDLINE OPTIONS HERE
// url to open
parser.addPositionalArgument(QStringLiteral("url"), i18n("file to open"));
/**
* do the command line parsing
*/
parser.process(app);
/**
* handle standard options
*/
aboutData.processCommandLine(&parser);
// create the singletons before we start memory checking
// to avoid false error reports
MyMoneyFile::instance();
KMyMoneyUtils::checkConstants();
// show startup logo
- std::unique_ptr splash = std::unique_ptr(new KStartupLogo());
+ std::unique_ptr splash(KMyMoneyGlobalSettings::showSplash() ? createStartupLogo() : nullptr);
app.processEvents();
// setup the MyMoneyMoney locale settings according to the KDE settings
MyMoneyMoney::setThousandSeparator(QLocale().groupSeparator());
MyMoneyMoney::setDecimalSeparator(QLocale().decimalPoint());
// TODO: port to kf5
//MyMoneyMoney::setNegativeMonetarySignPosition(static_cast(KLocale::global()->negativeMonetarySignPosition()));
//MyMoneyMoney::setPositiveMonetarySignPosition(static_cast(KLocale::global()->positiveMonetarySignPosition()));
//MyMoneyMoney::setNegativePrefixCurrencySymbol(KLocale::global()->negativePrefixCurrencySymbol());
//MyMoneyMoney::setPositivePrefixCurrencySymbol(KLocale::global()->positivePrefixCurrencySymbol());
QString language = parser.value(langOption);
if (!language.isEmpty()) {
//if (!KLocale::global()->setLanguage(QStringList() << language)) {
// qWarning("Unable to select language '%s'. This has one of two reasons:\n\ta) the standard KDE message catalog is not installed\n\tb) the KMyMoney message catalog is not installed", qPrintable(language));
//}
}
#ifdef KMM_DEBUG
if (parser.isSet(traceOption))
MyMoneyTracer::on();
timersOn = parser.isSet(timersOption);
#endif
kmymoney = new KMyMoneyApp();
#ifdef KMM_DEBUG
if (parser.isSet(dumpActionsOption)) {
kmymoney->dumpActions();
// Before we delete the application, we make sure that we destroy all
// widgets by running the event loop for some time to catch all those
// widgets that are requested to be destroyed using the deleteLater() method.
//QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput, 10);
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 10);
delete kmymoney;
exit(0);
}
#endif
const QStringList urls = parser.positionalArguments();
const QUrl url = urls.isEmpty() ? QUrl() : QUrl::fromUserInput(urls.front());
int rc = 0;
if (parser.isSet(noCatchOption)) {
qDebug("Running w/o global try/catch block");
rc = runKMyMoney(&app, std::move(splash), url, parser.isSet(noFileOption));
} else {
try {
rc = runKMyMoney(&app, std::move(splash), url, parser.isSet(noFileOption));
} catch (const MyMoneyException &e) {
KMessageBox::detailedError(0, i18n("Uncaught error. Please report the details to the developers"),
i18n("%1 in file %2 line %3", e.what(), e.file(), e.line()));
throw e;
}
}
return rc;
}
-int runKMyMoney(QApplication *a, std::unique_ptr splash, const QUrl & file, bool noFile)
+int runKMyMoney(QApplication *a, std::unique_ptr splash, const QUrl & file, bool noFile)
{
#ifdef KMM_DBUS
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kmymoney")) {
const QList instances = kmymoney->instanceList();
if (instances.count() > 0) {
// If the user launches a second copy of the app and includes a file to
// open, they are probably attempting a "WebConnect" session. In this case,
// we'll check to make sure it's an importable file that's passed in, and if so, we'll
// notify the primary instance of the file and kill ourselves.
if (file.isValid()) {
if (kmymoney->isImportableFile(file)) {
// if there are multiple instances, we'll send this to the first one
QString primary = instances[0];
// send a message to the primary client to import this file
QDBusInterface remoteApp(primary, "/KMymoney", "org.kde.kmymoney");
// TODO: port ot kf5
//remoteApp.call("webConnect", file.path(), KStartupInfo::startupId());
// Before we delete the application, we make sure that we destroy all
// widgets by running the event loop for some time to catch all those
// widgets that are requested to be destroyed using the deleteLater() method.
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents, 10);
delete kmymoney;
return 0;
}
}
if (KMessageBox::questionYesNo(0, i18n("Another instance of KMyMoney is already running. Do you want to quit?")) == KMessageBox::Yes) {
delete kmymoney;
return 1;
}
}
} else {
qDebug("D-Bus registration failed. Some functions are not available.");
}
#else
qDebug("D-Bus disabled. Some functions are not available.");
#endif
kmymoney->show();
kmymoney->centralWidget()->setEnabled(false);
splash.reset();
// force complete paint of widgets
qApp->processEvents();
QString importfile;
QUrl url;
// make sure, we take the file provided on the command
// line before we go and open the last one used
if (file.isValid()) {
// Check to see if this is an importable file, as opposed to a loadable
// file. If it is importable, what we really want to do is load the
// last used file anyway and then immediately import this file. This
// implements a "web connect" session where there is not already an
// instance of the program running.
if (kmymoney->isImportableFile(file)) {
importfile = file.path();
url = QUrl::fromUserInput(kmymoney->readLastUsedFile());
}
} else {
url = QUrl::fromUserInput(kmymoney->readLastUsedFile());
}
KTipDialog::showTip(kmymoney, "", false);
if (url.isValid() && !noFile) {
kmymoney->slotFileOpenRecent(url);
} else if (KMyMoneyGlobalSettings::firstTimeRun()) {
kmymoney->slotFileNew();
}
KMyMoneyGlobalSettings::setFirstTimeRun(false);
// TODO: port to kf5
//if (!importfile.isEmpty())
// kmymoney->webConnect(importfile, KStartupInfo::startupId());
kmymoney->updateCaption();
kmymoney->centralWidget()->setEnabled(true);
const int rc = a->exec();
return rc;
}