Merge branch 'KDE/4.14'

This commit is contained in:
Frank Reininghaus 2014-08-03 10:55:58 +02:00
commit 985b6fbec7
5 changed files with 33 additions and 176 deletions

View file

@ -102,11 +102,13 @@ void PixmapViewer::paintEvent(QPaintEvent* event)
const bool useOldPixmap = (m_transition == SizeTransition) &&
(m_oldPixmap.width() > m_pixmap.width());
const QPixmap& largePixmap = useOldPixmap ? m_oldPixmap : m_pixmap;
const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth,
scaledHeight,
Qt::IgnoreAspectRatio,
Qt::FastTransformation);
painter.drawPixmap(x, y, scaledPixmap);
if (!largePixmap.isNull()) {
const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth,
scaledHeight,
Qt::IgnoreAspectRatio,
Qt::FastTransformation);
painter.drawPixmap(x, y, scaledPixmap);
}
} else {
const int x = (width() - m_pixmap.width() ) / 2;
const int y = (height() - m_pixmap.height()) / 2;

View file

@ -1,7 +1,6 @@
add_subdirectory(pics)
set(kcm_useraccount_PART_SRCS
chfnprocess.cpp
main.cpp
chfacedlg.cpp)

View file

@ -1,103 +0,0 @@
/***************************************************************************
* Copyright 2003 Braden MacDonald <bradenm_k@shaw.ca> *
* Copyright 2003 Ravikiran Rajagopal <ravi@ee.eng.ohio-state.edu> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License (version 2) as *
* published by the Free Software Foundation. *
* *
***************************************************************************/
/**
* @file Change a user's 'finger' information, specifically their full name.
* derived from kdepasswd.
*/
#include "chfnprocess.h"
#include <unistd.h>
#include <stdlib.h>
#include <kdesu/process.h>
#include <kdebug.h>
int ChfnProcess::exec(const char *pass, const char *name)
{
// Try to set the default locale to make the parsing of the output
// of `chfn' easier.
qputenv("LC_ALL", "C");
QList<QByteArray> args;
args += "-f";
args += name;
int ret = KDESu::PtyProcess::exec("chfn", args);
if (ret < 0)
return ChfnNotFound;
ret = ConverseChfn(pass);
waitForChild();
return ret;
}
/*
* The actual work.
* Return values: -1 = unknown error, 0 = ok, >0 = error code.
*/
int ChfnProcess::ConverseChfn(const char *pass)
{
int status=-1;
QByteArray line;
while(1)
{
line = readLine();
if ( line.isEmpty() )
continue;// discard line
else if ( line.contains( "Permission denied" ) )
{
status=MiscError;
m_Error=line;
break;
}
if ( line.contains( "Password: " )/*isPrompt( line, "password" )*/ )
{
WaitSlave();
write(fd(), pass, strlen(pass));
write(fd(), "\n", 1);
}
line = readLine(); // Let's see what the outcome was
if ( line.contains( "Changing finger info" ) )
{
// do nothing
}
else if ( line.contains( "information changed" ) )
{
status=0;
break;
}
else if ( line.isEmpty() )
{
status=0;
break;
}
else if ( line.contains( "Password error" ) || line.contains("Incorrect password") || line.contains("Authentication failure") )
{
status=PasswordError;
break;
}
else
{
status=MiscError;
m_Error=line;
break;
}
}
return status;
}

View file

@ -1,33 +0,0 @@
/***************************************************************************
* Copyright 2003 Braden MacDonald <bradenm_k@shaw.ca> *
* Copyright 2003 Ravikiran Rajagopal <ravi@ee.eng.ohio-state.edu> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License (version 2) as *
* published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef CHFNPROC_H
#define CHFNPROC_H
#include <QtCore/QByteRef>
#include <kdesu/process.h>
class ChfnProcess : public KDESu::PtyProcess
{
public:
enum Errors { ChfnNotFound=1, PasswordError=2, MiscError=3 };
int exec(const char *pass, const char *name);
QByteArray error() { return m_Error; }
private:
int ConverseChfn(const char *pass);
QByteArray m_Error;
};
#endif

View file

@ -49,7 +49,6 @@
#include "settings.h"
#include "pass.h"
#include "chfnprocess.h"
#include <KPluginFactory>
#include <KPluginLoader>
@ -181,36 +180,27 @@ void KCMUserAccount::save()
/* Save realname to /etc/passwd */
if ( _mw->leRealname->isModified() )
{
KPasswordDialog dlg( _mw );
dlg.setPrompt(i18n("Please enter your password in order to save your settings:"));
if ( !dlg.exec() )
{
KMessageBox::sorry( this, i18n("You must enter "
"your password in order to change your information."));
return;
}
// save icon file also with accountsservice
QDBusInterface ainterface("org.freedesktop.Accounts",
"/org/freedesktop/Accounts",
"org.freedesktop.Accounts",
QDBusConnection::systemBus());
QDBusReply<QDBusObjectPath> reply = ainterface.call("FindUserById", qlonglong(_ku->uid()));
if (reply.isValid() && !reply.error().isValid()) {
QDBusInterface uinterface("org.freedesktop.Accounts",
reply.value().path(),
"org.freedesktop.Accounts.User",
QDBusConnection::systemBus(),
this);
ChfnProcess *proc = new ChfnProcess();
int ret = proc->exec(dlg.password().toLocal8Bit() , _mw->leRealname->text().toLocal8Bit() );
if ( ret )
{
if ( ret == ChfnProcess::PasswordError )
KMessageBox::sorry( this, i18n("You must enter a correct password."));
else
{
KMessageBox::sorry( this, i18n("An error occurred and your name has "
"probably not been changed. The error "
"message was:\n%1", QString::fromLocal8Bit(proc->error())));
kDebug() << "ChfnProcess->exec() failed. Error code: " << ret
<< "\nOutput:" << proc->error() << endl;
}
delete proc;
return;
}
delete proc;
QString name = _mw->leRealname->text();
QDBusReply<void> ureply = uinterface.call("SetRealName", name);
if (!ureply.isValid() || ureply.error().isValid()) {
kDebug() << ureply.error().message();
KMessageBox::error( this, i18n("There was an error setting the name: %1" ,
name) );
}
}
}
#endif
@ -243,10 +233,12 @@ void KCMUserAccount::save()
}
}
else { // delete existing image
if ( !KIO::NetAccess::del(KCFGUserAccount::faceFile(), this) ) {
KMessageBox::error( this, i18n("There was an error deleting the image: %1" ,
KCFGUserAccount::faceFile()) );
}
if (QFile::exists(KCFGUserAccount::faceFile())) {
if ( !KIO::NetAccess::del(KCFGUserAccount::faceFile(), this) ) {
KMessageBox::error( this, i18n("There was an error deleting the image: %1" ,
KCFGUserAccount::faceFile()) );
}
}
}
/* Save KDE's homebrewn settings */