mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
interfaces: drop firstname and lastname placeholders for file templates
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4a4c85431e
commit
baf7818f4b
2 changed files with 10 additions and 17 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <kmessagebox.h>
|
#include <kmessagebox.h>
|
||||||
#include <kcalendarsystem.h>
|
#include <kcalendarsystem.h>
|
||||||
|
#include <kemailsettings.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -41,9 +42,6 @@ bool TemplateInterface::expandMacros( QMap<QString, QString> &map, QWidget *pare
|
||||||
QDate date = datetime.date();
|
QDate date = datetime.date();
|
||||||
QTime time = datetime.time();
|
QTime time = datetime.time();
|
||||||
|
|
||||||
QStringList personalitems;
|
|
||||||
personalitems<<"firstname"<<"lastname"<<"fullname"<<"email";
|
|
||||||
|
|
||||||
QMap<QString,QString>::Iterator it;
|
QMap<QString,QString>::Iterator it;
|
||||||
for ( it = map.begin(); it != map.end(); ++it )
|
for ( it = map.begin(); it != map.end(); ++it )
|
||||||
{
|
{
|
||||||
|
@ -53,20 +51,17 @@ bool TemplateInterface::expandMacros( QMap<QString, QString> &map, QWidget *pare
|
||||||
if ( placeholder == "index" ) map[ placeholder ] = "i";
|
if ( placeholder == "index" ) map[ placeholder ] = "i";
|
||||||
else if ( placeholder == "loginname" )
|
else if ( placeholder == "loginname" )
|
||||||
{}
|
{}
|
||||||
else if (personalitems.contains(placeholder))
|
else if (placeholder == "fullname" || placeholder == "email")
|
||||||
{
|
{
|
||||||
#warning FIXME: implement first and last name info via KEMailSettings, KUser or other class
|
|
||||||
#if 0
|
|
||||||
KEMailSettings mailsettings;
|
KEMailSettings mailsettings;
|
||||||
map[ "firstname" ] = mailsettings.getSetting(KEMailSettings::TODO);
|
const QString fullname = mailsettings.getSetting(KEMailSettings::RealName);
|
||||||
map[ "lastname" ] = mailsettings.getSetting(KEMailSettings::TODO);
|
const QString email = mailsettings.getSetting(KEMailSettings::EmailAddress);
|
||||||
map[ "fullname" ] = mailsettings.getSetting(KEMailSettings::RealName);
|
if (fullname.isEmpty() || email.isEmpty()) {
|
||||||
map[ "email" ] = mailsettings.getSetting(KEMailSettings::EmailAddresss);
|
|
||||||
#else
|
|
||||||
// TODO: use this message when the info is missing (not set yet)
|
|
||||||
KMessageBox::sorry(parentWindow,i18n("The template needs information about you but it is not available.\n The information can be set set from system settings."));
|
KMessageBox::sorry(parentWindow,i18n("The template needs information about you but it is not available.\n The information can be set set from system settings."));
|
||||||
return false;
|
return false;
|
||||||
#endif
|
}
|
||||||
|
map[ "fullname" ] = fullname;
|
||||||
|
map[ "email" ] = email;
|
||||||
}
|
}
|
||||||
else if ( placeholder == "date" )
|
else if ( placeholder == "date" )
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,8 +115,6 @@ class KTEXTEDITOR_EXPORT TemplateInterface //should be named AbstractTemplateInt
|
||||||
*
|
*
|
||||||
* - index: "i"
|
* - index: "i"
|
||||||
* - loginname: The current users's loginname
|
* - loginname: The current users's loginname
|
||||||
* - firstname: The current user's first name retrieved from kabc
|
|
||||||
* - lastname: The current user's last name retrieved from kabc
|
|
||||||
* - fullname: The current user's first and last name retrieved from kabc
|
* - fullname: The current user's first and last name retrieved from kabc
|
||||||
* - email: The current user's primary email address retrieved from kabc
|
* - email: The current user's primary email address retrieved from kabc
|
||||||
* - date: current date
|
* - date: current date
|
||||||
|
|
Loading…
Add table
Reference in a new issue