[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepimlibs/KDE/4.14] kpimidentities: Speed up the default Identity() constructor.
From: David Faure <faure () kde ! org>
Date: 2016-01-26 7:33:18
Message-ID: E1aNy7q-0005fD-Fs () scm ! kde ! org
[Download RAW message or body]
Git commit 9ce1b9856b13f485442c5600511b616ba47e455e by David Faure.
Committed on 24/01/2016 at 09:59.
Pushed by dfaure into branch 'KDE/4.14'.
Speed up the default Identity() constructor.
Sonnet::defaultLanguageName() is very slow (it parses 3 config files).
Sonnet is fixed in KF5, well, that method is gone and the call in identity.cpp
is commented out, but at least Sonnet has the default dict in a member var...
Testcase: opening a mail with an invitation took a very long time before
rendering the invitation. Now it only takes a long time (ICAL parsing).
REVIEW: 126867
M +5 -7 kpimidentities/identity.cpp
http://commits.kde.org/kdepimlibs/9ce1b9856b13f485442c5600511b616ba47e455e
diff --git a/kpimidentities/identity.cpp b/kpimidentities/identity.cpp
index f644c7a..68560a6 100644
--- a/kpimidentities/identity.cpp
+++ b/kpimidentities/identity.cpp
@@ -46,7 +46,6 @@ Identity::Identity( const QString &id, const QString &fullName,
setProperty( QLatin1String(s_email), emailAddr );
setProperty( QLatin1String(s_organization), organization );
setProperty( QLatin1String(s_replyto), replyToAddr );
- setDictionary( Sonnet::defaultLanguageName() );
setProperty( QLatin1String(s_disabledFcc), false );
setProperty( QLatin1String(s_defaultDomainName), QHostInfo::localHostName());
}
@@ -72,11 +71,6 @@ bool Identity::isNull() const
++i;
continue;
}
- // Take into account that the dictionary for a null identity is not empty
- if ( i.key() == QLatin1String(s_dict) ) {
- ++i;
- continue;
- }
// Take into account that disableFcc == false for a null identity
if( i.key() == QLatin1String(s_disabledFcc) && i.value().toBool() == false ) {
++i;
@@ -434,7 +428,11 @@ QString Identity::xface() const
QString Identity::dictionary() const
{
- return property( QLatin1String( s_dict ) ).toString();
+ const QString dict = property( QLatin1String( s_dict ) ).toString();
+ if (dict.isEmpty()) {
+ return Sonnet::defaultLanguageName(); // this is slow, so do it on demand
+ }
+ return QString();
}
QString Identity::templates() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic